auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void forceResize () { long topHandle = topHandle (); GtkRequisition requisition = new GtkRequisition (); GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation(topHandle, allocation); gtk_widget_size_request (topHandle, requisition); OS.gtk_widget_size_allocate (topHandle, allocation); }

Target:
void forceResize () { long topHandle = topHandle (); GtkRequisition requisition = new GtkRequisition (); gtk_widget_size_request (topHandle, requisition); GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation(topHandle, allocation); OS.gtk_widget_size_allocate (topHandle, allocation); }
Source:
public void getTokenForEmbedCodes(List<String> embedCodes, EmbedTokenGeneratorCallback callback) { String embedCodesString = ""; for (String ec : embedCodes) { if(ec.equals("")) embedCodesString += ","; embedCodesString += ec; } HashMap<String, String> params = new HashMap<String, String>(); params.put("account_id", ACCOUNT_ID); String uri = "/sas/embed_token/" + PCODE + "/" + embedCodesString; EmbeddedSecureURLGenerator urlGen = new EmbeddedSecureURLGenerator(APIKEY, SECRET); URL tokenUrl = urlGen.secureURL("<LINK_0>", uri, params); callback.setEmbedToken(tokenUrl.toString()); }

Target:
public void getTokenForEmbedCodes(List<String> embedCodes, EmbedTokenGeneratorCallback callback) { String embedCodesString = ""; for (String ec : embedCodes) { if (ec.equals("")) { embedCodesString += ","; } embedCodesString += ec; } HashMap<String, String> params = new HashMap<String, String>(); params.put("account_id", ACCOUNT_ID); String uri = "/sas/embed_token/" + PCODE + "/" + embedCodesString; EmbeddedSecureURLGenerator urlGen = new EmbeddedSecureURLGenerator(APIKEY, SECRET); URL tokenUrl = urlGen.secureURL("<LINK_0>", uri, params); callback.setEmbedToken(tokenUrl.toString()); }
Source:
public boolean onInterceptTouchEvent(MotionEvent e) { int x = Math.round(e.getRawX()); int y = Math.round(e.getRawY()); try { scrollView.getGlobalVisibleRect(scrollViewRect); boolean touchedScrollView = x > scrollViewRect.left && x < scrollViewRect.right && y > scrollViewRect.top && y < scrollViewRect.bottom; boolean emptyTruncateText = songTruncated.isEmpty(); boolean isTextTruncated = songTruncated.endsWith("…"); switch (e.getAction()) { case MotionEvent.ACTION_DOWN: if (!touchedScrollView || (!emptyTruncateText && !isTextTruncated)){ scrollView.cancelPendingInputEvents(); return false; } startX = e.getX(); startY = e.getY(); isTap = true; onTouchEvent(e); break; case MotionEvent.ACTION_MOVE: float distanceY = Math.abs(e.getY() - startY); if (touchedScrollView) { float distance = Math.abs(e.getX() - startX); if (distance > MAX_CLICK_DISTANCE) { if (!emptyTruncateText){ textView.setText(song); }else{ Log.e("E/TouchInterceptFL","songTruncated is empty or null. Did you remember " + "to set the song string when setting the song name in your text view?"); } cancelPendingInputEvents(); cancelLongPress(); scrollView.cancelLongPress(); scrollView.cancelPendingInputEvents(); isTap = false; } } if (distanceY > MAX_VERTICAL_DISTANCE) { cancelLongPress(); cancelPendingInputEvents(); scrollView.cancelLongPress(); scrollView.cancelPendingInputEvents(); isTap = false; } break; case MotionEvent.ACTION_UP: if (touchedScrollView) { if (isTap) onTouchEvent(e); } break; } return false; }catch (NullPointerException exception) { Log.e(TAG, NULL_VIEWS_EXCEPTION_MESSAGE); Log.e(TAG, exception.toString()); onTouchEvent(e); return false; } }

Target:
public boolean onInterceptTouchEvent(MotionEvent e) { int x = Math.round(e.getRawX()); int y = Math.round(e.getRawY()); scrollView = getTouchInterceptHorizontalScrollView(); scrollView.getGlobalVisibleRect(scrollViewRect); boolean touchedScrollView = x > scrollViewRect.left && x < scrollViewRect.right && y > scrollViewRect.top && y < scrollViewRect.bottom; if (scrollView.isScrollable()) { switch (e.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!touchedScrollView) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { scrollView.cancelPendingInputEvents(); } else { scrollView.cancelLongPress(); } return false; } startX = e.getX(); isTap = true; onTouchEvent(e); break; case MotionEvent.ACTION_MOVE: if (touchedScrollView) { float distance = Math.abs(e.getX() - startX); if (distance > MAX_CLICK_DISTANCE) { isTap = false; cancelLongClick(); } } break; case MotionEvent.ACTION_CANCEL: if (e.getX() != 0) { cancelLongClick(); } break; case MotionEvent.ACTION_UP: if (touchedScrollView && isTap) { onTouchEvent(e); } break; } return false; } if (touchedScrollView) { if (e.getAction() == MotionEvent.ACTION_CANCEL && e.getX() != 0) { cancelLongClick(); } onTouchEvent(e); } return false; }
Source:
public void init(ServletConfig config) throws ServletException { AuthenticationHandler.setSystemProperties("krb5.conf"); try { AuthenticationHandler.initialize(); } catch (GSSException | LoginException | PrivilegedActionException e) { log.error("Error when creating gss credentials ." + e); } }

Target:
public void init(ServletConfig config) throws ServletException { AuthenticationHandlerUtil.setSystemProperties("krb5.conf"); try { AuthenticationHandlerUtil.initialize(); } catch (GSSException | LoginException | PrivilegedActionException e) { log.error("Error when creating gss credentials .", e); throw new ServletException("Error when creating gss credentials ."); } }
Source:
public ThreadPoolBulkheadConfig build() { if (config.maxThreadPoolSize < config.coreThreadPoolSize) { throw new IllegalArgumentException( "maxThreadPoolSize must be a greater than or equals to coreThreadPoolSize"); } if (contextPropagatorClasses.length > 0) { config.contextPropagators = stream(contextPropagatorClasses) .map(c -> instantiateClassDefConstructor(c)) .collect(toList()); } if (contextPropagators.size() > 0){ config.contextPropagators = this.contextPropagators; } return config; }

