auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPredicateOnPartitionSymbolsPushedThroughWindow() { PlanMatchPattern tableScan = tableScan("orders", ImmutableMap.of("CUST_KEY", "custkey", "ORDER_KEY", "orderkey")); assertPlan( "SELECT * FROM (" + "SELECT custkey, orderkey, rank() OVER (PARTITION BY custkey ORDER BY orderdate ASC)" + "FROM orders" + ") WHERE custkey = 0 AND orderkey > 0", anyTree( filter("ORDER_KEY > BIGINT '0'", anyTree( window(builder -> {}, anyTree(filter("CUST_KEY = BIGINT '0'", tableScan))))))); }

Target:
public void testPredicateOnPartitionSymbolsPushedThroughWindow() { PlanMatchPattern tableScan = tableScan( "orders", ImmutableMap.of( "CUST_KEY", "custkey", "ORDER_KEY", "orderkey")); assertPlan( "SELECT * FROM (" + "SELECT custkey, orderkey, rank() OVER (PARTITION BY custkey ORDER BY orderdate ASC)" + "FROM orders" + ") WHERE custkey = 0 AND orderkey > 0", anyTree( filter("ORDER_KEY > BIGINT '0'", anyTree( node(WindowNode.class, anyTree( filter("CUST_KEY = BIGINT '0'", tableScan))))))); }
Source:
public boolean checkAndStartUnsentFormsTask(SyncCapableCommCareActivity activity, final boolean syncAfterwards, boolean userTriggered) { SqlStorage<FormRecord> storage = CommCareApplication.instance().getUserStorage(FormRecord.class); FormRecord[] records = StorageUtils.getUnsentRecordsForCurrentApp(storage); HiddenPreferences.updateLastUploadAttemptTime(); if (records.length > 0) { processAndSendForms(activity, records, syncAfterwards, userTriggered); return true; } else { return false; } }

Target:
public boolean checkAndStartUnsentFormsTask(SyncCapableCommCareActivity activity, final boolean syncAfterwards, boolean userTriggered) { SqlStorage<FormRecord> storage = CommCareApplication.instance().getUserStorage(FormRecord.class); FormRecord[] records = StorageUtils.getUnsentRecordsForCurrentApp(storage); if (syncAfterwards) { HiddenPreferences.updateLastUploadSyncAttemptTime(); } if (records.length > 0) { processAndSendForms(activity, records, syncAfterwards, userTriggered); return true; } else { return false; } }
Source:
public void rememeberFilter() { MetadataMap filters = (MetadataMap) getSession().getAttribute(FILTER_INPUTS); if (filter.getDefaultModelObjectAsString().isEmpty() && filters != null) { filters.put(dataProvider.getClass().getName(), null); return; } if (filters == null) { filters = new MetadataMap(); getSession().setAttribute(FILTER_INPUTS, filters); } filters.put(dataProvider.getClass().getName(), filter.getDefaultModelObjectAsString()); }

Target:
private void rememeberFilter() { MetadataMap filters = getMetaDataMapFromSession(FILTER_INPUTS); if (filter.getDefaultModelObjectAsString().isEmpty() && filters != null) { filters.put(dataProvider.getClass().getName(), null); return; } if (filters == null) { filters = new MetadataMap(); getSession().setAttribute(FILTER_INPUTS, filters); } filters.put(dataProvider.getClass().getName(), filter.getDefaultModelObjectAsString()); }
Source:
public void onExecutionStart() { if (onStartInvoked.compareAndSet(false, true)) { for (ExecutionListener<I, O> listener : listeners) { try { listener.onExecutionStart(context.getChildContext(listener)); } catch (Throwable e) { if (e instanceof AbortExecutionException) { throw (AbortExecutionException) e; } logger.error("Error invoking listener " + listener, e); } } } }

Target:
public void onExecutionStart() { onExecutionStart(this.context); }
Source:
protected void run(@Nonnull List<String> cmdLine) { ExecuteFile exec = new ExecuteFile(cmdLine.toArray(new String[cmdLine.size()])); String userHome = System.getProperty("user.home"); if (userHome == null) { throw new RuntimeException("'user.home' is not defined"); } String userName = System.getProperty("user.name"); if (userName == null) { throw new RuntimeException("'user.name' is not defined"); } exec.addEnvVar("HOME", userHome); exec.addEnvVar("USER", userName); exec.setErr(errRedirectStream); exec.setOut(outRedirectStream); exec.setVerbose(isVerbose); try { if (exec.run() != 0) { throw new RuntimeException("Jack compiler exited with an error"); } } catch (ExecFileException e) { throw new RuntimeException("An error occurred while running Jack", e); } }

Target:
protected void run(@Nonnull List<String> cmdLine) { ExecuteFile exec = new ExecuteFile(cmdLine.toArray(new String[cmdLine.size()])); exec.addEnvVar("HOME", System.getenv("HOME")); exec.addEnvVar("USER", System.getenv("USER")); exec.setErr(errRedirectStream); exec.setOut(outRedirectStream); exec.setVerbose(isVerbose); try { if (exec.run() != 0) { throw new RuntimeException("Jack compiler exited with an error"); } } catch (ExecFileException e) { throw new RuntimeException("An error occurred while running Jack", e); } }
Source:
private static void assertBufferStringAndVariables(String expected, TemplateBuffer buffer) { assertEquals(expected, buffer.getString()); for (TemplateVariable v : buffer.getVariables()) { assertEquals(true, v.isResolved()); assertEquals(true, v.isUnambiguous()); } }

Target:
private static void assertBufferStringAndVariables(String expected, TemplateBuffer buffer) { assertEquals(expected, buffer.getString()); for (TemplateVariable v : buffer.getVariables()) { assertTrue(v.isResolved()); assertTrue(v.isUnambiguous()); } }
Source:
public void testCLIFsckWithParam() throws Exception { final int result = run(S3GuardTool.Fsck.NAME, "-check", "s3a://" + getFileSystem().getBucket()); assertEquals("The result should be success when fsck is running with " + "correct parameters.", SUCCESS, result); }

Target:
public void testCLIFsckWithParam() throws Exception { final int result = run(S3GuardTool.Fsck.NAME, "-check", "s3a://" + getFileSystem().getBucket()); LOG.info("This test serves the purpose to run fsck with the correct " + "parameters, so there will be no exception thrown. " + "The return value of the run: {}", result); }
Source:
public StreamSerializerAdapter(InternalSerializationService service, StreamSerializer serializer) { this.service = service; this.serializer = serializer; }

