auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void updateEvent(Event event, Position position) { try { dataManager.addEvent(event); } catch (SQLException error) { Log.warning(error); } Set<Long> users = Context.getPermissionsManager().getDeviceUsers(event.getDeviceId()); Device device = Context.getIdentityManager().getDeviceById(event.getDeviceId()); if (device != null && device.getAttributes().containsKey("notifyOnly")) { List<String> notifyOnly = Arrays.asList(device.getAttributes().get("notifyOnly").toString().split(" ")); for (long userId : users) { if (!notifyOnly.contains(Context.getPermissionsManager().getUser(userId).getEmail())) { users.remove(userId); } } } for (long userId : users) { if (event.getGeofenceId() == 0 || Context.getGeofenceManager() != null && Context.getGeofenceManager().checkGeofence(userId, event.getGeofenceId())) { Notification notification = getUserNotificationByType(userId, event.getType()); if (notification != null) { if (notification.getAttributes().containsKey("web")) { Context.getConnectionManager().updateEvent(userId, event, position); } if (notification.getAttributes().containsKey("mail")) { NotificationMail.sendMailAsync(userId, event, position); } } } } if (Context.getEventForwarder() != null) { Context.getEventForwarder().forwardEvent(event, position); } }

Target:
public void updateEvent(Event event, Position position) { try { dataManager.addEvent(event); } catch (SQLException error) { Log.warning(error); } Set<Long> users = new HashSet<>(Context.getPermissionsManager().getDeviceUsers(event.getDeviceId())); String notifyOnly = Context.getDeviceManager().lookupConfigString(event.getDeviceId(), "event.notifyOnly", null); if (notifyOnly != null) { List<String> notifyOnlyList = Arrays.asList(notifyOnly.split(" ")); for (long userId : users) { if (!notifyOnlyList.contains(Context.getPermissionsManager().getUser(userId).getEmail())) { users.remove(userId); } } } for (long userId : users) { if (event.getGeofenceId() == 0 || Context.getGeofenceManager() != null && Context.getGeofenceManager().checkGeofence(userId, event.getGeofenceId())) { Notification notification = getUserNotificationByType(userId, event.getType()); if (notification != null) { if (notification.getAttributes().containsKey("web")) { Context.getConnectionManager().updateEvent(userId, event, position); } if (notification.getAttributes().containsKey("mail")) { NotificationMail.sendMailAsync(userId, event, position); } } } } if (Context.getEventForwarder() != null) { Context.getEventForwarder().forwardEvent(event, position); } }
Source:
public void dialogIsCancellable() { dialogFragment.show(fragmentManager, "tag"); fragmentManager.executePendingTransactions(); assertThat(shadowOf(dialogFragment.getDialog()).isCancelable(), equalTo(true)); }

Target:
public void dialogIsCancellable() { dialogFragment.show(fragmentManager, "tag"); assertThat(shadowOf(dialogFragment.getDialog()).isCancelable(), equalTo(true)); }
Source:
public void testCreateTableNotExistsTrue() throws Exception { CreateTable statement = new CreateTable(QualifiedName.of("test_table"), ImmutableList.of(new ColumnDefinition("a", "BIGINT", Optional.empty())), true, ImmutableMap.of(), Optional.empty()); try { getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList())); } catch (RuntimeException e) { fail("CreateTableTask shouldn't throw when notExists is set to true"); } assertEquals(metadata.getCreateTableCallCount(), 1); }

Target:
public void testCreateTableNotExistsTrue() throws Exception { CreateTable statement = new CreateTable(QualifiedName.of("test_table"), ImmutableList.of(new ColumnDefinition("a", "BIGINT", Optional.empty())), true, ImmutableMap.of(), Optional.empty()); getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList())); assertEquals(metadata.getCreateTableCallCount(), 1); }
Source:
public boolean removeOverview(ProjectOverview overview) throws IOException { if (overview.isDeletable()) { currentSession().delete(overview); return true; } return false; }

Target:
public boolean removeOverview(ProjectOverview overview) throws IOException { if (overview.isDeletable()) { overview.setProject(null); currentSession().delete(overview); return true; } return false; }
Source:
protected boolean canDoAction() { if (!GlusterFeatureSupported.glusterGeoReplication(getVdsGroup().getCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GEO_REP_NOT_SUPPORTED); } slaveVolume = getSlaveVolume(); if (slaveVolume == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID); } if (slaveVolume.getStatus() != GlusterStatus.UP) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SHOULD_BE_STARTED); } slaveHost = getSlaveHost(); if (slaveHost == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); } if (!areAllRemoteServersUp()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_ONE_OR_MORE_REMOTE_HOSTS_ARE_NOT_ACCESSIBLE); } GlusterGeoRepSession geoRepSession = getGeoRepDao().getGeoRepSession(getGlusterVolumeId(), getParameters().getSlaveHost(), getParameters().getSlaveVolumeName()); if (geoRepSession != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_GEOREP_SESSION_ALREADY_CREATED); } return super.canDoAction(); }

Target:
protected boolean canDoAction() { if (!GlusterFeatureSupported.glusterGeoReplication(getVdsGroup().getCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GEO_REP_NOT_SUPPORTED); } slaveHost = getSlaveHost(); if (slaveHost == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); } if (slaveHost.getStatus() != VDSStatus.Up) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP, String.format("$%1$s %2$s", "VdsName", slaveHost.getName())); } slaveVolume = getSlaveVolume(); if (slaveVolume == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID); } if (slaveVolume.getStatus() != GlusterStatus.UP) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SHOULD_BE_STARTED); } if (!areAllRemoteServersUp()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_ONE_OR_MORE_REMOTE_HOSTS_ARE_NOT_ACCESSIBLE); } GlusterGeoRepSession geoRepSession = getGeoRepDao().getGeoRepSession(getGlusterVolumeId(), getParameters().getSlaveHost(), getParameters().getSlaveVolumeName()); if (geoRepSession != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_GEOREP_SESSION_ALREADY_CREATED); } return super.canDoAction(); }
Source:
private void submitNewTask( TaskMonitor<SubTaskType> taskMonitor, SubTaskSpec<SubTaskType> spec ) { LOG.info("Submit a new task for spec[%s] and inputSplit[%s]", spec.getId(), spec.getInputSplit()); final ListenableFuture<SubTaskCompleteEvent<SubTaskType>> future = taskMonitor.submit(spec); Futures.addCallback( future, new FutureCallback<SubTaskCompleteEvent<SubTaskType>>() { @Override public void onSuccess(SubTaskCompleteEvent<SubTaskType> completeEvent) { taskCompleteEvents.offer(completeEvent); } @Override public void onFailure(Throwable t) { LOG.error(t, "Error while running a task for subTaskSpec[%s]", spec); taskCompleteEvents.offer(SubTaskCompleteEvent.fail(spec, t)); } }, blockingQueueHandler ); }

