auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ResponseEntity<?> commitCursors(@PathVariable("subscriptionId") final String subscriptionId, @Valid @RequestBody final ItemsWrapper<SubscriptionCursor> cursors, final Errors errors, @NotNull @RequestHeader("X-Nakadi-StreamId") final String streamId, final NativeWebRequest request, final Client client) { LOG.debug("[COMMIT_CURSORS] committing cursor(s) for subscription {}", cursors.getItems().size(), subscriptionId); if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } try { validateSubscriptionReadScopes(client, subscriptionId); LOG.debug("[COMMIT_CURSORS] scopes validation finished"); final Map<SubscriptionCursor, Boolean> result = cursorsService.commitCursors(streamId, subscriptionId, cursors.getItems()); LOG.debug("[COMMIT_CURSORS] commit finished"); final List<CursorCommitResult> items = result.entrySet().stream() .map(entry -> new CursorCommitResult(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); final boolean allCommited = result.values() .stream() .reduce(Boolean::logicalAnd) .orElseGet(() -> true); final ItemsWrapper<CursorCommitResult> body = new ItemsWrapper<>(items); return allCommited ? noContent().build() : ok(body); } catch (final NakadiException e) { return create(e.asProblem(), request); } catch (final InvalidCursorException e) { return create(Problem.valueOf(UNPROCESSABLE_ENTITY, e.getMessage()), request); } }

Target:
public ResponseEntity<?> commitCursors(@PathVariable("subscriptionId") final String subscriptionId, @Valid @RequestBody final ItemsWrapper<SubscriptionCursor> cursors, final Errors errors, @NotNull @RequestHeader("X-Nakadi-StreamId") final String streamId, final NativeWebRequest request, final Client client) { LOG.debug("[COMMIT_CURSORS] committing cursor(s) for subscription {}", cursors.getItems().size(), subscriptionId); if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } try { validateSubscriptionReadScopes(client, subscriptionId); LOG.debug("[COMMIT_CURSORS] scopes validation finished"); final List<CursorCommitResult> items = cursorsService.commitCursors(streamId, subscriptionId, cursors.getItems()); LOG.debug("[COMMIT_CURSORS] commit finished"); final boolean allCommited = items.stream() .allMatch(cursor -> CursorCommitResult.COMMITTED.equals(cursor.getResult())); final ItemsWrapper<CursorCommitResult> body = new ItemsWrapper<>(items); return allCommited ? noContent().build() : ok(body); } catch (final NoSuchEventTypeException e) { return create(Problem.valueOf(UNPROCESSABLE_ENTITY, e.getMessage()), request); } catch (final NakadiException e) { return create(e.asProblem(), request); } catch (final InvalidCursorException e) { return create(Problem.valueOf(UNPROCESSABLE_ENTITY, e.getMessage()), request); } }
Source:
public boolean isMatch(String relativeTarget, boolean isDirectory) { if (relativeTarget == null) { return false; } relativeTarget = stripTrailing(relativeTarget, FastIgnoreRule.PATH_SEPARATOR); if (relativeTarget.length() == 0) { return false; } boolean match = matcher.matches(relativeTarget, isDirectory); return match; }

Target:
public boolean isMatch(String relativeTarget, boolean isDirectory) { if (relativeTarget == null) return false; if (relativeTarget.length() == 0) return false; boolean match = matcher.matches(relativeTarget, isDirectory); return match; }
Source:
void findFormTypes1099FromFormCodeMisc() { FormTypes1099 expectedType = FormTypes1099.MISC; FormTypes1099 actualType = FormTypes1099.findFormTypes1099FromFormCode(FormTypes1099.MISC.formCode); assertEquals(expectedType.formDescription, actualType.formDescription); }

Target:
void findFormTypes1099FromFormCodeMisc() { FormTypes1099 expectedType = FormTypes1099.MISC; FormTypes1099 actualType = FormTypes1099.findFormTypes1099FromFormCode(FormTypes1099.MISC.formCode); assertEquals(expectedType.formDescription, actualType.formDescription); assertEquals(expectedType.formCode, actualType.formCode); }
Source:
private void updateDefinitionByCannedExpresssion(CannedGroupExpression cge) { Query query = entityManager.createNamedQuery(GroupDefinition.QUERY_FIND_BY_CANNED_EXPR_NAME); query.setParameter("cannedExpression", cge.getGroupDefinitionReferenceKey()); @SuppressWarnings("unchecked") List<GroupDefinition> result = query.getResultList(); if (cge.isCreateByDefault()) { if (result.isEmpty()) { log.info("Creating dynaGroup based on +cge.getPlugin()+ "+cge); GroupDefinition gd = new GroupDefinition(cge.getName()); updateGroupProperties(gd, cge); try { createGroupDefinition(subjectManager.getOverlord(), gd); } catch (Exception ex) { log.error(ex); } } else { log.info("Updating dynaGroup based on +cge.getPlugin()+ "+cge); GroupDefinition gd = result.get(0); updateGroupProperties(gd, cge); try { updateGroupDefinition(subjectManager.getOverlord(), gd); } catch (Exception ex) { log.error(ex); } } } else { if (!result.isEmpty()) { log.info("Purging "+result.get(0)+" because CannedExpression was upgraded in plugin with createByDefault=false"); try { removeGroupDefinition(subjectManager.getOverlord(), result.get(0).getId()); } catch (Exception ex) { log.error(ex); } } } }

