auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static boolean isShowingEntireContents(StyledText widget) { if (widget.getTopPixel() != 0) return false; int lastVisiblePixel= computeLastVisiblePixel(widget); int lineCount= widget.getLineCount(); if (lineCount > 400) { int linePixel400= widget.getLinePixel(400); if (linePixel400 > lastVisiblePixel) { return false; } } int lastPossiblePixel= widget.getLinePixel(lineCount); return lastPossiblePixel <= lastVisiblePixel; }

Target:
public static boolean isShowingEntireContents(StyledText widget) { if (widget.getTopPixel() != 0) return false; int lastVisiblePixel= computeLastVisiblePixel(widget); int bottom= widget.getLineIndex(lastVisiblePixel); if (bottom + 1 < widget.getLineCount()) return false; int bottomLastPixel= getLinePixel(widget, bottom + 1) - 1; return bottomLastPixel <= lastVisiblePixel; }
Source:
public InvalidSecretFormatException () { }

Target:
public InvalidSecretFormatException() { super(); }
Source:
private void deleteRelationIfExists(@Nonnull final SQLiteConnection sqliteConnection, @Nonnull final RelationKey relation) throws CatalogException { try { SQLiteStatement statement = sqliteConnection .prepare("DELETE FROM relations WHERE user_name=? AND program_name=? AND relation_name=? AND tombstone=1;"); statement.bind(1, relation.getUserName()); statement.bind(2, relation.getProgramName()); statement.bind(3, relation.getRelationName()); statement.stepThrough(); statement.dispose(); statement = null; } catch (final SQLiteException e) { throw new CatalogException(e); } }

Target:
private void deleteRelationIfExists(@Nonnull final SQLiteConnection sqliteConnection, @Nonnull final RelationKey relation) throws CatalogException { try { SQLiteStatement statement = sqliteConnection .prepare("DELETE FROM relations WHERE user_name=? AND program_name=? AND relation_name=? AND is_deleted=1;"); statement.bind(1, relation.getUserName()); statement.bind(2, relation.getProgramName()); statement.bind(3, relation.getRelationName()); statement.stepThrough(); statement.dispose(); statement = null; } catch (final SQLiteException e) { throw new CatalogException(e); } }
Source:
protected String getCharset() { return charset; }

Target:
String getCharset() { return charset; }
Source:
public boolean next() throws IOException { while ( !exhausted() ) { if ( currentChunkExhausted() ) { readNextChunk(); } chunkCursor++; assert chunkCursor <= chunkLength; return true; } return false; }

Target:
public boolean next() throws IOException { if ( !exhausted() ) { if ( currentChunkExhausted() ) { readNextChunk(); } currentChunkTransaction = chunkTransactions.pop(); return true; } return false; }
Source:
private List<ParquetFileReader> getReaders(List<InputFile> inputFiles) throws IOException { List<ParquetFileReader> readers = new ArrayList<>(); for (InputFile inputFile : inputFiles) { readers.add(ParquetFileReader.open(inputFile)); } return readers; }

Target:
private List<ParquetFileReader> getReaders(List<InputFile> inputFiles) throws IOException { List<ParquetFileReader> readers = new ArrayList<>(inputFiles.size()); for (InputFile inputFile : inputFiles) { readers.add(ParquetFileReader.open(inputFile)); } return readers; }
Source:
public ActionResult execute() { gateKeeper.verifyInstructorPrivileges(account); InstructorCoursesPageData data = new InstructorCoursesPageData(account, sessionToken); try { List<InstructorAttributes> instructorList = logic.getInstructorsForGoogleId(data.account.googleId); logic.deleteAllCourses(instructorList); String statusMessage = Const.StatusMessages.COURSE_ALL_DELETED; statusToUser.add(new StatusMessage(statusMessage, StatusMessageColor.SUCCESS)); statusToAdmin = "All courses deleted"; } catch (Exception e) { setStatusForException(e); } if (isRedirectedToHomePage()) { return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); } return createRedirectResult(Const.ActionURIs.INSTRUCTOR_COURSES_PAGE); }

Target:
public ActionResult execute() { InstructorCoursesPageData data = new InstructorCoursesPageData(account, sessionToken); List<InstructorAttributes> instructorList = logic.getInstructorsForGoogleId(data.account.googleId); for (InstructorAttributes instructor : instructorList) { CourseAttributes course = logic.getRecoveryCourseForInstructor(instructor); if (course != null) { gateKeeper.verifyAccessible(instructor, course, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE); } } try { logic.deleteAllCourses(instructorList); String statusMessage = Const.StatusMessages.COURSE_ALL_DELETED; statusToUser.add(new StatusMessage(statusMessage, StatusMessageColor.SUCCESS)); statusToAdmin = "All courses deleted"; } catch (Exception e) { setStatusForException(e); } return createRedirectResult(Const.ActionURIs.INSTRUCTOR_COURSES_PAGE); }
Source:
public static void register(AggregationImplModule mod) { BinaryOperator<Long> add = Math::addExact; BinaryOperator<Long> sub = Math::subtractExact; mod.register( Signature.aggregate( NAME, DataTypes.FLOAT.getTypeSignature(), DataTypes.FLOAT.getTypeSignature()), args -> new SumAggregation<>(DataTypes.FLOAT, Float::sum, (n1, n2) -> n1 - n2) ); mod.register( Signature.aggregate( NAME, DataTypes.DOUBLE.getTypeSignature(), DataTypes.DOUBLE.getTypeSignature()), args -> new SumAggregation<>(DataTypes.DOUBLE, Double::sum, (n1, n2) -> n1 - n2) ); for (var supportedType : List.of(DataTypes.BYTE, DataTypes.SHORT, DataTypes.INTEGER, DataTypes.LONG)) { mod.register( Signature.aggregate( NAME, supportedType.getTypeSignature(), supportedType.getTypeSignature()), args -> new SumAggregation<>(supportedType, DataTypes.LONG, add, sub) ); } }