Target:
StreamSerializerAdapter(InternalSerializationService service, StreamSerializer serializer) { this.service = service; this.serializer = serializer; }
Source:
public Callable<Course> getFullCourseInfoTask(final Course courseStub) { return wrapWithNotLoggedInException(new Callable<Course>() { @Override public Course call() throws Exception { try { URI serverUrl = addApiCallQueryParameters(courseStub.getDetailsUrl()); Course returnedFromServer = getCourseInfo(serverUrl); try { URI skillifierUrl = getSkillifierUrl("/course/" + courseStub.getName()); Course returnedFromSkillifier = getCourseInfo(skillifierUrl); returnedFromServer.getExercises().addAll(returnedFromSkillifier.getExercises()); } catch (Exception e) { LOG.log(Level.WARNING, "Downloading adaptive exercise info from skillifier failed."); } addAdaptiveExercisesFromStub(returnedFromServer, courseStub); returnedFromServer.generateThemes(); return returnedFromServer; } catch (FailedHttpResponseException ex) { return checkForObsoleteClient(ex); } } }); }

Target:
public Callable<Course> getFullCourseInfoTask(final Course courseStub) { return wrapWithNotLoggedInException(new Callable<Course>() { @Override public Course call() throws Exception { try { URI serverUrl = addApiCallQueryParameters(courseStub.getDetailsUrl()); Course returnedFromServer = getCourseInfo(serverUrl); try { URI skillifierUrl = getSkillifierUrl("/course/" + courseStub.getName()); Course returnedFromSkillifier = getCourseInfo(skillifierUrl); returnedFromServer.getExercises().addAll(returnedFromSkillifier.getExercises()); } catch (Exception e) { LOG.log(Level.WARNING, "Downloading adaptive exercise info from skillifier failed.", e); } addAdaptiveExercisesFromStub(returnedFromServer, courseStub); returnedFromServer.generateThemes(); return returnedFromServer; } catch (FailedHttpResponseException ex) { return checkForObsoleteClient(ex); } } }); }
Source:
protected void assertEvaluationEquals(String expectedValue) throws Exception { IValue value = getValue(); CStringValue cstrValue = (CStringValue) value; assertEquals(expectedValue, cstrValue.cStringValue()); }

Target:
protected void assertEvaluationEquals(String expectedValue) throws Exception { IValue value = getValue(); assertInstance(value, CStringValue.class); CStringValue cstrValue = (CStringValue) value; assertEquals(expectedValue, cstrValue.cStringValue()); }
Source:
protected TimeGraphPresentationProvider getPresentationProvider() { return fPresentation; }

Target:
protected ITimeGraphPresentationProvider2 getPresentationProvider() { return fPresentation; }
Source:
public void testUpsertSelectDoesntSeeUpsertedData() throws Exception { String tableName = "TBL_" + generateUniqueName(); String indexName = "IDX_" + generateUniqueName(); String seqName = "SEQ_" + generateUniqueName(); String fullTableName = SchemaUtil.getTableName(tableName, tableName); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(QueryServices.MUTATE_BATCH_SIZE_BYTES_ATTRIB, Integer.toString(512)); props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, Integer.toString(3)); props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, Integer.toString(3)); Connection conn = getConnection(props); conn.setAutoCommit(true); conn.createStatement().execute("CREATE SEQUENCE "+seqName); conn.createStatement().execute("CREATE TABLE " + fullTableName + "(pk INTEGER PRIMARY KEY, val INTEGER)"+tableDDLOptions); conn.createStatement().execute("CREATE "+(localIndex? "LOCAL " : "")+"INDEX " + indexName + " ON " + fullTableName + "(val)"); conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES (NEXT VALUE FOR " + seqName + ",1)"); PreparedStatement stmt = comm.prepareStatement("UPSERT INTO " + fullTableName + " SELECT NEXT VALUE FOR " + seqName + ", val FROM " + fullTableName); for (int i=0; i<6; i++) { int upsertCount = stmt.executeUpdate(); assertEquals((int)Math.pow(2, i), upsertCount); } conn.close(); }

Target:
public void testUpsertSelectDoesntSeeUpsertedData() throws Exception { String tableName = "TBL_" + generateUniqueName(); String indexName = "IDX_" + generateUniqueName(); String seqName = "SEQ_" + generateUniqueName(); String fullTableName = SchemaUtil.getTableName(tableName, tableName); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(QueryServices.MUTATE_BATCH_SIZE_BYTES_ATTRIB, Integer.toString(512)); props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, Integer.toString(3)); props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, Integer.toString(3)); Connection conn = getConnection(props); conn.setAutoCommit(true); Statement stmt = conn.createStatement(); stmt.execute("CREATE SEQUENCE "+seqName); stmt.execute("CREATE TABLE " + fullTableName + "(pk INTEGER PRIMARY KEY, val INTEGER)"+tableDDLOptions); stmt.execute("CREATE "+(localIndex? "LOCAL " : "")+"INDEX " + indexName + " ON " + fullTableName + "(val)"); stmt.execute("UPSERT INTO " + fullTableName + " VALUES (NEXT VALUE FOR " + seqName + ",1)"); String sqlStr = "UPSERT INTO " + fullTableName + " SELECT NEXT VALUE FOR " + seqName + ", val FROM " + fullTableName; PreparedStatement pstmt = conn.prepareStatement(sqlStr); for (int i=0; i<6; i++) { int upsertCount = pstmt.executeUpdate(); assertEquals((int)Math.pow(2, i), upsertCount); } conn.close(); }
Source:
private String getResourceAsString(String resourceName) { StringBuilder resourceContent = new StringBuilder(); InputStream resourceInputStream = getClass().getClassLoader().getResourceAsStream(resourceName); if (resourceInputStream != null) { try { InputStreamReader inR = new InputStreamReader(resourceInputStream); BufferedReader buf = new BufferedReader(inR); String line; while ((line = buf.readLine()) != null) { resourceContent.append(line).append('\n'); } } catch (IOException e) { } finally { try { resourceInputStream.close(); } catch (IOException e) { } } } return resourceContent.toString(); }

Target:
private String getResourceAsString(String resourceName) { StringBuilder resourceContent = new StringBuilder(); InputStream resourceInputStream = getClass().getClassLoader().getResourceAsStream(resourceName); if (resourceInputStream != null) { try { InputStreamReader inR = new InputStreamReader(resourceInputStream); BufferedReader buf = new BufferedReader(inR); String line; while ((line = buf.readLine()) != null) { resourceContent.append(line).append('\n'); } } catch (IOException ioe) { log.error("Failed to embed resource: " + resourceName, ioe); } finally { try { resourceInputStream.close(); } catch (IOException ioe) { log.error("Failed to close resource: " + resourceName, ioe); } } } return resourceContent.toString(); }
Source:
private void setGutenbergEnabledIfNeeded() { if (AppPrefs.isGutenbergAutoEnabledForTheNewPosts() && !mIsNewPost && !SiteUtils.isBlockEditorDefaultForNewPost(mSite, mAccountStore)) { AppPrefs.setGutenbergDefaultForNewPosts(true); mDispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorAction( new DesignateMobileEditorPayload(mSite, "gutenberg"))); AppPrefs.setGutenbergAutoEnabledForTheNewPosts(false); showGutenbergInformativeDialog(); } }