Target:
private void submitNewTask( TaskMonitor<SubTaskType> taskMonitor, SubTaskSpec<SubTaskType> spec ) { LOG.info("Submit a new task for spec[%s] and inputSplit[%s]", spec.getId(), spec.getInputSplit()); final ListenableFuture<SubTaskCompleteEvent<SubTaskType>> future = taskMonitor.submit(spec); Futures.addCallback( future, new FutureCallback<SubTaskCompleteEvent<SubTaskType>>() { @Override public void onSuccess(SubTaskCompleteEvent<SubTaskType> completeEvent) { taskCompleteEvents.offer(completeEvent); } @Override public void onFailure(Throwable t) { LOG.error(t, "Error while running a task for subTaskSpec[%s]", spec); taskCompleteEvents.offer(SubTaskCompleteEvent.fail(spec, t)); } }, Execs.directExecutor() ); }
Source:
public void testArrayOfRow() { Optional<VerifierQueryEvent> event = createVerification("SELECT ARRAY[ROW(1, 'a'), ROW(2, null)]", "SELECT ARRAY[ROW(1, 'a'), ROW(2, null)]").run(); assertTrue(event.isPresent()); assertEvent(event.get(), SUCCEEDED, Optional.empty(), Optional.empty(), Optional.empty()); event = createVerification("SELECT ARRAY[ROW(1, 'a'), ROW(2, 'b')]", "SELECT ARRAY[ROW(1, 'a'), ROW(2, null)]").run(); assertTrue(event.isPresent()); assertEvent( event.get(), FAILED, Optional.of(true), Optional.of("COLUMN_MISMATCH"), Optional.of("Test state SUCCEEDED, Control state SUCCEEDED\n" + "COLUMN MISMATCH\n" + "Control 1 rows, Test 1 rows\n" + "Mismatched Columns:\n" + " _col0 \\(array\\(row\\(integer, varchar\\(1\\)\\)\\)\\): control\\(sorted_checksum: 71 b5 2f 7f 1e 9b a6 a4\\) test\\(sorted_checksum: b4 3c 7d 02 2b 14 77 12\\)\n")); }

Target:
public void testArrayOfRow() { Optional<VerifierQueryEvent> event = createVerification("SELECT ARRAY[ROW(1, 'a'), ROW(2, null)]", "SELECT ARRAY[ROW(1, 'a'), ROW(2, null)]").run(); assertTrue(event.isPresent()); assertEvent(event.get(), SUCCEEDED, Optional.empty(), Optional.empty(), Optional.empty()); event = createVerification("SELECT ARRAY[ROW(1, 'a'), ROW(2, 'b')]", "SELECT ARRAY[ROW(1, 'a'), ROW(2, null)]").run(); assertTrue(event.isPresent()); assertEvent( event.get(), FAILED, Optional.of(true), Optional.of("COLUMN_MISMATCH"), Optional.of("Test state SUCCEEDED, Control state SUCCEEDED\n" + "COLUMN MISMATCH\n" + "Control 1 rows, Test 1 rows\n" + "Mismatched Columns:\n" + " _col0 \\(array\\(row\\(integer, varchar\\(1\\)\\)\\)\\): control\\(checksum: 71 b5 2f 7f 1e 9b a6 a4\\) test\\(checksum: b4 3c 7d 02 2b 14 77 12\\)\n")); }
Source:
private static JSONObject getCollectionFields(OskariLayer layer) throws ServiceException { final String url = layer.getUrl() + "collections/" + layer.getName() + "/queryables"; try { final String rawResponse = IOHelper.getURL(url, layer.getUsername(), layer.getPassword()); final JSONObject response = new JSONObject(rawResponse); final JSONArray attributes = response.getJSONArray("queryables"); for (int i = 0; i < attributes.length(); i++) { JSONObject attribute = attributes.getJSONObject(i); String attributeName = attribute.getString("id"); attribute.put("name", attributeName); attribute.remove("id"); } final JSONObject result = new JSONObject(); result.put("attributes", attributes); result.put("geometryField", "geometry"); return result; } catch (IOException ex) { throw new ServiceException("Couldn't reach url: " + url); } catch (JSONException ex) { throw new ServiceException("Response is not a valid JSON string: " + url); } }

Target:
private static JSONObject getCollectionFields(OskariLayer layer) throws ServiceException { try { final JSONArray features = getCollectionItems(layer); final JSONObject attributes = getFeatureAttributes(features); final JSONObject result = new JSONObject(); result.put(ATTRIBUTES_KEY, attributes); result.put(GEOMETRY_FIELD_KEY, "geometry"); return result; } catch (JSONException ex) { throw new ServiceException("Couldn't parse collection items response", ex); } }
Source:
public String valueForInsert(Object value) { if (value == null) { return null; } var string = convert(value); if (unbound() || string.length() <= lengthLimit) { return string; } else { if (string.substring(lengthLimit).isBlank()) { return string.substring(0, lengthLimit); } else { throw new IllegalArgumentException( "The value is too long for text type of the length: " + lengthLimit); } } }