Target:
public static void register(AggregationImplModule mod) { BinaryOperator<Long> add = Math::addExact; BinaryOperator<Long> sub = Math::subtractExact; mod.register( Signature.aggregate( NAME, DataTypes.FLOAT.getTypeSignature(), DataTypes.FLOAT.getTypeSignature()), args -> new SumAggregation<>(DataTypes.FLOAT, Float::sum, (n1, n2) -> n1 - n2) ); mod.register( Signature.aggregate( NAME, DataTypes.DOUBLE.getTypeSignature(), DataTypes.DOUBLE.getTypeSignature()), args -> new SumAggregation<>(DataTypes.DOUBLE, Double::sum, (n1, n2) -> n1 - n2) ); for (var supportedType : List.of(DataTypes.BYTE, DataTypes.SHORT, DataTypes.INTEGER, DataTypes.LONG)) { mod.register( Signature.aggregate( NAME, supportedType.getTypeSignature(), DataTypes.LONG.getTypeSignature()), args -> new SumAggregation<>(supportedType, DataTypes.LONG, add, sub) ); } }
Source:
public List<PluginWrapper> getPlugins() { return plugins; }

Target:
public List<PluginWrapper> getPlugins() { return Collections.unmodifiableList(plugins); }
Source:
public void validateNameUniqueness(Map<String, JobConfig> visitedConfigs) { if (name() == null) return; String currentJob = name().toLower(); if (visitedConfigs.containsKey(CaseInsensitiveString.str(name())) || visitedConfigs.containsKey(currentJob)) { JobConfig conflictingConfig = visitedConfigs.get(currentJob); conflictingConfig.addUniquenessViolationMessage(); this.addUniquenessViolationMessage(); } else { visitedConfigs.put(currentJob, this); } }

Target:
public void validateNameUniqueness(Map<String, JobConfig> visitedConfigs) { if (StringUtil.isBlank(CaseInsensitiveString.str(name()))) return; String currentJob = name().toLower(); if (visitedConfigs.containsKey(CaseInsensitiveString.str(name())) || visitedConfigs.containsKey(currentJob)) { JobConfig conflictingConfig = visitedConfigs.get(currentJob); conflictingConfig.addUniquenessViolationMessage(); this.addUniquenessViolationMessage(); } else { visitedConfigs.put(currentJob, this); } }
Source:
public void should_pass_on_equal_files() throws Exception { File actual = createDeleteOnExitTempFileWithContent("assertJ"); File expected = createDeleteOnExitTempFileWithContent("assertJ"); assertThat(actual).hasSameBinaryContentAs(expected); }

Target:
public void should_pass_on_equal_files() throws Exception { File actual = createTempFileWithContent("assertJ"); File expected = createTempFileWithContent("assertJ"); assertThat(actual).hasSameBinaryContentAs(expected); }
Source:
public boolean waitFor(LogOffset offset, String group, Duration timeout) throws InterruptedException { boolean ret = false; if (!name.equals(offset.partition().name())) { throw new IllegalArgumentException(name + " can not wait for an offset with a different Log: " + offset); } TopicPartition topicPartition = new TopicPartition(topic, offset.partition().partition()); try { ret = isProcessed(group, topicPartition, offset.offset()); if (ret) { return true; } final long timeoutMs = timeout.toMillis(); final long deadline = System.currentTimeMillis() + timeoutMs; final long delay = Math.min(100, timeoutMs); while (!ret && System.currentTimeMillis() < deadline) { Thread.sleep(delay); ret = isProcessed(group, topicPartition, offset.offset()); } return ret; } finally { if (log.isDebugEnabled()) { log.debug("waitFor " + offset + "/" + group + " returns: " + ret); } } }

Target:
public boolean waitFor(LogOffset offset, String group, Duration timeout) throws InterruptedException { boolean ret = false; if (!name.equals(offset.partition().name())) { throw new IllegalArgumentException(name + " can not wait for an offset with a different Log: " + offset); } TopicPartition topicPartition = new TopicPartition(topic, offset.partition().partition()); try { ret = isProcessed(group, topicPartition, offset.offset()); if (ret) { return true; } long timeoutMs = timeout.toMillis(); long deadline = System.currentTimeMillis() + timeoutMs; long delay = Math.min(100, timeoutMs); while (!ret && System.currentTimeMillis() < deadline) { Thread.sleep(delay); ret = isProcessed(group, topicPartition, offset.offset()); } return ret; } finally { if (log.isDebugEnabled()) { log.debug("waitFor " + offset + "/" + group + " returns: " + ret); } } }
Source:
public void setReadTimeout(final int readTimeout) { if (readTimeout < 1) { throw new IllegalArgumentException("Read timeout must be positive."); } this.readTimeout = readTimeout; }

Target:
public void setReadTimeout(final int readTimeout) { if (readTimeout < 1) { throw new IllegalArgumentException("Read timeout must be greater than zero."); } this.readTimeout = readTimeout; }
Source:
public SanctumOfCalmWaters(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.SHRINE); Ability ability = new BeginningOfPreCombatMainTriggeredAbility(new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)), TargetController.YOU, true); Effect effect = new DiscardControllerEffect(1); effect.setText("If you do, discard a card"); ability.addEffect(effect); this.addAbility(ability); }

Target:
public SanctumOfCalmWaters(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.SHRINE); Ability ability = new BeginningOfPreCombatMainTriggeredAbility(new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.SHRINE))) .setText("At the beginning of your precombat main phase, you may draw X cards, where X is the number of Shrines you control"), TargetController.YOU, true); ability.addEffect(new DiscardControllerEffect(1).setText("If you do, discard a card")); this.addAbility(ability); }
Source:
private void saveFile(Uri sourceUri, File externalFile) { final int chunkSize = 1024; byte[] imageData = new byte[chunkSize]; InputStream in = null; OutputStream out = null; try { in = getContentResolver().openInputStream(sourceUri); out = new FileOutputStream(externalFile); int bytesRead; while((bytesRead = in.read(imageData)) > 0) { out.write(Arrays.copyOfRange(imageData, 0, Math.max(0, bytesRead))); } } catch(IOException ex) { Toast.makeText(this, "Saving picture failed.", Toast.LENGTH_SHORT).show(); } finally { try { if(in != null) { in.close(); } if(out != null) { out.close(); } } catch(IOException e) { throw new RuntimeException(e); } } }