Target:
private void setGutenbergEnabledIfNeeded() { if ((TextUtils.isEmpty(mSite.getMobileEditor()) && !mIsNewPost) || AppPrefs.shouldShowGutenbergInfoPopup(mSite.getUrl())) { SiteUtils.enableBlockEditor(mDispatcher, mSite); AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, mSite); showGutenbergInformativeDialog(); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CacheRoleImpl cacheRole = (CacheRoleImpl) o; if (mask != cacheRole.mask) return false; if (name != null ? !name.equals(cacheRole.name) : cacheRole.name != null) return false; return permissions != null ? permissions.equals(cacheRole.permissions) : cacheRole.permissions == null; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CacheRoleImpl cacheRole = (CacheRoleImpl) o; if (mask != cacheRole.mask) return false; if (!name.equals(cacheRole.name)) return false; return permissions.equals(cacheRole.permissions); }
Source:
public AppInstallStatus checkAndPrepareUpgradeResources(String profileRef) { synchronized (updateLock) { this.profileRef = profileRef; try { instantiateLatestProfile(); if (isUpgradeTableStaged()) { return AppInstallStatus.UpdateStaged; } if (updateIsntNewer(getMasterProfile())) { Logger.log(AndroidLogger.TYPE_RESOURCES, "App Resources up to Date"); upgradeTable.clear(); return AppInstallStatus.UpToDate; } prepareUpgradeResources(); } catch (InstallCancelledException e) { return AppInstallStatus.UnknownFailure; } catch (LocalStorageUnavailableException e) { ResourceInstallUtils.logInstallError(e, "Couldn't install file to local storage|"); return AppInstallStatus.NoLocalStorage; } catch (UnfullfilledRequirementsException e) { if (e.isDuplicateException()) { return AppInstallStatus.DuplicateApp; } else { ResourceInstallUtils.logInstallError(e, "App resources are incompatible with this device|"); return AppInstallStatus.IncompatibleReqs; } } catch (UnresolvedResourceException e) { return ResourceInstallUtils.processUnresolvedResource(e); } return AppInstallStatus.UpdateStaged; } }

Target:
public AppInstallStatus checkAndPrepareUpgradeResources(String profileRef) { synchronized (updateLock) { this.profileRef = profileRef; try { instantiateLatestUpgradeProfile(); if (isUpgradeTableStaged()) { return AppInstallStatus.UpdateStaged; } if (updateNotNewer(getMasterProfile())) { Logger.log(AndroidLogger.TYPE_RESOURCES, "App Resources up to Date"); upgradeTable.clear(); return AppInstallStatus.UpToDate; } prepareUpgradeResources(); } catch (InstallCancelledException e) { return AppInstallStatus.UnknownFailure; } catch (LocalStorageUnavailableException e) { ResourceInstallUtils.logInstallError(e, "Couldn't install file to local storage|"); return AppInstallStatus.NoLocalStorage; } catch (UnfullfilledRequirementsException e) { ResourceInstallUtils.logInstallError(e, "App resources are incompatible with this device|"); return AppInstallStatus.IncompatibleReqs; } catch (UnresolvedResourceException e) { return ResourceInstallUtils.processUnresolvedResource(e); } return AppInstallStatus.UpdateStaged; } }
Source:
public void completeTaskCmdExecutorTest() { Map<String, Object> variables = new HashMap<>(); CompleteTaskCmd completeTaskCmd = new CompleteTaskCmd("taskId", variables); assertThat(completeTaskCmdExecutor).isNotNull(); assertThat(completeTaskCmdExecutor.getHandledType()).isEqualTo(CompleteTaskCmd.class); completeTaskCmdExecutor.execute(completeTaskCmd); verify(processEngine).completeTask(completeTaskCmd); verify(commandResults).send(ArgumentMatchers.<Message<CompleteTaskResults>>any()); }

Target:
public void completeTaskCmdExecutorTest() { Map<String, Object> variables = new HashMap<>(); CompleteTaskCmd completeTaskCmd = new CompleteTaskCmd("taskId", variables); assertThat(completeTaskCmdExecutor.getHandledType()).isEqualTo(CompleteTaskCmd.class); completeTaskCmdExecutor.execute(completeTaskCmd); verify(processEngine).completeTask(completeTaskCmd); verify(commandResults).send(ArgumentMatchers.<Message<CompleteTaskResults>>any()); }
Source:
private static void addUpgradeHeader(HttpRequestHeader httpRequestHeader){ httpRequestHeader.addHeader(UPGRADE_HEADER,UPGRADE_PARAMETER); }

Target:
public static void addUpgradeHeader(HttpRequestHeader httpRequestHeader){ httpRequestHeader.addHeader(UPGRADE_HEADER,UPGRADE_PARAMETER); }
Source:
private CinderDisk getInitialCinderVolumeToDelete(DiskImage cinderVolume) { CinderDisk cinderVolumeToRemove = null; List<DiskImage> snapshotsForParent = getDiskImageDao().getAllSnapshotsForParent(cinderVolume.getParentId()); for (DiskImage diskImage : snapshotsForParent) { if (!diskImage.getImageId().equals(cinderVolume.getImageId())) { cinderVolumeToRemove = (CinderDisk) diskImage; break; } } return cinderVolumeToRemove; }

Target:
private CinderDisk getInitialCinderVolumeToDelete(DiskImage cinderVolume) { List<DiskImage> snapshotsForParent = getDiskImageDao().getAllSnapshotsForParent(cinderVolume.getParentId()); CinderDisk cinderVolumeToRemove = (CinderDisk) snapshotsForParent.stream().findFirst().filter( diskImage -> !diskImage.getImageId().equals(cinderVolume.getImageId())).get(); return cinderVolumeToRemove; }
Source:
public void showHtmlForm(Model model, HttpSession httpSession, @ModelAttribute("htmlForm") HtmlForm htmlForm) { HtmlForm hf = (HtmlForm) model.asMap().get("htmlForm"); if (hf.getId() == null) { model.addAttribute("previewHtml", ""); } else { try { Patient demo = HtmlFormEntryUtil.getFakePerson(); FormEntrySession fes = new FormEntrySession(demo, hf.getXmlData(), httpSession); String html = fes.getHtmlToDisplay(); FormEntryContext formEntryContext = fes.getContext(); if (fes.getFieldAccessorJavascript() != null) { html += "<script>" + fes.getFieldAccessorJavascript() + "</script>"; } if (!formEntryContext.getInvalidObsGroupConceptIds().isEmpty()) { model.addAttribute("invalidObsGroupConceptIds", formEntryContext.getInvalidObsGroupConceptIds()); } if (!formEntryContext.getInvalidSetMemberConceptIds().isEmpty()) { model.addAttribute("invalidSetMemberConceptIds", formEntryContext.getInvalidSetMemberConceptIds()); } model.addAttribute("previewHtml", html); } catch (Exception ex) { log.warn("Error rendering html form", ex); model.addAttribute("previewHtml", "Error! " + ex); } } }

