auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void validateExpiredRowsAreNotReturnedUsingData(long phoenixTTL, com.google.common.collect.Table<String, String, Object> upsertedData, DataReader dataReader, SchemaBuilder schemaBuilder) throws SQLException { String tenantConnectUrl = getUrl() + ';' + TENANT_ID_ATTRIB + '=' + schemaBuilder.getDataOptions().getTenantId(); long scnTimestamp = EnvironmentEdgeManager.currentTimeMillis(); Properties props = new Properties(); props.setProperty("CurrentSCN", Long.toString(scnTimestamp)); try (Connection readConnection = DriverManager.getConnection(tenantConnectUrl, props)) { dataReader.setConnection(readConnection); com.google.common.collect.Table<String, String, Object> fetchedData = fetchData(dataReader); assertTrue("Upserted data should not be null", upsertedData != null); assertTrue("Fetched data should not be null", fetchedData != null); verifyRowsBeforeTTLExpiration(upsertedData, fetchedData); } props.setProperty("CurrentSCN", Long.toString(scnTimestamp + (2 * phoenixTTL * 1000))); try (Connection readConnection = DriverManager.getConnection(tenantConnectUrl, props)) { dataReader.setConnection(readConnection); com.google.common.collect.Table<String, String, Object> fetchedData = fetchData(dataReader); assertTrue("Fetched data should not be null", fetchedData != null); assertTrue("Expired rows should not be fetched", fetchedData.rowKeySet().size() == 0); } }

Target:
private void validateExpiredRowsAreNotReturnedUsingData(long phoenixTTL, com.google.common.collect.Table<String, String, Object> upsertedData, DataReader dataReader, SchemaBuilder schemaBuilder) throws SQLException { String tenantConnectUrl = getUrl() + ';' + TENANT_ID_ATTRIB + '=' + schemaBuilder.getDataOptions().getTenantId(); Properties props = new Properties(); long scnTimestamp = EnvironmentEdgeManager.currentTimeMillis(); props.setProperty("CurrentSCN", Long.toString(scnTimestamp)); try (Connection readConnection = DriverManager.getConnection(tenantConnectUrl, props)) { dataReader.setConnection(readConnection); com.google.common.collect.Table<String, String, Object> fetchedData = fetchData(dataReader); assertNotNull("Upserted data should not be null", upsertedData); assertNotNull("Fetched data should not be null", fetchedData); verifyRowsBeforeTTLExpiration(upsertedData, fetchedData); } props.setProperty("CurrentSCN", Long.toString(scnTimestamp + (2 * phoenixTTL * 1000))); try (Connection readConnection = DriverManager.getConnection(tenantConnectUrl, props)) { dataReader.setConnection(readConnection); com.google.common.collect.Table<String, String, Object> fetchedData = fetchData(dataReader); assertNotNull("Fetched data should not be null", fetchedData); assertEquals("Expired rows should not be fetched", 0, fetchedData.rowKeySet().size()); } }
Source:
public void checkBodyType() { AmqpAnnotatedMessage amqpAnnotatedMessage = null; AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType(); AmqpMessageBody messageBody = null; switch (bodyType) { case DATA: messageBody = AmqpMessageBody.fromData(amqpAnnotatedMessage.getBody().getFirstData()); break; case SEQUENCE: case VALUE: throw new RuntimeException("Body type not supported yet."); default: throw new RuntimeException("Body type not valid."); } END: com.azure.core.amqp.models.AmqpBodyType.checkBodyType }

Target:
public void checkBodyType() { AmqpAnnotatedMessage amqpAnnotatedMessage = null; byte[] payload = null; AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType(); switch (bodyType) { case DATA: payload = amqpAnnotatedMessage.getBody().getFirstData(); break; case SEQUENCE: case VALUE: throw new RuntimeException("Body type not supported yet."); default: throw new RuntimeException("Body type not valid."); } System.out.println(new String(payload)); END: com.azure.core.amqp.models.AmqpBodyType.checkBodyType }
Source:
public void setup() throws Exception { File rootDir = temp.newFolder("zk-test"); zkport = Net.getFreePort(); ezk = new EmbeddedZooKeeper(rootDir, zkport); ezk.init(); final CountDownLatch connectedLatch = new CountDownLatch(1); zk = new ZooKeeper("localhost:" + zkport, 1000, new Watcher() { public void process(WatchedEvent event) { if (event.getState() == Event.KeeperState.SyncConnected) { connectedLatch.countDown(); } } }); connectedLatch.await(); coordinateRunning = Coordinate.parse("1.service.user.cell"); cn = new ZkCloudname.Builder().setConnectString("localhost:" + zkport).build().connect(); cn.createCoordinate(coordinateRunning); ServiceHandle handleRunning = cn.claim(coordinateRunning); handleRunning.putEndpoint(new Endpoint(coordinateRunning, "foo", "localhost", 1234, "http", "data")); handleRunning.putEndpoint(new Endpoint(coordinateRunning, "bar", "localhost", 1235, "http", null)); ServiceStatus statusRunning = new ServiceStatus(ServiceState.RUNNING, "Running message"); handleRunning.setStatus(statusRunning); coordinateDraining = Coordinate.parse("0.service.user.cell"); cn.createCoordinate(coordinateDraining); handleDraining = cn.claim(coordinateDraining); handleDraining.putEndpoint(new Endpoint(coordinateDraining, "foo", "localhost", 5555, "http", "data")); handleDraining.putEndpoint(new Endpoint(coordinateDraining, "bar", "localhost", 5556, "http", null)); ServiceStatus statusDraining = new ServiceStatus(ServiceState.DRAIN, "Draining message"); handleDraining.setStatus(statusDraining); }