Target:
private void updateDefinitionByCannedExpresssion(CannedGroupExpression cge) { Query query = entityManager.createNamedQuery(GroupDefinition.QUERY_FIND_BY_CANNED_EXPR_NAME); query.setParameter("cannedExpression", cge.getGroupDefinitionReferenceKey()); @SuppressWarnings("unchecked") List<GroupDefinition> result = query.getResultList(); if (cge.isCreateByDefault()) { if (result.isEmpty()) { GroupDefinition sameName = getByName(cge.getName()); if (sameName != null) { log.info("Not creating DynaGroup based on +cge.getPlugin()+ "+cge+" DynaGroup with same name already exists"); return; } log.info("Creating dynaGroup based on +cge.getPlugin()+ "+cge); GroupDefinition gd = new GroupDefinition(cge.getName()); updateGroupProperties(gd, cge); try { createGroupDefinition(subjectManager.getOverlord(), gd); } catch (Exception ex) { log.error(ex); } } else { log.info("Updating dynaGroup based on +cge.getPlugin()+ "+cge); GroupDefinition gd = result.get(0); updateGroupProperties(gd, cge); try { updateGroupDefinition(subjectManager.getOverlord(), gd, false); } catch (Exception ex) { log.error(ex); } } } else { if (!result.isEmpty()) { log.info("Purging "+result.get(0)+" because CannedExpression was upgraded in plugin with createByDefault=false"); try { removeGroupDefinition(subjectManager.getOverlord(), result.get(0).getId()); } catch (Exception ex) { log.error(ex); } } } }
Source:
public void getYamlsExposesSingleYamlField() { PodTemplate podTemplate = new PodTemplate(); assertThat(podTemplate.getYamls(), empty()); podTemplate.setYamls(null); assertThat(podTemplate.getYamls(), empty()); podTemplate.setYaml("yaml"); List<String> yamls = podTemplate.getYamls(); assertThat(yamls, hasSize(1)); assertEquals("yaml", yamls.get(0)); podTemplate.setYaml(null); assertThat(podTemplate.getYamls(), empty()); }

Target:
public void getYamlsExposesSingleYamlField() { PodTemplate podTemplate = new PodTemplate(); assertThat(podTemplate.getYamls(), empty()); podTemplate.setYamls(null); assertThat(podTemplate.getYamls(), empty()); podTemplate.setYaml("yaml"); assertThat(podTemplate.getYamls(), contains("yaml")); podTemplate.setYaml(null); assertThat(podTemplate.getYamls(), empty()); }
Source:
private void writeUserMapToDisk(String prefix, byte[] userMapBytes) throws Exception { File cacheDir = new File(commonCacheConfig.getCacheDirectory()); cacheDir.mkdirs(); File userMapFile = new File(commonCacheConfig.getCacheDirectory(), getUserMapFilename(prefix)); Files.write(userMapBytes, userMapFile); }

Target:
private void writeUserMapToDisk(String prefix, byte[] userMapBytes) throws IOException { File cacheDir = new File(commonCacheConfig.getCacheDirectory()); cacheDir.mkdirs(); File userMapFile = new File(commonCacheConfig.getCacheDirectory(), getUserMapFilename(prefix)); Files.write(userMapBytes, userMapFile); }
Source:
public AnnotationValueReader(@Nonnull DexBuffer dex, @Nonnull ByteInput in) { super(dex, in); this.dex = dex; }

Target:
public AnnotationValueReader(@Nonnull DexBuffer dex, @Nonnull ByteInput in) { super(dex, in); }
Source:
public void deleteMailById(PerunSession sess, ApplicationForm form, Integer id) throws PerunException { if (form.getGroup() != null) { if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, form.getVo()) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, form.getGroup())) { throw new PrivilegeException(sess, "deleteMail"); } } else { if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, form.getVo())) { throw new PrivilegeException(sess, "deleteMail"); } } ApplicationMail mail = getMailById(sess, id); int result = jdbc.update("delete from application_mails where id=?", id); if (result == 0) throw new ApplicationMailAlreadyRemovedException("Mail notification with id="+id+" doesn't exists!"); if (result == 1) log.info("[MAIL MANAGER] Mail notification with id={} deleted", id); if (result > 1) throw new ConsistencyErrorException("There is more than one mail notification with id="+id); if (form.getGroup() != null) { perun.getAuditer().log(sess, new MailForGroupIdRemoved(mail, form.getGroup())); } else { perun.getAuditer().log(sess, new MailForVoIdRemoved(mail, form.getVo())); } }

Target:
public void deleteMailById(PerunSession sess, ApplicationForm form, Integer id) throws ApplicationMailAlreadyRemovedException, PrivilegeException, ApplicationMailNotExistsException { if (form.getGroup() != null) { if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, form.getVo()) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, form.getGroup())) { throw new PrivilegeException(sess, "deleteMail"); } } else { if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, form.getVo())) { throw new PrivilegeException(sess, "deleteMail"); } } ApplicationMail mail = getMailById(sess, id); int result = jdbc.update("delete from application_mails where id=?", id); if (result == 0) throw new ApplicationMailAlreadyRemovedException("Mail notification with id="+id+" doesn't exists!"); if (result == 1) log.info("[MAIL MANAGER] Mail notification with id={} deleted", id); if (result > 1) throw new ConsistencyErrorException("There is more than one mail notification with id="+id); if (form.getGroup() != null) { perun.getAuditer().log(sess, new MailForGroupIdRemoved(mail, form.getGroup())); } else { perun.getAuditer().log(sess, new MailForVoIdRemoved(mail, form.getVo())); } }
Source:
public void testCheckoutPath() throws Exception { Git git = new Git(db); writeTrashFile("a", "Hello world a"); git.add().addFilepattern(".").call(); git.commit().setMessage("commit file a").call(); git.branchCreate().setName("branch_1").call(); writeTrashFile("b", "Hello world b"); git.add().addFilepattern("b").call(); git.commit().setMessage("commit file b").call(); File a = writeTrashFile("a", "New Hello world a"); git.add().addFilepattern(".").call(); git.commit().setMessage("modified a").call(); assertArrayEquals(new String[] { "" }, execute("git checkout HEAD~2 -- a")); assertEquals("Hello world a", read(a)); }