Target:
public ThreadPoolBulkheadConfig build() { if (config.maxThreadPoolSize < config.coreThreadPoolSize) { throw new IllegalArgumentException( "maxThreadPoolSize must be a greater than or equals to coreThreadPoolSize"); } if (contextPropagatorClasses.length > 0) { config.contextPropagators.addAll((List)stream(contextPropagatorClasses) .map(c -> instantiateClassDefConstructor(c)) .collect(toList())); } if (contextPropagators.size() > 0){ config.contextPropagators.addAll((List)this.contextPropagators); } return config; }
Source:
public List<IpAddressOrRange> ipRules() { return this.innerModel().ipRules(); }

Target:
public List<IpAddressOrRange> ipRules() { return Collections.unmodifiableList(this.innerModel().ipRules()); }
Source:
protected void setState(ServerState newState) { boolean updated = false; while(!updated){ ServerState currState = getState(); if (currState == ServerState.SHUTDOWN && newState != ServerState.SHUTDOWN) { throw new IllegalStateException("Server is in SHUTDOWN state. Can't be changed"); } updated = state.compareAndSet(currState, newState); } }

Target:
protected void setState(ServerState newState) { state.updateAndGet(currState -> { if (currState == ServerState.SHUTDOWN && newState != ServerState.SHUTDOWN) { throw new IllegalStateException("Server is in SHUTDOWN state. Can't be changed"); } return newState; }); }
Source:
public void getAllTickersShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final TickerService tickerService = adapter.create(TickerService.class); tickerService.getAllTickers(new RetrofitPromise<List<Ticker>>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/ticker", MOCK_URL)); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); }

Target:
public void getAllTickersShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final TickerService tickerService = adapter.create(TickerService.class); tickerService.getAllTickers(new RetrofitPromise<List<Ticker>>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/ticker", MOCK_URL)); }
Source:
public void setUp() throws Exception { for (int i = 1; i <= NB_JOBS; i++) { String user = DEFAULT_USER_NAME; if (i <= NB_JOBS_AS_DEMO_USER) { user = DEMO_USERNAME; } InternalJob job = insertNewJob(user); InternalTask task = job.getITasks().get(0); job.setStatus(JobStatus.FINISHED); job.setNumberOfFinishedTasks(1); job.setRemovedTime(-1L); task.setStatus(TaskStatus.FINISHED); dbManager.updateJobAndTasksState(job); long startTime = getTimeRelativeToReference(-i - 1); long endTime = getTimeRelativeToReference(-i); dbManager.updateStartTime( job.getId().longValue(), task.getId().longValue(), startTime); dbManager.updateFinishedTime( job.getId().longValue(), task.getId().longValue(),endTime); if (i == NTH_JOB_TO_BE_CROND) { dbManager.updateScheduledTime( job.getId().longValue(), task.getId().longValue(), SCHEDULED_TIME); } log.info("Job " + job.getId() + " with task " + task.getId() + " has startTime=" + startTime + " and finishedTime=" + endTime); } }

Target:
public void setUp() throws Exception { for (int jobCount = 1; jobCount <= NB_JOBS; jobCount++) { String user = DEFAULT_USER_NAME; if (jobCount <= NB_JOBS_AS_DEMO_USER) { user = DEMO_USERNAME; } InternalJob job = insertNewJob(user); InternalTask task = job.getITasks().get(0); job.setStatus(JobStatus.FINISHED); job.setNumberOfFinishedTasks(1); job.setRemovedTime(-1L); task.setStatus(TaskStatus.FINISHED); dbManager.updateJobAndTasksState(job); long startTime = getTimeRelativeToReference(-jobCount - 1); long endTime = getTimeRelativeToReference(-jobCount); dbManager.updateStartTime( job.getId().longValue(), task.getId().longValue(), startTime); dbManager.updateFinishedTime( job.getId().longValue(), task.getId().longValue(),endTime); if (jobCount == JOB_TO_BE_CROND) { dbManager.updateScheduledTime( job.getId().longValue(), task.getId().longValue(), SCHEDULED_TIME); } log.info("Job " + job.getId() + " with task " + task.getId() + " has startTime=" + startTime + " and finishedTime=" + endTime); } }
Source:
public int compareTo(@Nullable ITmfStateValue object) { if (!(object instanceof LongStateValue)) { return -1; } LongStateValue other = (LongStateValue) object; return Long.compare(this.value, other.value); }

Target:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { return 1; } int result = 0; switch (object.getType()) { case INTEGER: long otherLongValue = ((IntegerStateValue) object).unboxInt(); result = Long.compare(this.value, otherLongValue); break; case DOUBLE: double otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); result = Double.compare(this.value, otherDoubleValue); break; case LONG: otherLongValue = ((LongStateValue) object).unboxLong(); result = Long.compare(this.value, otherLongValue); break; case NULL: result = 1; break; case STRING: result = -1; break; default: break; } return result; }
Source:
public void setupLayout() { Form mainForm = Form.create(this, Form.MAIN); mainForm.addRow(Widget.widget(sourceType).setWidgetType(Widget.RADIO_WIDGET_TYPE)); mainForm.addRow(Widget.widget(moduleName).setWidgetType(Widget.DATALIST_WIDGET_TYPE)); mainForm.addRow(Widget.widget(query).setWidgetType(Widget.TEXT_AREA_WIDGET_TYPE)); mainForm.addRow(Widget.widget(selectColumnIds).setWidgetType(Widget.MULTIPLE_VALUE_SELECTOR_WIDGET_TYPE)); selectColumnIds.setDisplayName("Column Selection"); mainForm.getWidget(selectColumnIds).setVisible(false); selectColumnIds.setRequired(false); }

