auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int hashCode() { int result = name.hashCode(); result = 31 * result + fullName.hashCode(); return result; }

Target:
public int hashCode() { return fullName.hashCode(); }
Source:
public void testTextFieldFeatures() { SeleniumWComponentsWebDriver driver = getDriver(); SeleniumWButtonWebElement validatingButton = driver.findWButton(new ByButton("Validate button", false, true)); validatingButton.click(); SeleniumWPhoneNumberFieldWebElement phoneNumberField = driver.findWPhoneNumberField(new ByLabel("this is a phoneNumberField", false)); phoneNumberField.sendKeys("0400000000"); phoneNumberField.sendKeys(Keys.TAB); assertEquals("0400000000", phoneNumberField.getValue()); SeleniumWFieldIndicatorWebElement message = phoneNumberField.getFieldIndicatorMessage(); assertEquals("Successfully updated.", message.getText()); assertEquals(message.getIndicatorType(), AbstractWFieldIndicator.FieldIndicatorType.SUCCESS); }

Target:
public void testTextFieldFeatures() { SeleniumWComponentsWebDriver driver = getDriver(); SeleniumWButtonWebElement validatingButton = driver.findWButton(new ByButtonText("Validate button", false, true)); validatingButton.click(); SeleniumWPhoneNumberFieldWebElement phoneNumberField = driver.findWPhoneNumberField(new ByLabel("this is a phoneNumberField", false)); phoneNumberField.sendKeys("0400000000"); phoneNumberField.sendKeys(Keys.TAB); assertEquals("0400000000", phoneNumberField.getValue()); SeleniumWFieldIndicatorWebElement message = phoneNumberField.getFieldIndicatorMessage(); assertEquals("Successfully updated.", message.getText()); assertEquals(message.getIndicatorType(), AbstractWFieldIndicator.FieldIndicatorType.SUCCESS); }
Source:
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); } }

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:
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); ArrayList<String> args = this.getIntent().getStringArrayListExtra(SESSION_ENDPOINT_ARGUMENTS); 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); } } ); }

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:
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 config = new MapConfig(cfg); StreamManager streamManager = buildAndStartStreamManager(config); try { ExecutionPlanner planner = new ExecutionPlanner(config, streamManager); return planner.plan(specGraph); } finally { streamManager.stop(); } }

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:
public PDataType getDataType() { return getStrExpression().getDataType(); }

Target:
public PDataType getDataType() { return PDataType.BINARY; }
Source:
protected boolean shouldValidate() { ConfigurationService cs = Framework.getService(ConfigurationService.class); if (cs.isBooleanPropertyTrue("studio.snapshot.disablePkgValidation")) { return false; } return validate; }

Target:
protected boolean shouldValidate() { ConfigurationService cs = Framework.getService(ConfigurationService.class); if (cs.isBooleanPropertyTrue(ConnectClientComponent.STUDIO_SNAPSHOT_DISABLE_VALIDATION_PROPERTY)) { return false; } return validate; }
Source:
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_clusterId \n" + "and vds_dynamic.status = :v_status"; final MapSqlParameterSource customMapSqlParameterSource = getCustomMapSqlParameterSource() .addValue("clusterId", clusterId) .addValue("status", hostStatus); return getNamedParameterJdbcTemplate().query(sql, customMapSqlParameterSource, createGuidMapper()); }

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:
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) { DtoFactory.newDto(WorkspaceStatusEvent.class) .withWorkspaceId(workspace.getId()) .withEventType(EventType.ERROR) .withPrevStatus(WorkspaceStatus.STARTING); } }

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:
public ContainerRequest filter(ContainerRequest request) { final ResourceAction resourceAction = new ResourceAction( new Resource("security", 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; }

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:
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")); cTaskCompletedSound = Gdx.audio.newSound(Gdx.files.internal("sounds/completedTask.wav")); cEventCompletedSound = Gdx.audio.newSound(Gdx.files.internal("sounds/eventCompleted.mp3")); cDefaultMusic.setLooping(true); setLastPlayed(cDefaultMusic); playAudio(cDefaultMusic); }

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:
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; int index = Collections.binarySearch(accumulatedValue, input, accComparator); index = index >= 0 ? index : (-index - 1); accumulatedValue.add(index, input); return accumulatedValue; }

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:
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); 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."); }

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:
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() ); store().initialize(null, new IdentityHashMap<CacheStore, ThreadLocal>()); }

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:
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) { VmNetworkInterface iface = nics.get(i); 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()); }

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:
private RuleKey getParsingErrorRuleKey() { List<RuleKey> keys = checks.all().stream() .filter(check -> check instanceof ParsingErrorCheck) .map(check -> checks.ruleKeyFor((ParsingErrorCheck) check)) .collect(Collectors.toList()); return keys.isEmpty() ? null : keys.get(0); }

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:
public IpUtil() { 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); } } }

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:
public void close() { _zkClient.close(); }