Target:
public void testCheckoutPath() throws Exception { Git git = new Git(db); writeTrashFile("a", "Hello world a"); git.add().addFilepattern(".").call(); git.commit().setMessage("commit file a").call(); git.branchCreate().setName("branch_1").call(); git.checkout().setName("branch_1").call(); File b = writeTrashFile("b", "Hello world b"); git.add().addFilepattern("b").call(); git.commit().setMessage("commit file b").call(); File a = writeTrashFile("a", "New Hello world a"); git.add().addFilepattern(".").call(); git.commit().setMessage("modified a").call(); assertArrayEquals(new String[] { "" }, execute("git checkout HEAD~2 -- a")); assertEquals("Hello world a", read(a)); assertArrayEquals(new String[] { "* branch_1", " master", "" }, execute("git branch")); assertEquals("Hello world b", read(b)); }
Source:
public Table<Locator, Long, String> getEnumHashValuesForLocators(final List<Locator> locators) { Timer.Context ctx = Instrumentation.getReadTimerContext(CassandraModel.CF_METRICS_ENUM_NAME); Session session = DatastaxIO.getSession(); Table<Locator, Long, String> locatorEnumHashValues = HashBasedTable.create(); List<ResultSetFuture> resultsFuture = new ArrayList<ResultSetFuture>(); try { for (String locatorStr : Locators.toStringList(locators)) { resultsFuture.add(session.executeAsync(selectFromMetricsEnumStatement.bind(locatorStr))); } for (ResultSetFuture future : resultsFuture) { try { List<Row> results = future.get().all(); for (Row row : results) { String key = row.getString(AbstractMetricsIO.KEY); Locator locator = Locator.createLocatorFromDbKey(key); Long hash = row.getLong(AbstractMetricsIO.COLUMN1); String enumValue = row.getString(AbstractMetricsIO.VALUE); locatorEnumHashValues.put(locator, hash, enumValue); } } catch (InterruptedException ex) { Instrumentation.markReadError(); LOG.error("Interrupted error querying enum from " + CassandraModel.CF_METRICS_ENUM_NAME, ex); } catch (ExecutionException ex) { Instrumentation.markReadError(); LOG.error("Execution error querying enum from " + CassandraModel.CF_METRICS_ENUM_NAME, ex); } } } finally { ctx.stop(); } return locatorEnumHashValues; }

Target:
public Table<Locator, Long, String> getEnumHashValuesForLocators(final List<Locator> locators) { Timer.Context ctx = Instrumentation.getReadTimerContext(CassandraModel.CF_METRICS_ENUM_NAME); Session session = DatastaxIO.getSession(); Table<Locator, Long, String> locatorEnumHashValues = HashBasedTable.create(); List<ResultSetFuture> resultsFuture = new ArrayList<ResultSetFuture>(); try { for (String locatorStr : LocatorsUtils.toStringList(locators)) { resultsFuture.add(session.executeAsync(selectFromMetricsEnumStatement.bind(locatorStr))); } for (ResultSetFuture future : resultsFuture) { try { List<Row> results = future.get().all(); for (Row row : results) { String key = row.getString(AbstractMetricsRW.KEY); Locator locator = Locator.createLocatorFromDbKey(key); Long hash = row.getLong(AbstractMetricsRW.COLUMN1); String enumValue = row.getString(AbstractMetricsRW.VALUE); locatorEnumHashValues.put(locator, hash, enumValue); } } catch (InterruptedException ex) { Instrumentation.markReadError(); LOG.error("Interrupted error querying enum from " + CassandraModel.CF_METRICS_ENUM_NAME, ex); } catch (ExecutionException ex) { Instrumentation.markReadError(); LOG.error("Execution error querying enum from " + CassandraModel.CF_METRICS_ENUM_NAME, ex); } } } finally { ctx.stop(); } return locatorEnumHashValues; }
Source:
public static void setUpClass() throws Exception { PopulateDB.recreateDB("prosub", "root", ""); PopulateDB.populateUseCaseTest(); }

Target:
public static void setUpClass() throws Exception { PopulateDB.recreateDB("pro_subPU", "root", ""); PopulateDB.populateUseCaseTest(); }
Source:
public void deleteCollectionDefaultBitstreamReadGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); String bitstreamGroupString = "BITSTREAM"; int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ; Group role = createDefaultReadGroup(bitstreamGroupString, defaultBitstreamRead); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup")) .andExpect(status().isUnauthorized()); }

Target:
public void deleteCollectionDefaultBitstreamReadGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); String bitstreamGroupString = "BITSTREAM"; int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ; Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString, defaultBitstreamRead); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(role.getID(), role.getName()))); }
Source:
protected long getCurrentMillis() { checkEmptyText(); int day = Integer.parseInt(dayTxt.getText().toString()); int month = monthArrayPointer + 1; int year = Integer.parseInt(yearTxt.getText().toString()); if(day > selectedDate.getActualMaximum(Calendar.DAY_OF_MONTH)){ dayTxt.setText(String.valueOf(selectedDate.getActualMaximum(Calendar.DAY_OF_MONTH))); day = Integer.parseInt(dayTxt.getText().toString()); } return toMillisFromJavaEpoch(year, month, day, millisOfDayOffset); }

Target:
protected long getCurrentMillis() { autoFillEmptyTextFields(); validateTextOnButtonPress(); int day = Integer.parseInt(dayText.getText().toString()); int month = monthArrayPointer + 1; int year = Integer.parseInt(yearText.getText().toString()); return toMillisFromJavaEpoch(year, month, day, millisOfDayOffset); }
Source:
public String getRawContent(D diagram) { try { return serizalize(diagram)[0]; } catch (java.io.IOException e) { LOG.error("Error while getting raw content for diagram with UUID [" + diagram.getName() + "].", e); throw new RuntimeException(e); } }