Target:
public void setupLayout() { Form mainForm = Form.create(this, Form.MAIN); mainForm.addRow(Widget.widget(sourceType).setWidgetType(Widget.RADIO_WIDGET_TYPE)); mainForm.addRow(Widget.widget(moduleName).setWidgetType(Widget.DATALIST_WIDGET_TYPE)); mainForm.addRow(Widget.widget(query).setWidgetType(Widget.TEXT_AREA_WIDGET_TYPE)); mainForm.addRow(Widget.widget(selectColumnIds).setWidgetType(Widget.MULTIPLE_VALUE_SELECTOR_WIDGET_TYPE)); mainForm.getWidget(selectColumnIds).setVisible(false); selectColumnIds.setRequired(false); }
Source:
public void shouldExecuteAlltests() { projectExplorer.openItemByPath(PATH_TO_ANOTHER_TEST_CLASS); editor.waitActive(); editor.goToCursorPositionVisible(26, 17); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); try { notifications.waitExpectedMessageOnProgressPanelAndClosed( "Test runner executed successfully."); } catch (WebDriverException ex) { fail("Known issue <LINK_0>"); } try { pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother"); } catch (TimeoutException ex) { fail("Known issue <LINK_1>", ex); } assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); editor.goToCursorPositionVisible(31, 17); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother"); assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); String testErrorMessage = pluginConsole.getTestErrorMessage(); assertTrue( testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE), "Actual message was: " + testErrorMessage); assertTrue( testErrorMessage.endsWith(END_OF_FAILED_TEST), "Actual message was: " + testErrorMessage); }

Target:
public void shouldExecuteAlltests() { projectExplorer.openItemByPath(PATH_TO_ANOTHER_TEST_CLASS); editor.waitActive(); editor.goToCursorPositionVisible(26, 17); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); try { notifications.waitExpectedMessageOnProgressPanelAndClosed( "Test runner executed successfully."); } catch (TimeoutException ex) { fail("Known issue <LINK_0>"); } try { pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother"); } catch (TimeoutException ex) { fail("Known issue <LINK_1>", ex); } assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); editor.goToCursorPositionVisible(31, 17); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother"); assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); String testErrorMessage = pluginConsole.getTestErrorMessage(); assertTrue( testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE), "Actual message was: " + testErrorMessage); assertTrue( testErrorMessage.endsWith(END_OF_FAILED_TEST), "Actual message was: " + testErrorMessage); }
Source:
public String computeTimePattern(Map<String, String> prefsMap) { String dateTimeFormat = prefsMap.get(DATIME); if (dateTimeFormat == null) { dateTimeFormat = DEFAULT_TIME_PATTERN; } String dateFormat; String timeFormat; int index = dateTimeFormat.indexOf(' '); if (index != -1) { dateFormat = dateTimeFormat.substring(0, dateTimeFormat.indexOf(' ') + 1); timeFormat = dateTimeFormat.substring(dateFormat.length()); } else { dateFormat = ""; timeFormat = dateTimeFormat; } String dateFieldSep = prefsMap.get(DATE_DELIMITER); String timeFieldSep = prefsMap.get(TIME_DELIMITER); String dateFmt = dateFormat.replaceAll("-", dateFieldSep); String timeFmt = timeFormat.replaceAll(":", timeFieldSep); String ssecFmt = computeSubSecFormat(prefsMap); return dateFmt + timeFmt + "." + ssecFmt; }

Target:
public String computeTimePattern(Map<String, String> prefsMap) { String dateTimeFormat = prefsMap.get(DATIME); if (dateTimeFormat == null) { dateTimeFormat = DEFAULT_TIME_PATTERN; } String dateFormat; String timeFormat; int index = dateTimeFormat.indexOf(' '); if (index != -1) { dateFormat = dateTimeFormat.substring(0, dateTimeFormat.indexOf(' ') + 1); timeFormat = dateTimeFormat.substring(dateFormat.length()); } else { dateFormat = ""; timeFormat = dateTimeFormat; } String dateFieldSep = prefsMap.get(DATE_DELIMITER); String timeFieldSep = prefsMap.get(TIME_DELIMITER); String dateFmt = dateFormat.replaceAll("-", dateFieldSep); String timeFmt = timeFormat.replaceAll(":", timeFieldSep); String ssecFmt = computeSubSecFormat(prefsMap); return dateFmt + timeFmt + (ssecFmt.equals(SUBSEC_NO_FMT) ? "" : '.' + ssecFmt); }
Source:
public void onMetadataChanged(@NonNull MediaItem item) { final MediaSessionImplBase session = getSession(); if (session == null) { return; } SessionPlayer player = session.getPlayer(); if (player.getCurrentMediaItem() == item) { boolean notified = updateCurrentMediaItemMetadataWithDuration(player); if (!notified) { notifyCurrentMediaItemChanged(item); } } }

Target:
public void onMetadataChanged(@NonNull MediaItem item) { final MediaSessionImplBase session = getSession(); if (session == null) { return; } SessionPlayer player = session.getPlayer(); if (player.getCurrentMediaItem() == item) { boolean notifyingPended = updateCurrentMediaItemMetadataWithDuration(player); if (!notifyingPended) { notifyCurrentMediaItemChanged(item); } } }
Source:
public void prepare(KubernetesEnvironment k8sEnv, String workspaceId) throws InfrastructureException { if (ephemeralWorkspaceAdapter.isEphemeral(k8sEnv.getAttributes())) { return; } final Collection<PersistentVolumeClaim> claims = k8sEnv.getPersistentVolumeClaims().values(); if (!claims.isEmpty()) { LOG.debug("Preparing PVC started for ws {}", workspaceId); final KubernetesNamespace namespace = factory.create(workspaceId); final KubernetesPersistentVolumeClaims pvcs = namespace.persistentVolumeClaims(); final Set<String> existing = pvcs.get().stream().map(p -> p.getMetadata().getName()).collect(toSet()); for (PersistentVolumeClaim pvc : claims) { final String[] subpaths = (String[]) pvc.getAdditionalProperties().remove(format(SUBPATHS_PROPERTY_FMT, workspaceId)); if (!existing.contains(pvc.getMetadata().getName())) { pvcs.create(pvc); } if (preCreateDirs && subpaths != null) { pvcSubPathHelper.createDirs(workspaceId, subpaths); } } LOG.debug("Preparing PVC done for ws {}", workspaceId); } }