Target:
private void saveFile(Uri sourceUri, File externalFile) { final int chunkSize = 1024; byte[] imageData = new byte[chunkSize]; InputStream in = null; OutputStream out = null; try { File temp = new File(getFilesDir(), "temp" + System.currentTimeMillis() +".jpg"); in = getContentResolver().openInputStream(sourceUri); out = new FileOutputStream(temp); int bytesRead; while((bytesRead = in.read(imageData)) > 0) { out.write(Arrays.copyOfRange(imageData, 0, Math.max(0, bytesRead))); } temp.renameTo(externalFile); } catch(IOException ex) { Log.e(TAG, ex.getMessage()); } finally { try { if(in != null) { in.close(); } if(out != null) { out.close(); } } catch(IOException e) { Log.e(TAG, "error closing input and output stream"); } } }
Source:
private MetricManager(@Parameter(Parameters.DashboardHostAddress.class) final String hostAddress, @Parameter(Parameters.DashboardPort.class) final int port) { this.workerEvalParams = Collections.synchronizedMap(new HashMap<>()); this.serverEvalParams = Collections.synchronizedMap(new HashMap<>()); this.metricCollectionEnabled = false; this.numBlockByEvalIdForWorker = null; this.numBlockByEvalIdForServer = null; boolean tempDashboardEnabled = !hostAddress.equals("INVALID"); CloseableHttpAsyncClient tempReusableHttpClient = null; if (tempDashboardEnabled) { this.dashboardURL = "http://" + hostAddress + ":" + port + "/"; try { final PoolingNHttpClientConnectionManager connectionManager = new PoolingNHttpClientConnectionManager(new DefaultConnectingIOReactor()); connectionManager.setMaxTotal(Integer.MAX_VALUE); tempReusableHttpClient = HttpAsyncClients.custom().setConnectionManager(connectionManager).build(); tempReusableHttpClient.start(); runMetricsSenderThread(); } catch (IOReactorException e) { LOG.log(Level.WARNING, "Dashboard: ", e); tempDashboardEnabled = false; tempReusableHttpClient = null; } } else { LOG.log(Level.INFO, "Dashboard is not in use"); this.dashboardURL = null; } this.reusableHttpClient = tempReusableHttpClient; this.dashboardEnabled = tempDashboardEnabled; }

Target:
private MetricManager(@Parameter(Parameters.DashboardHostAddress.class) final String hostAddress, @Parameter(Parameters.DashboardPort.class) final int port) { this.workerEvalParams = Collections.synchronizedMap(new HashMap<>()); this.serverEvalParams = Collections.synchronizedMap(new HashMap<>()); this.metricCollectionEnabled = false; this.numBlockByEvalIdForWorker = null; this.numBlockByEvalIdForServer = null; this.dashboardSetupStatus = initDashboard(hostAddress, port); }
Source:
private void goRunTest(Project project, String args, ArtifactoryBuildInfoClientBuilder clientBuilder, String repo) { Path projectDir = null; try { CommandExecutor goCommandExecutor = new CommandExecutor("go", null); List<String> goEnvArgs = new ArrayList<>(); goEnvArgs.add("env"); goCommandExecutor.exeCommand(PROJECTS_ROOT.toFile(), goEnvArgs, log); projectDir = createProjectDir(project); GoRun goRun = new GoRun(args, projectDir, clientBuilder, repo, getUsername(), getPassword(), getLog(), env); Build build = goRun.execute(); assertNotNull(build); assertEquals(build.getModules().size(), 1); Module module = build.getModules().get(0); assertEquals(module.getId(), project.getModuleId()); Set<String> moduleDependencies = module.getDependencies().stream().map(Dependency::getId).collect(Collectors.toSet()); assertEquals(moduleDependencies, project.dependencies); } catch (Exception e) { fail(ExceptionUtils.getStackTrace(e)); } finally { if (projectDir != null) { FileUtils.deleteQuietly(projectDir.toFile()); } } }

Target:
private void goRunTest(Project project, String args, ArtifactoryBuildInfoClientBuilder clientBuilder, String repo) { Path projectDir = null; try { projectDir = createProjectDir(project); GoRun goRun = new GoRun(args, projectDir, clientBuilder, repo, getUsername(), getPassword(), getLog(), env); Build build = goRun.execute(); assertNotNull(build); assertEquals(build.getModules().size(), 1); Module module = build.getModules().get(0); assertEquals(module.getId(), project.getModuleId()); Set<String> moduleDependencies = module.getDependencies().stream().map(Dependency::getId).collect(Collectors.toSet()); assertEquals(moduleDependencies, project.dependencies); } catch (Exception e) { fail(ExceptionUtils.getStackTrace(e)); } finally { if (projectDir != null) { FileUtils.deleteQuietly(projectDir.toFile()); } } }
Source:
private boolean isClusterOverloaded() { int overloadedTaskNum = 0; for (final Map.Entry<String, TaskStats> entry : taskStatsMap.entrySet()) { if (entry.getValue().getTaskLoad() > overloadedTaskLoadThreshold) { overloadedTaskNum += 1; } } final double overloadedTaskRate = overloadedTaskNum / taskStatsMap.getTaskList().size(); return overloadedTaskRate > scaleOutOverloadedTaskRate; }

Target:
private boolean isClusterOverloaded() { int overloadedTaskNum = 0; for (final Map.Entry<String, TaskStats> entry : taskStatsMap.entrySet()) { if (entry.getValue().getTaskLoad() > overloadedTaskLoadThreshold) { overloadedTaskNum += 1; } } final double overloadedTaskRatio = overloadedTaskNum / taskStatsMap.getTaskList().size(); return overloadedTaskRatio > scaleOutOverloadedTaskRatio; }
Source:
public void onClick(View v) { mActivityHelper .getCurrentUser() .unlink(mProviderId) .addOnFailureListener( new TaskFailureLogger(TAG, "Failed to unlink " + mProviderId)) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult result) { populateLinkedAccounts(); } }); }