Target:
public String getRawContent(D diagram) { try { return serialize(diagram)[0]; } catch (java.io.IOException e) { LOG.error("Error while getting raw content for diagram with UUID [" + diagram.getName() + "].", e); throw new RuntimeException(e); } }
Source:
public void rewriteImports(TextChangeManager changeManager, IProgressMonitor pm) throws CoreException { for (Entry<ICompilationUnit, ImportChange> entry : fImportChanges.entrySet()) { ICompilationUnit cu= entry.getKey(); ImportChange importChange= entry.getValue(); ImportRewrite importRewrite= StubUtility.createImportRewrite(cu, true); importRewrite.setFilterImplicitImports(false); for (String string : importChange.fStaticToRemove) { importRewrite.removeStaticImport(string); } for (String string : importChange.fToRemove) { importRewrite.removeImport(string); } for (String[] toAdd : importChange.fStaticToAdd) { importRewrite.addStaticImport(toAdd[0], toAdd[1], true); } for (String string : importChange.fToAdd) { importRewrite.addImport(string); } if (importRewrite.hasRecordedChanges()) { TextEdit importEdit= importRewrite.rewriteImports(pm); String name= RefactoringCoreMessages.RenamePackageRefactoring_update_imports; try { TextChangeCompatibility.addTextEdit(changeManager.get(cu), name, importEdit); } catch (MalformedTreeException e) { JavaPlugin.logErrorMessage("MalformedTreeException while processing cu " + cu); throw e; } } } }

Target:
public void rewriteImports(TextChangeManager changeManager, IProgressMonitor pm) throws CoreException { for (Entry<ICompilationUnit, ImportChange> entry : fImportChanges.entrySet()) { ICompilationUnit cu= entry.getKey(); ImportChange importChange= entry.getValue(); ImportRewrite importRewrite= StubUtility.createImportRewrite(cu, true); importRewrite.setFilterImplicitImports(false); for (String toRemove : importChange.fStaticToRemove) { importRewrite.removeStaticImport(toRemove); } for (String toRemove : importChange.fToRemove) { importRewrite.removeImport(toRemove); } for (String[] toAdd : importChange.fStaticToAdd) { importRewrite.addStaticImport(toAdd[0], toAdd[1], true); } for (String toAdd : importChange.fToAdd) { importRewrite.addImport(toAdd); } if (importRewrite.hasRecordedChanges()) { TextEdit importEdit= importRewrite.rewriteImports(pm); String name= RefactoringCoreMessages.RenamePackageRefactoring_update_imports; try { TextChangeCompatibility.addTextEdit(changeManager.get(cu), name, importEdit); } catch (MalformedTreeException e) { JavaPlugin.logErrorMessage("MalformedTreeException while processing cu " + cu); throw e; } } } }
Source:
protected byte[] findBasesByMD5(String md5) throws MalformedURLException, IOException { String url = String.format("<LINK_0>", md5); for (int i = 0; i < downloadTriesBeforeFailing; i++) { InputStream is = new URL(url).openStream(); if (is == null) return null; log.info("Downloading reference sequence: " + url); byte[] data = ByteBufferUtils.readFully(is); log.info("Downloaded " + data.length + " bytes for md5 " + md5); is.close(); try { String downloadedMD5 = Utils.calculateMD5String(data); if (md5.equals(downloadedMD5)) { return data; } else { String message = String .format("Downloaded sequence is corrupt: requested md5=%s, received md5=%s", md5, downloadedMD5); log.error(message); } } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } throw new RuntimeException("Giving up on downloading sequence for md5 " + md5); }

Target:
protected byte[] findBasesByMD5(String md5) throws MalformedURLException, IOException { String url = String.format(Defaults.EBI_REFERENCE_SEVICE_URL_MASK, md5); for (int i = 0; i < downloadTriesBeforeFailing; i++) { InputStream is = new URL(url).openStream(); if (is == null) return null; log.debug("Downloading reference sequence: " + url); byte[] data = ByteBufferUtils.readFully(is); log.debug("Downloaded " + data.length + " bytes for md5 " + md5); is.close(); try { String downloadedMD5 = SequenceUtil.calculateMD5String(data); if (md5.equals(downloadedMD5)) { return data; } else { String message = String .format("Downloaded sequence is corrupt: requested md5=%s, received md5=%s", md5, downloadedMD5); log.error(message); } } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } throw new RuntimeException("Giving up on downloading sequence for md5 " + md5); }
Source:
public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { DSpaceRestPermission restPermission = DSpaceRestPermission.convert(permission); if (!DSpaceRestPermission.READ.equals(restPermission) || !StringUtils.equalsIgnoreCase(targetType, AuthorizationRest.NAME)) { return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); try { if (authorizeService.isAdmin(context)) { return true; } EPerson ePerson = authorizationRestUtil.getEperson(context, targetId.toString()); EPerson currUser = null; currUser = ePersonService.findByEmail(context, (String) authentication.getPrincipal()); if (ePerson == null) { return true; } else { if (currUser != null && currUser.getID().equals(ePerson.getID())) { return true; } } } catch (SQLException e) { log.error(e.getMessage(), e); } return false; }

Target:
public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { DSpaceRestPermission restPermission = DSpaceRestPermission.convert(permission); if (!DSpaceRestPermission.READ.equals(restPermission) || !StringUtils.equalsIgnoreCase(targetType, AuthorizationRest.NAME)) { return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); try { if (authorizeService.isAdmin(context)) { return true; } EPerson ePerson = authorizationRestUtil.getEperson(context, targetId.toString()); EPerson currUser = context.getCurrentUser(); if (ePerson == null) { return true; } else { if (currUser != null && currUser.getID().equals(ePerson.getID())) { return true; } } } catch (SQLException e) { log.error(e.getMessage(), e); } return false; }
Source:
private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); this.validationBootstrapParameters.addValidatedValueHandler( new JavaFXPropertyValueUnwrapper() ); if (Version.getJavaRelease() >= 8) { this.validationBootstrapParameters.addValidatedValueHandler( new OptionalValueUnwrapper() ); } this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); this.defaultParameterNameProvider = new DefaultParameterNameProvider(); this.defaultMessageInterpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); }