Target:
public void prepare(KubernetesEnvironment k8sEnv, String workspaceId) throws InfrastructureException { if (ephemeralWorkspaceAdapter.isEphemeral(k8sEnv.getAttributes())) { return; } final Collection<PersistentVolumeClaim> claims = k8sEnv.getPersistentVolumeClaims().values(); if (!claims.isEmpty()) { LOG.debug("Preparing PVC started for workspace '{}'", workspaceId); final KubernetesNamespace namespace = factory.create(workspaceId); final KubernetesPersistentVolumeClaims pvcs = namespace.persistentVolumeClaims(); final Set<String> existing = pvcs.get().stream().map(p -> p.getMetadata().getName()).collect(toSet()); for (PersistentVolumeClaim pvc : claims) { final String[] subpaths = (String[]) pvc.getAdditionalProperties().remove(format(SUBPATHS_PROPERTY_FMT, workspaceId)); if (!existing.contains(pvc.getMetadata().getName())) { pvcs.create(pvc); } if (preCreateDirs && subpaths != null) { pvcSubPathHelper.createDirs(workspaceId, subpaths); } } LOG.debug("Preparing PVC done for workspace '{}'", workspaceId); } }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("[proxy=").append(proxy).append(", proxycreds=") .append(creds).append(", proxyBypass=").append(proxyBypass).append("]"); return builder.toString(); }

Target:
public String toString() { return "[proxy=" + proxy + ", proxyCredential=" + creds + ", proxyBypass=" + proxyBypass + ", proxyProfileMap=" + proxyProfileMap + "]"; }
Source:
protected void doExecute() { if (monitor == null) { monitor = new NullProgressMonitor(); } if (semanticResource != null && session != null) { Collection<Resource> semanticResources = new ArrayList<Resource>(session.getSemanticResources()); if (session instanceof DAnalysisSessionImpl) semanticResources.addAll(((DAnalysisSessionEObject) session).getControlledResources()); if (semanticResources.contains(semanticResource)) { if (session instanceof DAnalysisSessionImpl) ((DAnalysisSessionImpl) session).removeSemanticResource(semanticResource, monitor, removeReferencingResources); else session.removeSemanticResource(semanticResource, monitor); } } }

Target:
protected void doExecute() { if (monitor == null) { monitor = new NullProgressMonitor(); } if (semanticResource != null && session != null) { Collection<Resource> semanticResources = new ArrayList<Resource>(session.getSemanticResources()); if (session instanceof DAnalysisSessionImpl) { semanticResources.addAll(((DAnalysisSessionEObject) session).getControlledResources()); } if (semanticResources.contains(semanticResource)) { if (session instanceof DAnalysisSessionImpl) { ((DAnalysisSessionImpl) session).removeSemanticResource(semanticResource, monitor, removeReferencingResources); } else { session.removeSemanticResource(semanticResource, monitor); } } } }
Source:
public DB2QuarterDiffFunction() { super("(select sign(i1) * floor(abs(i1)) from lateral(values (trunc(-months_between(?1, ?2))/3)) as temp(i1))"); }

Target:
public DB2QuarterDiffFunction() { super("-int(months_between(cast(?1 as timestamp),cast(?2 as timestamp))/3)"); }
Source:
public static StreamApplication createStreamApplication(Config config) { if (config.get(StreamApplication.APP_CLASS_CONFIG) != null && !config.get(StreamApplication.APP_CLASS_CONFIG).isEmpty()) { TaskConfig taskConfig = new TaskConfig(config); if (taskConfig.getTaskClass() != null && !taskConfig.getTaskClass().isEmpty()) { throw new ConfigException("High level StreamApplication API cannot be used together with low-level API using task.class."); } String appClassName = config.get(StreamApplication.APP_CLASS_CONFIG); try { Class<?> builderClass = Class.forName(appClassName); return (StreamApplication) builderClass.newInstance(); } catch (Throwable t) { log.error("Failed to validate StreamApplication class from the config. {}={}", StreamApplication.APP_CLASS_CONFIG, appClassName); throw new ConfigException(String.format("%s is not a StreamApplication.", appClassName)); } } else { return null; } }