Target:
public void onClick(View v) { mActivityHelper .getCurrentUser() .unlink(mProviderId) .addOnFailureListener( new TaskFailureLogger(TAG, "Failed to unlink " + mProviderId)) .addOnSuccessListener( AccountSettingsActivity.this, new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult result) { populateLinkedAccounts(); } }); }
Source:
protected SpawnResult actuallyExec(Spawn spawn, SpawnExecutionContext context) throws IOException, ExecException, InterruptedException { Path tmpDir = createActionTemp(execRoot); Path commandTmpDir = tmpDir.getRelative("work"); commandTmpDir.createDirectory(); Map<String, String> environment = localEnvProvider.rewriteLocalEnv( spawn.getEnvironment(), binTools, commandTmpDir.getPathString()); Map<PathFragment, Path> readablePaths = SandboxHelpers.processInputFiles( spawn, context, execRoot, getSandboxOptions().symlinkedSandboxExpandsTreeArtifactsInRunfilesTree); ImmutableSet.Builder<Path> writablePaths = ImmutableSet.builder(); writablePaths.addAll(getWritableDirs(execRoot, environment)); for (ActionInput output : spawn.getOutputFiles()) { writablePaths.add(execRoot.getRelative(output.getExecPath())); } Duration timeout = context.getTimeout(); WindowsSandboxUtil.CommandLineBuilder commandLineBuilder = WindowsSandboxUtil.commandLineBuilder(windowsSandbox, spawn.getArguments()) .setWritableFilesAndDirectories(writablePaths.build()) .setReadableFilesAndDirectories(readablePaths) .setInaccessiblePaths(getInaccessiblePaths()) .setUseDebugMode(getSandboxOptions().sandboxDebug) .setKillDelay(timeoutKillDelay); if (!timeout.isZero()) { commandLineBuilder.setTimeout(timeout); } Path statisticsPath = null; SandboxedSpawn sandbox = new DummySandboxedSpawn(execRoot, environment, commandLineBuilder.build()); return runSpawn(spawn, sandbox, context, execRoot, timeout, statisticsPath); }

Target:
protected SpawnResult actuallyExec(Spawn spawn, SpawnExecutionContext context) throws IOException, ExecException, InterruptedException { Path tmpDir = createActionTemp(execRoot); Path commandTmpDir = tmpDir.getRelative("work"); commandTmpDir.createDirectory(); ImmutableMap<String, String> environment = ImmutableMap.copyOf( localEnvProvider.rewriteLocalEnv( spawn.getEnvironment(), binTools, commandTmpDir.getPathString())); Map<PathFragment, Path> readablePaths = SandboxHelpers.processInputFiles( spawn, context, execRoot, getSandboxOptions().symlinkedSandboxExpandsTreeArtifactsInRunfilesTree); ImmutableSet.Builder<Path> writablePaths = ImmutableSet.builder(); writablePaths.addAll(getWritableDirs(execRoot, environment)); for (ActionInput output : spawn.getOutputFiles()) { writablePaths.add(execRoot.getRelative(output.getExecPath())); } Duration timeout = context.getTimeout(); WindowsSandboxUtil.CommandLineBuilder commandLineBuilder = WindowsSandboxUtil.commandLineBuilder(windowsSandbox, spawn.getArguments()) .setWritableFilesAndDirectories(writablePaths.build()) .setReadableFilesAndDirectories(readablePaths) .setInaccessiblePaths(getInaccessiblePaths()) .setUseDebugMode(getSandboxOptions().sandboxDebug) .setKillDelay(timeoutKillDelay); if (!timeout.isZero()) { commandLineBuilder.setTimeout(timeout); } Path statisticsPath = null; SandboxedSpawn sandbox = new WindowsSandboxedSpawn(execRoot, environment, commandLineBuilder.build()); return runSpawn(spawn, sandbox, context, execRoot, timeout, statisticsPath); }
Source:
private String combineFlags(Iterable<Flag> flags) { List<String> flagNames = new ArrayList<String>(); for (Flag flag : flags) { if( !flag.equals(Flag.RECENT) ) flagNames.add(flag.realName()); } return combine(flagNames.toArray(new String[flagNames.size()]), ' '); }

Target:
private String combineFlags(Iterable<Flag> flags) { List<String> flagNames = new ArrayList<String>(); for (Flag flag : flags) { if (!flag.equals(Flag.RECENT)) { flagNames.add(flag.realName()); } } return combine(flagNames.toArray(new String[flagNames.size()]), ' '); }
Source:
public CacheResult get(FileReadRequest request, byte[] buffer, int offset, CacheQuota cacheQuota) { boolean result = read(request, buffer, offset); if (!result && ifExceedQuota(cacheQuota, request)) { stats.incrementQuotaExceed(); return CacheResult.CACHE_QUOTA_EXCEED; } try { cache.get(request.getPath(), cacheQuota::getIdentifier); } catch (ExecutionException e) { } if (result) { stats.incrementCacheHit(); return CacheResult.IN_CACHE; } stats.incrementCacheMiss(); return CacheResult.NOT_IN_CACHE; }

Target:
public CacheResult get(FileReadRequest request, byte[] buffer, int offset, CacheQuota cacheQuota) { boolean result = read(request, buffer, offset); if (!result && ifExceedQuota(cacheQuota, request)) { stats.incrementQuotaExceed(); return CacheResult.CACHE_QUOTA_EXCEED; } try { cache.get(request.getPath(), cacheQuota::getIdentifier); } catch (ExecutionException e) { } if (result) { stats.incrementCacheHit(); return CacheResult.HIT; } stats.incrementCacheMiss(); return CacheResult.MISS; }
Source:
private synchronized void connectToCassandra() { Cluster.Builder clusterBuilder = Cluster.builder().addContactPoint(config.getHost()) .withPort(config.getPort().intValue()); keyspace = config.getKeyspace(); table = config.getTable(); if (!Strings.isNullOrEmpty(config.getUser()) && !Strings.isNullOrEmpty(config.getPassword())) { cluster = clusterBuilder.withCredentials(config.getUser(), config.getPassword()).build(); } else { cluster = clusterBuilder.build(); } Metadata metadata = cluster.getMetadata(); if (Objects.isNull(metadata.getKeyspace(keyspace))) { LOGGER.info("Keyspace does not exist. Creating Keyspace", keyspace); Map<String, Object> replication = new HashMap<String, Object>(); replication.put("class", "SimpleStrategy"); replication.put("replication_factor", 1); String createKeyspaceStmt = SchemaBuilder.createKeyspace(keyspace).with() .replication(replication).getQueryString(); cluster.connect().execute(createKeyspaceStmt); } session = cluster.connect(keyspace); KeyspaceMetadata ks = metadata.getKeyspace(keyspace); TableMetadata tableMetadata = ks.getTable(table); if (Objects.isNull(tableMetadata)) { LOGGER.info("Table does not exist in Keyspace {}. Creating Table", table, keyspace); String createTableStmt = SchemaBuilder.createTable(table) .addPartitionKey(config.getPartitionKeyColumn(), DataType.varchar()) .addColumn(config.getColumn(), DataType.blob()).getQueryString(); session.execute(createTableStmt); } }