Target:
public void showHtmlForm(Model model, HttpSession httpSession, @ModelAttribute("htmlForm") HtmlForm htmlForm) { HtmlForm hf = (HtmlForm) model.asMap().get("htmlForm"); if (hf.getId() == null) { model.addAttribute("previewHtml", ""); } else { try { Patient demo = HtmlFormEntryUtil.getFakePerson(); FormEntrySession fes = new FormEntrySession(demo, hf.getXmlData(), httpSession); String html = fes.getHtmlToDisplay(); if (fes.getFieldAccessorJavascript() != null) { html += "<script>" + fes.getFieldAccessorJavascript() + "</script>"; } model.addAttribute("previewHtml", html); } catch (Exception ex) { log.warn("Error rendering html form", ex); model.addAttribute("previewHtml", "Error! " + ex); } } }
Source:
private void ensureConnectionState() { while (!Thread.currentThread().isInterrupted() && stopped == false) { boolean connectionEstablished = false; try { connectionManagerLock.lock(); if (reconnectNeeded()) { connectionEstablished = connectionManager.tryToEstablishConnection(); if (connectionEstablished) { waitTillConnectionIsLost(); } } } catch (InterruptedException e) { LOGGER.debug("connect thread was interrupted while waiting", e); Thread.currentThread().interrupt(); return; } finally { connectionManagerLock.unlock(); } if (!connectionEstablished && (!Thread.currentThread().isInterrupted() && stopped == false)) { waitForRetry(); } } }

Target:
private void ensureConnectionState() { while (!Thread.currentThread().isInterrupted() && !stopped) { boolean connectionEstablished = false; try { connectionManagerLock.lock(); if (reconnectNeeded()) { connectionEstablished = connectionManager.tryToEstablishConnection(); if (connectionEstablished) { waitTillConnectionIsLost(); } } } catch (InterruptedException e) { LOGGER.debug("connect thread was interrupted while waiting", e); Thread.currentThread().interrupt(); return; } finally { connectionManagerLock.unlock(); } if (!connectionEstablished && (!Thread.currentThread().isInterrupted() && !stopped)) { waitForRetry(); } } }
Source:
private Object valueOf( IndexEntryUpdate<SchemaIndexDescriptor> update ) { return update.values()[0]; }

Target:
private Value valueOf( IndexEntryUpdate<SchemaIndexDescriptor> update ) { return update.values()[0]; }
Source:
private void extractSubjectConfirmation(Map<String, Object> requestContext, AssertionType assertion) { List<SubjectConfirmationDataBean> senderBeans = new ArrayList<>(); List<SubjectConfirmationDataBean> bearBeans = new ArrayList<>(); DateTimeFormatter dateFormat = ISODateTimeFormat.dateTimeParser(); for (SamlSubjectsType samlSubject : assertion.getSamlSubjects()){ String method = samlSubject.getMethod(); SubjectConfirmationDataBean bean = new SubjectConfirmationDataBean(); bean.setAddress(samlSubject.getAddress()); bean.setInResponseTo(samlSubject.getInResponseTo()); bean.setRecipient(samlSubject.getRecipient()); SamlConditionsType subjectCondition = samlSubject.getSubjectCondition(); if (subjectCondition != null) { bean.setNotAfter(dateFormat.parseDateTime(subjectCondition.getNotOnOrAfter())); bean.setNotBefore(dateFormat.parseDateTime(subjectCondition.getNotBefore())); } if (SubjectConfirmation.METHOD_SENDER_VOUCHES.equalsIgnoreCase(method)){ senderBeans.add(bean); } if (SubjectConfirmation.METHOD_BEARER.equalsIgnoreCase(method)){ bearBeans.add(bean); } } requestContext.put(SamlConstants.SUBJECT_SENDER_VOUCHES, senderBeans); requestContext.put(SamlConstants.SUBJECT_BEARER, bearBeans); }

Target:
private static void extractSubjectConfirmation(Map<String, Object> requestContext, AssertionType assertion) { List<SAMLSubjectConfirmation> samlSubjectConfirmations = new ArrayList<>(); DateTimeFormatter dateFormat = ISODateTimeFormat.dateTimeParser(); for (SamlSubjectConfirmationType samlSubject : assertion.getSamlSubjectConfirmations()) { SAMLSubjectConfirmation bean = new SAMLSubjectConfirmation(); bean.setMethod(samlSubject.getMethod()); bean.setAddress(samlSubject.getAddress()); bean.setInResponseTo(samlSubject.getInResponseTo()); bean.setRecipient(samlSubject.getRecipient()); SamlConditionsType subjectCondition = samlSubject.getSubjectCondition(); if (subjectCondition != null && subjectCondition.getNotOnOrAfter() != null) { bean.setNotAfter(dateFormat.parseDateTime(subjectCondition.getNotOnOrAfter())); } if (subjectCondition != null && subjectCondition.getNotBefore() != null) { bean.setNotBefore(dateFormat.parseDateTime(subjectCondition.getNotBefore())); } samlSubjectConfirmations.add(bean); } requestContext.put(SamlConstants.SUBJECT_CONFIRMATION, samlSubjectConfirmations); }
Source:
protected void setStatusForException(Exception e) { isError = true; String exceptionMessageForHtml = e.getMessage().replace(Const.EOL, "<br>"); statusToUser.add(new StatusMessage(exceptionMessageForHtml, StatusMessageColor.DANGER)); statusToAdmin = Const.ACTION_RESULT_FAILURE + " : " + exceptionMessageForHtml; }