Target:
public static StreamApplication createStreamApplication(Config config) { if (config.get(StreamApplication.APP_CLASS_CONFIG) != null && !config.get(StreamApplication.APP_CLASS_CONFIG).isEmpty()) { TaskConfig taskConfig = new TaskConfig(config); if (taskConfig.getTaskClass() != null && !taskConfig.getTaskClass().isEmpty()) { throw new ConfigException("High level StreamApplication API cannot be used together with low-level API using task.class."); } String appClassName = config.get(StreamApplication.APP_CLASS_CONFIG); try { Class<?> builderClass = Class.forName(appClassName); return (StreamApplication) builderClass.newInstance(); } catch (Throwable t) { throw new ConfigException(String.format("%s is not a StreamApplication.", appClassName)); } } else { return null; } }
Source:
protected void testAccessControl_studentAccessOtherTeam_inaccessible() { ______TS("Student intends to access other team's response, should not be accessible"); loginAsStudent(student5InCourse1.getGoogleId()); assertEquals(FeedbackParticipantType.TEAMS, logic.getFeedbackQuestion(typicalResponse2.getFeedbackQuestionId()).getGiverType()); assertNotEquals(student5InCourse1.getTeam(), typicalResponse2.getGiver()); FeedbackResponseUpdateRequest updateRequest = new FeedbackResponseUpdateRequest(); updateRequest.setQuestionType(FeedbackQuestionType.MCQ); updateRequest.setRecipientIdentifier(student5InCourse1.getEmail()); FeedbackMcqResponseDetails newDetails = new FeedbackMcqResponseDetails(); newDetails.setAnswer("TEAM_NOT_EXIST"); updateRequest.setResponseDetails(newDetails); String[] studentAccessOtherTeamParams = new String[] { Const.ParamsNames.INTENT, Intent.STUDENT_SUBMISSION.toString(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, typicalResponse2.getId(), }; UpdateFeedbackResponseAction a = getAction(updateRequest, studentAccessOtherTeamParams); assertThrows(UnauthorizedAccessException.class, a::checkAccessControl); }

Target:
protected void testAccessControl_studentAccessOtherTeam_inaccessible() { ______TS("Student intends to access other team's response, should not be accessible"); StudentAttributes student5InCourse1 = typicalBundle.students.get("student5InCourse1"); StudentAttributes student4inCourse1 = typicalBundle.students.get("student4InCourse1"); FeedbackSessionAttributes session2 = typicalBundle.feedbackSessions.get("session2InCourse1"); FeedbackQuestionAttributes question2 = logic.getFeedbackQuestion( session2.getFeedbackSessionName(), session2.getCourseId(), 1); FeedbackResponseAttributes student4ResponseToTeam = logic.getFeedbackResponse(question2.getId(), student4inCourse1.getEmail(), "Team 1.2"); loginAsStudent(student5InCourse1.getGoogleId()); assertEquals(FeedbackParticipantType.TEAMS, logic.getFeedbackQuestion(student4ResponseToTeam.getFeedbackQuestionId()).getGiverType()); assertNotEquals(student5InCourse1.getTeam(), student4ResponseToTeam.getGiver()); FeedbackResponseUpdateRequest updateRequest = getUpdateRequest(student5InCourse1.getEmail()); String[] studentAccessOtherTeamParams = new String[] { Const.ParamsNames.INTENT, Intent.STUDENT_SUBMISSION.toString(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, student4ResponseToTeam.getId(), }; verifyCannotAccess(updateRequest, studentAccessOtherTeamParams); }
Source:
protected void addContextResolver(ContextResolver provider, Class providerClass, boolean builtin) { if (providerClass.getName().contains("$$Lambda$")) { throw new ResteasyProviderFactoryException("Registering a context resolver doesn't support lambdas."); } Type parameter = Types.getActualTypeArgumentsOfAnInterface(providerClass, ContextResolver.class)[0]; addContextResolver(provider, parameter, providerClass, builtin); }

Target:
protected void addContextResolver(ContextResolver provider, Class providerClass, boolean builtin) { if (providerClass.getName().contains("$$Lambda$")) { throw new RuntimeException(Messages.MESSAGES.registeringContextResolverAsLambda()); } Type parameter = Types.getActualTypeArgumentsOfAnInterface(providerClass, ContextResolver.class)[0]; addContextResolver(provider, parameter, providerClass, builtin); }
Source:
public static AnyValue multiply( AnyValue lhs, AnyValue rhs ) { if ( lhs == NO_VALUE || rhs == NO_VALUE ) { return NO_VALUE; } if ( lhs instanceof NumberValue && rhs instanceof NumberValue ) { return ((NumberValue) lhs).times( (NumberValue) rhs ); } if ( lhs instanceof DurationValue ) { if ( rhs instanceof NumberValue ) { return ((DurationValue) lhs).mul( (NumberValue) rhs ); } } if ( rhs instanceof DurationValue ) { if ( lhs instanceof NumberValue ) { return ((DurationValue) rhs).mul( (NumberValue) lhs ); } } throw new CypherTypeException( String.format( "Don't know how to subtract `%s` and `%s`", lhs, rhs ), null ); }

Target:
public static AnyValue multiply( AnyValue lhs, AnyValue rhs ) { if ( lhs == NO_VALUE || rhs == NO_VALUE ) { return NO_VALUE; } if ( lhs instanceof NumberValue && rhs instanceof NumberValue ) { return ((NumberValue) lhs).times( (NumberValue) rhs ); } if ( lhs instanceof DurationValue ) { if ( rhs instanceof NumberValue ) { return ((DurationValue) lhs).mul( (NumberValue) rhs ); } } if ( rhs instanceof DurationValue ) { if ( lhs instanceof NumberValue ) { return ((DurationValue) rhs).mul( (NumberValue) lhs ); } } throw new CypherTypeException( String.format( "Don't know how to multiply `%s` and `%s`", lhs, rhs ), null ); }
Source:
public void remove_unsupportedTypeIgnored() { final int initialSize = list.size(); final List<Object> unsupportedValues = Arrays.<Object>asList( new int[] {0}, new StringBuilder("0") ); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { for (Object unsupportedValue : unsupportedValues) { list.remove(unsupportedValue); } } }); assertEquals(initialSize, list.size()); }

Target:
public void remove_unsupportedTypeIgnored() { final int initialSize = list.size(); final List<Object> unsupportedValues = Arrays.<Object>asList( new int[] {0}, new StringBuilder("0") ); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { for (Object unsupportedValue : unsupportedValues) { assertFalse(list.remove(unsupportedValue)); } } }); assertEquals(initialSize, list.size()); }
Source:
public void setBackground(Color color) { checkWidget(); Color disabledBg = getDisplay().getSystemColor(SWT.COLOR_TEXT_DISABLED_BACKGROUND); boolean backgroundDisabled = false; if (!this.enabled && color == null) { if (background != null) { if (background.equals(disabledBg)) { return; } else { color = new Color (getDisplay(), disabledBg.getRGBA()); backgroundDisabled = true; } } } customBackground = color != null && !this.enableDisableCall && !backgroundDisabled; background = color; super.setBackground(color); resetCache(0, content.getLineCount()); setCaretLocation(); super.redraw(); }