Target:
private synchronized void connectToCassandra() { Cluster.Builder clusterBuilder = Cluster.builder() .addContactPoints(config.getHost().toArray(new String[config.getHost().size()])) .withPort(config.getPort().intValue()); keyspace = config.getKeyspace(); table = config.getTable(); if (StringUtils.isNotEmpty(config.getUser()) && StringUtils.isNotEmpty(config.getPassword())) { cluster = clusterBuilder.withCredentials(config.getUser(), config.getPassword()).build(); } else { cluster = clusterBuilder.build(); } Metadata metadata = cluster.getMetadata(); if (Objects.isNull(metadata.getKeyspace(keyspace))) { LOGGER.info("Keyspace does not exist. Creating Keyspace", keyspace); Map<String, Object> replication = new HashMap<>(); replication.put("class", "SimpleStrategy"); replication.put("replication_factor", 1); String createKeyspaceStmt = SchemaBuilder.createKeyspace(keyspace).with() .replication(replication).getQueryString(); cluster.connect().execute(createKeyspaceStmt); } session = cluster.connect(keyspace); KeyspaceMetadata ks = metadata.getKeyspace(keyspace); TableMetadata tableMetadata = ks.getTable(table); if (Objects.isNull(tableMetadata)) { LOGGER.info("Table does not exist in Keyspace {}. Creating Table", table, keyspace); String createTableStmt = SchemaBuilder.createTable(table) .addPartitionKey(config.getPartitionKeyColumn(), DataType.varchar()) .addColumn(config.getColumn(), DataType.blob()).getQueryString(); session.execute(createTableStmt); } }
Source:
private <I, T extends I> @Nullable I getSingleServiceInstance(Class<T> clazz, final List<I> filteredServices) { if (filteredServices.size() > 1) { Assert.fail("More than 1 service matching the filter is registered."); } if (filteredServices.isEmpty()) { new MissingServiceAnalyzer(System.out, bundleContext).printMissingServiceDetails(clazz); return null; } else { return filteredServices.get(0); } }

Target:
private <T, I extends T> @Nullable I getSingleServiceInstance(Class<T> clazz, final List<I> filteredServices) { if (filteredServices.size() > 1) { Assert.fail("More than 1 service matching the filter is registered."); } if (filteredServices.isEmpty()) { new MissingServiceAnalyzer(System.out, bundleContext).printMissingServiceDetails(clazz); return null; } else { return filteredServices.get(0); } }
Source:
public static synchronized EmailEventAdapter getEmailEventAdapter(Map<String, String> dynamicProperties) { if (emailAdapter == null) { emailAdapter = new EmailEventAdapter(null, dynamicProperties); } try { emailAdapter.init(); } catch (OutputEventAdapterException e) { log.error("unable to initialize adapter"+ emailAdapter + e); } return emailAdapter; }

Target:
public static synchronized EmailEventAdapter getEmailEventAdapter(Map<String, String> dynamicProperties) { if (emailAdapter == null) { emailAdapter = new EmailEventAdapter(null, dynamicProperties); } try { emailAdapter.init(); } catch (OutputEventAdapterException e) { log.error("Unable to initialize email adapter.", e); } return emailAdapter; }
Source:
private void updateOriginalTemplateNameOnDerivedVms() { if (!getParameters().isImportAsNewEntity()) { DbFacade.getInstance().getVmDao().updateOriginalTemplateName(getVmTemplate().getId(), getVmTemplate().getName()); } }

Target:
private void updateOriginalTemplateNameOnDerivedVms() { if (!getParameters().isImportAsNewEntity()) { getVmDAO().updateOriginalTemplateName(getVmTemplate().getId(), getVmTemplate().getName()); } }
Source:
public void testNewTempFile() { int CREATE_CNT = 1500; Collection<File> folders = new ArrayList<File>(CREATE_CNT); try { for (int i = 0; i < CREATE_CNT; i++) { try { folders.add(Os.newTempFile(OsTest.class, "test")); } catch (IllegalStateException e) { log.warn("testNewTempFile failed at " + i + " iteration."); Exceptions.propagate(e); } } } finally { for (File folder : folders) { folder.delete(); } } }

Target:
public void testNewTempFile() { int CREATE_CNT = 5000; Collection<File> folders = new ArrayList<File>(CREATE_CNT); try { for (int i = 0; i < CREATE_CNT; i++) { try { folders.add(Os.newTempFile(OsTest.class, "test")); } catch (IllegalStateException e) { log.warn("testNewTempFile failed at " + i + " iteration."); Exceptions.propagate(e); } } } finally { for (File folder : folders) { folder.delete(); } } }
Source:
public void test4_11DeleteTraceFromExperiment() { SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME); traceItem.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, TRACE_NAME)); fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); experimentsItem.expand(); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable("ExampleCustomTxt.log [1]", experimentsItem)); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "ExampleCustomTxt.log [1]"); expItem.expand(); SWTBotTreeItem expTrace = expItem.getNode("ExampleCustomTxt.log"); expTrace.contextMenu("Delete").click(); fBot.waitUntil(Conditions.shellIsActive("Confirm Delete")); SWTBotShell shell = fBot.shell("Confirm Delete"); shell.bot().button("Yes").click(); fBot.waitUntil(Conditions.shellCloses(shell)); fBot.waitWhile(new ConditionHelpers.ActiveEventsEditor(fBot, null)); SWTBotUtils.waitUntil(exp -> exp.getItems().length == 0, experimentsItem, "Failed to delete the trace from the experiment"); fBot.waitUntil(new TraceDeletedCondition()); }