Target:
protected void setStatusForException(Exception e) { isError = true; String exceptionMessageForHtml = e.getMessage().replace(Const.EOL, Const.HTML_BR_TAG); statusToUser.add(new StatusMessage(exceptionMessageForHtml, StatusMessageColor.DANGER)); statusToAdmin = Const.ACTION_RESULT_FAILURE + " : " + exceptionMessageForHtml; }
Source:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "{0} starting...", taskId); final AsyncWorkerDataSet[] asyncWorkerDataSets = divideDataSets(); final ExecutorService executorService = Executors.newFixedThreadPool(numWorkerThreads); final Future[] futures = new Future[numWorkerThreads]; LOG.log(Level.INFO, "Initializing {0} worker threads", numWorkerThreads); for (int index = 0; index < numWorkerThreads; index++) { final Injector forkedInjector = injector.forkInjector(); forkedInjector.bindVolatileInstance(DataSet.class, asyncWorkerDataSets[index]); final Worker worker = forkedInjector.getInstance(Worker.class); futures[index] = executorService.submit(new Runnable() { @Override public void run() { worker.initialize(); for (int iteration = 0; iteration < maxIterations; ++iteration) { if (abort.get()) { LOG.log(Level.INFO, "Abort task"); return; } worker.run(); } worker.cleanup(); } }); } for (int index = 0; index < numWorkerThreads; index++) { futures[index].get(); } return null; }

Target:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "{0} starting...", taskId); final AsyncWorkerDataSet[] asyncWorkerDataSets = divideDataSets(); final ExecutorService executorService = Executors.newFixedThreadPool(numWorkerThreads); final Future[] futures = new Future[numWorkerThreads]; LOG.log(Level.INFO, "Initializing {0} worker threads", numWorkerThreads); for (int index = 0; index < numWorkerThreads; index++) { final Injector forkedInjector = injector.forkInjector(); forkedInjector.bindVolatileInstance(DataSet.class, asyncWorkerDataSets[index]); final Worker worker = forkedInjector.getInstance(Worker.class); futures[index] = executorService.submit(new Runnable() { @Override public void run() { worker.initialize(); for (int iteration = 0; iteration < maxIterations; ++iteration) { if (aborted) { LOG.log(Level.INFO, "Abort a thread to completely close the task"); return; } worker.run(); } worker.cleanup(); } }); } for (int index = 0; index < numWorkerThreads; index++) { futures[index].get(); } return null; }
Source:
protected String getLogFileLocation() { return format("${%s}/data/karaf.out", getRunDir()); }

Target:
protected String getLogFileLocation() { return format("{%s}/data/karaf.out", getRunDir()); }
Source:
public GeoCollection(AbstractGeoJsonObject firstGeoObject, AbstractGeoJsonObject... additionalGeoObjects) { super( TYPE ); Contracts.assertNotNull( firstGeoObject, "firstPoint" ); Contracts.assertNotNull( additionalGeoObjects, "additionalPoints" ); this.geometries = new ArrayList<>( Arrays.asList( ArrayHelper.concat( firstGeoObject, additionalGeoObjects ) ) ); }

Target:
public GeoCollection(AbstractGeoJsonObject firstGeoObject, AbstractGeoJsonObject... additionalGeoObjects) { super( TYPE ); Contracts.assertNotNull( firstGeoObject, "firstGeoObject" ); Contracts.assertNotNull( additionalGeoObjects, "additionalGeoObjects" ); this.geometries = new ArrayList<>( Arrays.asList( ArrayHelper.concat( firstGeoObject, additionalGeoObjects ) ) ); }
Source:
public static void cleanUp() { fLogger.removeAllAppenders(); fFileLocation.delete(); tearDown(); }

Target:
public static void cleanUp() { fLogger.removeAllAppenders(); fFileLocation.delete(); fBot.closeAllEditors(); SWTBotUtils.deleteProject(PROJECT_NAME, fBot); SWTBotUtils.closeViewById(ColorsView.ID, fBot); }
Source:
private void startCacheServer(VM server, final int port, final boolean disableQueryMonitorForLowMemory, final int queryTimeout, final boolean createPR) { server.invoke(() -> { getSystem(getServerProperties()); if (disableQueryMonitorForLowMemory) { System.setProperty( GeodeGlossary.GEMFIRE_PREFIX + "Cache.DISABLE_QUERY_MONITOR_FOR_LOW_MEMORY", "true"); } else { System.clearProperty( GeodeGlossary.GEMFIRE_PREFIX + "Cache.DISABLE_QUERY_MONITOR_FOR_LOW_MEMORY"); } GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); cache.MAX_QUERY_EXECUTION_TIME = queryTimeout; InternalResourceManager resourceManager = (InternalResourceManager) cache.getResourceManager(); HeapMemoryMonitor heapMonitor = resourceManager.getHeapMonitor(); heapMonitor.setTestMaxMemoryBytes(1000); HeapMemoryMonitor.setTestBytesUsedForThresholdSet(NORMAL_HEAP_USED); resourceManager.setCriticalHeapPercentage(85); RegionFactory<String, Portfolio> factory = cache.createRegionFactory(); if (createPR) { PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(0); paf.setTotalNumBuckets(11); factory.setPartitionAttributes(paf.create()); } else { factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.REPLICATE); } Region region = createRootRegion("portfolios", factory); if (createPR) { assertThat(region instanceof PartitionedRegion).isTrue(); } else { assertThat(region instanceof DistributedRegion).isTrue(); } CacheServer cacheServer = getCache().addCacheServer(); cacheServer.setPort(port); cacheServer.start(); return null; }); }