Target:
public void setBackground(Color color) { checkWidget(); boolean backgroundDisabled = false; if (!this.enabled && color == null) { if (background != null) { Color disabledBg = getDisplay().getSystemColor(SWT.COLOR_TEXT_DISABLED_BACKGROUND); if (background.equals(disabledBg)) { return; } else { color = new Color (getDisplay(), disabledBg.getRGBA()); backgroundDisabled = true; } } } customBackground = color != null && !this.insideSetEnableCall && !backgroundDisabled; background = color; super.setBackground(color); resetCache(0, content.getLineCount()); setCaretLocation(); super.redraw(); }
Source:
public void testDouble() { assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day is null"); assertQueryUsingH2Cte("SELECT count(ship_day) FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT sum(quantity), sum(striking_factories) FROM lineitem_ex WHERE ship_by_air is null"); assertQueryUsingH2Cte("SELECT quantity * (1 - discount) * (1 + tax), striking_factories * quantity FROM lineitem_ex WHERE is_returned = true"); assertQuery("SELECT quantity, extendedprice, discount, tax from lineitem"); assertQuery("SELECT quantity, extendedprice, discount, tax from lineitem WHERE quantity = 4"); assertQuery("SELECT quantity, extendedprice, discount, tax from lineitem WHERE quantity = 4 AND discount = 0"); assertQueryUsingH2Cte("SELECT quantity, extendedprice, discount, tax, striking_factories from lineitem_ex WHERE quantity = 4 AND discount = 0 AND tax=.05"); assertQueryUsingH2Cte("SELECT quantity, extendedprice, discount, striking_factories, orderkey, partkey, suppkey from lineitem_ex WHERE quantity = 4 AND discount = 0 AND tax=.05"); assertQuery("SELECT quantity, extendedprice, discount, tax, orderkey, partkey, suppkey from lineitem WHERE quantity > 4 AND discount = 0 AND tax=.05"); assertQueryUsingH2Cte("SELECT quantity, striking_factories, discount, tax, orderkey, partkey, suppkey from lineitem_ex WHERE quantity > 4 AND discount > 0 AND tax<.05"); assertQueryUsingH2Cte("SELECT quantity, extendedprice, striking_factories, tax, orderkey, partkey, suppkey from lineitem_ex WHERE (discount + tax) < (quantity / 10) AND striking_factories != 1.0"); assertQueryUsingH2Cte("SELECT quantity, extendedprice, discount, striking_factories, orderkey, partkey, suppkey from lineitem_ex WHERE (discount + tax) < (quantity / 10) OR orderkey * 1.0 / partkey % suppkey < (tax + discount) * 100"); }

Target:
public void testDouble() { assertQuery("SELECT quantity, extendedprice, discount, tax FROM lineitem"); assertQueryUsingH2Cte("SELECT count(discount) FROM lineitem_ex"); assertFilterProject("discount IS NULL", "count(*)"); assertFilterProject("discount IS NOT NULL", "sum(quantity), sum(discount)"); assertFilterProject("is_returned = true", "quantity, extendedprice, discount"); assertFilterProject("quantity = 4", "orderkey, tax"); assertFilterProject("quantity = 4 AND discount = 0", "extendedprice, discount"); assertFilterProject("quantity = 4 AND discount = 0 AND tax = .05", "orderkey"); assertFilterProject("(discount + tax) < (quantity / 10)", "tax"); assertFilterProject("doubles[1] > 0.01", "count(*)"); assertFilterProject("discount + tax > .05 AND discount > .01 AND tax > .01", "tax"); assertFilterProject("is_returned AND doubles[2] = .01 AND doubles[1] + discount > 0.10", "count(*)"); }
Source:
public Date getEndDate() { return endDate == null ? null : _responseBuilder.startOfNextDay(endDate); }

Target:
public Date getEndDate() { return endDate == null ? null : _responseBuilder.startOfNextDay(endDate == null ? null : new Date(endDate.getTime())); }
Source:
public void testVersionComparison() { Version version1 = new Version("15.09"); Version version2 = new Version("15.09"); assertTrue(version1.compareTo(version2) == 0); version1 = new Version("15.09"); version2 = new Version("1.09"); System.out.println(version1.compareTo(version2)); assertTrue(version1.compareTo(version2) < 0); assertTrue(version2.compareTo(version1) > 0); version1 = new Version("15.09"); version2 = new Version("15.09.01"); assertTrue(version1.compareTo(version2) > 0); }

Target:
public void testVersionComparison() { Version version1 = new Version("15.09"); Version version2 = new Version("15.09"); assertTrue(version1.compareTo(version2) == 0); version1 = new Version("15.09"); version2 = new Version("1.09"); assertTrue(version1.compareTo(version2) < 0); assertTrue(version2.compareTo(version1) > 0); version1 = new Version("15.09"); version2 = new Version("15.09.01"); assertTrue(version1.compareTo(version2) > 0); ______TS("Test rc versions will come first when the rest are similar"); version1 = new Version("15.09"); version2 = new Version("15.09rc"); assertTrue(version2.compareTo(version1) < 0); }
Source:
public EventGridSasCredential(String sas) { if (CoreUtils.isNullOrEmpty(sas)) { throw new IllegalArgumentException("the access signature cannot be null or empty"); } this.sas = sas; }

Target:
public EventGridSasCredential(String sas) { if (sas == null) { throw logger.logExceptionAsError(new IllegalArgumentException("the access signature cannot be null")); } if (sas.isEmpty()) { throw logger.logExceptionAsError(new IllegalArgumentException("the access signature cannot be empty")); } this.sas = sas; }
Source:
public void setCamelContext(CamelContext camelContext) { this.camelContext = camelContext; ExecutorServiceManager executorServiceManager = camelContext.getExecutorServiceManager(); executorService = executorServiceManager.newFixedThreadPool(this, "KafkaIdempotentRepository", 1); executorService.submit(topicPoller); log.info("Warming up cache"); try { if (cacheReadyLatch.await(30, TimeUnit.SECONDS)) { log.info("Cache OK"); } else { log.warn("Timeout waiting for cache warm-up from topic {}. Proceeding anyway. " + "Duplicate records may not be detected.", topic); } } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public void setCamelContext(CamelContext camelContext) { this.camelContext = camelContext; ExecutorServiceManager executorServiceManager = camelContext.getExecutorServiceManager(); executorService = executorServiceManager.newSingleThreadExecutor(this, "KafkaIdempotentRepository"); executorService.submit(topicPoller); log.info("Warming up cache"); try { if (cacheReadyLatch.await(30, TimeUnit.SECONDS)) { log.info("Cache OK"); } else { log.warn("Timeout waiting for cache warm-up from topic {}. Proceeding anyway. " + "Duplicate records may not be detected.", topic); } } catch (InterruptedException e) { log.error("Interrupted: {}", e.getMessage()); } }
Source:
public void verifyNoInteractions(Object... mocks) { assertMocksNotEmpty(mocks); mockingProgress().validateState(); for (Object mock : mocks) { try { if (mock == null) { throw nullPassedToVerifyNoMoreInteractions(); } InvocationContainer invocations = getMockHandler(mock).getInvocationContainer(); VerificationDataImpl data = new VerificationDataImpl(invocations, null); noInteractions().verify(data); } catch (NotAMockException e) { throw notAMockPassedToVerifyNoMoreInteractions(); } } }

Target:
public void verifyNoInteractions(Object... mocks) { assertMocksNotEmpty(mocks); mockingProgress().validateState(); for (Object mock : mocks) { if (mock == null) { throw nullPassedToVerifyNoMoreInteractions(); } if (!isMock(mock)) { throw notAMockPassedToVerifyNoMoreInteractions(); } InvocationContainer invocations = getMockHandler(mock).getInvocationContainer(); VerificationDataImpl data = new VerificationDataImpl(invocations, null); noInteractions().verify(data); } }
Source:
public void create() { createInternalAAAConfigurations(); createKerberosLdapAAAConfigurations(); EngineExtensionsManager.getInstance().dump(); AuthenticationProfileRepository.getInstance(); DbUserCacheManager.getInstance().init(); AsyncTaskManager.getInstance().initAsyncTaskManager(); ResourceManager.getInstance().init(); OvfDataUpdater.getInstance().initOvfDataUpdater(); SchedulingManager.getInstance().setMigrationHandler(new MigrationHandler() { @Override public void migrateVM(List<Guid> initialHosts, Guid vmToMigrate) { MigrateVmParameters parameters = new MigrateVmParameters(false, vmToMigrate); parameters.setInitialHosts(new ArrayList<Guid>(initialHosts)); Backend.getInstance().runInternalAction(VdcActionType.MigrateVm, parameters, ExecutionHandler.createInternalJobContext()); } }); ThreadPoolUtil.execute(new Runnable() { @Override public void run() { MacPoolManager.getInstance().initialize(); } }); StoragePoolStatusHandler.init(); GlusterJobsManager.init(); ExternalTrustStoreInitializer.init(); try { log.info("Init VM custom properties utilities"); VmPropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of vm custom properties failed.", e); } try { log.info("Init device custom properties utilities"); DevicePropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of device custom properties failed.", e); } SchedulingManager.getInstance().init(); new DwhHeartBeat().init(); PmHealthCheckManager.getInstance().initialize(); }

Target:
public void create() { EngineExtensionsManager.getInstance().dump(); AuthenticationProfileRepository.getInstance(); DbUserCacheManager.getInstance().init(); AsyncTaskManager.getInstance().initAsyncTaskManager(); ResourceManager.getInstance().init(); OvfDataUpdater.getInstance().initOvfDataUpdater(); SchedulingManager.getInstance().setMigrationHandler(new MigrationHandler() { @Override public void migrateVM(List<Guid> initialHosts, Guid vmToMigrate) { MigrateVmParameters parameters = new MigrateVmParameters(false, vmToMigrate); parameters.setInitialHosts(new ArrayList<Guid>(initialHosts)); Backend.getInstance().runInternalAction(VdcActionType.MigrateVm, parameters, ExecutionHandler.createInternalJobContext()); } }); ThreadPoolUtil.execute(new Runnable() { @Override public void run() { MacPoolManager.getInstance().initialize(); } }); StoragePoolStatusHandler.init(); GlusterJobsManager.init(); ExternalTrustStoreInitializer.init(); try { log.info("Init VM custom properties utilities"); VmPropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of vm custom properties failed.", e); } try { log.info("Init device custom properties utilities"); DevicePropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of device custom properties failed.", e); } SchedulingManager.getInstance().init(); new DwhHeartBeat().init(); PmHealthCheckManager.getInstance().initialize(); }
Source:
public final void fetchesDecoded() throws Exception { final Content content = Mockito.mock(Content.class); final String prop = "dGVzdCBlbmNvZGU="; Mockito.doReturn( Json.createObjectBuilder() .add("content", prop) .build() ).when(content).json(); MatcherAssert.assertThat( new String(new Content.Smart(content).decoded()), Matchers.is("test encode") ); }