Target:
public void setup() throws Exception { File rootDir = temp.newFolder("zk-test"); zkport = Net.getFreePort(); ezk = new EmbeddedZooKeeper(rootDir, zkport); ezk.init(); final CountDownLatch connectedLatch = new CountDownLatch(1); zk = new ZooKeeper("localhost:" + zkport, 1000, new Watcher() { public void process(WatchedEvent event) { if (event.getState() == Event.KeeperState.SyncConnected) { connectedLatch.countDown(); } } }); connectedLatch.await(); coordinateRunning = Coordinate.parse("1.service.user.cell"); cn = new ZkCloudname.Builder().setConnectString("localhost:" + zkport).build().connect(); cn.createCoordinate(coordinateRunning); ServiceHandle handleRunning = cn.claim(coordinateRunning); assertTrue(handleRunning.waitForCoordinateOkSeconds(30)); handleRunning.putEndpoint(new Endpoint(coordinateRunning, "foo", "localhost", 1234, "http", "data")); handleRunning.putEndpoint(new Endpoint(coordinateRunning, "bar", "localhost", 1235, "http", null)); ServiceStatus statusRunning = new ServiceStatus(ServiceState.RUNNING, "Running message"); handleRunning.setStatus(statusRunning); coordinateDraining = Coordinate.parse("0.service.user.cell"); cn.createCoordinate(coordinateDraining); handleDraining = cn.claim(coordinateDraining); assertTrue(handleDraining.waitForCoordinateOkSeconds(10)); handleDraining.putEndpoint(new Endpoint(coordinateDraining, "foo", "localhost", 5555, "http", "data")); handleDraining.putEndpoint(new Endpoint(coordinateDraining, "bar", "localhost", 5556, "http", null)); ServiceStatus statusDraining = new ServiceStatus(ServiceState.DRAINING, "Draining message"); handleDraining.setStatus(statusDraining); }
Source:
public static void setupTestWorkflow(DropwizardTestSupport<DockstoreWebserviceConfiguration> support) throws Exception { LOG.info("Migrating testworkflow migrations"); Application<DockstoreWebserviceConfiguration> application = support.getApplication(); application.run("db", "drop-all", "--confirm-delete-everything", CONFIDENTIAL_CONFIG_PATH); application.run("db", "migrate", CONFIDENTIAL_CONFIG_PATH, "--include", "1.3.0.generated"); application.run("db", "migrate", CONFIDENTIAL_CONFIG_PATH, "--include", "1.3.1.consistency"); application.run("db", "migrate", CONFIDENTIAL_CONFIG_PATH, "--include", "test"); application.run("db", "migrate", CONFIDENTIAL_CONFIG_PATH, "--include", "1.4.0"); application.run("db", "migrate", CONFIDENTIAL_CONFIG_PATH, "--include", "testworkflow"); application.run("db", "migrate", CONFIDENTIAL_CONFIG_PATH, "--include", "1.5.0"); application.run("db", "migrate", CONFIDENTIAL_CONFIG_PATH, "--include", "test_1.5.0"); }

Target:
public static void setupTestWorkflow(DropwizardTestSupport<DockstoreWebserviceConfiguration> support) throws Exception { LOG.info("Migrating testworkflow migrations"); Application<DockstoreWebserviceConfiguration> application = support.getApplication(); application.run("db", "drop-all", "--confirm-delete-everything", CONFIDENTIAL_CONFIG_PATH); List<String> migrationList = Arrays.asList("1.3.0.generated", "1.3.1.consistency", "test", "1.4.0", "testworkflow", "1.5.0", "test_1.5.0"); runMigration(migrationList, application, CONFIDENTIAL_CONFIG_PATH); }
Source:
public void cancel(Account account, OCFile file){ SynchronizeFolderOperation syncOperation = null; String targetKey = buildRemoteName(account, file.getRemotePath()); ArrayList<String> keyItems = new ArrayList<String>(); synchronized (mPendingOperations) { if (file.isFolder()) { Log_OC.d(TAG, "Canceling pending sync operations"); Iterator<String> it = mPendingOperations.keySet().iterator(); boolean found = false; while (it.hasNext()) { String keySyncOperation = it.next(); found = keySyncOperation.contains(targetKey); if (found) { keyItems.add(keySyncOperation); } } } else { Log_OC.d(TAG, "Canceling sync operation"); keyItems.add(buildRemoteName(account, file.getRemotePath())); } } for (String item: keyItems) { syncOperation = mPendingOperations.remove(item); Log_OC.d(TAG, "Key sync operations removed: " + item); if (syncOperation != null) { syncOperation.cancel(); } } Intent intent = new Intent(mService, FileDownloader.class); intent.setAction(FileDownloader.ACTION_CANCEL_FILE_DOWNLOAD); intent.putExtra(FileDownloader.EXTRA_ACCOUNT, account); intent.putExtra(FileDownloader.EXTRA_FILE, file); mService.startService(intent); }

Target:
public void cancel(Account account, OCFile file){ SynchronizeFolderOperation syncOperation = null; String targetKey = buildRemoteName(account, file.getRemotePath()); ArrayList<String> keyItems = new ArrayList<String>(); synchronized (mPendingOperations) { if (file.isFolder()) { Log_OC.d(TAG, "Canceling pending sync operations"); Iterator<String> it = mPendingOperations.keySet().iterator(); boolean found = false; while (it.hasNext()) { String keySyncOperation = it.next(); found = keySyncOperation.startsWith(targetKey); if (found) { keyItems.add(keySyncOperation); } } } else { Log_OC.d(TAG, "Canceling sync operation"); keyItems.add(buildRemoteName(account, file.getRemotePath())); } } for (String item: keyItems) { syncOperation = mPendingOperations.remove(item); Log_OC.d(TAG, "Key sync operations removed: " + item); if (syncOperation != null) { syncOperation.cancel(); } } Intent intent = new Intent(mService, FileDownloader.class); intent.setAction(FileDownloader.ACTION_CANCEL_FILE_DOWNLOAD); intent.putExtra(FileDownloader.EXTRA_ACCOUNT, account); intent.putExtra(FileDownloader.EXTRA_FILE, file); mService.startService(intent); }
Source:
public void testHardResetWithConflicts_DoOverWriteUntrackedFile() throws JGitInternalException, AmbiguousObjectException, IOException, GitAPIException { setupRepository(); git.rm().setCached(true).addFilepattern("a.txt").call(); assertTrue(new File(db.getWorkTree(), "a.txt").exists()); git.reset().setMode(ResetType.HARD).setRef(Constants.HEAD) .call(); assertTrue(new File(db.getWorkTree(), "a.txt").exists()); }