Target:
private void startCacheServer(VM server, final int port, final boolean disableQueryMonitorForLowMemory, final int queryTimeout, final boolean createPR) { server.invoke(() -> { getSystem(getServerProperties()); if (disableQueryMonitorForLowMemory) { System.setProperty( GeodeGlossary.GEMFIRE_PREFIX + "Cache.DISABLE_QUERY_MONITOR_FOR_LOW_MEMORY", "true"); } else { System.clearProperty( GeodeGlossary.GEMFIRE_PREFIX + "Cache.DISABLE_QUERY_MONITOR_FOR_LOW_MEMORY"); } GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); cache.MAX_QUERY_EXECUTION_TIME = queryTimeout; InternalResourceManager resourceManager = (InternalResourceManager) cache.getResourceManager(); HeapMemoryMonitor heapMonitor = resourceManager.getHeapMonitor(); heapMonitor.setTestMaxMemoryBytes(1000); HeapMemoryMonitor.setTestBytesUsedForThresholdSet(NORMAL_HEAP_USED); resourceManager.setCriticalHeapPercentage(85); RegionFactory<String, Portfolio> factory = cache.createRegionFactory(); if (createPR) { PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(0); paf.setTotalNumBuckets(11); factory.setPartitionAttributes(paf.create()); } else { factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.REPLICATE); } Region<String, Portfolio> region = createRootRegion("portfolios", factory); if (createPR) { assertThat(region).isInstanceOf(PartitionedRegion.class); } else { assertThat(region).isInstanceOf(DistributedRegion.class); } CacheServer cacheServer = getCache().addCacheServer(); cacheServer.setPort(port); cacheServer.start(); return null; }); }
Source:
private void initMembers(){ executedUpdatedMetadataForStoragePool = new HashMap<Guid, Map<Guid, KeyValuePairCompat<String, List<Guid>>>>(); executedRemovedIds = new HashMap<Guid, List<Guid>>(); executedUpdatedOvfGenerationIdsInDb = new HashMap<Guid, Map<Guid, Long>>(); vms = new HashMap<Guid, VM>(); templates = new HashMap<Guid, VmTemplate>(); executedUpdatedMetadataForStoragePool.put(pool1.getId(), new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>()); executedUpdatedMetadataForStoragePool.put(pool2.getId(), new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>()); executedUpdatedMetadataForStoragePool.put(pool3.getId(), new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>()); executedRemovedIds.put(pool1.getId(), new LinkedList<Guid>()); executedRemovedIds.put(pool2.getId(), new LinkedList<Guid>()); executedRemovedIds.put(pool3.getId(), new LinkedList<Guid>()); executedUpdatedOvfGenerationIdsInDb.put(pool1.getId(), new HashMap<Guid, Long>()); executedUpdatedOvfGenerationIdsInDb.put(pool2.getId(), new HashMap<Guid, Long>()); executedUpdatedOvfGenerationIdsInDb.put(pool3.getId(), new HashMap<Guid, Long>()); }

Target:
private void initMembers() { executedUpdatedMetadataForStoragePool = new HashMap<Guid, Map<Guid, KeyValuePairCompat<String, List<Guid>>>>(); executedRemovedIds = new HashMap<Guid, List<Guid>>(); executedUpdatedOvfGenerationIdsInDb = new HashMap<Guid, Map<Guid, Long>>(); vms = new HashMap<Guid, VM>(); templates = new HashMap<Guid, VmTemplate>(); pool1 = new storage_pool("first sp", Guid.NewGuid(), "storage_pool1", StorageType.NFS.getValue(), StoragePoolStatus.Up.getValue()); pool2 = new storage_pool("second sp", Guid.NewGuid(), "storage_pool2", StorageType.NFS.getValue(), StoragePoolStatus.Up.getValue()); pool3 = new storage_pool("third sp", Guid.NewGuid(), "storage_pool3", StorageType.NFS.getValue(), StoragePoolStatus.Maintanance.getValue()); performStoragePoolInitOps(pool1); performStoragePoolInitOps(pool2); performStoragePoolInitOps(pool3); }
Source:
public static MergeOptions createFromRequest(List<RenderedImage> imageStack, int dx, int dy, int margin, GetLegendGraphicRequest req, boolean forceLabelsOn, boolean forceLabelsOff) { return new LegendMerger.MergeOptions(imageStack, dx, dy, margin, LegendUtils.getBackgroundColor(req), req.isTransparent(), LegendUtils.isFontAntiAliasing(req), LegendUtils.getLayout(req), LegendUtils.getRowWidth(req), LegendUtils.getRows(req), LegendUtils.getColumnHeight(req), LegendUtils.getColumns(req), LegendUtils.getLabelFont(req), forceLabelsOn, forceLabelsOff); }

Target:
public static MergeOptions createFromRequest(List<RenderedImage> imageStack, int dx, int dy, int margin, GetLegendGraphicRequest req, boolean forceLabelsOn, boolean forceLabelsOff) { return new LegendMerger.MergeOptions(imageStack, dx, dy, margin, req, forceLabelsOn, forceLabelsOff); }
Source:
private Network getOrCreateNetwork(GoogleComputeEngineTemplateOptions templateOptions, String sharedResourceName) { String networkName = templateOptions.getNetworkName().isPresent() ? templateOptions.getNetworkName().get() : sharedResourceName; Network network = api.getNetworkApiForProject(userProject.get()).get(networkName); if (network != null) { return network; } checkArgument(!templateOptions.getNetwork().isPresent(), "requested network %s does not exist", templateOptions.getNetwork().orNull()); AtomicReference<Operation> operation = new AtomicReference<Operation>(api.getNetworkApiForProject(userProject .get()).createInIPv4Range(sharedResourceName, DEFAULT_INTERNAL_NETWORK_RANGE)); retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS).apply(operation); checkState(!operation.get().getHttpError().isPresent(),"Could not create network, operation failed" + operation); return checkNotNull(api.getNetworkApiForProject(userProject.get()).get(sharedResourceName), "no network with name %s was found", sharedResourceName); }

Target:
private Network getOrCreateNetwork(GoogleComputeEngineTemplateOptions templateOptions, String sharedResourceName) { String networkName = templateOptions.getNetworkName().or(sharedResourceName); Network network = api.getNetworkApiForProject(userProject.get()).get(networkName); if (network != null) { return network; } else if (templateOptions.getNetwork().isPresent()) { throw new IllegalArgumentException("requested network " + networkName + " does not exist"); } AtomicReference<Operation> operation = new AtomicReference<Operation>(api.getNetworkApiForProject(userProject .get()).createInIPv4Range(sharedResourceName, DEFAULT_INTERNAL_NETWORK_RANGE)); retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS).apply(operation); checkState(!operation.get().getHttpError().isPresent(),"Could not create network, operation failed" + operation); return checkNotNull(api.getNetworkApiForProject(userProject.get()).get(sharedResourceName), "no network with name %s was found", sharedResourceName); }
Source:
public static void setup() throws IOException { final Configuration conf = new Configuration(); conf.set(TxConstants.Persist.CFG_TX_SNAPHOT_CODEC_CLASSES, SnapshotCodecV2.class.getName()); conf.set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, tmpFolder.newFolder().getAbsolutePath()); Injector injector = Guice.createInjector( new ConfigModule(conf), new DiscoveryModules().getInMemoryModules(), Modules.override( new TransactionModules().getInMemoryModules()).with(new AbstractModule() { @Override protected void configure() { TransactionManager txManager = new TransactionManager(conf); txManager.startAndWait(); bind(TransactionManager.class).toInstance(txManager); bind(TransactionSystemClient.class).to(DummyTxClient.class).in(Singleton.class); } })); txClient = (DummyTxClient) injector.getInstance(TransactionSystemClient.class); }