Target:
public String valueForInsert(Object value) { if (value == null) { return null; } assert value instanceof String : "valueForInsert must be called only on objects of String type"; var string = (String) value; if (unbound() || string.length() <= lengthLimit) { return string; } else { if (isBlank(string, lengthLimit, string.length())) { return string.substring(0, lengthLimit); } else { if (string.length() > 20) { string = string.substring(0, 20) + "..."; } throw new IllegalArgumentException( "'" + string + "' is too long for the text type of length: " + lengthLimit); } } }
Source:
public TimerJobInstance getTimerByName(String jobName) { if (localCache.containsKey(jobName)) { logger.debug("Found job in cache returning", jobName); return localCache.get(jobName); } TimerJobInstance found = null; for (Timer timer : timerService.getTimers()) { try { Serializable info = timer.getInfo(); if (info instanceof EjbTimerJob) { EjbTimerJob job = (EjbTimerJob) info; EjbGlobalJobHandle handle = (EjbGlobalJobHandle) job.getTimerJobInstance().getJobHandle(); if (handle.getUuid().equals(jobName)) { found = handle.getTimerJobInstance(); localCache.putIfAbsent(jobName, found); logger.debug("Job does match timer and is going to be returned {}", jobName, found); } } } catch (NoSuchObjectLocalException e) { logger.debug("Timer info for was not found ", timer); } } return found; }

Target:
public TimerJobInstance getTimerByName(String jobName) { if (localCache.containsKey(jobName)) { logger.debug("Found job in cache returning", jobName); return localCache.get(jobName); } TimerJobInstance found = null; for (Timer timer : timerService.getTimers()) { try { Serializable info = timer.getInfo(); if (info instanceof EjbTimerJob) { EjbTimerJob job = (EjbTimerJob) info; EjbGlobalJobHandle handle = (EjbGlobalJobHandle) job.getTimerJobInstance().getJobHandle(); if (handle.getUuid().equals(jobName)) { found = handle.getTimerJobInstance(); localCache.putIfAbsent(jobName, found); logger.debug("Job does match timer and is going to be returned {}", jobName, found); break; } } } catch (NoSuchObjectLocalException e) { logger.debug("Timer info for was not found ", timer); } } return found; }
Source:
public boolean equals(Object o) { Section other = (Section) o; return getId() == other.getId() && getLevel() == other.getLevel() && Utils.compareStrings(getHeading(), other.getHeading()) && Utils.compareStrings(getAnchor(), other.getAnchor()) && Utils.compareStrings(getContent(), other.getContent()) && getSubSections().equals(other.getSubSections()); }

Target:
public boolean equals(Object o) { if (!(o instanceof Section)) { return false; } Section other = (Section) o; return getId() == other.getId() && getLevel() == other.getLevel() && Utils.compareStrings(getHeading(), other.getHeading()) && Utils.compareStrings(getAnchor(), other.getAnchor()) && Utils.compareStrings(getContent(), other.getContent()) && getSubSections().equals(other.getSubSections()); }
Source:
public void testSpatialJoinContains() { assertPlan("SELECT b.name, a.name " + "FROM " + POINTS_SQL + ", " + POLYGONS_SQL + " " + "WHERE ST_Contains(ST_GeometryFromText(wkt), ST_Point(lng, lat))", anyTree( spatialJoin("st_contains(st_geometryfromtext, st_point)", project(ImmutableMap.of("st_point", expression("ST_Point(lng, lat)")), anyTree(values(ImmutableMap.of("lng", 0, "lat", 1)))), anyTree(project(ImmutableMap.of("st_geometryfromtext", expression("ST_GeometryFromText(cast(wkt as varchar))")), anyTree(values(ImmutableMap.of("wkt", 0))))))), getQueryRunner().getPlanOptimizers(false)); assertPlan("SELECT * " + "FROM (SELECT length(name), * FROM " + POINTS_SQL + "), (SELECT length(name), * FROM " + POLYGONS_SQL + ") " + "WHERE ST_Contains(ST_GeometryFromText(wkt), ST_Point(lng, lat))", anyTree( spatialJoin("st_contains(st_geometryfromtext, st_point)", project(ImmutableMap.of("st_point", expression("ST_Point(lng, lat)"), "length", expression("length(name)")), anyTree(values(ImmutableMap.of("lng", 0, "lat", 1, "name", 2)))), anyTree(project(ImmutableMap.of("st_geometryfromtext", expression("ST_GeometryFromText(cast(wkt as varchar))"), "length_2", expression("length(name_2)")), anyTree(values(ImmutableMap.of("wkt", 0, "name_2", 1))))))), getQueryRunner().getPlanOptimizers(false)); }

Target:
public void testSpatialJoinContains() { assertPlan("SELECT b.name, a.name " + "FROM " + POINTS_SQL + ", " + POLYGONS_SQL + " " + "WHERE ST_Contains(ST_GeometryFromText(wkt), ST_Point(lng, lat))", anyTree( spatialJoin("st_contains(st_geometryfromtext, st_point)", project(ImmutableMap.of("st_point", expression("ST_Point(lng, lat)")), anyTree(values(ImmutableMap.of("lng", 0, "lat", 1)))), anyTree(project(ImmutableMap.of("st_geometryfromtext", expression("ST_GeometryFromText(cast(wkt as varchar))")), anyTree(values(ImmutableMap.of("wkt", 0)))))))); assertPlan("SELECT * " + "FROM (SELECT length(name), * FROM " + POINTS_SQL + "), (SELECT length(name), * FROM " + POLYGONS_SQL + ") " + "WHERE ST_Contains(ST_GeometryFromText(wkt), ST_Point(lng, lat))", anyTree( spatialJoin("st_contains(st_geometryfromtext, st_point)", project(ImmutableMap.of("st_point", expression("ST_Point(lng, lat)"), "length", expression("length(name)")), anyTree(values(ImmutableMap.of("lng", 0, "lat", 1, "name", 2)))), anyTree(project(ImmutableMap.of("st_geometryfromtext", expression("ST_GeometryFromText(cast(wkt as varchar))"), "length_2", expression("length(name_2)")), anyTree(values(ImmutableMap.of("wkt", 0, "name_2", 1)))))))); }
Source:
public static void threadDumpMC () { boolean ret = true; if (LaunchFrame.MCRunning) { YNDialog yn = new YNDialog("TD_MC_MESSAGE", "TD_MC_CONFIRM", "TD_MC_TITLE"); yn.setVisible(true); yn.toFront(); if (yn.ready && yn.ret && LaunchFrame.MCRunning && LaunchFrame.getProcMonitor() != null) { Logger.logWarn("Getting thread dump from MC"); ret = OSUtils.genThreadDump(LaunchFrame.getProcMonitor().getPid()); } yn.setVisible(false); if (ret) { ErrorUtils.showClickableMessage(I18N.getLocaleString("TD_MC_FAIL_MESSAGE"), JOptionPane.ERROR_MESSAGE); } } else { Logger.logInfo("No Minecraft Process currently running to thread dump"); } }