Target:
public void test4_11DeleteTraceFromExperiment() { fBot.closeAllEditors(); SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME); traceItem.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, TRACE_NAME)); fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); experimentsItem.expand(); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable("ExampleCustomTxt.log [1]", experimentsItem)); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "ExampleCustomTxt.log [1]"); expItem.expand(); SWTBotTreeItem expTrace = expItem.getNode(TRACE_NAME); expTrace.contextMenu("Delete").click(); fBot.waitUntil(Conditions.shellIsActive("Confirm Delete")); SWTBotShell shell = fBot.shell("Confirm Delete"); shell.bot().button("Yes").click(); fBot.waitUntil(Conditions.shellCloses(shell)); fBot.waitWhile(new ConditionHelpers.ActiveEventsEditor(fBot, null)); SWTBotUtils.waitUntil(exp -> exp.getItems().length == 0, experimentsItem, "Failed to delete the trace from the experiment"); fBot.waitUntil(new TraceDeletedCondition()); }
Source:
public void testDeletionOfReleasesWithNonMatchingTarget() throws Exception { fillInRepo(); releases.setAccessManager( new OpenAccessManager() ); targetRegistry.addRepositoryTarget( new Target( "test", "test", new Maven2ContentClass(), Lists.newArrayList( ".*/com/sonatype/.*" ) ) ); targetRegistry.commitChanges(); ReleaseRemovalResult releaseRemovalResult = defaultNexus.removeReleases( new ReleaseRemovalRequest( releases.getId(), 2, "test" ) ); assertThat( releaseRemovalResult.getDeletedFileCount(), is( 0 ) ); assertThat( releaseRemovalResult.isSuccessful(), is( true ) ); try { StorageItem storageItem = releases.retrieveItem( new ResourceStoreRequest( "org/sonatype/test/1.0" ) ); } catch ( ItemNotFoundException e ) { Assert.fail(); } }

Target:
public void testDeletionOfReleasesWithNonMatchingTarget() throws Exception { fillInRepo(); releases.setAccessManager( new OpenAccessManager() ); targetRegistry.addRepositoryTarget( new Target( "test", "test", new Maven2ContentClass(), Lists.newArrayList( ".*/com/sonatype/.*" ) ) ); targetRegistry.commitChanges(); ReleaseRemovalResult releaseRemovalResult = releaseRemover.removeReleases( new ReleaseRemovalRequest( releases.getId(), 2, "test" ) ); assertThat( releaseRemovalResult.getDeletedFileCount(), is( 0 ) ); assertThat( releaseRemovalResult.isSuccessful(), is( true ) ); try { StorageItem storageItem = releases.retrieveItem( new ResourceStoreRequest( "org/sonatype/test/1.0" ) ); } catch ( ItemNotFoundException e ) { Assert.fail("Files should not have been deleted, but we can't find them now"); } }
Source:
public static boolean hasPackageJson(IProject project){ IFile packageJsonFile = project.getFile(NodeConstants.PACKAGE_JSON); if (packageJsonFile != null && packageJsonFile.isAccessible()) { return true; } return false; }

Target:
private boolean hasPackageJson(IProject project){ IFile packageJsonFile = project.getFile(NodeConstants.PACKAGE_JSON); if (packageJsonFile != null && packageJsonFile.isAccessible()) { return true; } return false; }
Source:
public void onMouseEnterUsername() { if (player == null || player.getChatOnly() || usernameLabel.getTooltip() != null) { return; } Tooltip userTooltip = new Tooltip(); usernameLabel.setTooltip(userTooltip); userTooltip.textProperty().bind(Bindings.createStringBinding( () -> String.format("%s\n%s", i18n.get("userInfo.ratingFormat", getGlobalRating(player), getLeaderboardRating(player)), i18n.get("userInfo.idleTimeFormat", Duration.between(player.getIdleSince(), Instant.now()).toMinutes())), player.leaderboardRatingMeanProperty(), player.leaderboardRatingDeviationProperty(), player.globalRatingMeanProperty(), player.globalRatingDeviationProperty(), player.idleSinceProperty() )); }

Target:
public void onMouseEnterUsername() { if (player == null || player.getChatOnly() || usernameLabel.getTooltip() != null) { return; } Tooltip userTooltip = new Tooltip(); usernameLabel.setTooltip(userTooltip); userTooltip.textProperty().bind(Bindings.createStringBinding( () -> String.format("%s\n%s", i18n.get("userInfo.ratingFormat", getGlobalRating(player), getLeaderboardRating(player)), i18n.get("userInfo.idleTimeFormat", timeService.timeAgo(player.getIdleSince()))), player.leaderboardRatingMeanProperty(), player.leaderboardRatingDeviationProperty(), player.globalRatingMeanProperty(), player.globalRatingDeviationProperty(), player.idleSinceProperty() )); }
Source:
private void setTripDetails(ObaTripDetailsResponse data) { mTripInfo = data; final int code = mTripInfo.getCode(); if (code == ObaApi.OBA_OK) { setEmptyText(""); } else { setEmptyText(UIUtils.getRouteErrorString(getActivity(), code)); return; } setUpHeader(); final ListView listView = getListView(); if (mAdapter == null) { mAdapter = new TripDetailsAdapter(); getListView().setDivider(null); setListAdapter(mAdapter); if (mScrollMode != null && mScrollMode.equals("vehicle")) { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } else if (mStopId != null) { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } } else { if (mStopId != null) { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } else { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } } } mAdapter.notifyDataSetChanged(); } else { int index = listView.getFirstVisiblePosition(); View v = listView.getChildAt(0); int top = (v == null) ? 0 : v.getTop(); mAdapter.notifyDataSetChanged(); listView.setSelectionFromTop(index, top); } }