Target:
public static void setup() throws IOException { final Configuration conf = new Configuration(); conf.set(TxConstants.Persist.CFG_TX_SNAPHOT_CODEC_CLASSES, SnapshotCodecV4.class.getName()); conf.set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, tmpFolder.newFolder().getAbsolutePath()); Injector injector = Guice.createInjector( new ConfigModule(conf), new DiscoveryModules().getInMemoryModules(), Modules.override( new TransactionModules().getInMemoryModules()).with(new AbstractModule() { @Override protected void configure() { TransactionManager txManager = new TransactionManager(conf); txManager.startAndWait(); bind(TransactionManager.class).toInstance(txManager); bind(TransactionSystemClient.class).to(DummyTxClient.class).in(Singleton.class); } })); txClient = (DummyTxClient) injector.getInstance(TransactionSystemClient.class); }
Source:
private Symbol[] loadSymbolsBySection(Section section) throws IOException { int numSyms = 1; if (section.sh_entsize != 0) { numSyms = (int) section.sh_size / (int) section.sh_entsize; } section.makeSureNotCompressed(); ArrayList<Symbol> symList = new ArrayList<>(numSyms); ElfSectionIterator elfIterator = symbolIterator(section); while (elfIterator.hasNext()) { Symbol symbol = elfIterator.next(); if (symbol.st_info == 0) continue; symList.add(symbol); } elfIterator.close(); Symbol[] results = symList.toArray(new Symbol[0]); Arrays.sort(results); return results; }

Target:
private Symbol[] loadSymbolsBySection(Section section) throws IOException { int numSyms = 1; if (section.sh_entsize != 0) { numSyms = (int) section.sh_size / (int) section.sh_entsize; } section.makeSureNotCompressed(); ArrayList<Symbol> symList = new ArrayList<>(numSyms); try (ElfSectionIterator elfIterator = symbolIterator(section)) { while (elfIterator.hasNext()) { Symbol symbol = elfIterator.next(); if (symbol.st_info == 0) continue; symList.add(symbol); } } Symbol[] results = symList.toArray(new Symbol[0]); Arrays.sort(results); return results; }
Source:
protected void delete(EncounterProvider delegate, String reason, RequestContext context) throws ResponseException { throw new ResourceDoesNotSupportOperationException(); }

Target:
protected void delete(EncounterProvider delegate, String reason, RequestContext context) throws ResponseException { delegate.getEncounter().removeProvider(delegate.getEncounterRole(), delegate.getProvider()); }
Source:
public void testNewThreadSweepsNewTable() { int otherThreadIndex = THREAD_INDEX + 1; setProgress(ImmutableSweepProgress.builder() .tableRef(TABLE_REF) .staleValuesDeleted(3) .cellTsPairsExamined(11) .minimumSweptTimestamp(4567L) .startRow(new byte[] {1, 2, 3}) .startColumn(PtBytes.toBytes("unused")) .timeInMillis(10L) .startTimeInMillis(20L) .build()); setNoProgress(otherThreadIndex); setupTaskRunner(OTHER_TABLE, ImmutableSweepResults.builder() .staleValuesDeleted(2) .cellTsPairsExamined(10) .minSweptTimestamp(12345L) .nextStartRow(Optional.of(new byte[] {4, 5, 6})) .timeInMillis(20L) .timeSweepStarted(50L) .build()); setNextTableToSweep(OTHER_TABLE); BackgroundSweepThread otherThread = getBackgroundSweepThread(otherThreadIndex); otherThread.runOnce(); Mockito.verify(progressStore).saveProgress(eq(otherThreadIndex), eq(ImmutableSweepProgress.builder() .tableRef(OTHER_TABLE) .staleValuesDeleted(2) .cellTsPairsExamined(10) .minimumSweptTimestamp(12345L) .startRow(new byte[] {4, 5, 6}) .startColumn(PtBytes.toBytes("unused")) .timeInMillis(20L) .startTimeInMillis(50L) .build())); }

Target:
public void testNewThreadSweepsNewTable() { int otherThreadIndex = THREAD_INDEX + 1; setProgress(ImmutableSweepProgress.builder() .tableRef(TABLE_REF) .staleValuesDeleted(3) .cellTsPairsExamined(11) .minimumSweptTimestamp(4567L) .startRow(new byte[] {1, 2, 3}) .startColumn(PtBytes.toBytes("unused")) .timeInMillis(10L) .startTimeInMillis(20L) .build()); setNoProgress(OTHER_TABLE); setupTaskRunner(OTHER_TABLE, ImmutableSweepResults.builder() .staleValuesDeleted(2) .cellTsPairsExamined(10) .minSweptTimestamp(12345L) .nextStartRow(Optional.of(new byte[] {4, 5, 6})) .timeInMillis(20L) .timeSweepStarted(50L) .build()); setNextTableToSweep(OTHER_TABLE); BackgroundSweepThread otherThread = getBackgroundSweepThread(otherThreadIndex); otherThread.runOnce(); Mockito.verify(progressStore).saveProgress( eq(ImmutableSweepProgress.builder() .tableRef(OTHER_TABLE) .staleValuesDeleted(2) .cellTsPairsExamined(10) .minimumSweptTimestamp(12345L) .startRow(new byte[] {4, 5, 6}) .startColumn(PtBytes.toBytes("unused")) .timeInMillis(20L) .startTimeInMillis(50L) .build())); }
Source:
public TimeSeriesValue<V> next() { Entry<TimeSeriesKey<K>, V> next = wrappedIterator.next(); TimeSeriesValue<V> kv = new TimeSeriesValue<>(next.getValue(), next.getKey().getTimestamp()); return kv; }

Target:
public TimestampedValue<V> next() { Entry<TimeSeriesKey<K>, V> next = wrappedIterator.next(); return new TimestampedValue<>(next.getValue(), next.getKey().getTimestamp()); }
Source:
RexNode simplifyAnd2(List<RexNode> terms, List<RexNode> notTerms) { for (RexNode term : terms) { if (term.isAlwaysFalse()) { return rexBuilder.makeLiteral(false); } } for (RexNode term : notTerms) { if (term.isAlwaysTrue()) { return rexBuilder.makeLiteral(false); } } if (terms.isEmpty() && notTerms.isEmpty()) { return rexBuilder.makeLiteral(true); } if (unknownAsFalse) { for (RexNode notDisjunction : notTerms) { final List<RexNode> terms2 = RelOptUtil.conjunctions(notDisjunction); if (terms.containsAll(terms2)) { return rexBuilder.makeLiteral(false); } } } for (RexNode notDisjunction : notTerms) { terms.add( simplify_( rexBuilder.makeCall(SqlStdOperatorTable.NOT, notDisjunction))); } return RexUtil.composeConjunction(rexBuilder, terms, false); }