Target:
public static void threadDumpMC () { boolean ret = true; if (LaunchFrame.MCRunning) { YNDialog yn = new YNDialog("TD_MC_MESSAGE", "TD_MC_CONFIRM", "TD_MC_TITLE"); yn.setVisible(true); yn.toFront(); if (yn.ready && yn.ret && LaunchFrame.MCRunning && LaunchFrame.getProcMonitor() != null) { Logger.logWarn("Getting thread dump from MC"); ret = OSUtils.genThreadDump(LaunchFrame.getProcMonitor().getPid()); } yn.setVisible(false); if (!ret) { ErrorUtils.showClickableMessage(I18N.getLocaleString("TD_MC_FAIL_MESSAGE"), JOptionPane.ERROR_MESSAGE); } } else { Logger.logInfo("No Minecraft Process currently running to thread dump"); } }
Source:
public void testRefreshTokenWebRequestHasError() throws InterruptedException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, InstantiationException, InvocationTargetException, NoSuchAlgorithmException, NoSuchPaddingException { FileMockContext mockContext = new FileMockContext(getContext()); ITokenCacheStore mockCache = getCacheForRefreshToken(TEST_IDTOKEN_USERID, TEST_IDTOKEN_UPN); final AuthenticationContext context = getAuthenticationContext(mockContext, VALID_AUTHORITY, false, mockCache); setConnectionAvailable(context, true); final CountDownLatch signal = new CountDownLatch(1); MockAuthenticationCallback callback = new MockAuthenticationCallback(signal); MockWebRequestHandler webrequest = new MockWebRequestHandler(); webrequest.setReturnResponse(new HttpWebResponse(500, null, null)); ReflectionUtils.setFieldValue(context, "mWebRequest", webrequest); final TestLogResponse response = new TestLogResponse(); response.listenLogForMessageSegments(signal, "Server error message"); context.acquireTokenSilentAsync("resource", "clientid", TEST_IDTOKEN_USERID, callback); signal.await(CONTEXT_REQUEST_TIME_OUT, TimeUnit.MILLISECONDS); assertTrue("Log message has same webstatus code", response.errorCode.equals(ADALError.SERVER_ERROR)); assertNotNull("Cache item is not removed for this item", mockCache.getItem(CacheKey.createCacheKey( VALID_AUTHORITY, "resource", "clientId", false, TEST_IDTOKEN_USERID))); clearCache(context); }

Target:
public void testRefreshTokenWebRequestHasError() throws InterruptedException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, InstantiationException, InvocationTargetException, NoSuchAlgorithmException, NoSuchPaddingException { FileMockContext mockContext = new FileMockContext(getContext()); ITokenCacheStore mockCache = getCacheForRefreshToken(TEST_IDTOKEN_USERID, TEST_IDTOKEN_UPN); final AuthenticationContext context = getAuthenticationContext(mockContext, VALID_AUTHORITY, false, mockCache); setConnectionAvailable(context, true); final CountDownLatch signal = new CountDownLatch(1); MockAuthenticationCallback callback = new MockAuthenticationCallback(signal); MockWebRequestHandler webrequest = new MockWebRequestHandler(); webrequest.setReturnResponse(new HttpWebResponse(500, null, null)); ReflectionUtils.setFieldValue(context, "mWebRequest", webrequest); context.acquireTokenSilentAsync("resource", "clientid", TEST_IDTOKEN_USERID, callback); signal.await(CONTEXT_REQUEST_TIME_OUT, TimeUnit.MILLISECONDS); assertNotNull(callback.mException); assertTrue(callback.mException instanceof AuthenticationException); AuthenticationException authenticationException = (AuthenticationException)callback.mException; assertEquals(authenticationException.getCode(), ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED); assertNotNull("Cache item is not removed for this item", mockCache.getItem(CacheKey.createCacheKey( VALID_AUTHORITY, "resource", "clientId", false, TEST_IDTOKEN_USERID))); clearCache(context); }
Source:
public static void deleteTenantDir(int tenantId) { if (log.isDebugEnabled()) { log.debug("Deleting tenant directory of tenant: " + tenantId); } String tenantDirPath = CarbonUtils.getCarbonTenantsDirPath() + File.separator + tenantId; File tenantDir = new File(tenantDirPath); try { FileUtils.deleteDirectory(tenantDir); } catch (IOException e) { log.error("Error in deleting tenant directory: " + tenantDirPath); } }

Target:
public static void deleteTenantDir(int tenantId) { if (log.isDebugEnabled()) { log.debug("Deleting tenant directory of tenant: " + tenantId); } String tenantDirPath = CarbonUtils.getCarbonTenantsDirPath() + File.separator + tenantId; File tenantDir = new File(tenantDirPath); try { FileUtils.deleteDirectory(tenantDir); } catch (IOException e) { log.error("Error in deleting tenant directory: " + tenantDirPath, e); } }
Source:
public void handlePut(ActionParameters params) throws ActionException { params.requireAdminUser(); try { Announcement announcement = AnnouncementsParser.parseAnnouncementParams(params); final JSONObject result = new JSONObject(); int updateId = service.updateAnnouncement(announcement); JSONHelper.putValue(result, "id", updateId); AuditLog.user(params.getClientIp(), params.getUser()) .withParam("id", announcement.getId()) .withParam("title", announcement.getTitle()) .withParam("content", announcement.getContent()) .withParam("beginDate", announcement.getBeginDate()) .withParam("endDate", announcement.getEndDate()) .withParam("active", announcement.getActive()); ResponseHelper.writeResponse(params, result); } catch (JSONException e) { LOG.error("Error updating announcement", e); throw new ActionException("Cannot update announcement"); } }