Target:
public final void fetchesDecoded() throws Exception { final Content content = Mockito.mock(Content.class); final String prop = "dGVzdCBlbmNvZGXigqw="; Mockito.doReturn( Json.createObjectBuilder() .add("content", prop) .build() ).when(content).json(); MatcherAssert.assertThat( new String(new Content.Smart(content).decoded(), Charsets.UTF_8), Matchers.is("test encode\u20ac") ); }
Source:
public void testRecursiveAutoMap() { RecursionMapper.Root root = RecursionMapper.INSTANCE.mapRoot( new RecursionMapper.RootDto( new RecursionMapper.ChildDto( "Sub Root", new RecursionMapper.ChildDto( "Sub child", null ) ) ) ); Assert.assertEquals( new RecursionMapper.Root( new RecursionMapper.Child( "Sub Root", new RecursionMapper.Child( "Sub child", null ) ) ), root ); }

Target:
public void testRecursiveAutoMap() { RecursionMapper.RootDto rootDto = new RecursionMapper.RootDto( new RecursionMapper.ChildDto( "Sub Root", new RecursionMapper.ChildDto( "Sub child", null ) ) ); RecursionMapper.Root root = RecursionMapper.INSTANCE.mapRoot( rootDto ); assertRootEquals( rootDto, root ); }
Source:
public void testElementTypeStringToString() throws ParseException { Element testElement = new Element("stringElement", "java.lang.String", null, null); assertThat(ElementHelper.getDs3Type(testElement), is("ds3_str*")); }