Target:
public void close() { if (_zkClient != null) { _zkClient.close(); } }
Source:
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: "); } message.append(failedIrreversibleOperationDescriptions.stream() .collect(Collectors.joining("; "))); PrestoException prestoException = new PrestoException( HIVE_METASTORE_ERROR, message.toString()); suppressedExceptions.forEach(prestoException::addSuppressed); throw prestoException; } }

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:
public int ifHit(Vector<Bullet> shipBullets) { Iterator iteralien = ConcreteAggregate.createIterator(shipBullets); 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; }

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:
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()); locationDto.setResourceProjectPath(b.getFile().getProject().getProjectConfig().getPath()); 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); }

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:
public void addProjectId(ProjectId projectId) { projectIds.add(projectId); }

Target:
public void addProjectId(ProjectId projectId) { projectIds.add(ModelUtil.clone(projectId)); }
Source:
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) { Throwables.propagate(new ISE("sizeInBytes should be greater than 0.")); } logEvictions = logEvictionCount != 0; numBytes = 0; evictionCount = 0; }

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:
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(), !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; }

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:
public Question map(int index, ResultSet r, StatementContext ctx) throws SQLException { final Integer[] response_ids = (Integer []) r.getArray("responses_ids").getArray(); final String[] response_text = (String []) r.getArray("responses").getArray(); final Integer question_id = r.getInt("id"); final List<Choice> choices = new ArrayList<>(); for (int i = 0; i < response_ids.length; i++) { choices.add(new Choice(response_ids[i], response_text[i], question_id)); } final int[] dependency_response_ids = (int []) r.getArray("dependency_response").getArray(); final List<Integer> dependency_response = Ints.asList(dependency_response_ids); DateTime createdLocal; try { int foundCreatedLocal = r.findColumn("created_local_utc_ts"); createdLocal = new DateTime(r.getTimestamp("created_local_utc_ts"), DateTimeZone.UTC); } catch (SQLException error) { createdLocal = DateTime.now(DateTimeZone.UTC); } Long accountQuestionId = 0L; final Question question = new Question(question_id, accountQuestionId, r.getString("question_text"), r.getString("lang"), Question.Type.fromString(r.getString("response_type")), Question.FREQUENCY.fromString(r.getString("frequency")), Question.ASK_TIME.fromString(r.getString("ask_time")), r.getInt("dependency"), r.getInt("parent_id"), createdLocal, choices, AccountInfo.Type.fromString(r.getString("account_info")), createdLocal, QuestionCategory.fromString(r.getString("category")), dependency_response ); return question; }