Target:
public void testHardResetWithConflicts_DoOverWriteUntrackedFile() throws JGitInternalException, AmbiguousObjectException, IOException, GitAPIException { setupRepository(); git.rm().setCached(true).addFilepattern("a.txt").call(); assertTrue(new File(db.getWorkTree(), "a.txt").exists()); git.reset().setMode(ResetType.HARD).setRef(Constants.HEAD) .call(); assertTrue(new File(db.getWorkTree(), "a.txt").exists()); assertEquals("content", read(new File(db.getWorkTree(), "a.txt"))); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { LOGGER.debug("Performing doFilter() on CsrfFilter"); HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; String targetContextPath = httpRequest.getRequestURI(); if (protectedContexts.stream().anyMatch(targetContextPath::startsWith)) { String sourceOrigin = httpRequest.getHeader(ORIGIN_HEADER); String sourceReferer = httpRequest.getHeader(REFERER_HEADER); String csrfHeader = httpRequest.getHeader(CSRF_HEADER); if (sourceOrigin == null && sourceReferer == null) { respondForbidden( httpResponse, "Cross-site check failure: Incoming request did not have an Origin or Referer header."); return; } if (!isTrustedAuthority(sourceOrigin) && !isTrustedAuthority(sourceReferer)) { respondForbidden( httpResponse, "Cross-site check failure: Neither the Origin or Referer header matched a system internal or external name."); return; } if (!targetContextPath.startsWith(WEBSOCKET_CONTEXT) && csrfHeader == null) { respondForbidden( httpResponse, "Cross-site check failure: Request did not have required X-Requested-With header."); return; } } chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { LOGGER.debug("Performing doFilter() on CsrfFilter"); HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; String targetContextPath = httpRequest.getRequestURI(); if (protectedContexts.stream().anyMatch(targetContextPath::startsWith)) { String sourceOrigin = httpRequest.getHeader(ORIGIN_HEADER); String sourceReferer = httpRequest.getHeader(REFERER_HEADER); String csrfHeader = httpRequest.getHeader(CSRF_HEADER); if (sourceOrigin == null && sourceReferer == null) { respondForbidden( httpResponse, "Cross-site check failure: Incoming request did not have an Origin or Referer header."); return; } if (!isTrustedAuthority(sourceOrigin) && !isTrustedAuthority(sourceReferer)) { respondForbidden( httpResponse, "Cross-site check failure: Neither the Origin nor Referer header matched a system internal or external name."); return; } if (!targetContextPath.startsWith(WEBSOCKET_CONTEXT) && csrfHeader == null) { respondForbidden( httpResponse, "Cross-site check failure: Request did not have required X-Requested-With header."); return; } } chain.doFilter(request, response); }
Source:
public String getCustomDefaultContributorRoleAlias(){ if (dvObject instanceof Dataverse && isCustomDefaultConributorRole()){ return defaultContributorRoleAlias.equals("none") ? "none" : roleService.findCustomRoleByAliasAndOwner(defaultContributorRoleAlias,dvObject.getId()).getAlias(); } else { return ""; } }

Target:
public String getCustomDefaultContributorRoleAlias(){ if (dvObject instanceof Dataverse && isCustomDefaultContributorRole()){ return defaultContributorRoleAlias.equals(DataverseRole.NONE) ? DataverseRole.NONE : roleService.findCustomRoleByAliasAndOwner(defaultContributorRoleAlias,dvObject.getId()).getAlias(); } else { return ""; } }
Source:
public synchronized void load() { try { Map.Entry<ManagerSpec, Map<ResourceGroupIdTemplate, ResourceGroupSpec>> specsFromDb = buildSpecsFromDb(); ManagerSpec managerSpec = specsFromDb.getKey(); Map<ResourceGroupIdTemplate, ResourceGroupSpec> resourceGroupSpecs = specsFromDb.getValue(); Set<ResourceGroupIdTemplate> changedSpecs = new HashSet<>(); Set<ResourceGroupIdTemplate> deletedSpecs = Sets.difference(this.resourceGroupSpecs.keySet(), resourceGroupSpecs.keySet()); for (Map.Entry<ResourceGroupIdTemplate, ResourceGroupSpec> entry : resourceGroupSpecs.entrySet()) { if (!entry.getValue().sameConfig(this.resourceGroupSpecs.get(entry.getKey()))) { changedSpecs.add(entry.getKey()); } } this.resourceGroupSpecs = resourceGroupSpecs; this.cpuQuotaPeriod.set(managerSpec.getCpuQuotaPeriod()); this.rootGroups.set(managerSpec.getRootGroups()); this.selectors.set(buildSelectors(managerSpec)); configureChangedGroups(changedSpecs); disableDeletedGroups(deletedSpecs); } catch (Exception e) { log.error("Error loading configuration from db: %s", e); } }

Target:
public synchronized void load() { try { Map.Entry<ManagerSpec, Map<ResourceGroupIdTemplate, ResourceGroupSpec>> specsFromDb = buildSpecsFromDb(); ManagerSpec managerSpec = specsFromDb.getKey(); Map<ResourceGroupIdTemplate, ResourceGroupSpec> resourceGroupSpecs = specsFromDb.getValue(); Set<ResourceGroupIdTemplate> changedSpecs = new HashSet<>(); Set<ResourceGroupIdTemplate> deletedSpecs = Sets.difference(this.resourceGroupSpecs.keySet(), resourceGroupSpecs.keySet()); for (Map.Entry<ResourceGroupIdTemplate, ResourceGroupSpec> entry : resourceGroupSpecs.entrySet()) { if (!entry.getValue().sameConfig(this.resourceGroupSpecs.get(entry.getKey()))) { changedSpecs.add(entry.getKey()); } } this.resourceGroupSpecs = resourceGroupSpecs; this.cpuQuotaPeriod.set(managerSpec.getCpuQuotaPeriod()); this.rootGroups.set(managerSpec.getRootGroups()); this.selectors.set(buildSelectors(managerSpec)); configureChangedGroups(changedSpecs); disableDeletedGroups(deletedSpecs); } catch (Throwable e) { log.error(e, "Error loading configuration from db"); } }
Source:
public void prepareSandboxTask(Path exercisePath, Path submissionPath, Path outputPath, Path tmcRunPath, Path tmcLangsPath) throws NoLanguagePluginFoundException, IOException { Path tempdir = Files.createTempDirectory("sandbox-task"); FileUtils.copyDirectoryStructure(exercisePath.toFile(), tempdir.toFile()); getLanguagePlugin(exercisePath).prepareSubmission(submissionPath, tempdir); TarCreator tarCreator = new TarCreator(); log.info("Copying files to directory " + submissionPath.toString() + " and creating tar ball"); try { tarCreator.createTarFromProject(tempdir, tmcLangsPath, tmcRunPath, outputPath); } catch (ArchiveException ex) { java.util.logging.Logger.getLogger(TaskExecutorImpl.class.getName()).log(Level.SEVERE, null, ex); } FileUtils.forceDelete(tempdir.toFile()); }

Target:
public void prepareSandboxTask(Path exercisePath, Path submissionPath, Path outputPath, Path tmcRunPath, Path tmcLangsPath) throws NoLanguagePluginFoundException, IOException { Path tempdir = Files.createTempDirectory("sandbox-task"); FileUtils.copyDirectoryStructure(exercisePath.toFile(), tempdir.toFile()); getLanguagePlugin(exercisePath).prepareSubmission(submissionPath, tempdir); TarCreator tarCreator = new TarCreator(); log.info("Copying files to directory " + submissionPath.toString() + " and creating tar ball"); try { tarCreator.createTarFromProject(tempdir, tmcLangsPath, tmcRunPath, outputPath); } catch (ArchiveException ex) { java.util.logging.Logger.getLogger(TaskExecutorImpl.class.getName()).log(Level.SEVERE, "Failed to create tar from project " + submissionPath, ex); } FileUtils.forceDelete(tempdir.toFile()); }
Source:
public static Iterable<Object[]> data() { return Arrays.asList(new Object[][]{ {FastMoney.of(29.95, "EUR"), FastMoney.of(100.00, "EUR"), FastMoney.of(0.0001, "EUR")}, {Money.of(29.95, "EUR"), Money.of(100.00, "EUR"), Money.of(0.0001, "EUR")}, {RoundedMoney.of(29.95, "EUR", getDefaultRounding()), RoundedMoney.of(100.00, "EUR", getDefaultRounding()), RoundedMoney.of(0.0001, "EUR", getDefaultRounding())}, }); }

Target:
public static Iterable<Object[]> data() { return Arrays.asList(new Object[][]{ {FastMoney.of(29.95, "EUR"), FastMoney.of(100, "EUR"), FastMoney.of(0.0001, "EUR")}, {Money.of(29.95, "EUR"), Money.of(100, "EUR"), Money.of(0.0001, "EUR")}, {RoundedMoney.of(29.95, "EUR", getDefaultRounding()), RoundedMoney.of(100, "EUR", getDefaultRounding()), RoundedMoney.of(0.0001, "EUR", getDefaultRounding())}, }); }
Source:
private Optional<Ref> getBestMatch(List<Ref> tags) { if (tags == null || tags.size() == 0) { return Optional.empty(); } else if (matchers.size() == 0) { if (tags.size() > 1) { Collections.sort(tags, tagTieBreaker); } return Optional.of(tags.get(0)); } else { Comparator<Ref> tieBreaker = tagTieBreaker; for (IMatcher matcher : matchers) { Optional<Ref> match = tags.stream() .filter(tag -> matcher.matches(tag.getName(), false, false)) .sorted(tieBreaker) .findFirst(); if (match.isPresent()) { return match; } } return Optional.empty(); } }

Target:
private Optional<Ref> getBestMatch(List<Ref> tags) { if (tags == null || tags.size() == 0) { return Optional.empty(); } else if (matchers.size() == 0) { if (tags.size() > 1) { Collections.sort(tags, tagTieBreaker); } return Optional.of(tags.get(0)); } else { for (IMatcher matcher : matchers) { Optional<Ref> match = tags.stream() .filter(tag -> matcher.matches(tag.getName(), false, false)) .sorted(tagTieBreaker) .findFirst(); if (match.isPresent()) { return match; } } return Optional.empty(); } }
Source:
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { final long nanos = TimeUnit.NANOSECONDS.convert(timeout, unit); final long millis = TimeUnit.MILLISECONDS.convert(timeout, unit); final int sleepNanos = (int) (nanos - millis * 1_000_000L); Thread.sleep(millis, sleepNanos); return false; }

Target:
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { try { shutdownPhaser.awaitAdvanceInterruptibly(initialPhase, timeout, unit); return true; } catch (TimeoutException e) { return false; } }
Source:
public TreeElement getTreeElement() { WebElement element = getDriver() .findElement(By.className(CONTAINER_TREE_CLASS)) .findElement(By.className(TREE_CLASS)); getDriver().waitUntilElementIsVisible(By.className(TREE_CLASS)); return new TreeElement(element); }

Target:
public TreeElement getTreeElement() { getDriver().waitUntilElementIsVisible(By.className(TREE_CLASS)); WebElement element = getDriver() .findElement(By.className(CONTAINER_TREE_CLASS)) .findElement(By.className(TREE_CLASS)); return new TreeElement(element); }
Source:
public Response listStaffMemberAddresses(@PathParam("STAFFMEMBERID") Long staffMemberId) { StaffMember staffMember = userController.findStaffMemberById(staffMemberId); if (staffMember == null) { return Response.status(Status.NOT_FOUND).build(); } if (staffMember.getArchived()) { return Response.status(Status.NOT_FOUND).build(); } if (!restSecurity.hasPermission(new String[] { UserPermissions.LIST_STAFFMEMBERADDRESES }, staffMember ) && !restSecurity.hasPermission(new String[] { PersonPermissions.PERSON_OWNER }, staffMember.getPerson() )) { return Response.status(Status.FORBIDDEN).build(); } List<Address> addresses = staffMember.getContactInfo().getAddresses(); if (addresses.isEmpty()) { return Response.noContent().build(); } return Response.ok(objectFactory.createModel(addresses)).build(); }

Target:
public Response listStaffMemberAddresses(@PathParam("STAFFMEMBERID") Long staffMemberId) { StaffMember staffMember = userController.findStaffMemberById(staffMemberId); if (staffMember == null) { return Response.status(Status.NOT_FOUND).build(); } if (staffMember.getArchived()) { return Response.status(Status.NOT_FOUND).build(); } if (!restSecurity.hasPermission(new String[] { UserPermissions.LIST_STAFFMEMBERADDRESSES }, staffMember ) && !restSecurity.hasPermission(new String[] { PersonPermissions.PERSON_OWNER }, staffMember.getPerson() )) { return Response.status(Status.FORBIDDEN).build(); } List<Address> addresses = staffMember.getContactInfo().getAddresses(); if (addresses.isEmpty()) { return Response.noContent().build(); } return Response.ok(objectFactory.createModel(addresses)).build(); }
Source:
public static void startServer() { try { if (!serverup){ getSERVER_PORT(); Server server = new Server(SERVER_PORT); String appDir = serverRootDir; File fp = new File(appDir); if (!fp.exists()){ fp = new File("/"+appDir); if (fp.exists()) appDir = "/"+appDir; } serverWorkingDir = appDir+"/threejs/editor/"; URI webRootUri = new File(appDir).toURI(); System.out.println("Web Root URI: %s%n"+webRootUri); ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/"); context.setBaseResource(Resource.newResource(webRootUri)); context.setWelcomeFiles(new String[] { pathToStartPage+"index.html" }); context.getMimeTypes().addMimeMapping("txt","text/plain;charset=utf-8"); context.addServlet(DefaultServlet.class,"/"); context.addServlet(OpenSimSocketServlet.class, "/visEndpoint"); server.setHandler(context); server.start(); serverup = true; server.join(); } } catch (MalformedURLException ex) { Logger.getLogger(JettyMain.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(JettyMain.class.getName()).log(Level.SEVERE, null, ex); } }

Target:
public static void startServer() { try { if (!serverup){ Server server = new Server(SERVER_PORT); String appDir = serverRootDir; File fp = new File(appDir); if (!fp.exists()){ fp = new File("/"+appDir); if (fp.exists()) appDir = "/"+appDir; } serverWorkingDir = appDir+"/threejs/editor/"; URI webRootUri = new File(appDir).toURI(); System.out.println("Web Root URI: %s%n"+webRootUri); ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/"); context.setBaseResource(Resource.newResource(webRootUri)); context.setWelcomeFiles(new String[] { pathToStartPage+"index.html" }); context.getMimeTypes().addMimeMapping("txt","text/plain;charset=utf-8"); context.addServlet(DefaultServlet.class,"/"); context.addServlet(OpenSimSocketServlet.class, "/visEndpoint"); server.setHandler(context); server.start(); serverup = true; server.join(); } } catch (MalformedURLException ex) { Logger.getLogger(JettyMain.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(JettyMain.class.getName()).log(Level.SEVERE, null, ex); } }
Source:
public void draw(Canvas canvas) { Rect bounds = getBounds(); int saveCount = canvas.save(); switch (mType) { case CLIPPING: mPath.setFillType(Path.FillType.EVEN_ODD); canvas.clipPath(mPath); super.draw(canvas); canvas.restoreToCount(saveCount); break; case OVERLAY_COLOR: mPath.setFillType(Path.FillType.EVEN_ODD); canvas.clipPath(mPath); super.draw(canvas); canvas.restoreToCount(saveCount); mPaint.setColor(mOverlayColor); mPaint.setStyle(Paint.Style.FILL); mPath.setFillType(Path.FillType.INVERSE_EVEN_ODD); canvas.drawPath(mPath, mPaint); if (mIsCircle) { float paddingH = (bounds.width() - bounds.height() + mBorderWidth) / 2f; float paddingV = (bounds.height() - bounds.width() + mBorderWidth) / 2f; if (paddingH > 0) { canvas.drawRect(bounds.left, bounds.top, bounds.left + paddingH, bounds.bottom, mPaint); canvas.drawRect( bounds.right - paddingH, bounds.top, bounds.right, bounds.bottom, mPaint); } if (paddingV > 0) { canvas.drawRect(bounds.left, bounds.top, bounds.right, bounds.top + paddingV, mPaint); canvas.drawRect( bounds.left, bounds.bottom - paddingV, bounds.right, bounds.bottom, mPaint); } } break; } if (mBorderColor != Color.TRANSPARENT) { mPaint.setStyle(Paint.Style.STROKE); mPaint.setColor(mBorderColor); mPaint.setStrokeWidth(mBorderWidth); mPath.setFillType(Path.FillType.EVEN_ODD); canvas.drawPath(mBorderPath, mPaint); } }

Target:
public void draw(Canvas canvas) { Rect bounds = getBounds(); switch (mType) { case CLIPPING: int saveCount = canvas.save(); mPath.setFillType(Path.FillType.EVEN_ODD); canvas.clipPath(mPath); super.draw(canvas); canvas.restoreToCount(saveCount); break; case OVERLAY_COLOR: super.draw(canvas); mPaint.setColor(mOverlayColor); mPaint.setStyle(Paint.Style.FILL); mPath.setFillType(Path.FillType.INVERSE_EVEN_ODD); canvas.drawPath(mPath, mPaint); if (mIsCircle) { float paddingH = (bounds.width() - bounds.height() + mBorderWidth) / 2f; float paddingV = (bounds.height() - bounds.width() + mBorderWidth) / 2f; if (paddingH > 0) { canvas.drawRect(bounds.left, bounds.top, bounds.left + paddingH, bounds.bottom, mPaint); canvas.drawRect( bounds.right - paddingH, bounds.top, bounds.right, bounds.bottom, mPaint); } if (paddingV > 0) { canvas.drawRect(bounds.left, bounds.top, bounds.right, bounds.top + paddingV, mPaint); canvas.drawRect( bounds.left, bounds.bottom - paddingV, bounds.right, bounds.bottom, mPaint); } } break; } if (mBorderColor != Color.TRANSPARENT) { mPaint.setStyle(Paint.Style.STROKE); mPaint.setColor(mBorderColor); mPaint.setStrokeWidth(mBorderWidth); mPath.setFillType(Path.FillType.EVEN_ODD); canvas.drawPath(mBorderPath, mPaint); } }
Source:
public boolean isNonPCMEncodedAudio() { return isAC3() || isDTS() || isTrueHD() || isDTSHD(); }

Target:
public boolean isNonPCMEncodedAudio() { return isAC3() || isAtmos() || isDTS() || isTrueHD() || isDTSHD(); }
Source:
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { HttpChildChannel httpChildChannel = this.httpChildChannel; if (httpChildChannel != null) { this.httpChildChannel = null; switch (httpChildChannel.readState()) { case UPGRADED: if (httpChildChannel.setReadClosed()) { fireChannelDisconnected(httpChildChannel); fireChannelUnbound(httpChildChannel); fireChannelClosed(httpChildChannel); } break; case CONTENT_COMPLETE: break; default: ChannelException exception = new ChannelException("Channel closed unexpectedly"); exception.fillInStackTrace(); fireExceptionCaught(httpChildChannel, exception); break; } switch (httpChildChannel.writeState()) { case UPGRADED: case CONTENT_CLOSE: if (httpChildChannel.setWriteClosed()) { fireChannelDisconnected(httpChildChannel); fireChannelUnbound(httpChildChannel); fireChannelClosed(httpChildChannel); } break; case CONTENT_COMPLETE: break; default: Channels.fireChannelAborted(httpChildChannel); break; } } }

Target:
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { HttpChildChannel httpChildChannel = this.httpChildChannel; if (httpChildChannel != null) { this.httpChildChannel = null; switch (httpChildChannel.readState()) { case UPGRADED: if (httpChildChannel.setReadClosed()) { fireChannelDisconnected(httpChildChannel); fireChannelUnbound(httpChildChannel); fireChannelClosed(httpChildChannel); } break; case CONTENT_COMPLETE: break; default: Channels.fireChannelAborted(httpChildChannel); break; } switch (httpChildChannel.writeState()) { case UPGRADED: case CONTENT_CLOSE: if (httpChildChannel.setWriteClosed()) { fireChannelDisconnected(httpChildChannel); fireChannelUnbound(httpChildChannel); fireChannelClosed(httpChildChannel); } break; case CONTENT_COMPLETE: break; default: Channels.fireChannelAborted(httpChildChannel); break; } } }
Source:
private void processFreeEntries() { TreeSet<FileEntry> l = new TreeSet<FileEntry>(new FileEntryByOffsetComparator()); l.addAll(freeList); long startTime = System.currentTimeMillis(); int reclaimedSpace = 0; int removedEntries = 0; for (Iterator<FileEntry> it = l.iterator() ; it.hasNext(); ) { FileEntry fe = it.next(); if (!fe.isLocked() && ((fe.offset + fe.size) == filePos)) { try { channel.truncate(fe.offset); filePos = fe.offset; freeList.remove(fe); it.remove(); reclaimedSpace += fe.size; removedEntries++; } catch (IOException e) { throw new PersistenceException("Error while truncating file", e); } } else { break; } } if (trace) { log.tracef("Removed entries: " + removedEntries + ", Reclaimed Space: " + reclaimedSpace); log.tracef("Time taken for truncateFile: " + (System.currentTimeMillis() - startTime) + " (ms)"); } }

Target:
private void processFreeEntries() { long startTime = 0; if (trace) startTime = System.currentTimeMillis(); List<FileEntry> l = new ArrayList<FileEntry>(freeList); Collections.sort(l, new FileEntryByOffsetComparator()); int reclaimedSpace = 0; int removedEntries = 0; long truncateOffset = -1; for (Iterator<FileEntry> it = l.iterator() ; it.hasNext(); ) { FileEntry fe = it.next(); if (!fe.isLocked() && ((fe.offset + fe.size) == filePos)) { truncateOffset = fe.offset; filePos = fe.offset; freeList.remove(fe); reclaimedSpace += fe.size; removedEntries++; } else { break; } } if (truncateOffset > 0) { try { channel.truncate(truncateOffset); } catch (IOException e) { throw new PersistenceException("Error while truncating file", e); } } if (trace) { log.tracef("Removed entries: " + removedEntries + ", Reclaimed Space: " + reclaimedSpace); log.tracef("Time taken for truncateFile: " + (System.currentTimeMillis() - startTime) + " (ms)"); } }
Source:
protected Type declareComplex(String name) { ComplexType primitive = TypesFactory.eINSTANCE.createComplexType(); primitive.setName(name); declareType(primitive, name); resource.getContents().add(primitive); return primitive; }

Target:
protected Type declareComplex(String name) { ComplexType complex = TypesFactory.eINSTANCE.createComplexType(); complex.setName(name); declareType(complex, name); resource.getContents().add(complex); return complex; }
Source:
public Set<MetricNameDto> getTestGroupPlotNamesNewModel(List<TaskDataDto> tests){ try { Set<Long> testIds = CommonUtils.getTestsIds(tests); Multimap<Long, Long> testGroupMap = fetchUtil.getTestsInTestGroup(testIds); List<Object[]> plotNamesNew = getMetricNames(testGroupMap.keySet()); plotNamesNew = filterMonitoring(plotNamesNew); if (plotNamesNew.isEmpty()) { return Collections.EMPTY_SET; } Set<MetricNameDto> result = new HashSet<MetricNameDto>(plotNamesNew.size()); for (Object[] mde : plotNamesNew){ for (TaskDataDto td : tests){ Collection<Long> allTestsInGroup = testGroupMap.get((Long)mde[2]); if (CommonUtils.containsAtLeastOne(td.getIds(), allTestsInGroup)){ result.add(new MetricNameDto(td, (String)mde[0], (String)mde[1], MetricNameDto.Origin.METRIC_GROUP)); } } } return result; } catch (PersistenceException e) { log.debug("Could not fetch test-group metric plot names from MetricPointEntity: {}", DataProcessingUtil.getMessageFromLastCause(e)); return Collections.EMPTY_SET; } }

Target:
public Set<MetricNameDto> getTestGroupPlotNamesNewModel(List<TaskDataDto> tests){ try { Set<Long> testIds = CommonUtils.getTestsIds(tests); Multimap<Long, Long> testGroupMap = fetchUtil.getTestsInTestGroup(testIds); List<Object[]> plotNamesNew = getMetricNames(testGroupMap.keySet()); plotNamesNew = CommonUtils.filterMonitoring(plotNamesNew, monitoringPlotGroups); if (plotNamesNew.isEmpty()) { return Collections.EMPTY_SET; } Set<MetricNameDto> result = new HashSet<MetricNameDto>(plotNamesNew.size()); for (Object[] mde : plotNamesNew){ for (TaskDataDto td : tests){ Collection<Long> allTestsInGroup = testGroupMap.get((Long)mde[2]); if (CommonUtils.containsAtLeastOne(td.getIds(), allTestsInGroup)){ result.add(new MetricNameDto(td, (String)mde[0], (String)mde[1], MetricNameDto.Origin.TEST_GROUP_METRIC)); } } } return result; } catch (PersistenceException e) { log.debug("Could not fetch test-group metric plot names from MetricPointEntity: {}", DataProcessingUtil.getMessageFromLastCause(e)); return Collections.EMPTY_SET; } }
Source:
public TransactionalBatch(PartitionKey partitionKey) { checkNotNull(partitionKey, "expected non-null partitionKey"); this.operations = new ArrayList<>(); this.partitionKey = partitionKey; }

Target:
TransactionalBatch(PartitionKey partitionKey) { checkNotNull(partitionKey, "expected non-null partitionKey"); this.operations = new ArrayList<>(); this.partitionKey = partitionKey; }
Source:
public Set<String> getConfiguredMetadataFields(){ final String configFields=Config.getStringProperty("INDEX_METADATA_FIELDS", null); if (UtilMethods.isSet(configFields)) { return new HashSet<>(Arrays.asList( configFields.split(","))); } return Collections.EMPTY_SET; }

Target:
public Set<String> getConfiguredMetadataFields(){ final String configFields=Config.getStringProperty("INDEX_METADATA_FIELDS", null); if (UtilMethods.isSet(configFields)) { return new HashSet<>(Arrays.asList( configFields.split(","))); } return Collections.emptySet(); }
Source:
protected void updateProvidedObjectsHolder(URL url, Set<E> providedObjects) { if (providedObjects != null && !providedObjects.isEmpty()) { List<String> previousPortfolio = providerPortfolio.get(url); List<String> uids = new ArrayList<String>(); for (E providedObject : providedObjects) { String uid = getUID(providedObject); if (providedObjectsHolder.get(uid) == null) { if (checkExistence(uid)) { continue; } } else if (previousPortfolio == null || !previousPortfolio.contains(uid)) { logger.error("{} with UID \"{}\" already exists! Failed to create a second with the same UID!", providedObject.getClass().getName(), uid, new IllegalArgumentException()); continue; } uids.add(uid); E oldProvidedObject = providedObjectsHolder.put(uid, providedObject); notifyListeners(oldProvidedObject, providedObject); } providerPortfolio.put(url, uids); } }

Target:
protected void updateProvidedObjectsHolder(URL url, Set<E> providedObjects) { if (providedObjects != null && !providedObjects.isEmpty()) { List<String> previousPortfolio = providerPortfolio.get(url); List<String> uids = new ArrayList<String>(); for (E providedObject : providedObjects) { String uid = getUID(providedObject); if (providedObjectsHolder.get(uid) == null) { if (checkExistence(uid)) { logger.warn("{} with UID \"{}\" already exists! Failed to create a second with the same UID!", providedObject.getClass().getName(), uid, new IllegalArgumentException()); continue; } } else if (previousPortfolio == null || !previousPortfolio.contains(uid)) { logger.warn("{} with UID \"{}\" already exists! Failed to create a second with the same UID!", providedObject.getClass().getName(), uid, new IllegalArgumentException()); continue; } uids.add(uid); E oldProvidedObject = providedObjectsHolder.put(uid, providedObject); notifyListeners(oldProvidedObject, providedObject); } providerPortfolio.put(url, uids); } }
Source:
public List<VdcBllMessages> validate() { Map<String, VdsNetworkInterface> ifaces = interfacesToMap(params.getInterfaces()); Map<String, VdsNetworkInterface> existingIfaces = extractExistingInterfaceNames(); Map<String, network> clusterNetworksMap = clusterNetworksToMap(clusterNetworks); Map<String, VdsNetworkInterface> bonds = new HashMap<String, VdsNetworkInterface>(); Map<String, List<VdsNetworkInterface>> bondSlaves = new HashMap<String, List<VdsNetworkInterface>>(); Map<String, network> networks = new HashMap<String, network>(); for (VdsNetworkInterface iface : ifaces.values()) { String name = iface.getName(); String networkName = iface.getNetworkName(); String bondName = iface.getBondName(); boolean bonded = isBond(iface); if (bonded) { extractBond(bonds, iface, name); } else { if (isNotBlank(bondName)) { extractBondSlave(bondSlaves, iface, bondName); } if (!existingIfaces.containsKey(name)) { violations.add(NETWORK_INTERFACE_NOT_EXISTS); } } if (isNotBlank(networkName)) extractNetwork(clusterNetworksMap, networks, iface, networkName); else { violations.add(NETWORK_NETWORK_NOT_EXISTS_IN_CLUSTER); } } validateBonds(bonds, bondSlaves); extractedData = new ExtractedData( new ArrayList<network>(networks.values()), extractRemoveNetworks(networks.keySet(), clusterNetworksMap), (new ArrayList<VdsNetworkInterface>(bonds.values())), extractRemovedBonds(bonds, existingIfaces)); return violations; }

Target:
public List<VdcBllMessages> validate() { Map<String, VdsNetworkInterface> ifaces = interfacesToMap(params.getInterfaces()); Map<String, VdsNetworkInterface> existingIfaces = extractExistingInterfaceNames(); Map<String, network> clusterNetworksMap = clusterNetworksToMap(clusterNetworks); Map<String, VdsNetworkInterface> bonds = new HashMap<String, VdsNetworkInterface>(); Map<String, List<VdsNetworkInterface>> bondSlaves = new HashMap<String, List<VdsNetworkInterface>>(); Map<String, network> networks = new HashMap<String, network>(); for (VdsNetworkInterface iface : ifaces.values()) { String name = iface.getName(); String networkName = iface.getNetworkName(); String bondName = iface.getBondName(); boolean bonded = isBond(iface); if (bonded) { extractBond(bonds, iface, name); } else { if (isNotBlank(bondName)) { extractBondSlave(bondSlaves, iface, bondName); } if (!existingIfaces.containsKey(name)) { violations.add(NETWORK_INTERFACE_NOT_EXISTS); } } if (isNotBlank(networkName)) { extractNetwork(clusterNetworksMap, networks, iface, networkName); } else { violations.add(NETWORK_NOT_EXISTS_IN_CLUSTER); } } validateBonds(bonds, bondSlaves); extractedData = new ExtractedData( new ArrayList<network>(networks.values()), extractRemoveNetworks(networks.keySet(), clusterNetworksMap), (new ArrayList<VdsNetworkInterface>(bonds.values())), extractRemovedBonds(bonds, existingIfaces)); return violations; }
Source:
private void scanProjects(final File dir, final String prefix, final SortedSet<Project.NameKey> names) { final File[] ls = dir.listFiles(); if (ls == null) { return; } for (File f : ls) { String name = f.getName(); if (FileKey.isGitRepository(f, FS.DETECTED)) { if (name.equals(Constants.DOT_GIT)) { name = prefix.substring(0, prefix.length() - 1); } else if (name.endsWith(Constants.DOT_GIT_EXT)) { int newLen = name.length() - Constants.DOT_GIT_EXT.length(); name = prefix + name.substring(0, newLen); } else { name = prefix + name; } Project.NameKey nameKey = new Project.NameKey(name); if (!isUnreasonableName(nameKey)) { names.add(nameKey); } } else if (f.isDirectory()) { scanProjects(f, prefix + f.getName() + "/", names); } } }

Target:
private void scanProjects(final File dir, final String prefix, final SortedSet<Project.NameKey> names) { final File[] ls = dir.listFiles(); if (ls == null) { return; } for (File f : ls) { String fileName = f.getName(); if (FileKey.isGitRepository(f, FS.DETECTED)) { String projectName; if (fileName.equals(Constants.DOT_GIT)) { projectName = prefix.substring(0, prefix.length() - 1); } else if (fileName.endsWith(Constants.DOT_GIT_EXT)) { int newLen = fileName.length() - Constants.DOT_GIT_EXT.length(); projectName = prefix + fileName.substring(0, newLen); } else { projectName = prefix + fileName; } Project.NameKey nameKey = new Project.NameKey(projectName); if (isUnreasonableName(nameKey)) { log.warn("Ignoring unreasonably named repository " + f.getAbsolutePath()); } else { names.add(nameKey); } } else if (f.isDirectory()) { scanProjects(f, prefix + f.getName() + "/", names); } } }
Source:
public void testLinuxNode() throws RunNodesException { final String groupName = String.format("ubu%s", System.getProperty("user.name").substring(0, 3)); final TemplateBuilder templateBuilder = view.getComputeService().templateBuilder(); templateBuilder.osFamily(OsFamily.UBUNTU); templateBuilder.osVersionMatches("14.04"); templateBuilder.hardwareId("Standard_A0"); templateBuilder.locationId("westus"); final Template template = templateBuilder.build(); final TemplateOptions options = template.getOptions(); options.inboundPorts(5985); try { Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(groupName, 1, template); assertThat(nodes).hasSize(1); } finally { view.getComputeService().destroyNodesMatching(inGroup(groupName)); } }

Target:
public void testLinuxNode() throws RunNodesException { final String groupName = this.azureGroup; final TemplateBuilder templateBuilder = view.getComputeService().templateBuilder(); templateBuilder.osFamily(OsFamily.UBUNTU); templateBuilder.osVersionMatches("14.04"); templateBuilder.hardwareId("Standard_A0"); templateBuilder.locationId("westus"); final Template template = templateBuilder.build(); try { Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(groupName, 1, template); assertThat(nodes).hasSize(1); } finally { view.getComputeService().destroyNodesMatching(inGroup(groupName)); } }
Source:
Promise loadDefinitionFromFile(final String file, final Map<String, JSITDefinitions> otherDefinitions) { return contentService.loadFile(file) .then((IThenable.ThenOnFulfilledCallbackFn<String, Void>) xml -> promises.create((success, failure) -> { if (!StringUtils.isEmpty(xml)) { final ServiceCallback<Object> callback = getCallback(file, otherDefinitions, success); diagramService.getDefinitions(xml, callback); } else { success.onInvoke(promises.resolve()); } })); }

Target:
Promise<Void> loadDefinitionFromFile(final String file, final Map<String, JSITDefinitions> otherDefinitions) { return contentService.loadFile(file) .then(xml -> promises.create((success, failure) -> { if (!StringUtils.isEmpty(xml)) { final ServiceCallback<Object> callback = getCallback(file, otherDefinitions, success); diagramService.getDefinitions(xml, callback); } else { success.onInvoke(promises.resolve()); } })); }
Source:
public void retireProgram_shouldSetRetiredStateToFalseAndSetAReason() { Program programTest = pws.getAllPrograms().get(0); Program program = pws.retireProgram(programTest, "expired"); for (ProgramWorkflow workflow : program.getWorkflows()) { assertEquals(workflow.getRetired(), true); for (ProgramWorkflowState state : workflow.getStates()) { assertNotNull(workflow.getStates()); assertEquals(state.getRetired(), true); assertEquals(state.getRetired(), true); } } assertEquals(program.getRetireReason(), "expired"); }

Target:
public void retireProgram_shouldSetRetiredStateToFalseAndSetAReason() { Concept concept = Context.getConceptService().getConcept(12); ProgramWorkflow programWorkflow = dao.getProgramWorkflowsByConcept(concept).get(1); ArrayList<ProgramWorkflow> programWorkflows = new ArrayList<>(); programWorkflows.add(programWorkflow); Set<ProgramWorkflow> allWorkflows = new HashSet<>(programWorkflows); Program programTest = pws.getAllPrograms().get(1); programTest.setAllWorkflows(allWorkflows); Program program = pws.retireProgram(programTest, "expired"); for (ProgramWorkflow workflow : program.getWorkflows()) { assertTrue(workflow.getRetired()); assertNotNull(workflow.getStates()); for (ProgramWorkflowState state : workflow.getStates()) { assertTrue(state.getRetired()); } } assertEquals(program.getRetireReason(), "expired"); }
Source:
public void init() throws MessagingException { subjectPrefix = getInitParameter("subjectPrefix", String.class); if (Strings.isNullOrEmpty(subjectPrefix)) { throw new MessagingException("Please configure a valid subjectPrefix"); } }

Target:
public void init() throws MessagingException { subjectPrefix = getInitParameter("subjectPrefix"); if (Strings.isNullOrEmpty(subjectPrefix)) { throw new MessagingException("Please configure a valid subjectPrefix"); } }
Source:
public void testSetFallbackToNull() { testSetFallbackTo.setFallbackTo(null); testSetFallbackTo.afterPropertiesSet(); }

Target:
public void testSetFallbackToNull() { SimpleI18nCodeList codeList = new SimpleI18nCodeList(); try { codeList.setFallbackTo(null); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("fallbackTo must not be null")); } }