Target:
private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); if (isJavaFxInClasspath()) { this.validationBootstrapParameters.addValidatedValueHandler( new JavaFXPropertyValueUnwrapper() ); } if (Version.getJavaRelease() >= 8) { this.validationBootstrapParameters.addValidatedValueHandler( new OptionalValueUnwrapper() ); } this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); this.defaultParameterNameProvider = new DefaultParameterNameProvider(); this.defaultMessageInterpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); }
Source:
private void runInternal() { for (Map.Entry<String, ClockService> entry : monitors.entrySet()) { String server = entry.getKey(); ClockService monitor = entry.getValue(); long localTimeAtStart = System.nanoTime(); long remoteSystemTime = monitor.getSystemTimeInNanos(); long localTimeAtEnd = System.nanoTime(); RequestTime previousRequest = previousRequests.get(server); RequestTime newRequest = new RequestTime(localTimeAtStart, localTimeAtEnd, remoteSystemTime); compareClockSkew(server, newRequest, previousRequest); } }

Target:
private void runInternal() { monitorByServer.forEach((server, remoteClockService) -> { long localTimeAtStart = localClockService.getSystemTimeInNanos(); long remoteSystemTime = remoteClockService.getSystemTimeInNanos(); long localTimeAtEnd = localClockService.getSystemTimeInNanos(); RequestTime previousRequest = previousRequestsByServer.get(server); RequestTime newRequest = new RequestTime(localTimeAtStart, localTimeAtEnd, remoteSystemTime); if (!previousRequest.equals(RequestTime.EMPTY)) { new ClockSkewComparer(server, events, previousRequest, newRequest).compare(); } previousRequestsByServer.put(server, newRequest); }); }
Source:
protected Warning createWarning(final Matcher matcher) { String fileName = "*.xdm"; int lineNumber = 0; String type = matcher.group(1); String category = matcher.group(2); String message = matcher.group(4); Priority priority; if (type.equals("ERROR")) { priority = Priority.HIGH; } if (type.equals("INFO")) { priority = Priority.NORMAL; for (int index = 0; index < TRESOS_INFO_MSGS_IGNORE.length; index++) { if (category.equals(TRESOS_INFO_MSGS_IGNORE[index])) { priority = Priority.LOW; message = "really unimportant tresos message"; fileName = "unimportant.file"; lineNumber = 1; break; } } } else { priority = Priority.HIGH; } Warning warning = createWarning(fileName, lineNumber, category, message, priority); return warning; }

Target:
protected Warning createWarning(final Matcher matcher) { String fileName = "*.xdm"; int lineNumber = 0; String type = matcher.group(1); String category = matcher.group(2); String message = matcher.group(4); Priority priority; if (type.equals("ERROR")) { priority = Priority.HIGH; } if (type.equals("INFO")) { priority = Priority.NORMAL; for (String tresosMsgCategory : TRESOS_INFO_MSGS_IGNORE) { if (tresosMsgCategory.equals(category)) { priority = Priority.LOW; message = "really unimportant tresos message"; fileName = "unimportant.file"; lineNumber = 1; break; } } } else { priority = Priority.HIGH; } return createWarning(fileName, lineNumber, category, message, priority); }
Source:
public void testGetSSPMetadataShouldTerminateAfterFiniteRetriesOnException() throws Exception{ SystemStreamPartition oneSSP = new SystemStreamPartition(TEST_SYSTEM, VALID_TOPIC, new Partition(0)); SystemStreamPartition otherSSP = new SystemStreamPartition(TEST_SYSTEM, "otherTopic", new Partition(1)); ImmutableSet<SystemStreamPartition> ssps = ImmutableSet.of(oneSSP, otherSSP); List<TopicPartition> topicPartitions = ssps.stream() .map(ssp -> new TopicPartition(ssp.getStream(), ssp.getPartition().getPartitionId())) .collect(Collectors.toList()); when(mockKafkaConsumer.beginningOffsets(topicPartitions)).thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()); kafkaSystemAdmin.getSSPMetadata(ssps); }

Target:
public void testGetSSPMetadataShouldTerminateAfterFiniteRetriesOnException() throws Exception{ SystemStreamPartition oneSSP = new SystemStreamPartition(TEST_SYSTEM, VALID_TOPIC, new Partition(0)); SystemStreamPartition otherSSP = new SystemStreamPartition(TEST_SYSTEM, "otherTopic", new Partition(1)); ImmutableSet<SystemStreamPartition> ssps = ImmutableSet.of(oneSSP, otherSSP); List<TopicPartition> topicPartitions = ssps.stream() .map(ssp -> new TopicPartition(ssp.getStream(), ssp.getPartition().getPartitionId())) .collect(Collectors.toList()); when(mockKafkaConsumer.beginningOffsets(topicPartitions)).thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()); kafkaSystemAdmin.getSSPMetadata(ssps, new ExponentialSleepStrategy(2, 1, 1)); }
Source:
private ElasticSearchIndexerProcessor(final LogIndexer<LoggingProtos.BatchLogMessage> senseLogElasticSearchIndexer){ this.senseLogElasticSearchIndexer = senseLogElasticSearchIndexer; this.senseLogs= Metrics.defaultRegistry().newMeter(LogIndexerProcessor.class, "sense-logs", "sense-processed", TimeUnit.SECONDS); }