Target:
private void setTripDetails(ObaTripDetailsResponse data) { mTripInfo = data; final int code = mTripInfo.getCode(); if (code == ObaApi.OBA_OK) { setEmptyText(""); } else { setEmptyText(UIUtils.getRouteErrorString(getActivity(), code)); return; } setUpHeader(); final ListView listView = getListView(); if (mAdapter == null) { mAdapter = new TripDetailsAdapter(); getListView().setDivider(null); setListAdapter(mAdapter); setScroller(listView); } else { int index = listView.getFirstVisiblePosition(); View v = listView.getChildAt(0); int top = (v == null) ? 0 : v.getTop(); mAdapter.notifyDataSetChanged(); listView.setSelectionFromTop(index, top); } }
Source:
protected void setAuthentication(okhttp3.Request.Builder builder) { if (getApiKey() == null) { throw new IllegalArgumentException("api_key needs to be specified. Use setApiKey()"); } if (endPointChanged && !getEndPoint().equals(URL)) { super.setAuthentication(builder); } final okhttp3.HttpUrl url = okhttp3.HttpUrl.parse(builder.build().url().toString()); if ((url.query() == null) || url.query().isEmpty()) { builder.url(builder.build().url() + "?api_key=" + getApiKey()); } else { builder.url(builder.build().url() + "&api_key=" + getApiKey()); } }

Target:
protected void setAuthentication(okhttp3.Request.Builder builder) { if (getUsername() != null && getPassword() != null) { super.setAuthentication(builder); } else if (getApiKey() != null) { final okhttp3.HttpUrl url = okhttp3.HttpUrl.parse(builder.build().url().toString()); if ((url.query() == null) || url.query().isEmpty()) { builder.url(builder.build().url() + "?api_key=" + getApiKey()); } else { builder.url(builder.build().url() + "&api_key=" + getApiKey()); } } else { throw new IllegalArgumentException( "Credentials need to be specified. Use setApiKey() or setUsernameAndPassword()"); } }
Source:
protected Device findActiveDevice(final String deviceIdentification) throws FunctionalException { Device device; try { device = this.deviceDomainService.searchActiveDevice(deviceIdentification); } catch (final UnregisteredDeviceException e) { throw new FunctionalException(FunctionalExceptionType.UNREGISTERED_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } catch (final InactiveDeviceException e) { throw new FunctionalException(FunctionalExceptionType.INACTIVE_DEVICE, ComponentType.DOMAIN_CORE, e); } catch (final UnknownEntityException e) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } return device; }