Target:
public void testElementTypeStringToString() throws ParseException { final Element testElement = new Element("stringElement", "java.lang.String", null, null); assertThat(ElementHelper.getDs3Type(testElement), is("ds3_str*")); }
Source:
public String loginPhase2(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpPost post = null; post = new HttpPost(config.gitHubOAuthAccessTokenUrl); post.setHeader("Accept", "application/json"); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("client_id", config.gitHubClientId)); nvps.add(new BasicNameValuePair("client_secret", config.gitHubClientSecret)); nvps.add(new BasicNameValuePair("code", request.getParameter("code"))); post.setEntity(new UrlEncodedFormEntity(nvps, Charsets.UTF_8)); try { HttpResponse postResponse = http.execute(post); if (postResponse.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_OK) { LOG.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed with status " + postResponse.getStatusLine()); response.sendError(HttpURLConnection.HTTP_UNAUTHORIZED, "Request for access token not authorised"); EntityUtils.consume(postResponse.getEntity()); return null; } JsonObject accessTokenJson = getAccessTokenJson(postResponse); if (accessTokenJson != null) { return getAccessToken(accessTokenJson); } else { LOG.error("Invalid response received from GitHub: {}", postResponse.toString()); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return null; } } catch (IOException e) { LOG.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed", e); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Request for access token not authorised"); return null; } }

Target:
public String loginPhase2(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpPost post = null; post = new HttpPost(config.gitHubOAuthAccessTokenUrl); post.setHeader("Accept", "application/json"); List<NameValuePair> nvps = new ArrayList<>(3); nvps.add(new BasicNameValuePair("client_id", config.gitHubClientId)); nvps.add(new BasicNameValuePair("client_secret", config.gitHubClientSecret)); nvps.add(new BasicNameValuePair("code", request.getParameter("code"))); post.setEntity(new UrlEncodedFormEntity(nvps, Charsets.UTF_8)); try { HttpResponse postResponse = http.execute(post); if (postResponse.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_OK) { LOG.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed with status " + postResponse.getStatusLine()); response.sendError(HttpURLConnection.HTTP_UNAUTHORIZED, "Request for access token not authorised"); EntityUtils.consume(postResponse.getEntity()); return null; } JsonObject accessTokenJson = getAccessTokenJson(postResponse); if (accessTokenJson != null) { return getAccessToken(accessTokenJson); } else { LOG.error("Invalid response received from GitHub: {}", postResponse.toString()); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return null; } } catch (IOException e) { LOG.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed", e); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Request for access token not authorised"); return null; } }
Source:
public static boolean isCandidateClass(Class<?> clazz, String annotationName) { if (AnnotationsScanner.hasPlainJavaAnnotationsOnly(clazz)) { return false; } return true; }

Target:
public static boolean isCandidateClass(Class<?> clazz, String annotationName) { if (annotationName.startsWith("java.")) { return true; } if (AnnotationsScanner.hasPlainJavaAnnotationsOnly(clazz)) { return false; } return true; }
Source:
public LoginStateGetter getLoginStateGetter() { return retrieveLoginNavFragment().getLoginStateGetter(); }

Target:
public LoginStateGetter getLoginStateGetter() { return getLoginNavFragmentOrThrow().getLoginStateGetter(); }
Source:
private long getTransferSize(DiskImage image, Guid domainId) { if (getParameters().getTransferType() == TransferType.Download) { DiskImage imageInfoFromVdsm = imagesHandler.getVolumeInfoFromVdsm( image.getStoragePoolId(), domainId, image.getId(), image.getImageId()); return imageInfoFromVdsm.getApparentSizeInBytes(); } else { if (getParameters().getTransferSize() != 0) { return getParameters().getTransferSize(); } else { boolean isOnBlock = getDiskImage().getStorageTypes().get(0).isBlockDomain(); return isOnBlock ? getDiskImage().getActualSizeInBytes() : getDiskImage().getSize(); } } }

Target:
private long getTransferSize(DiskImage image, Guid domainId) { if (getParameters().getTransferType() == TransferType.Download) { DiskImage imageInfoFromVdsm = imagesHandler.getVolumeInfoFromVdsm( image.getStoragePoolId(), domainId, image.getId(), image.getImageId()); return imageInfoFromVdsm.getApparentSizeInBytes(); } if (getParameters().getTransferSize() != 0) { return getParameters().getTransferSize(); } else { boolean isOnBlock = getDiskImage().getStorageTypes().get(0).isBlockDomain(); return isOnBlock ? getDiskImage().getActualSizeInBytes() : getDiskImage().getSize(); } }
Source:
public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> parameterValues, PatientCalculationContext context) { Program mchmsProgram = MetadataUtils.getProgram(Metadata.Program.MCHMS); Set<Integer> alive = alivePatients(cohort, context); Set<Integer> inMchmsProgram = CalculationUtils.patientsThatPass(Calculations.activeEnrollment(mchmsProgram, alive, context)); CalculationResultMap partnerHivStatusObs = Calculations.lastObs(getConcept(Dictionary.PARTNER_HIV_STATUS), inMchmsProgram, context); CalculationResultMap ret = new CalculationResultMap(); for (Integer ptId : cohort) { boolean partnerHivStatusUnknown = false; if (inMchmsProgram.contains(ptId)) { Concept partnerHivStatus = EmrCalculationUtils.codedObsResultForPatient(partnerHivStatusObs, ptId); if (partnerHivStatus != null) { partnerHivStatusUnknown = partnerHivStatus.equals(Dictionary.getConcept(Dictionary.UNKNOWN)); } } ret.put(ptId, new BooleanResult(partnerHivStatusUnknown, this, context)); } return ret; }

Target:
public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> parameterValues, PatientCalculationContext context) { Program mchmsProgram = MetadataUtils.getProgram(Metadata.Program.MCHMS); Set<Integer> alive = alivePatients(cohort, context); Set<Integer> inMchmsProgram = CalculationUtils.patientsThatPass(Calculations.activeEnrollment(mchmsProgram, alive, context)); CalculationResultMap partnerHivStatusObs = Calculations.lastObs(getConcept(Dictionary.PARTNER_HIV_STATUS), inMchmsProgram, context); Concept unknownConcept = Dictionary.getConcept(Dictionary.UNKNOWN); CalculationResultMap ret = new CalculationResultMap(); for (Integer ptId : cohort) { boolean partnerHivStatusUnknown = false; if (inMchmsProgram.contains(ptId)) { Concept partnerHivStatus = EmrCalculationUtils.codedObsResultForPatient(partnerHivStatusObs, ptId); if (partnerHivStatus != null) { partnerHivStatusUnknown = partnerHivStatus.equals(unknownConcept); } } ret.put(ptId, new BooleanResult(partnerHivStatusUnknown, this, context)); } return ret; }