Target:
private ElasticSearchIndexerProcessor(final LogIndexer<LoggingProtos.BatchLogMessage> senseLogElasticSearchIndexer){ this.senseLogElasticSearchIndexer = senseLogElasticSearchIndexer; this.senseLogs= Metrics.defaultRegistry().newMeter(ElasticSearchIndexerProcessor.class, "es-sense-logs", "es-sense-processed", TimeUnit.SECONDS); }
Source:
private void notifyClick(final Point p) { notify(SWT.MouseEnter); notify(SWT.Activate); notify(SWT.FocusIn); notify(SWT.Selection); notify(SWT.MouseDown, createMouseEvent(p.x, p.y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(p.x, p.y, 1, SWT.BUTTON1, 1)); }

Target:
private void notifyClick(final Point p) { notify(SWT.MouseEnter); notify(SWT.Activate); notify(SWT.FocusIn); notify(SWT.MouseDown, createMouseEvent(p.x, p.y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(p.x, p.y, 1, SWT.BUTTON1, 1)); }
Source:
private long getRetryPeriodMs() { return Math.round(_retryPeriodMs * RandomUtils.nextDouble(0.6, 1.4)) + 1; }

Target:
private long getRetryPeriodMs() { return Math.min(Math.round(_retryPeriodMs * RandomUtils.nextDouble(0.6, 1.4)) + 1, _retryTimeoutMs); }
Source:
public NavigationService createService(EMFFormsViewContext emfFormsViewContext) { if (ViewModelContext.class.isInstance(emfFormsViewContext)) { final DefaultNavigationService drs = new DefaultNavigationService(); drs.instantiate(ViewModelContext.class.cast(emfFormsViewContext)); return drs; } throw new IllegalStateException("The provided context is not a ViewModelContext."); }

Target:
public NavigationService createService(EMFFormsViewContext emfFormsViewContext) { if (ViewModelContext.class.isInstance(emfFormsViewContext)) { final DefaultNavigationService dns = new DefaultNavigationService(); dns.instantiate(ViewModelContext.class.cast(emfFormsViewContext)); return dns; } throw new IllegalStateException("The provided context is not a ViewModelContext."); }
Source:
public ListenableFuture<GuidePostsInfo> reload( final GuidePostsKey key, GuidePostsInfo prevGuidepostInfo) { ListenableFutureTask<GuidePostsInfo> task = ListenableFutureTask.create( new Callable<GuidePostsInfo>() { public GuidePostsInfo call() { try { return statsLoader.loadStats(key, prevGuidepostInfo); } catch (Exception e) { logger.warn("Unable to load stats from table: " + key.toString(), e); return prevGuidepostInfo; } } } ); executor.execute(task); return task; }

Target:
public ListenableFuture<GuidePostsInfo> reload( final GuidePostsKey key, GuidePostsInfo prevGuidepostInfo) { if (statsLoader.needsLoad()) { ListenableFutureTask<GuidePostsInfo> task = ListenableFutureTask.create(new Callable<GuidePostsInfo>() { public GuidePostsInfo call() { try { return statsLoader.loadStats(key, prevGuidepostInfo); } catch (Exception e) { logger.warn("Unable to load stats from table: " + key.toString(), e); return prevGuidepostInfo; } } }); executor.execute(task); return task; } else { return Futures.immediateFuture(prevGuidepostInfo); } }
Source:
public static void first() throws Exception { String candybeanConfigStr = System.getProperty("candybean_config"); if (candybeanConfigStr == null) candybeanConfigStr = AbstractTest.CONFIG_DIR.getCanonicalPath() + File.separator + "candybean.config"; System.out.println("candybeanConfigPath: " + candybeanConfigStr); Configuration candybeanConfig = new Configuration(new File(Utils.adjustPath(candybeanConfigStr))); candybean = Candybean.getInstance(candybeanConfig); iface = candybean.getInterface(); iface.start(); }

Target:
public static void first() throws Exception { String candybeanConfigStr = System.getProperty("candybean_config"); if (candybeanConfigStr == null) candybeanConfigStr = Candybean.CONFIG_DIR.getCanonicalPath() + File.separator + "candybean.config"; System.out.println("candybeanConfigPath: " + candybeanConfigStr); Configuration candybeanConfig = new Configuration(new File(Utils.adjustPath(candybeanConfigStr))); candybean = Candybean.getInstance(candybeanConfig); iface = candybean.getInterface(); iface.start(); }
Source:
public void end() throws Exception { super.init(); super.cleanup(); }

Target:
public void end() throws Exception { super.cleanup(); }
Source:
public static final void setUp(final Map<String, String>... propertyMaps) { Properties properties = new Properties(); for (Map<String, String> map: propertyMaps) { for (Map.Entry<String, String> entry : map.entrySet()) { properties.setProperty(entry.getKey(), entry.getValue()); } } ConfigurationHolder.initFromProperties(properties); }

Target:
public final void setUp(final Map<String, String>... propertyMaps) { Properties properties = new Properties(); for (Map<String, String> map: propertyMaps) { for (Map.Entry<String, String> entry : map.entrySet()) { properties.setProperty(entry.getKey(), entry.getValue()); } } ConfigurationHolder.initFromProperties(properties); }
Source:
public void testRemoveValueEqualStoreEntryCacheAccessExceptionUnequalCacheWriterEntry() throws Exception { final MockStore realStore = new MockStore(Collections.singletonMap("key", "value")); this.store = spy(realStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final MockCacheWriter realCache = new MockCacheWriter(Collections.singletonMap("key", "unequalValue")); this.cacheWriter = spy(realCache); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); assertThat(realCache.getEntries().get("key"), is(equalTo("unequalValue"))); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }

Target:
public void testRemoveValueEqualStoreEntryCacheAccessExceptionUnequalCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "value")); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.singletonMap("key", "unequalValue")); this.cacheWriter = spy(fakeWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); ehcache.remove("key", "value"); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
public void testAmazonUndergroundInstallSourceIsParsedCorrectly() { final InstallSource installSource = InstallSource.fromInstallerPackageName("com.amazon.mshop.android"); assertTrue(installSource instanceof AmazonUndergroundInstallSource); assertEquals("Amazon Underground", installSource.toString()); }