Target:
public void handlePut(ActionParameters params) throws ActionException { params.requireAdminUser(); try { Announcement announcement = AnnouncementsParser.parseAnnouncementParams(params); final JSONObject result = new JSONObject(); int updateId = service.updateAnnouncement(announcement); JSONHelper.putValue(result, "id", updateId); AuditLog.user(params.getClientIp(), params.getUser()) .withParam("id", announcement.getId()) .withParam("title", announcement.getTitle()) .withParam("content", announcement.getContent()) .withParam("beginDate", announcement.getBeginDate()) .withParam("endDate", announcement.getEndDate()) .withParam("active", announcement.getActive()); ResponseHelper.writeResponse(params, result); } catch (JSONException e) { throw new ActionException("Cannot update announcement", e); } }
Source:
public Matrix mul(final Matrix matrix) { if (matrix.isDense()) { throw new UnsupportedOperationException(); } else { return new CSCMatrix((breeze.linalg.CSCMatrix<Double>) breezeMatrix.$colon$times(((CSCMatrix) matrix).breezeMatrix, MatrixOps.EMUL_SS)); } }

Target:
public Matrix mul(final Matrix matrix) { if (matrix.isDense()) { return new CSCMatrix((breeze.linalg.CSCMatrix<Double>) breezeMatrix.$colon$times(((DenseMatrix) matrix).getBreezeMatrix(), MatrixOps.EMUL_MM)); } else { return new CSCMatrix((breeze.linalg.CSCMatrix<Double>) breezeMatrix.$colon$times(((CSCMatrix) matrix).breezeMatrix, MatrixOps.EMUL_SS)); } }
Source:
private void initPreApplicationState() { logger.info(Utility.version(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); prefs = TestController.loadApplicationPreferences(); KeyboardShortcuts.loadKeyboardShortcuts(prefs); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); updateProgressWindow = new UpdateProgressWindow(); if (!TestController.isTestMode()) { updateManager = new UpdateManager(updateProgressWindow); } else { updateManager = new UpdateManagerStub(); } updateManager.run(); }

Target:
private void initPreApplicationState() { logger.info(Utility.version(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); prefs = TestController.loadApplicationPreferences(); KeyboardShortcuts.loadKeyboardShortcuts(prefs); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); updateManager = TestController.createUpdateManager(); updateManager.run(); }
Source:
public void throwIfNullProvider() throws Exception { Transaction transaction = newTransaction( AnonymousContext.writeToken() ); transaction.tokenWrite().labelGetOrCreateForName( "Person" ); createProperties( transaction, "name" ); commit(); newTransaction( AnonymousContext.full() ); String pattern = indexPattern( "Person", "name" ); try { callIndexProcedure( pattern, null ); fail( "Expected to fail" ); } catch ( ProcedureException e ) { assertThat( e.getMessage(), containsString( "Could not create index with specified index provider being null" ) ); } commit(); }

Target:
public void throwIfNullProvider() throws Exception { Transaction transaction = newTransaction( AnonymousContext.writeToken() ); transaction.tokenWrite().labelGetOrCreateForName( "Person" ); createProperties( transaction, "name" ); commit(); newTransaction( AnonymousContext.full() ); String pattern = indexPattern( "Person", "name" ); ProcedureException e = assertThrows( ProcedureException.class, () -> callIndexProcedure( pattern, null ) ); assertThat( e.getMessage(), containsString( "Could not create index with specified index provider being null" ) ); commit(); }
Source:
private void checkRequiresCapability(Command cmd) throws UnloggedFailure { String pluginName = null; if (cmd instanceof BaseCommand) { pluginName = ((BaseCommand) cmd).getPluginName(); } try { CapabilityUtils.checkRequiresCapability(currentUser, pluginName, cmd.getClass()); } catch (AuthException e) { throw new UnloggedFailure(BaseCommand.STATUS_NOT_ADMIN, "fatal: cannot check capability"); } }

Target:
private void checkRequiresCapability(Command cmd) throws UnloggedFailure { String pluginName = null; if (cmd instanceof BaseCommand) { pluginName = ((BaseCommand) cmd).getPluginName(); } try { CapabilityUtils.checkRequiresCapability(currentUser, pluginName, cmd.getClass()); } catch (AuthException e) { throw new UnloggedFailure(BaseCommand.STATUS_NOT_ADMIN, e.getMessage()); } }
Source:
protected ValidationResult macAvailable() { Boolean allowDupMacs = Config.<Boolean> GetValue(ConfigValues.AllowDuplicateMacAddresses); if (allowDupMacs || !existsPluggedInterfaceWithSameMac(vmNetworkInterface)) { return ValidationResult.VALID; } else { return new ValidationResult(VdcBllMessages.NETWORK_MAC_ADDRESS_IN_USE); } }

Target:
protected ValidationResult macAvailable() { Boolean allowDupMacs = Config.<Boolean> GetValue(ConfigValues.AllowDuplicateMacAddresses); VmInterfaceManager vmInterfaceManager = new VmInterfaceManager(); if (allowDupMacs || !vmInterfaceManager.existsPluggedInterfaceWithSameMac(vmNetworkInterface)) { return ValidationResult.VALID; } else { return new ValidationResult(VdcBllMessages.NETWORK_MAC_ADDRESS_IN_USE); } }
Source:
private void writeMetrics() throws IOException { if (!isConnected()) { connect(); } if (metrics.size() > 0) { try { byte[] payload = GraphitePickler.pickleMetrics(metrics,charset); ByteBuffer byteBuffer = ByteBuffer.allocate(4 + payload.length).putInt(payload.length).put(payload); datagramChannel.send(byteBuffer, address); this.failures = 0; if (LOGGER.isDebugEnabled()) { LOGGER.debug("Wrote metrics", metrics.size()); } } catch (IOException e) { failures++; throw e; } finally { metrics.clear(); } } }