Target:
RexNode simplifyAnd2(List<RexNode> terms, List<RexNode> notTerms) { for (RexNode term : terms) { if (term.isAlwaysFalse()) { return rexBuilder.makeLiteral(false); } } for (RexNode term : notTerms) { if (term.isAlwaysTrue()) { return rexBuilder.makeLiteral(false); } } if (terms.isEmpty() && notTerms.isEmpty()) { return rexBuilder.makeLiteral(true); } for (RexNode notDisjunction : notTerms) { terms.add( simplify_( rexBuilder.makeCall(SqlStdOperatorTable.NOT, notDisjunction))); } return RexUtil.composeConjunction(rexBuilder, terms, false); }
Source:
public <T extends LwM2mResponse> T send(Registration destination, DownlinkRequest<T> request) throws InterruptedException { if (destination.usesQueueMode()) { if (presenceService.isClientSleeping(destination)) { LOG.info("The destination client is sleeping, request couldn't been sent."); return null; } else { presenceService.startClientAwakeTimer(destination); } } return requestSender.send(destination, request, DEFAULT_TIMEOUT); }

Target:
public <T extends LwM2mResponse> T send(Registration destination, DownlinkRequest<T> request) throws InterruptedException { if (destination.usesQueueMode()) { if (!presenceService.isClientAwake(destination)) { LOG.info("The destination client is sleeping, request couldn't been sent."); return null; } } return requestSender.send(destination, request, DEFAULT_TIMEOUT); }
Source:
public Optional<Boolean> onActivated(EntityPlayer player, EnumHand hand, ItemStack heldItem, RayTraceResult hit) { return Optional.absent(); }

Target:
public EnumActionResult onActivated(EntityPlayer player, EnumHand hand, ItemStack heldItem, RayTraceResult hit) { return EnumActionResult.PASS; }
Source:
public int rank() { if ((columns == 0) || (rows == 0)) return 0; Matrix m = this; int i; int x, y; x = 0; y = 0; int endi = (columns > rows)? rows : columns; for(i = 0; i < endi; i++) { if (m.get(i, i)== 0) { boolean c = false; for (int k = i; k < rows; k++){ for (int l = i; l < columns; l++){ if (m.get(k, l) != 0){ y = k; x = l; c = true; break; } } if (c) break; } if (!c) break; if (i != y) m.swapRows(i, y); if (i != x) m.swapColumns(i, x); } for (x = i; x < columns; x++) { m.set(i, x, m.get(i, x) / m.get(i, i) ); } for (y = i + 1; y < rows; y++) { for (x = i; x < columns; x++) m.set(y, x, m.get(y, x) - m.get(i, x) * m.get(y, i)); } for (x = i + 1; x < columns; x++) { for (y = i; y < rows; y++) m.set(y, x, m.get(y, x) - m.get(y, i) * m.get(i, x)); } } int cnt = 0; for (i = 0; i < endi; i++) if (m.get(i, i) == 0) break; else cnt++; return cnt; }

Target:
public int rank() { if ((columns == 0) || (rows == 0)) { return 0; } int x = 0; int y = 0; int endi = (columns > rows)? rows : columns; for(int i = 0; i < endi; i++) { if (Math.abs(unsafe_get(i, i)) <= Matrices.EPS) { boolean c = false; for (int k = i; k < rows; k++){ for (int l = i; l < columns; l++){ if (Math.abs(unsafe_get(k, l)) > Matrices.EPS){ y = k; x = l; c = true; break; } } if (c) { break; } } if (!c) { break; } if (i != y) { swapRows(i, y); } if (i != x) { swapColumns(i, x); } } for (x = i; x < columns; x++) { unsafe_set(i, x, unsafe_get(i, x) / unsafe_get(i, i)); } for (y = i + 1; y < rows; y++) { for (x = i; x < columns; x++) unsafe_set(y, x, unsafe_get(y, x) - unsafe_get(i, x) * unsafe_get(y, i)); } for (x = i + 1; x < columns; x++) { for (y = i; y < rows; y++) unsafe_set(y, x, unsafe_get(y, x) - unsafe_get(y, i) * unsafe_get(i, x)); } } int result = 0; for (int i = 0; i < endi; i++) if (Math.abs(unsafe_get(i, i)) <= Matrices.EPS) { break; } else { result++; } return result; }
Source:
public ITmfTimestamp normalize(final long offset, final int scale) { long value = fValue; int precision = fPrecision; if (fScale == scale && offset == 0) { return new TmfTimestamp(this); } if (this.equals(BIG_BANG) || this.equals(BIG_CRUNCH)) { return this; } if (fScale != scale) { final int scaleDiff = Math.abs(fScale - scale); if (scaleDiff >= scalingFactors.length) { throw new ArithmeticException("Scaling exception"); } final long scalingFactor = scalingFactors[scaleDiff]; if (scale < fScale) { value *= scalingFactor; precision *= scalingFactor; } else { value /= scalingFactor; precision /= scalingFactor; } } if (offset < 0) { value = (value < Long.MIN_VALUE - offset) ? Long.MIN_VALUE : value + offset; } else { value = (value > Long.MAX_VALUE - offset) ? Long.MAX_VALUE : value + offset; } return new TmfTimestamp(value, scale, precision); }

Target:
public ITmfTimestamp normalize(final long offset, final int scale) { long value = fValue; int precision = fPrecision; if (fScale == scale && offset == 0) { return this; } if (this.equals(BIG_BANG) || this.equals(BIG_CRUNCH)) { return this; } if (fScale != scale) { final int scaleDiff = Math.abs(fScale - scale); if (scaleDiff >= scalingFactors.length) { throw new ArithmeticException("Scaling exception"); } final long scalingFactor = scalingFactors[scaleDiff]; if (scale < fScale) { value *= scalingFactor; precision *= scalingFactor; } else { value /= scalingFactor; precision /= scalingFactor; } } if (offset < 0) { value = (value < Long.MIN_VALUE - offset) ? Long.MIN_VALUE : value + offset; } else { value = (value > Long.MAX_VALUE - offset) ? Long.MAX_VALUE : value + offset; } return new TmfTimestamp(value, scale, precision); }
Source:
public String getDefaultValidationMessage() {; return AgeValidator.DEFAULT_VALIDATION_MESSAGE; }

Target:
public String getDefaultValidationMessage() { return AgeValidator.DEFAULT_VALIDATION_MESSAGE; }
Source:
public Color getColor() { switch (type) { case INTEGER: return new Color(52, 152, 255); case STRING: return new Color(204, 88, 56); case SYMBOL: return new Color(46, 204, 50); default: return new Color(0, 0, 0); } }

Target:
public Color getColor() { switch (type) { case INTEGER: return new Color(52, 152, 255); case STRING: return new Color(204, 88, 56); case SYMBOL: return new Color(46, 204, 113); default: return new Color(0, 0, 0); } }