Target:
public void testAmazonUndergroundInstallSourceIsParsedCorrectly() { final InstallSource installSource = InstallSource.fromInstallerPackageName("com.amazon.mshop.android"); assertTrue( "Package name is correctly identified as belonging to Amazon Underground", installSource instanceof AmazonUndergroundInstallSource); assertEquals( "Amazon Underground install source has correct description", "Amazon Underground", installSource.toString()); }
Source:
public void tearDown() { executorService.shutdown(); try { executorService.awaitTermination(1, TimeUnit.SECONDS); } catch (InterruptedException ex) { throw new RuntimeException(ex); } }

Target:
public void tearDown() throws InterruptedException { executorService.shutdownNow(); if (!executorService.awaitTermination(1, TimeUnit.MILLISECONDS)) { logger.warn("Thread pool didn't terminate within the timeout."); } }
Source:
public void testSuccessfulStartTransport() { try { CustomCarbonTransport carbonTransport = new CustomCarbonTransport("dummyTransport"); transportManager.registerTransport(carbonTransport); transportManager.startTransport("dummyTransport"); } catch (IllegalArgumentException e) { Assert.assertTrue(false); } Assert.assertTrue(true); }

Target:
public void testSuccessfulStartTransport() { CustomCarbonTransport carbonTransport = new CustomCarbonTransport("dummyTransport"); transportManager.registerTransport(carbonTransport); transportManager.startTransport("dummyTransport"); }
Source:
public void buildInsertOptionsMutate() { InsertOptions insertOptions = InsertOptions.builder() .ttl(10) .timestamp(1519222753) .withIfNotExists() .build(); InsertOptions mutated = insertOptions.mutate().ttl(Duration.ofSeconds(5)).timestamp(1519200753).build(); assertThat(mutated).isNotNull(); assertThat(mutated).isNotSameAs(insertOptions); assertThat(mutated.getTtl()).isEqualTo(Duration.ofSeconds(5)); assertThat(mutated.getTimestamp() == 1519200753); assertThat(mutated.isIfNotExists()).isTrue(); }

Target:
public void buildInsertOptionsMutate() { InsertOptions insertOptions = InsertOptions.builder() .ttl(10) .timestamp(1519222753) .withIfNotExists() .build(); InsertOptions mutated = insertOptions.mutate().ttl(Duration.ofSeconds(5)).timestamp(1519200753).build(); assertThat(mutated).isNotNull(); assertThat(mutated).isNotSameAs(insertOptions); assertThat(mutated.getTtl()).isEqualTo(Duration.ofSeconds(5)); assertThat(mutated.getTimestamp()).isEqualTo(1519200753); assertThat(mutated.isIfNotExists()).isTrue(); }
Source:
public List<Service> getAssignedServices(PerunSession sess, Facility facility) throws InternalErrorException, FacilityNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getFacilitiesManagerBl().checkFacilityExists(sess, facility); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, facility) && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER, facility) && !AuthzResolver.isAuthorized(sess, Role.ENGINE) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility) ) { throw new PrivilegeException(sess, "getAssignedServices"); } return getFacilitiesManagerBl().getAssignedServices(sess, facility); }

Target:
public List<Service> getAssignedServices(PerunSession sess, Facility facility) throws InternalErrorException, FacilityNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getFacilitiesManagerBl().checkFacilityExists(sess, facility); if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "getAssignedServices"); } return getFacilitiesManagerBl().getAssignedServices(sess, facility); }
Source:
protected boolean canDoAction() { if (getSnapshot() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_DOES_NOT_EXIST); return false; } vmFromConfiguration = getVmFromConfiguration(); if (vmFromConfiguration == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION); addCanDoActionMessage(String.format("VmName %1$s", getVmName())); addCanDoActionMessage(String.format("SnapshotName %1$s", getSnapshotName())); return false; } if (!super.canDoAction()) { return false; } if (!canLockSnapshot()) { return false; } return true; }

Target:
protected boolean canDoAction() { if (getSnapshot() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_DOES_NOT_EXIST); return false; } vmFromConfiguration = getVmFromConfiguration(); if (vmFromConfiguration == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION); addCanDoActionMessage(String.format("$VmName %1$s", getVmName())); addCanDoActionMessage(String.format("$SnapshotName %1$s", getSnapshotName())); return false; } if (!super.canDoAction()) { return false; } if (!canLockSnapshot()) { return false; } return true; }
Source:
private ArrayNode buildJsonArray(Object[] elements) throws SQLException { ArrayNode arrayNode = jsonNodeFactory.arrayNode(); for (Object v : elements) { if (v == null) { arrayNode.add(NullNode.getInstance()); continue; } if (v.getClass().isArray()) { arrayNode.add(buildJsonArray((Object[]) v)); } else { switch (value.getBaseType()) { case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: arrayNode.add(jsonNodeFactory.numberNode(((Number) v).longValue())); break; case Types.FLOAT: case Types.REAL: case Types.DOUBLE: arrayNode.add(jsonNodeFactory.numberNode(((Number) v).doubleValue())); break; case Types.BOOLEAN: case Types.BIT: arrayNode.add(jsonNodeFactory.booleanNode((Boolean) v)); break; case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: case Types.NCHAR: case Types.NVARCHAR: case Types.LONGNVARCHAR: arrayNode.add(jsonNodeFactory.textNode((String) v)); break; default: arrayNode.add(jsonNodeFactory.textNode(v.toString())); } } } return arrayNode; }