Target:
private void writeMetrics() throws IOException { if (!isConnected()) { connect(); } if (metrics.size() > 0) { try { byte[] payload = GraphitePickler.pickleMetrics(metrics,charset); ByteBuffer byteBuffer = ByteBuffer.allocate(4 + payload.length).putInt(payload.length).put(payload); datagramChannel.send(byteBuffer, address); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Wrote metrics", metrics.size()); } } catch (IOException e) { failures++; throw e; } finally { metrics.clear(); } } }
Source:
public static String getMessage(final String key) { return getMessage(key, LocaleFilter.DEFAULT_LOCALE); }

Target:
public String getMessage(final String key) { return getMessage(key, LocaleFilter.DEFAULT_LOCALE); }
Source:
public void shibboleth(HttpServletResponse response, @RequestParam(name = "redirectUrl", required = false) String redirectUrl) throws IOException { if (redirectUrl == null) { redirectUrl = ConfigurationManager.getProperty("dspace.url"); } log.info("Redirecting to " + redirectUrl); response.sendRedirect(redirectUrl); }

Target:
public void shibboleth(HttpServletResponse response, @RequestParam(name = "redirectUrl", required = false) String redirectUrl) throws IOException { if (redirectUrl == null) { redirectUrl = configurationService.getProperty("dspace.ui.url"); } log.info("Redirecting to " + redirectUrl); response.sendRedirect(redirectUrl); }
Source:
public boolean isValid(String value, ConstraintValidatorContext context) { return isNotBlank(value) && value.matches(TWENTY_FOUR_LOWER_CASE_HEXADECIMAL_CHARACTERS.pattern()); }

Target:
public boolean isValid(String value, ConstraintValidatorContext context) { return isNotBlank(value) && TWENTY_FOUR_LOWER_CASE_HEXADECIMAL_CHARACTERS.matcher(value).matches(); }
Source:
public Boolean isAjaxRequest() { return HttpHeaderConstants.XML_HTTP_REQUEST.equals(headers.get(HttpHeaderConstants.X_REQUESTED_WITH)); }

Target:
public boolean isAjaxRequest() { return HttpHeaderConstants.XML_HTTP_REQUEST.equalsIgnoreCase(headers.get(HttpHeaderConstants.X_REQUESTED_WITH)); }
Source:
private String getHashKey(HashingAlgorithm hashingAlgorithm, Boolean shouldEncodeHashKey, Integer maxDigestBytes, Integer maxHashLength, String encoder) { if (null == hashingAlgorithm) { return null; } final String key = hashingAlgorithm.toString()+ maxDigestBytes != null ? maxDigestBytes.toString() : "-" + maxHashLength != null ? maxHashLength.toString() : "-" + encoder != null ? encoder : "-"; String val = hashedKeysByAlgorithm.get(key); if(val == null) { val = KeyHasher.getHashedKeyEncoded(canonicalKey, hashingAlgorithm, maxDigestBytes, maxHashLength, encoder); hashedKeysByAlgorithm.put(key , val); } if (log.isDebugEnabled()) log.debug("getHashKey : " + val); return val; }

Target:
private String getHashKey(HashingAlgorithm hashingAlgorithm, Boolean shouldEncodeHashKey, Integer maxDigestBytes, Integer maxHashLength, String encoder) { if (null == hashingAlgorithm) { return null; } final String key = hashingAlgorithm.toString()+ maxDigestBytes != null ? maxDigestBytes.toString() : "-" + maxHashLength != null ? maxHashLength.toString() : "-" + encoder != null ? encoder : "-"; String val = hashedKeysByAlgorithm.get(key); if(val == null) { val = KeyHasher.getHashedKeyEncoded(getCanonicalKey(false), hashingAlgorithm, maxDigestBytes, maxHashLength, encoder); hashedKeysByAlgorithm.put(key , val); } if (log.isDebugEnabled()) log.debug("getHashKey : " + val); return val; }
Source:
public void changeCustomAuthorizationHeaderInAPI(String customAuth) throws Exception { HttpResponse getSwaggerResponse = apiPublisher.getSwagger("PhoneVerifyAPI-1", "1.0.0", API_DEVELOPER_USERNAME); APIManageBean apiManageBean = new APIManageBean("PhoneVerifyAPI-1", "1.0.0", API_DEVELOPER_USERNAME, "https", "disabled", "resource_level", "Production and Sandbox", getSwaggerResponse.getData(), "Unlimited,Gold,Bronze"); apiManageBean.setAuthorizationHeader(customAuth); HttpResponse apiManageResponse = apiPublisher.manageAPI(apiManageBean); verifyResponse(apiManageResponse); org.wso2.am.integration.test.utils.bean.APILifeCycleStateRequest updateLifeCycle = new org.wso2.am.integration.test.utils.bean.APILifeCycleStateRequest("PhoneVerifyAPI-1", API_DEVELOPER_USERNAME, APILifeCycleState.PUBLISHED); HttpResponse apiPublishResponse = apiPublisher.changeAPILifeCycleStatus(updateLifeCycle); verifyResponse(apiPublishResponse); }

Target:
public void changeCustomAuthorizationHeaderInAPI(String customAuth) throws Exception { HttpResponse getSwaggerResponse = apiPublisher.getSwagger("PhoneVerifyAPI-1", "1.0.0", API_DEVELOPER_USERNAME); APIManageBean apiManageBean = new APIManageBean("PhoneVerifyAPI-1", "1.0.0", API_DEVELOPER_USERNAME, "https", "disabled", "resource_level", "Production and Sandbox", getSwaggerResponse.getData(), "Unlimited,Gold,Bronze"); apiManageBean.setAuthorizationHeader(customAuth); HttpResponse apiManageResponse = apiPublisher.manageAPI(apiManageBean); verifyResponse(apiManageResponse); APILifeCycleStateRequest updateLifeCycle = new APILifeCycleStateRequest("PhoneVerifyAPI-1", API_DEVELOPER_USERNAME, APILifeCycleState.PUBLISHED); HttpResponse apiPublishResponse = apiPublisher.changeAPILifeCycleStatus(updateLifeCycle); verifyResponse(apiPublishResponse); }
Source:
public ResponseEntity<VocabularyVersionDTO> releaseVersion() { String vocabularyVersion = vocabularyService.getVocabularyReleaseVersion(); return ResponseEntity.ok(new VocabularyVersionDTO(vocabularyVersion)); }

Target:
public VocabularyVersionDTO releaseVersion() { String vocabularyVersion = vocabularyService.getOMOPVocabularyVersion(); return converterUtils.convert(vocabularyVersion, VocabularyVersionDTO.class); }
Source:
public void postCollectionSubmittersGroupCreateSubmittersGroupUnAuthorized() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); getClient().perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); }