Target:
protected Device findActiveDevice(final String deviceIdentification) throws FunctionalException { Device device; try { device = this.deviceDomainService.searchActiveDevice(deviceIdentification); } catch (final UnregisteredDeviceException e) { throw new FunctionalException(FunctionalExceptionType.UNREGISTERED_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } catch (final InactiveDeviceException e) { throw new FunctionalException(FunctionalExceptionType.INACTIVE_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } catch (final UnknownEntityException e) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } return device; }
Source:
public INDArray doForward(boolean training, LayerWorkspaceMgr workspaceMgr) { if(sameDiff == null){ doInit(); } try(MemoryWorkspace ws = Nd4j.getWorkspaceManager().scopeOutOfWorkspaces()) { for(int i=0; i<inputs.length; i++ ){ String name = config.getVertexParams().getInputs().get(i); sameDiff.associateArrayWithVariable(inputs[i].dup(), sameDiff.getVariable(name)); } if(maskArrays != null){ for(int i=0; i<maskArrays.length; i++ ){ String name = config.getVertexParams().getInputs().get(i); sameDiff.associateArrayWithVariable(maskArrays[i++].dup(), name + "_mask"); } } if(paramTable != null && paramTable.size() > 0) { for (String s : paramTable.keySet()) { sameDiff.associateArrayWithVariable(paramTable.get(s), s); } } Map<String,INDArray> out = sameDiff.exec(null, outputKey); INDArray result = out.get(outputKey); return workspaceMgr.dup(ArrayType.ACTIVATIONS, result); } }

Target:
public INDArray doForward(boolean training, LayerWorkspaceMgr workspaceMgr) { if(sameDiff == null){ doInit(); } try(MemoryWorkspace ws = Nd4j.getWorkspaceManager().scopeOutOfWorkspaces()) { config.validateInput(inputs); for(int i=0; i<inputs.length; i++ ){ String name = config.getVertexParams().getInputs().get(i); final String maskName = name + "_mask"; sameDiff.associateArrayWithVariable(inputs[i].dup(), sameDiff.getVariable(name)); if(maskArrays != null && maskArrays[i] != null) { sameDiff.associateArrayWithVariable(maskArrays[i].dup(), maskName); }else{ sameDiff.associateArrayWithVariable(createMask(inputs[i].shape()), maskName); } } if(paramTable != null && paramTable.size() > 0) { for (String s : paramTable.keySet()) { sameDiff.associateArrayWithVariable(paramTable.get(s), s); } } Map<String,INDArray> out = sameDiff.exec(null, outputKey); INDArray result = out.get(outputKey); return workspaceMgr.dup(ArrayType.ACTIVATIONS, result); } }
Source:
protected void initParametersForExternalNetworks(VDS vds, boolean isMigration) { if (getVm().getInterfaces().isEmpty()) { return; } Map<VmDeviceId, VmDevice> nicDevices = Entities.businessEntitiesById(vmDeviceDao.getVmDeviceByVmIdAndType(getVmId(), VmDeviceGeneralType.INTERFACE)); for (VmNic iface : getVm().getInterfaces()) { VnicProfile vnicProfile = vnicProfileDao.get(iface.getVnicProfileId()); Network network = networkHelper.getNetworkByVnicProfile(vnicProfile); VmDevice vmDevice = nicDevices.get(new VmDeviceId(iface.getId(), getVmId())); if (network != null && network.isExternal() && vmDevice.isPlugged()) { Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = providerProxyFactory.create(provider); Map<String, String> deviceProperties = providerProxy.allocate( network, vnicProfile, iface, vds, isMigration); getVm().getRuntimeDeviceCustomProperties().put(vmDevice.getId(), deviceProperties); } } }

Target:
protected void initParametersForExternalNetworks(VDS vds, boolean isMigration) { for (VmNetworkInterface iface : getVm().getInterfaces()) { VnicProfile vnicProfile = vnicProfileDao.get(iface.getVnicProfileId()); Network network = networkHelper.getNetworkByVnicProfile(vnicProfile); if (network != null && network.isExternal() && iface.isPlugged()) { Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = providerProxyFactory.create(provider); Map<String, String> deviceProperties = providerProxy.allocate( network, vnicProfile, iface, vds, isMigration); getVm().getRuntimeDeviceCustomProperties().put( new VmDeviceId(iface.getId(), getVmId()), deviceProperties); } } }
Source:
public void onComplete(Result result) { final long requestTime = System.currentTimeMillis() - start; try { emitter.emit( DruidMetrics.makeQueryTimeMetric(jsonMapper, query, req.getRemoteAddr()) .build("query/time", requestTime) ); requestLogger.log( new RequestLogLine( new DateTime(), req.getRemoteAddr(), query, new QueryStats( ImmutableMap.<String, Object>of( "query/time", requestTime, "success", result.isSucceeded() && result.getResponse().getStatus() == 200 ) ) ) ); } catch (Exception e) { log.error(e, "Unable to log query [%s]!", query); } super.onComplete(result); }

Target:
public void onComplete(Result result) { final long requestTime = System.currentTimeMillis() - start; try { emitter.emit( DruidMetrics.makeQueryTimeMetric(jsonMapper, query, req.getRemoteAddr()) .build("query/time", requestTime) ); requestLogger.log( new RequestLogLine( new DateTime(), req.getRemoteAddr(), query, new QueryStats( ImmutableMap.<String, Object>of( "query/time", requestTime, "success", result.isSucceeded() && result.getResponse().getStatus() == javax.ws.rs.core.Response.Status.OK.getStatusCode() ) ) ) ); } catch (Exception e) { log.error(e, "Unable to log query [%s]!", query); } super.onComplete(result); }
Source:
void unpackId(String id) { if (id != null && id.length() > 0) { this.id = id; try { URL url = new URL(id); String[] tokens = url.getPath().split("/"); this.name = (tokens.length >= 3 ? tokens[2] : null); this.version = (tokens.length >= 4 ? tokens[3] : null); } catch (MalformedURLException e) { e.printStackTrace(); } } }

Target:
void unpackId(String id) { if (id != null && id.length() > 0) { this.id = id; try { URL url = new URL(id); String[] tokens = url.getPath().split("/"); this.name = (tokens.length >= 3 ? tokens[2] : null); this.version = (tokens.length >= 4 ? tokens[3] : null); } catch (MalformedURLException e) { logger.error("Received Malformed Secret Id URL from KV Service"); } } }
Source:
public void execute(JobExecutionContext context) throws JobExecutionException { String jobUuid = context.getJobDetail().getKey().getName(); long startTime = System.currentTimeMillis(); try { MDC.put("requestType", "job"); MDC.put("requestUuid", jobUuid); } catch (NullPointerException npe) { } if (logExecutionTime()) { log.info("Starting job: {}", getClass().getName()); } boolean startedUow = startUnitOfWork(); try { toExecute(context); if (eventSinkProvider != null) { eventSinkProvider.get().sendEvents(); } } catch (PersistenceException e) { refireCheck(context, e); } catch (RetryJobException e) { refireCheck(context, e); } finally { if (startedUow) { endUnitOfWork(); } if (logExecutionTime()) { long executionTime = System.currentTimeMillis() - startTime; log.info("Job completed: time={}", executionTime); } } }

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { long startTime = System.currentTimeMillis(); try { MDC.put("requestType", "job"); MDC.put("requestUuid", context.getJobDetail().getKey().getName()); } catch (NullPointerException npe) { } if (logExecutionTime()) { log.info("Starting job: {}", getClass().getName()); } boolean startedUow = startUnitOfWork(); try { toExecute(context); if (eventSinkProvider != null) { eventSinkProvider.get().sendEvents(); } } catch (PersistenceException e) { refireCheck(context, e); } catch (RetryJobException e) { refireCheck(context, e); } finally { if (startedUow) { endUnitOfWork(); } if (logExecutionTime()) { long executionTime = System.currentTimeMillis() - startTime; log.info("Job completed: time={}", executionTime); } } }
Source:
private boolean inTouchableArea(float x, float y) { if(mDisableCircularTransformation) { return true; } return Math.pow(x - mBorderRect.centerX(), 2) + Math.pow(y - mBorderRect.centerY(), 2) <= Math.pow(mBorderRadius, 2); }

Target:
private boolean inTouchableArea(float x, float y) { if(mDisableCircularTransformation || mBitmap == null) { return true; } return Math.pow(x - mBorderRect.centerX(), 2) + Math.pow(y - mBorderRect.centerY(), 2) <= Math.pow(mBorderRadius, 2); }
Source:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"0", new int[] {0}}, {"0 1", new int[] {0}}, {"0\\n1", new int[] {0, 1}}, {"0 1\\n2 3", new int[] {0, 2}}, {"0 1 2\\n3 4 5\\n6 7 8", new int[] {0, 3, 6}} }); }

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"0", new int[] {0}}, {"0 1", new int[] {0}}, { "0\n" + "1", new int[] {0, 1}}, { "0 1\n" + "2 3", new int[] {0, 2}}, { "0 1 2\n" + "3 4 5\n" + "6 7 8", new int[] {0, 3, 6}} }); }
Source:
public void removeTicket() { Long id = persistTicket().getId(); Ticket ticket = ticketService.removeTicket(id); assertEquals(id, ticket.getId()); }

Target:
public void removeTicket() { Long id = persistTicket().getId(); Ticket ticket = ticketService.removeTicket(id); assertEquals(id, ticket.getId()); assertNull(ticketRepository.findOne(id)); }
Source:
private void refresh(boolean archived) { if (!NetworkUtils.isInternetConnectionEstablished(this)) { progressBar.setVisibility(View.GONE); Snackbar.make(relativeLayout, R.string.no_internet, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.retry, view -> refresh(archived)).show(); } else { if (getSupportActionBar() != null) { if (archived) { getSupportActionBar().setTitle(R.string.archived_notifications); } else { getSupportActionBar().setTitle(R.string.notifications); } } addNotifications(archived); }progressBar.setVisibility(View.VISIBLE); no_notification.setVisibility(View.GONE); relativeLayout.setVisibility(View.VISIBLE); }

Target:
private void refresh(boolean archived) { if (!NetworkUtils.isInternetConnectionEstablished(this)) { progressBar.setVisibility(View.GONE); Snackbar.make(relativeLayout, R.string.no_internet, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.retry, view -> refresh(archived)).show(); } else { addNotifications(archived); } progressBar.setVisibility(View.VISIBLE); no_notification.setVisibility(View.GONE); relativeLayout.setVisibility(View.VISIBLE); }