Target:
public Question map(int index, ResultSet r, StatementContext ctx) throws SQLException { final Integer[] response_ids = (Integer []) r.getArray("responses_ids").getArray(); final String[] response_text = (String []) r.getArray("responses").getArray(); final Integer question_id = r.getInt("id"); final List<Choice> choices = new ArrayList<>(); for (int i = 0; i < response_ids.length; i++) { choices.add(new Choice(response_ids[i], response_text[i], question_id)); } final List<Integer> dependencyResponse = Lists.newArrayList(); final String dependencyResponseString = r.getString("dependency_response"); if (dependencyResponseString != null) { final Integer[] dependencyResponseIds; dependencyResponseIds = (Integer []) r.getArray("dependency_response").getArray(); for (final Integer responseId : dependencyResponseIds) { dependencyResponse.add(responseId); } } DateTime createdLocal; try { int foundCreatedLocal = r.findColumn("created_local_utc_ts"); createdLocal = new DateTime(r.getTimestamp("created_local_utc_ts"), DateTimeZone.UTC); } catch (SQLException error) { createdLocal = DateTime.now(DateTimeZone.UTC); } Long accountQuestionId = 0L; final Question question = new Question(question_id, accountQuestionId, r.getString("question_text"), r.getString("lang"), Question.Type.fromString(r.getString("response_type")), Question.FREQUENCY.fromString(r.getString("frequency")), Question.ASK_TIME.fromString(r.getString("ask_time")), r.getInt("dependency"), r.getInt("parent_id"), createdLocal, choices, AccountInfo.Type.fromString(r.getString("account_info")), createdLocal, QuestionCategory.fromString(r.getString("category")), dependencyResponse ); return question; }
Source:
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++) { Integer nameLen = new Integer(buff.getInt()); 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; }

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:
<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?"); }

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:
public synchronized boolean compareAndSetState(final String expectedCurrentState, final String state) { final boolean compared = currentState.name.equals(expectedCurrentState); if (compared) { setState(state); } return compared; }

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:
protected void handleAgentIfNotConnected(HostVO host, boolean vmsMigrating) { final boolean isAgentOnHost = host.getHypervisorType() == HypervisorType.KVM || host.getHypervisorType() == HypervisorType.LXC; if (isAgentOnHost) { final boolean sshToAgent = Boolean.parseBoolean(_configDao.getValue(Config.KvmSshToAgentEnabled.key())); 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"); } } } }

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:
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 FileIOUtils.readNumberFromFile(path); }

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:
private static String asText(JsonNode node) { Preconditions.checkState(node.isValueNode()); return node.isNull() ? null : node.asText(); }

Target:
private static String asText(JsonNode node) { checkState(node.isValueNode()); return node.isNull() ? null : node.asText(); }
Source:
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"); }

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:
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); getCustomBondEditor().setEntity(bondOptions); } }

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:
InfiniumFileTOC[] getTableOfContents() throws IOException { InfiniumFileTOC[] tableOfContents = new InfiniumFileTOC[getNumberOfEntries()]; for (int i = 0; i < getNumberOfEntries(); i++) { InfiniumFileTOC toc = new InfiniumFileTOC(); toc.setTableOfContentsId(Short.reverseBytes(stream.readShort())); toc.setOffset(Integer.reverseBytes(stream.readInt())); tableOfContents[i] = toc; } return tableOfContents; }

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:
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: return true; default: return false; } }

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:
public void createProject() throws ProjectCreationFailedException { validateParameters(); try { 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(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); } }

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); } }
Source:
public static EmptyMessage manageError(OSException e, Response response) { if (e == null) { LOGGER.error(Error.EXCEPTION_NULL); throw new IllegalArgumentException(Error.EXCEPTION_NULL); } String errMess = e.getMessage(); if (errMess == null) { LOGGER.error(Error.ERROR_MESS_NULL); throw new IllegalArgumentException(Error.ERROR_MESS_NULL); } if (!response.isConfirmable()) { LOGGER.error("An Empty Message will not be created"); return null; } return EmptyMessage.newACK(response); }

Target:
public static EmptyMessage manageError(OSException e, Response response) { if (e == null) { LOGGER.error(Error.EXCEPTION_NULL); throw new NullPointerException(Error.EXCEPTION_NULL); } String errMess = e.getMessage(); if (errMess == null) { LOGGER.error(Error.ERROR_MESS_NULL); throw new NullPointerException(Error.ERROR_MESS_NULL); } if (!response.isConfirmable()) { LOGGER.error("An Empty Message will not be created"); return null; } return EmptyMessage.newACK(response); }