Target:
public void postCollectionSubmittersGroupCreateSubmittersGroupUnAuthorized() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); getClient().perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isNoContent()); }
Source:
public SpongeDataRegistrationBuilder reset() { super.reset(); this.dataProviderMap = new HashMap<>(); this.dataStoreMap = new HashMap<>(); this.keys = new ArrayList<>(); return this; }

Target:
public SpongeDataRegistrationBuilder reset() { super.reset(); this.dataProviderMap = new HashMap<>(); this.dataStoreMap = new IdentityHashMap<>(); this.keys = new ArrayList<>(); return this; }
Source:
private ConceptReferenceTerm getConceptReferenceTermByConceptSource(Concept concept, ConceptSource conceptSource) { Collection<ConceptMap> conceptMappings = concept.getConceptMappings(); if(conceptMappings != null && conceptSource != null) { for (ConceptMap cm : conceptMappings) { ConceptReferenceTerm term = cm.getConceptReferenceTerm(); if (term.getConceptSource() != null && term.getConceptSource().equals(conceptSource)) { return term; } } } return null; }

Target:
private ConceptReferenceTerm getConceptReferenceTermByConceptSource(Concept concept, ConceptSource conceptSource) { Collection<ConceptMap> conceptMappings = concept.getConceptMappings(); if(conceptMappings != null && conceptSource != null) { for (ConceptMap cm : conceptMappings) { ConceptReferenceTerm term = cm.getConceptReferenceTerm(); if (conceptSource.equals(term.getConceptSource())) { return term; } } } return null; }
Source:
public void execute(String[] args, Console console) { if (args.length > 0) { final String subCommand = args[0]; switch (subCommand) { case SUBCMD_APPROVE: if (args.length > 2) { String label = args[2]; try { ThingUID thingUID = new ThingUID(args[1]); List<DiscoveryResult> results = inbox.get(new InboxFilterCriteria(thingUID, null)); if (results.isEmpty()) { console.println("No matching inbox entry could be found."); return; } inbox.approve(thingUID, label); } catch (Exception e) { console.println(e.getMessage()); } } else { console.println("Specify thing id to approve: inbox approve <thingUID> <label>"); } break; case SUBCMD_IGNORE: if (args.length > 1) { try { ThingUID thingUID = new ThingUID(args[1]); PersistentInbox persistentInbox = (PersistentInbox) inbox; persistentInbox.setFlag(thingUID, DiscoveryResultFlag.IGNORED); } catch (IllegalArgumentException e) { console.println("'" + args[1] + "' is no valid thing UID."); } } else { console.println("Cannot approve thing as managed thing provider is missing."); } break; case SUBCMD_LIST_IGNORED: printInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.IGNORED))); break; case SUBCMD_CLEAR: clearInboxEntries(console, inbox.getAll()); break; default: break; } } else { printInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.NEW))); } }

Target:
public void execute(String[] args, Console console) { if (args.length > 0) { final String subCommand = args[0]; switch (subCommand) { case SUBCMD_APPROVE: if (args.length > 2) { String label = args[2]; try { ThingUID thingUID = new ThingUID(args[1]); List<DiscoveryResult> results = inbox.stream().filter(forThingUID(thingUID)) .collect(Collectors.toList()); if (results.isEmpty()) { console.println("No matching inbox entry could be found."); return; } inbox.approve(thingUID, label); } catch (Exception e) { console.println(e.getMessage()); } } else { console.println("Specify thing id to approve: inbox approve <thingUID> <label>"); } break; case SUBCMD_IGNORE: if (args.length > 1) { try { ThingUID thingUID = new ThingUID(args[1]); PersistentInbox persistentInbox = (PersistentInbox) inbox; persistentInbox.setFlag(thingUID, DiscoveryResultFlag.IGNORED); } catch (IllegalArgumentException e) { console.println("'" + args[1] + "' is no valid thing UID."); } } else { console.println("Cannot approve thing as managed thing provider is missing."); } break; case SUBCMD_LIST_IGNORED: printInboxEntries(console, inbox.stream().filter(withFlag((DiscoveryResultFlag.IGNORED))) .collect(Collectors.toList())); break; case SUBCMD_CLEAR: clearInboxEntries(console, inbox.getAll()); break; default: break; } } else { printInboxEntries(console, inbox.stream().filter(withFlag((DiscoveryResultFlag.NEW))) .collect(Collectors.toList())); } }
Source:
public SearchBox(ThemeManager themeManager, Consumer<String> onSearch, Runnable onClear) { this.searchField = new TextField(); this.searchField.getStyleClass().add("searchBar"); this.searchField.prefHeightProperty().bind(this.prefHeightProperty()); this.searchField.prefWidthProperty().bind(this.prefWidthProperty()); this.searchField.setOnAction(event -> onSearch.accept(getText())); AnchorPane.setLeftAnchor(searchField, 0.0); AnchorPane.setRightAnchor(searchField, 0.0); this.clearButton = new Button(); this.clearButton.getStyleClass().add("searchCleanButton"); this.clearButton.styleProperty().set( "-fx-graphic: url('" + themeManager.getResourceUrl(SearchBox.cleanButtonIcon) + "');"); this.clearButton.setOnMouseClicked(event -> { this.searchField.clear(); onClear.run(); }); AnchorPane.setRightAnchor(clearButton, 0.0); this.getChildren().addAll(searchField, clearButton); }