Target:
private ArrayNode buildJsonArray(Object[] elements) throws SQLException { ArrayNode arrayNode = jsonNodeFactory.arrayNode(); for (Object v : elements) { if (v == null) { arrayNode.add(NullNode.getInstance()); continue; } if (v.getClass().isArray()) { arrayNode.add(buildJsonArray((Object[]) v)); } else { switch (value.getBaseType()) { case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: arrayNode.add(jsonNodeFactory.numberNode(((Number) v).longValue())); break; case Types.FLOAT: case Types.REAL: case Types.DOUBLE: arrayNode.add(jsonNodeFactory.numberNode(((Number) v).doubleValue())); break; case Types.BOOLEAN: case Types.BIT: arrayNode.add(jsonNodeFactory.booleanNode((Boolean) v)); break; case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: case Types.NCHAR: case Types.NVARCHAR: case Types.LONGNVARCHAR: arrayNode.add(jsonNodeFactory.textNode((String) v)); break; case Types.DECIMAL: case Types.NUMERIC: arrayNode.add(jsonNodeFactory.numberNode((BigDecimal) v)); break; default: arrayNode.add(jsonNodeFactory.textNode(v.toString())); } } } return arrayNode; }
Source:
public int getNumUserSessions(DbUser user) { Iterator<Entry<String, SessionInfo>> iter = sessionInfoMap.entrySet().iterator(); int numSessions = 0; while (iter.hasNext()) { Entry<String, SessionInfo> entry = iter.next(); ConcurrentMap<String, Object> sessionMap = entry.getValue().contentOfSession; DbUser sessionUser = (DbUser) sessionMap.get(USER_PARAMETER_NAME); if (user.getId().equals(sessionUser.getId())) { numSessions += 1; } } return numSessions; }

Target:
public long getNumUserSessions(DbUser user) { return sessionInfoMap.entrySet().stream().filter ( map->((DbUser)map.getValue().contentOfSession .get(USER_PARAMETER_NAME)).getId().equals(user.getId()) && getSessionValid((String)map.getValue().contentOfSession.get(ENGINE_SESSION_ID), false) ).count(); }
Source:
private FSDataInputStream openWithRetryFsInputStream(Path filePath) { FSDataInputStream in = null; try { in = fs.open(filePath); } catch (IOException e) { try { this.connect(); fs.open(filePath); } catch (IOException ex) { throw new RuntimeException(ex); } } return in; }

Target:
private FSDataInputStream openWithRetryFsInputStream(Path filePath) { FSDataInputStream in; try { in = fs.open(filePath); } catch (IOException e) { try { this.connect(); in = fs.open(filePath); } catch (IOException ex) { throw new RuntimeException(ex); } } return in; }
Source:
static <T> Stream<T> gen(T head, Supplier<Stream<T>> tailSupplier) { Objects.requireNonNull(tailSupplier, "tailSupplier is null"); return new Stream.Cons<>(head, () -> tailSupplier.get()); }

Target:
static <T> Stream<T> gen(T head, Supplier<Stream<T>> tailSupplier) { Objects.requireNonNull(tailSupplier, "tailSupplier is null"); return new Stream.Cons<>(head, tailSupplier); }
Source:
private void checkForChanges() { final WatchKey key = folderWatcher.poll(); if (key != null) { for (WatchEvent<?> watchEvent : key.pollEvents()) { final Path filePath = (Path) watchEvent.context(); final WatchEvent.Kind<?> kind = watchEvent.kind(); log.fine(kind + " : " + filePath); handleFileChange(kind, new File(selendroidConfiguration.getAppFolderToMonitor(), filePath.getFileName().toString())); } boolean valid = key.reset(); if (!valid) { log.warning("Can't monitor folder anymore; has it been deleted?"); stop(); } } }

Target:
private void checkForChanges() { final WatchKey key = folderWatcher.poll(); if (key != null) { for (WatchEvent<?> watchEvent : key.pollEvents()) { final Path filePath = (Path) watchEvent.context(); final WatchEvent.Kind<?> kind = watchEvent.kind(); log.fine(kind + " : " + filePath); handleFileChange(kind, new File(selendroidConfiguration.getAppFolderToMonitor(), filePath.getFileName().toString())); } boolean valid = key.reset(); if (!valid) { log.warning("Cannot monitor this folder anymore. Has it been deleted?"); stop(); } } }
Source:
public MessageAttribute asMessageAttribute(ChangeMessage message) { MessageAttribute a = new MessageAttribute(); a.timestamp = message.getWrittenOn().getTime(); a.author = accountCache.get(message.getAuthor()).getAccount().getFullName(); a.message = message.getMessage(); return a; }

Target:
public MessageAttribute asMessageAttribute(ChangeMessage message) { MessageAttribute a = new MessageAttribute(); a.timestamp = message.getWrittenOn().getTime(); a.author = asAccountAttribute(message.getAuthor()); a.message = message.getMessage(); return a; }
Source:
public void drawBackgroundPreWidgets(float f, int x, int y) { drawTexturedModalRect(guiLeft + 75, guiTop + 58 - (fluidicCompressor.fill ? 39 : 0), 195, 99 - (fluidicCompressor.fill ? 16 : 0), 25, 9); drawTexturedModalRect(guiLeft + 89, guiTop + 53, 176, 3, fluidicCompressor.getProgress(), 4); }

Target:
public void drawBackgroundPreWidgets(float f, int x, int y) { drawTexturedModalRect(guiLeft + 75, guiTop + 58 - (fluidicCompressor.fill ? 39 : 0), 176, 78 - (fluidicCompressor.fill ? 9 : 0), 25, 9); drawTexturedModalRect(guiLeft + 89, guiTop + 53, 176, 3, fluidicCompressor.getProgress(), 4); }