Target:
public SearchBox(ThemeManager themeManager, Consumer<String> onSearch, Runnable onClear) { this.searchField = new TextField(); this.searchField.getStyleClass().add("searchBar"); this.searchField.prefHeightProperty().bind(this.prefHeightProperty()); this.searchField.prefWidthProperty().bind(this.prefWidthProperty()); this.searchField.textProperty().addListener(event -> onSearch.accept(getText())); AnchorPane.setLeftAnchor(searchField, 0.0); AnchorPane.setRightAnchor(searchField, 0.0); this.clearButton = new Button(); this.clearButton.getStyleClass().add("searchCleanButton"); this.clearButton.styleProperty().set( "-fx-graphic: url('" + themeManager.getResourceUrl(SearchBox.cleanButtonIcon) + "');"); this.clearButton.setOnMouseClicked(event -> { this.searchField.clear(); onClear.run(); }); AnchorPane.setRightAnchor(clearButton, 0.0); this.getChildren().addAll(searchField, clearButton); }
Source:
private static void verifySameSpatialReference(OGCGeometry leftGeometry, OGCGeometry rightGeometry) { checkArgument(Objects.equals(leftGeometry.getEsriSpatialReference(), rightGeometry.getEsriSpatialReference()), "Input Geometries Spatial Reference do not match"); }

Target:
private static void verifySameSpatialReference(OGCGeometry leftGeometry, OGCGeometry rightGeometry) { checkArgument(Objects.equals(leftGeometry.getEsriSpatialReference(), rightGeometry.getEsriSpatialReference()), "Input geometries must have same spatial reference"); }
Source:
private Action getImportMappingAction(final Composite parent) { if (fImportMappingAction != null) { return fImportMappingAction; } fImportMappingAction = new Action() { @Override public void run() { FileDialog dialog = new FileDialog(parent.getShell()); dialog.setText(Messages.CallStackView_ImportMappingDialogTitle); String filePath = dialog.open(); if (filePath == null) { return; } fNameMapping = FunctionNameMapper.mapFromNmTextFile(new File(filePath)); buildThreadList(fTrace, new NullProgressMonitor()); redraw(); } }; fImportMappingAction.setText(Messages.CallStackView_ImportMappingButtonText); fImportMappingAction.setToolTipText(Messages.CallStackView_ImportMappingButtonTooltip); fImportMappingAction.setImageDescriptor(null); return fImportMappingAction; }

Target:
private Action getImportMappingAction(final Composite parent) { if (fImportMappingAction != null) { return fImportMappingAction; } fImportMappingAction = new Action() { @Override public void run() { FileDialog dialog = new FileDialog(parent.getShell()); dialog.setText(Messages.CallStackView_ImportMappingDialogTitle); String filePath = dialog.open(); if (filePath == null) { return; } Job job = new ImportMappingJob(new File(filePath)); job.schedule(); } }; fImportMappingAction.setText(Messages.CallStackView_ImportMappingButtonText); fImportMappingAction.setToolTipText(Messages.CallStackView_ImportMappingButtonTooltip); fImportMappingAction.setImageDescriptor(null); return fImportMappingAction; }
Source:
public void testConsumerReadSplitResults() throws Exception { final Map<String, Object> headers = new HashMap<>(); String endpoint = "olingo4://read/People?consumer.splitResult=true"; int expectedEntities = 20; final ClientEntitySet entities = (ClientEntitySet)requestBodyAndHeaders(endpoint, null, headers); assertNotNull(entities); assertEquals(expectedEntities, entities.getEntities().size()); int expectedMsgCount = 3; MockEndpoint mockEndpoint = getMockEndpoint("mock:consumer-splitresult"); mockEndpoint.expectedMinimumMessageCount(expectedMsgCount); mockEndpoint.assertIsSatisfied(); for (int i = 0; i < expectedMsgCount; ++i) { Object body = mockEndpoint.getExchanges().get(i).getIn().getBody(); assertTrue(body instanceof ClientEntity); ClientEntity entity = (ClientEntity)body; ClientProperty nameProperty = entity.getProperty("UserName"); assertNotNull(nameProperty); switch(i) { case 0: assertEquals("russellwhyte", nameProperty.getValue().toString()); break; case 1: assertEquals("scottketchum", nameProperty.getValue().toString()); break; case 2: assertEquals("ronaldmundy", nameProperty.getValue().toString()); break; } } }

Target:
public void testConsumerReadSplitResults() throws Exception { final Map<String, Object> headers = new HashMap<>(); String endpoint = "olingo4://read/People?consumer.splitResult=true"; int expectedEntities = 20; int expectedMsgCount = 3; MockEndpoint mockEndpoint = getMockEndpoint("mock:consumer-splitresult"); mockEndpoint.expectedMinimumMessageCount(expectedMsgCount); final ClientEntitySet entities = (ClientEntitySet)requestBodyAndHeaders(endpoint, null, headers); assertNotNull(entities); assertEquals(expectedEntities, entities.getEntities().size()); mockEndpoint.assertIsSatisfied(); for (int i = 0; i < expectedMsgCount; ++i) { Object body = mockEndpoint.getExchanges().get(i).getIn().getBody(); assertTrue(body instanceof ClientEntity); ClientEntity entity = (ClientEntity)body; ClientProperty nameProperty = entity.getProperty("UserName"); assertNotNull(nameProperty); switch(i) { case 0: assertEquals("russellwhyte", nameProperty.getValue().toString()); break; case 1: assertEquals("scottketchum", nameProperty.getValue().toString()); break; case 2: assertEquals("ronaldmundy", nameProperty.getValue().toString()); break; default: } } }
Source:
public long getArrivalTime() { long multiplier = 1000000; if (this.pcapGlobalHeader.timestampsInNs()) { multiplier = multiplier*1000; } return this.pcapHeader.getTimeStampSeconds() * multiplier + this.pcapHeader.getTimeStampMicroOrNanoSeconds(); }

Target:
public long getArrivalTime() { final long multiplier = pcapGlobalHeader.timestampsInNs() ? 1000000000 : 1000000; return this.pcapHeader.getTimeStampSeconds() * multiplier + this.pcapHeader.getTimeStampMicroOrNanoSeconds(); }