auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
synchronized String encrypt(String plainTextValue) { if (initFailureMessage != null) { alertSystem(initFailureMessage, initException); } if (isBlank(plainTextValue)) { LOGGER.debug( "Failed to encrypt value of %s, because it was null or blank.", plainTextValue); return plainTextValue; } try { return crypter.encrypt(plainTextValue); } catch (CrypterException e) { LOGGER.warn(String.format("Failed to encrypt to bundle cache. %s", e.getMessage())); AUDIT_LOG.warn(AUDIT_MESSAGE); return plainTextValue; } }

Target:
synchronized String encrypt(String plainTextValue) { if (initFailureMessage != null) { alertSystem(initFailureMessage, initException); } if (isBlank(plainTextValue)) { LOGGER.debug( "Failed to encrypt value of {}, because it was null or blank.", plainTextValue); return plainTextValue; } try { return crypter.encrypt(plainTextValue); } catch (CrypterException e) { LOGGER.warn("Failed to encrypt to bundle cache. {}", e.getMessage()); AUDIT_LOG.warn(AUDIT_MESSAGE); return plainTextValue; } }
Source:
public LogReplicationEntry resend() { LogReplicationEntry ack = null; boolean force = false; try { ack = processAcks(); } catch (ExecutionException ee) { log.warn("Caught an execution exception while processing ACKs", ee); final Throwable cause = ee.getCause(); if (cause instanceof TimeoutException) { force = true; } } catch (Exception e) { log.warn("Caught an exception while processing ACKs.", e); return null; } for (int i = 0; i < pendingMessages.getSize(); i++) { LogReplicationPendingEntry entry = pendingMessages.getList().get(i); if (entry.timeout(msgTimer) || force) { if (errorOnMsgTimeout && entry.retry >= maxRetry) { log.warn("Entry of type has been resent max times for timer {}.", entry.getData().getMetadata().getTimestamp(), entry.getData().getMetadata().getMessageMetadataType(), maxRetry, msgTimer); throw new LogEntrySyncTimeoutException("timeout"); } entry.retry(); CompletableFuture<LogReplicationEntry> cf = dataSender.send(entry.getData()); addCFToAcked(entry.getData(), cf); log.info("Resend message {}", entry.getData().getMetadata().getTimestamp()); } } return ack; }

Target:
public LogReplicationEntry resend() { LogReplicationEntry ack = null; boolean force = false; try { ack = processAcks(); } catch (TimeoutException te) { log.warn("Caught a timeout exception while processing ACKs", te); force = true; } catch (ExecutionException ee) { log.warn("Caught an execution exception while processing ACKs", ee); final Throwable cause = ee.getCause(); if (cause instanceof TimeoutException) { force = true; } } catch (Exception e) { log.warn("Caught an exception while processing ACKs.", e); } for (int i = 0; i < pendingMessages.getSize(); i++) { LogReplicationPendingEntry entry = pendingMessages.getList().get(i); if (entry.timeout(msgTimer) || force) { entry.retry(); LogReplicationEntry dataEntry = entry.getData(); dataEntry.getMetadata().setTopologyConfigId(topologyConfigId); CompletableFuture<LogReplicationEntry> cf = dataSender.send(entry.getData()); addCFToAcked(entry.getData(), cf); log.debug("Resend message {}[ts={}]", entry.getData().getMetadata().getMessageMetadataType(), entry.getData().getMetadata().getTimestamp()); } } return ack; }
Source:
public void testSubscribe() throws Exception { when(conn.getState()).thenReturn(Constants.ConnState.CONNECTED); when(conn.subscribe(any(String.class), any(MessageHandler.class))).thenReturn(mockSub); transport.subscribe(topic); assertTrue(transport.isOpen()); assertEquals(mockSub, transport.sub); }

Target:
public void testSubscribe() throws Exception { when(conn.getState()).thenReturn(Constants.ConnState.CONNECTED); ArgumentCaptor<String> topicCaptor = ArgumentCaptor.forClass(String.class); when(conn.subscribe(topicCaptor.capture(), any(MessageHandler.class))).thenReturn(mockSub); transport.subscribe(topic); assertTrue(transport.isOpen()); assertEquals(mockSub, transport.sub); assertEquals(formattedSubject, topicCaptor.getValue()); }
Source:
private Optional<CursorQuad> getQuad(List<String> path, String uri, QuadStore quadStore) { return quadStore.getQuads(uri, path.get(0), Direction.OUT, "").map(quad -> { if (path.size() > 1) { return getQuad(path.subList(1, path.size()), quad.getObject(), quadStore); } else { return Optional.of(quad); } }).filter(Optional::isPresent).findFirst().map(Optional::get); }

Target:
private Optional<CursorQuad> getQuad(List<String> path, String uri, QuadStore quadStore) { Optional<CursorQuad> foundQuad; try (Stream<CursorQuad> quads = quadStore.getQuads(uri, path.get(0), Direction.OUT, "")) { foundQuad = quads.map(quad -> { if (path.size() > 1) { if (quad.getValuetype().isPresent()) { return Optional.<CursorQuad>empty(); } return getQuad(path.subList(1, path.size()), quad.getObject(), quadStore); } else { return Optional.of(quad); } }).filter(Optional::isPresent).findFirst().map(Optional::get); } return foundQuad; }
Source:
public Agency createAgency(Long sponsorId) { LOG.info("Creating Agency: "+ sponsorId); Sponsor sponsor = businessObjectService.findBySinglePrimaryKey(Sponsor.class, sponsorId); Agency agency = new Agency(); agency.setAgencyNumber(sponsorId.toString()); agency.setReportingName(sponsor.getSponsorLabel()); if (ObjectUtils.isNotNull(sponsor.getSponsorName()) && sponsor.getSponsorName().length() > 150) agency.setFullName(sponsor.getSponsorName().substring(0,149)); else { agency.setFullName(sponsor.getSponsorName()); } if (sponsor.getParentSponsor() != null) { Agency rptsToAgency = businessObjectService.findBySinglePrimaryKey(Agency.class, sponsor.getParentSponsor()); if (rptsToAgency == null) { rptsToAgency = createAgency(sponsor.getParentSponsor()); routeAgencyDocument(rptsToAgency, null); } agency.setReportsToAgencyNumber(sponsor.getParentSponsor().toString()); } String sponsorTypeCode = getAgencyTypeMap().get(sponsor.getSourceCode().toString()); agency.setAgencyTypeCode(sponsorTypeCode); agency.setActive(true); return agency; }

Target:
public Agency createAgency(Long sponsorId) { LOG.info("Creating Agency: "+ sponsorId); Sponsor sponsor = businessObjectService.findBySinglePrimaryKey(Sponsor.class, sponsorId); Agency agency = new Agency(); agency.setAgencyNumber(sponsorId.toString()); agency.setReportingName(sponsor.getSponsorLabel()); if (ObjectUtils.isNotNull(sponsor.getSponsorName()) && sponsor.getSponsorName().length() > 150) agency.setFullName(sponsor.getSponsorName().substring(0, 150)); else { agency.setFullName(sponsor.getSponsorName()); } if (sponsor.getParentSponsor() != null) { Agency rptsToAgency = businessObjectService.findBySinglePrimaryKey(Agency.class, sponsor.getParentSponsor()); if (rptsToAgency == null) { rptsToAgency = createAgency(sponsor.getParentSponsor()); routeAgencyDocument(rptsToAgency, null); } agency.setReportsToAgencyNumber(sponsor.getParentSponsor().toString()); } String sponsorTypeCode = getAgencyTypeMap().get(sponsor.getSourceCode().toString()); agency.setAgencyTypeCode(sponsorTypeCode); agency.setActive(true); return agency; }
Source:
public void testInListWithAnd1Filter() throws SQLException { String tenantId1 = "000000000000001"; String tenantId2 = "000000000000002"; String tenantId3 = "000000000000003"; String entityId = "00000000000000X"; String query = String.format("select * from %s where organization_id IN ('%s','%s','%s') AND entity_id='%s'", ATABLE_NAME, tenantId1, tenantId3, tenantId2, entityId); SQLParser parser = new SQLParser(query); SelectStatement statement = parser.parseQuery(); Scan scan = new Scan(); List<Object> binds = Collections.emptyList(); PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class); ColumnResolver resolver = FromCompiler.getResolver(statement, pconn); StatementContext context = new StatementContext(pconn, resolver, binds, statement.getBindCount(), scan); statement = compileStatement(context, statement, resolver, binds, scan, 0, null); byte[] startRow = PDataType.VARCHAR.toBytes(tenantId1); assertArrayEquals(startRow, scan.getStartRow()); byte[] stopRow = PDataType.VARCHAR.toBytes(tenantId3); assertArrayEquals(ByteUtil.nextKey(stopRow), scan.getStopRow()); Filter filter = scan.getFilter(); assertNotNull(filter); assertEquals( new SkipScanFilter() .setCnf( Arrays.asList( Arrays.asList( Bytes.toBytes(tenantId1), Bytes.toBytes(tenantId1), Bytes.toBytes(tenantId2), Bytes.toBytes(tenantId2), Bytes.toBytes(tenantId3), Bytes.toBytes(tenantId3)) )) .setFilter( rowKeyFilter( and( in(pkColumn(BaseConnectionlessQueryTest.ORGANIZATION_ID, BaseConnectionlessQueryTest.ATABLE.getPKColumns()),PDataType.CHAR, tenantId1,tenantId3, tenantId2), constantComparison(CompareOp.EQUAL, pkColumn(BaseConnectionlessQueryTest.ENTITY_ID, BaseConnectionlessQueryTest.ATABLE.getPKColumns()), entityId))) ), filter); }

Target:
public void testInListWithAnd1Filter() throws SQLException { String tenantId1 = "000000000000001"; String tenantId2 = "000000000000002"; String tenantId3 = "000000000000003"; String entityId = "00000000000000X"; String query = String.format("select * from %s where organization_id IN ('%s','%s','%s') AND entity_id='%s'", ATABLE_NAME, tenantId1, tenantId3, tenantId2, entityId); SQLParser parser = new SQLParser(query); SelectStatement statement = parser.parseQuery(); Scan scan = new Scan(); List<Object> binds = Collections.emptyList(); PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class); ColumnResolver resolver = FromCompiler.getResolver(statement, pconn); StatementContext context = new StatementContext(pconn, resolver, binds, statement.getBindCount(), scan); statement = compileStatement(context, statement, resolver, binds, scan, 2, null); Filter filter = scan.getFilter(); assertEquals( new SkipScanFilter().setCnf( ImmutableList.of( Arrays.asList( pointRange(tenantId1), pointRange(tenantId2), pointRange(tenantId3)), Arrays.asList(pointRange(entityId))), new int[] { 15, 15 }), filter); }
Source:
public void save(Member member) { EntityManager entityManager = entityManagerFactory.createEntityManager(); EntityTransaction transaction = entityManager.getTransaction(); transaction.begin(); entityManager.persist(member); entityManager.merge(member); transaction.commit(); entityManager.close(); }

Target:
public Member save(Member member) { EntityManager entityManager = entityManagerFactory.createEntityManager(); EntityTransaction transaction = entityManager.getTransaction(); transaction.begin(); Member memberToReturn = entityManager.merge(member); transaction.commit(); entityManager.close(); return memberToReturn; }
Source:
public Object set(final Object o, final Text text) { return new BinaryWritable(text == null ? null : Binary.fromUnmodifiedByteArray(text.getBytes ())); }

Target:
public Object set(final Object o, final Text text) { return new BinaryWritable(text == null ? null : Binary.fromReusedByteArray(text.getBytes ())); }
Source:
public String getConfDir() { return getRelativeDir(getString(ConfVars.ZEPPELIN_CONF_DIR)); }

Target:
public String getConfDir() { return getRelativeDir(ConfVars.ZEPPELIN_CONF_DIR); }
Source:
public Iterable<Result<TimeBoundaryResultValue>> mergeResults(List<Result<TimeBoundaryResultValue>> results) { if (results == null || results.isEmpty()) { return Lists.newArrayList(); } DateTime min = new DateTime(Long.MAX_VALUE); DateTime max = new DateTime(Long.MIN_VALUE); for (Result<TimeBoundaryResultValue> result : results) { TimeBoundaryResultValue val = result.getValue(); if (!bound.equalsIgnoreCase(MAX_TIME)) { DateTime currMinTime = val.getMinTime(); if (currMinTime.isBefore(min)) { min = currMinTime; } } if (!bound.equalsIgnoreCase(MIN_TIME)) { DateTime currMaxTime = val.getMaxTime(); if (currMaxTime.isAfter(max)) { max = currMaxTime; } } } final ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>(); final DateTime ts; if (bound.equalsIgnoreCase(MIN_TIME)) { ts = min; builder.put(MIN_TIME, max); } else if (bound.equalsIgnoreCase(MAX_TIME)) { ts = max; builder.put(MAX_TIME, min); } else { ts = min; builder.put(MIN_TIME, min); builder.put(MAX_TIME, max); } return Arrays.asList( new Result<>( ts, new TimeBoundaryResultValue( builder.build() ) ) ); }

Target:
public Iterable<Result<TimeBoundaryResultValue>> mergeResults(List<Result<TimeBoundaryResultValue>> results) { if (results == null || results.isEmpty()) { return Lists.newArrayList(); } DateTime min = new DateTime(Long.MAX_VALUE); DateTime max = new DateTime(Long.MIN_VALUE); for (Result<TimeBoundaryResultValue> result : results) { TimeBoundaryResultValue val = result.getValue(); DateTime currMinTime = val.getMinTime(); if (currMinTime != null && currMinTime.isBefore(min)) { min = currMinTime; } DateTime currMaxTime = val.getMaxTime(); if (currMaxTime != null && currMaxTime.isAfter(max)) { max = currMaxTime; } } final DateTime ts; final DateTime minTime; final DateTime maxTime; if (bound.equalsIgnoreCase(MIN_TIME)) { ts = min; minTime = min; maxTime = null; } else if (bound.equalsIgnoreCase(MAX_TIME)) { ts = max; minTime = null; maxTime = max; } else { ts = min; minTime = min; maxTime = max; } return buildResult(ts, minTime, maxTime); }
Source:
public void theGetSynchronizeTimeRequestIsReceived() throws Throwable { this.correlationUidPattern = Pattern.compile(this.organisationId.getOrganisationId() + "\\|\\|\\|\\S{17}\\|\\|\\|\\S{17}"); this.testCase = this.wsdlProjectFactory.createWsdlTestCase(SOAP_PROJECT_XML, TEST_SUITE_XML, TEST_CASE_XML); PROPERTIES_MAP.put("DeviceIdentificationE", this.deviceId.getDeviceId()); PROPERTIES_MAP.put("OrganisationIdentification", this.organisationId.getOrganisationId()); final TestCaseResult runTestStepByName = this.testCaseRunner.runWsdlTestCase(this.testCase, PROPERTIES_MAP, TEST_CASE_NAME_REQUEST); final TestStepResult runTestStepByNameResult = runTestStepByName.getRunTestStepByName(); final WsdlTestCaseRunner wsdlTestCaseRunner = runTestStepByName.getResults(); assertEquals(TestStepStatus.OK, runTestStepByNameResult.getStatus()); for (final TestStepResult tcr : wsdlTestCaseRunner.getResults()) { this.response = ((MessageExchange) tcr).getResponseContent(); this.correlationUidMatcher = this.correlationUidPattern.matcher(this.response); } this.correlationUidMatcher.find(); this.correlationUid = this.correlationUidMatcher.group(); }

Target:
public void theGetSynchronizeTimeRequestIsReceived() throws Throwable { this.correlationUidPattern = Pattern.compile(this.organisationId.getOrganisationId() + "\\|\\|\\|\\S{17}\\|\\|\\|\\S{17}"); this.testCase = this.wsdlProjectFactory.createWsdlTestCase(SOAP_PROJECT_XML, TEST_SUITE_XML, TEST_CASE_XML); PROPERTIES_MAP.put("DeviceIdentificationE", this.deviceId.getDeviceId()); PROPERTIES_MAP.put("OrganisationIdentification", this.organisationId.getOrganisationId()); final TestCaseResult runTestStepByName = this.testCaseRunner.runWsdlTestCase(this.testCase, PROPERTIES_MAP, TEST_CASE_NAME_REQUEST); final TestStepResult runTestStepByNameResult = runTestStepByName.getRunTestStepByName(); final WsdlTestCaseRunner wsdlTestCaseRunner = runTestStepByName.getResults(); assertEquals(TestStepStatus.OK, runTestStepByNameResult.getStatus()); for (final TestStepResult tcr : wsdlTestCaseRunner.getResults()) { this.response = ((MessageExchange) tcr).getResponseContent(); this.correlationUidMatcher = this.correlationUidPattern.matcher(this.response); } assertTrue(this.correlationUidMatcher.find()); this.correlationUid = this.correlationUidMatcher.group(); }
Source:
public void makeChange(BibDatabaseContext database, NamedCompound undoEdit) { database.getDatabase().insertEntry(diskEntry); undoEdit.addEdit(new UndoableInsertEntries(database.getDatabase(), Collections.singletonList(diskEntry))); }

Target:
public void makeChange(BibDatabaseContext database, NamedCompound undoEdit) { database.getDatabase().insertEntry(entry); undoEdit.addEdit(new UndoableInsertEntries(database.getDatabase(), entry)); }
Source:
public boolean isValid() { return interval == null ^ segmentIds == null; }

Target:
public boolean isValid() { return (interval == null ^ segmentIds == null) && (segmentIds == null || !segmentIds.isEmpty()); }
Source:
private void verifyMonitor(JenkinsRule.WebClient wc) throws IOException, SAXException { HtmlPage p = wc.goTo("manage"); DomElement adminMonitorDiv = p.getElementById("tooManyJobsButNoView"); assertThat(adminMonitorDiv.getTextContent(), containsString("There appears to be a large number of jobs")); }

Target:
private void verifyMonitor(JenkinsRule.WebClient wc) throws IOException, SAXException { HtmlPage p = wc.goTo("manage"); DomElement adminMonitorDiv = p.getElementById("tooManyJobsButNoView"); assertThat(adminMonitorDiv, is(notNullValue())); assertThat(adminMonitorDiv.getTextContent(), is(notNullValue())); }
Source:
public void processLeftData(final MistDataEvent input) { try { final OUT operationResult = aggregateFunc.apply((WindowData<IN>)input.getValue()); LOG.log(Level.FINE, "{0} aggregates the input window {1} using {2}, and generates {3}", new Object[]{getOperatorIdentifier(), input, aggregateFunc, operationResult}); input.setValue(operationResult); outputEmitter.emitData(input); } catch (final ClassCastException e) { throw e; } }

Target:
public void processLeftData(final MistDataEvent input) { try { final WindowData<IN> windowData = (WindowData<IN>) input.getValue(); final OUT operationResult = aggregateFunc.apply(windowData); LOG.log(Level.FINE, "{0} aggregates the input window {1} which started at {2} and ended at {3}, " + "and generates {4}", new Object[]{getOperatorIdentifier(), input, windowData.getStart(), windowData.getEnd(), operationResult}); input.setValue(operationResult); outputEmitter.emitData(input); } catch (final ClassCastException e) { throw e; } }
Source:
protected void doOperation() { Datastore.initialize(); List<FeedbackSessionAttributes> feedbackSessions = fsDb.getAllFeedbackSessions(); try { for(FeedbackSessionAttributes session : feedbackSessions){ logic.updateRespondants(session.feedbackSessionName, session.courseId); System.out.println("Successfully update response rate for session " + session.feedbackSessionName + " in course " + session.courseId); } } catch (InvalidParametersException | EntityDoesNotExistException e) { Assumption.fail("Fail to update respondants"); } }

Target:
protected void doOperation() { Datastore.initialize(); boolean isForAllSession = true; if(isForAllSession){ updateRespondantsForAllSessions(); } else { updateRespondantsForSession("Feedback Session Name", "Course ID"); } }
Source:
public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException { ModelNode superResult = value.getType() == ModelType.LIST ? value : super.resolveValue(resolver, value); ModelNode result = new ModelNode(); if (superResult.getType() != ModelType.LIST) { return superResult; }else{ result.setEmptyList(); } ModelNode clone = superResult == value ? value.clone() : superResult; for (ModelNode element : clone.asList()) { result.add(valueType.resolveValue(resolver, element)); } getValidator().validateResolvedParameter(getName(), result); return result; }

Target:
public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException { ModelNode superResult = value.getType() == ModelType.LIST ? value : super.resolveValue(resolver, value); if (superResult.getType() != ModelType.LIST) { return superResult; } ModelNode clone = superResult == value ? value.clone() : superResult; ModelNode result = new ModelNode(); result.setEmptyList(); for (ModelNode element : clone.asList()) { result.add(valueType.resolveValue(resolver, element)); } getValidator().validateResolvedParameter(getName(), result); return result; }
Source:
public PropertiesConfig(final Path configTemplate, final Path localConfig, final String delimiterRegex) throws IOException { checkNotNull(configTemplate); checkNotNull(localConfig); checkNotNull(delimiterRegex); final Properties properties = new Properties(); try (final Reader templateReader = Files.newBufferedReader(configTemplate); final Reader localReader = Files.newBufferedReader(localConfig)) { properties.load(templateReader); properties.load(localReader); } user = readUser(properties); environment = readEnvironment(properties); final Properties collapsed = collapse(properties, environment.name().toLowerCase()); this.properties = new Properties(collapsed); delimiter = Pattern.compile(delimiterRegex); }

Target:
public PropertiesConfig(final Path configTemplate, final Path localConfig, final String delimiterRegex) throws IOException { checkNotNull(configTemplate); checkNotNull(delimiterRegex); final Properties properties = new Properties(); try (final Reader templateReader = Files.newBufferedReader(configTemplate)) { properties.load(templateReader); } if (localConfig != null) { try (final Reader localReader = Files.newBufferedReader(localConfig)) { properties.load(localReader); } } user = readUser(properties); environment = readEnvironment(properties); this.properties = new Properties(collapse(properties, environment.name().toLowerCase())); delimiter = Pattern.compile(delimiterRegex); }
Source:
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { final boolean syncDownOnly = extras.getBoolean(SYNC_DOWN_ONLY, false); final SmartStoreSDKManager sdkManager = SmartStoreSDKManager.getInstance(); final UserAccountManager accManager = sdkManager.getUserAccountManager(); if (sdkManager.isLoggingOut() || accManager.getAuthenticatedUsers() == null) { return; } if (account != null) { sdkManager.setupUserStoreFromDefaultConfig(); final UserAccount user = sdkManager.getUserAccountManager().buildUserAccount(account); final ContactListLoader contactLoader = new ContactListLoader(getContext(), user); if (syncDownOnly) { contactLoader.syncDown(); } else { contactLoader.syncUp(); } } }

Target:
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { final boolean syncDownOnly = extras.getBoolean(SYNC_DOWN_ONLY, false); final SalesforceSDKManager sdkManager = SalesforceSDKManager.getInstance(); final UserAccountManager accManager = sdkManager.getUserAccountManager(); if (sdkManager.isLoggingOut() || accManager.getAuthenticatedUsers() == null) { return; } if (account != null) { final UserAccount user = sdkManager.getUserAccountManager().buildUserAccount(account); final ContactListLoader contactLoader = new ContactListLoader(getContext(), user); if (syncDownOnly) { contactLoader.syncDown(); } else { contactLoader.syncUp(); } } }
Source:
protected boolean removeMemoryVolumes(String memVols, boolean startPollingTasks) { List<Guid> guids = GuidUtils.getGuidListFromString(memVols); if (guids.size() == 6) { Guid guid1 = removeMemoryImage(guids); if (guid1 == null) { return false; } Guid guid2 = removeConfImage(guids); if (startPollingTasks) { if (!Guid.Empty.equals(guid1)) { AsyncTaskManager.getInstance().StartPollingTask(guid1); } if (guid2 != null && !Guid.Empty.equals(guid2)) { AsyncTaskManager.getInstance().StartPollingTask(guid2); } } return guid2 != null; } return true; }

Target:
protected boolean removeMemoryVolumes(String memVols, boolean startPollingTasks) { List<Guid> guids = GuidUtils.getGuidListFromString(memVols); if (guids.size() == 6) { Guid guid1 = removeMemoryImage(guids); if (guid1 == null) { return false; } Guid guid2 = removeConfImage(guids); if (startPollingTasks) { AsyncTaskManager.getInstance().StartPollingTask(guid1); if (guid2 != null) { AsyncTaskManager.getInstance().StartPollingTask(guid2); } } return guid2 != null; } return true; }
Source:
public Snmp(NotificationProperties props) { for (Map.Entry<String, String> entry : props.getProperties().entrySet()) { Matcher m = PROFILE_PATTERN.matcher(entry.getKey()); if (m.matches()) { String profile = m.group("profile") == null ? "" : m.group("profile"); String managers = props.getProperty(SNMP_MANAGERS, profile, false); if (!StringUtils.isBlank(managers)) { int snmpVersion = Integer.parseInt(props.getProperty(SNMP_VERSION, false)); if (!(snmpVersion == SnmpConstants.version2c || snmpVersion == SnmpConstants.version3)) { throw new NotificationServiceException("Unknown snmp version in properties file " + snmpVersion); } if (snmpVersion == SnmpConstants.version3) { profiles.put( profile, new Profile( managers, props.getProperty(SNMP_ENGINE_ID, profile, false), props.getProperty(SNMP_USERNAME, profile, false), props.getProperty(SNMP_AUTH_PASSPHRASE, profile, false), props.getProperty(SNMP_PRIVACY_PASSPHRASE, profile, false), Integer.parseInt(props.getProperty(SNMP_SECURITY_LEVEL, profile, false)), props.getProperty(SNMP_OID, profile, false), snmpVersion ) ); } else { profiles.put( profile, new Profile( managers, props.getProperty(SNMP_COMMUNITY, profile, false), props.getProperty(SNMP_OID, profile, false), snmpVersion ) ); } } } } if (!profiles.isEmpty()) { active = true; } }

Target:
public Snmp(NotificationProperties props) { for (Map.Entry<String, String> entry : props.getProperties().entrySet()) { Matcher m = PROFILE_PATTERN.matcher(entry.getKey()); if (m.matches()) { String profile = m.group("profile") == null ? "" : m.group("profile"); String managers = props.getProperty(SNMP_MANAGERS, profile, false); if (!StringUtils.isBlank(managers)) { int snmpVersion = getSnmpVersion(props.getProperty(SNMP_VERSION, false)); if (snmpVersion == SnmpConstants.version3) { profiles.put( profile, Profile.buildProfile( managers, props.getProperty(SNMP_ENGINE_ID, profile, false), props.getProperty(SNMP_USERNAME, profile, false), props.getProperty(SNMP_AUTH_PASSPHRASE, profile, false), props.getProperty(SNMP_PRIVACY_PASSPHRASE, profile, false), Integer.parseInt(props.getProperty(SNMP_SECURITY_LEVEL, profile, false)), props.getProperty(SNMP_OID, profile, false), snmpVersion ) ); } else { profiles.put( profile, Profile.buildProfile( managers, props.getProperty(SNMP_COMMUNITY, profile, false), props.getProperty(SNMP_OID, profile, false), snmpVersion ) ); } } } } if (!profiles.isEmpty()) { active = true; } }
Source:
protected Folder find(String folderInode) throws DotDataException { Folder folder = fc.getFolder(folderInode); if (folder == null) { try{ DotConnect dc = new DotConnect() .setSQL("SELECT * from folder where inode = ? or identifier=?") .addParam(folderInode) .addParam(folderInode); folder = TransformerLocator.createFolderTransformer(dc.loadObjectResults()).asList().get(0); Identifier id = APILocator.getIdentifierAPI().find(folder.getIdentifier()); fc.addFolder(folder, id); } catch(Exception e){ throw new DotDataException(e.getMessage(),e); } } return folder; }

Target:
protected Folder find(String folderInode) throws DotDataException { Folder folder = fc.getFolder(folderInode); if (folder == null) { try{ DotConnect dc = new DotConnect() .setSQL("select * from folder f join inode i on f.inode = i.inode where f.inode = ? "+ "UNION select * from folder f join inode i on f.inode = i.inode where f.identifier = ?") .addParam(folderInode) .addParam(folderInode); folder = TransformerLocator.createFolderTransformer(dc.loadObjectResults()).asList().get(0); Identifier id = APILocator.getIdentifierAPI().find(folder.getIdentifier()); fc.addFolder(folder, id); } catch(Exception e){ throw new DotDataException(e.getMessage(),e); } } return folder; }
Source:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); context.record( TransformLineageRecorderUtils.oneToOneIn(TransformLineageRecorderUtils.getFields(context.getInputSchema()), "mapValueOf", "Map values of fields based on the lookup table.")); }

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); if (context.getInputSchema() == null || context.getInputSchema().getFields() == null) { return; } parseConfiguration(this.config, context.getFailureCollector()); List<String> mappedFields = TransformLineageRecorderUtils.getFields(context.getInputSchema()) .stream().filter(mappingValues::containsKey).collect(Collectors.toList()); List<String> identityFields = TransformLineageRecorderUtils.getFields(context.getInputSchema()); identityFields.removeAll(mappedFields); List<FieldOperation> output = new ArrayList<>(); output.addAll(mappedFields.stream().map(sourceFieldName -> new FieldTransformOperation( "mapValueOf" + sourceFieldName, "Mapped values of fields based on the lookup table.", Collections.singletonList(sourceFieldName), mappingValues.get(sourceFieldName).getDefaultValue())).collect( Collectors.toList())); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(identityFields, "identity", TransformLineageRecorderUtils.IDENTITY_TRANSFORM_DESCRIPTION)); context.record(output); }
Source:
private synchronized void startBuild(BuildDefinition definition, Build queued, Optional<Build> previous) throws Exception { CommitInfo commitInfo = commitInfo(definition.getGitInfo(), commit(previous)); BuildConfig buildConfig = configAtSha(definition, commitInfo.getCurrent().getId()); BuildConfig resolvedConfig = resolveConfig(buildConfig, definition); Build launching = queued.withStartTimestamp(System.currentTimeMillis()) .withState(State.LAUNCHING) .withCommitInfo(commitInfo) .withBuildConfig(buildConfig) .withResolvedConfig(resolvedConfig); LOG.info("Updating status of build to {}", launching.getId().get(), launching.getState()); buildService.begin(launching); LOG.info("About to launch build {}", launching.getId().get()); SingularityRunNowRequest runNowRequest = new SingularityRunNowRequest( Optional.of(String.format("Build %d", launching.getId().get())), Optional.of(false), Optional.of("blazar-executor"), Optional.of(buildRunArgs(definition, launching))); try { singularityClient.runSingularityRequest("blazar-executor", Optional.of(runNowRequest)); } catch (SingularityClientException e) { LOG.warn(String.format("Launch of %d resulted in SingularityClientException", launching.getId().get()), e); return; } LOG.info("Launch of was successful", launching.getId().get()); }

Target:
private synchronized void startBuild(BuildDefinition definition, Build queued, Optional<Build> previous) throws Exception { CommitInfo commitInfo = commitInfo(definition.getGitInfo(), commit(previous)); BuildConfig buildConfig = configAtSha(definition, commitInfo.getCurrent().getId()); BuildConfig resolvedConfig = resolveConfig(buildConfig, definition); Build launching = queued.withStartTimestamp(System.currentTimeMillis()) .withState(State.LAUNCHING) .withCommitInfo(commitInfo) .withBuildConfig(buildConfig) .withResolvedConfig(resolvedConfig); LOG.info("Updating status of build to {}", launching.getId().get(), launching.getState()); buildService.begin(launching); LOG.info("About to launch build {}", launching.getId().get()); SingularityRunNowRequest runNowRequest = new SingularityRunNowRequest( Optional.of(String.format("Build %d", launching.getId().get())), Optional.<Boolean>absent(), Optional.of("blazar-executor"), Optional.of(buildRunArgs(definition, launching))); try { singularityClient.runSingularityRequest("blazar-executor", Optional.of(runNowRequest)); } catch (SingularityClientException e) { LOG.warn(String.format("Launch of %d resulted in SingularityClientException", launching.getId().get()), e); return; } LOG.info("Launch of was successful", launching.getId().get()); }
Source:
public JobRequestMetadata( @Nullable final ApiClientMetadata apiClientMetadata, @Nullable final AgentClientMetadata agentClientMetadata, final int numAttachments, final long totalSizeOfAttachments ) throws IllegalArgumentException { if (apiClientMetadata == null && agentClientMetadata == null) { throw new IllegalArgumentException( "Both apiClientMetadata and agentClientMetadata are missing. One is required." ); } if (apiClientMetadata != null && agentClientMetadata != null) { throw new IllegalArgumentException( "Both apiClientMetadata and agentClientMetadata are present. Only one should be present" ); } this.apiClientMetadata = apiClientMetadata; this.agentClientMetadata = agentClientMetadata; this.numAttachments = Math.max(numAttachments, 0); this.totalSizeOfAttachments = Math.max(totalSizeOfAttachments, 0L); }

Target:
public JobRequestMetadata( @Nullable final ApiClientMetadata apiClientMetadata, @Nullable final AgentClientMetadata agentClientMetadata, final int numAttachments, final long totalSizeOfAttachments ) throws IllegalArgumentException { if (apiClientMetadata == null && agentClientMetadata == null) { throw new IllegalArgumentException( "Both apiClientMetadata and agentClientMetadata are missing. One is required." ); } if (apiClientMetadata != null && agentClientMetadata != null) { throw new IllegalArgumentException( "Both apiClientMetadata and agentClientMetadata are present. Only one should be present" ); } this.api = apiClientMetadata != null; this.apiClientMetadata = apiClientMetadata; this.agentClientMetadata = agentClientMetadata; this.numAttachments = Math.max(numAttachments, 0); this.totalSizeOfAttachments = Math.max(totalSizeOfAttachments, 0L); }
Source:
public void publishDiagnostics(PublishDiagnosticsParams diagnostics) { String uri = diagnostics.getUri(); for (Observer observer : fObservers) { observer.diagnostic(uri, diagnostics.getDiagnostics()); } System.out.println(uri); TextDocumentIdentifier filterBoxId = new TextDocumentIdentifier(uri); Runnable completionTask = () -> { Position position = new Position(); position.setLine(0); position.setCharacter(fCursor); CompletionParams completionParams = new CompletionParams(filterBoxId, position); try { Either<List<CompletionItem>, CompletionList> completion = fServerProxy.getTextDocumentService().completion(completionParams).get(); for (Observer observer : fObservers) { observer.completion(uri, completion); } } catch (Exception e) { Activator.getInstance().logError(e.getMessage()); } }; Runnable syntaxHighlightingTask = () -> { DocumentColorParams colorParams = new DocumentColorParams(filterBoxId); try { List<ColorInformation> colors = fServerProxy.getTextDocumentService().documentColor(colorParams).get(); for (Observer observer : fObservers) { observer.syntaxHighlighting(uri, colors); } } catch (Exception e) { Activator.getInstance().logError(e.getMessage()); } }; fThreadPoolExecutor.execute(completionTask); fThreadPoolExecutor.execute(syntaxHighlightingTask); }

Target:
public void publishDiagnostics(PublishDiagnosticsParams diagnostics) { String uri = diagnostics.getUri(); for (LspObserver observer : fObservers) { observer.diagnostic(uri, diagnostics.getDiagnostics()); } TextDocumentIdentifier textDocumentIdentifier = new TextDocumentIdentifier(uri); fThreadPoolExecutor.execute(completionTask(uri, textDocumentIdentifier)); fThreadPoolExecutor.execute(syntaxHighlightingTask(uri, textDocumentIdentifier)); }
Source:
public static List<String> validateParameters(Object obj, ParametersMap paramsMap) { List<String> messages = new ArrayList<String>(); if (paramsMap.size() > 0) { Map<Boolean, List<Parameter>> cmdParams = getCommandParameters(obj, messages); if (messages.isEmpty()) { List<Parameter> params = new ArrayList<Parameter>(paramsMap.keySet()); if (!params.containsAll(cmdParams.get(false))) { List<Parameter> copy = new ArrayList(cmdParams.get(false)); copy.removeAll(params); log.warnFormat("Required parameters {0} not found in command.", getParameterNames(copy)); messages.add(VdcBllMessages.REQUIRED_PARAMETER_MISSING.name()); } else { params.removeAll(cmdParams.get(false)); params.removeAll(cmdParams.get(true)); if (params.size() > 0) { log.warnFormat("Unknown parameters {0} found in command.", getParameterNames(params)); } } } } return messages; }

Target:
public static void validateParameters(Object obj, ParametersMap paramsMap) { if (paramsMap.size() > 0) { Map<Boolean, List<Parameter>> cmdParams = getCommandParameters(obj); List<Parameter> params = new ArrayList<Parameter>(paramsMap.keySet()); if (!params.containsAll(cmdParams.get(false))) { List<Parameter> copy = new ArrayList(cmdParams.get(false)); copy.removeAll(params); log.warnFormat("Required parameters {0} not found in command.", getParameterNames(copy)); throw new RequiredParametersMissingException(obj.getClass().getName(), getParameterNames(copy)); } else { params.removeAll(cmdParams.get(false)); params.removeAll(cmdParams.get(true)); if (params.size() > 0) { log.warnFormat("Unknown parameters {0} found in command.", getParameterNames(params)); } } } }
Source:
public void addSettings(String workspace, GeoServer geoServer) { WorkspaceInfo ws = workspace != null ? geoServer.getCatalog().getWorkspaceByName(workspace) : null; GeoServerInfo global = geoServer.getGlobal(); SettingsInfo settings = ws != null ? geoServer.getSettings(ws) : global.getSettings(); if (settings == null) { settings = geoServer.getFactory().createSettings(); } settings.setWorkspace(ws); settings.getContact().setContactPerson("Andrea Aime"); settings.setNumDecimals(8); settings.setOnlineResource("<LINK_0>"); settings.setVerbose(false); settings.setVerboseExceptions(false); settings.setLocalWorkspaceIncludesPrefix(true); if (ws != null) { if (settings.getId() != null) { geoServer.save(settings); } else { geoServer.add(settings); } } else { geoServer.save(global); } }

Target:
public void addSettings(String workspace, GeoServer geoServer) { WorkspaceInfo ws = workspace != null ? geoServer.getCatalog().getWorkspaceByName(workspace) : null; GeoServerInfo global = geoServer.getGlobal(); SettingsInfo settings = ws != null ? geoServer.getSettings(ws) : global.getSettings(); if (settings == null) { settings = geoServer.getFactory().createSettings(); } settings.setWorkspace(ws); settings.getContact().setContactPerson("Andrea Aime"); settings.setNumDecimals(8); settings.setOnlineResource("<LINK_0>"); settings.setVerbose(false); settings.setVerboseExceptions(false); settings.setLocalWorkspaceIncludesPrefix(false); if (ws != null) { if (settings.getId() != null) { geoServer.save(settings); } else { geoServer.add(settings); } } else { geoServer.save(global); } }
Source:
public void testOptionalRequirements() { TmfAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1, EVENT2), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(checkNotNull(Collections.EMPTY_LIST), checkNotNull(Collections.EMPTY_LIST)); assertTrue(req.isFulfilled(trace)); }

Target:
public void testOptionalRequirements() { TmfAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1, EVENT2), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(checkNotNull(Collections.EMPTY_LIST), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(checkNotNull(ImmutableSet.of(EVENT1)), checkNotNull(Collections.EMPTY_LIST)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(checkNotNull(Collections.EMPTY_LIST), checkNotNull(Collections.EMPTY_LIST)); assertTrue(req.isFulfilled(trace)); }
Source:
public void status() throws RocksDBException { throw new UnsupportedOperationException("status"); }

Target:
public void status() { try { iterator.status(); } catch (RocksDBException e) { throw new UnrecoverableCorfuError("Iterator is in an invalid state", e); } }
Source:
public boolean isFinished() { try { return inputStream.available() == 0; } catch (IOException e) { LOG.error("Error occurred when reading request input stream", e); return false; } }

Target:
public boolean isFinished() { try { return inputStream.available() == 0; } catch (final IOException e) { LOG.error("Error occurred when reading request input stream", e); return false; } }
Source:
public void createPartControl(Composite parent) { this.parentControl = parent; if (error != null) { new StatusPart(getSite(), parent, error); } }

Target:
public void createPartControl(Composite parent) { this.parentControl = parent; if (error != null) { new StatusPart(parent, error); } }
Source:
public IndexDocument getIndexedDocument(AsyncIndexer.File2Index fileData) throws SolrException, RegistryException { IndexDocument indexedDocument = super.getIndexedDocument(fileData); try { Registry registry = GovernanceUtils.getGovernanceSystemRegistry(IndexingManager.getInstance().getRegistry(fileData.tenantId)); GovernanceArtifactConfiguration configuration = GovernanceUtils.findGovernanceArtifactConfigurationByMediaType(fileData.mediaType, registry); if (configuration == null) { return indexedDocument; } GenericArtifactManager manager = new GenericArtifactManager(registry, configuration.getKey()); String xmlAsStr = RegistryUtils.decodeBytes(fileData.data); IndexableGovernanceArtifact artifact = new IndexableGovernanceArtifact((GovernanceArtifactImpl) manager.newGovernanceArtifact(AXIOMUtil.stringToOM(xmlAsStr))); Map<String, List<String>> fields = indexedDocument.getFields(); setAttributesToLowerCase(fields); Map<String, List<String>> attributes = artifact.getAttributes(); if (fileData.mediaType.matches("application/vnd.(.)+\\+xml") && attributes.size() > 0) { setAttributesToLowerCase(attributes); fields.putAll(attributes); } else { fields.put("overview_name", Arrays.asList(RegistryUtils.getResourceName(fileData.path).toLowerCase())); } updateTenantsUnboundedFieldMap(configuration.getContentDefinition().getParent().toString()); indexedDocument.setFields(fields); if (log.isDebugEnabled()) { log.debug("Registry RXT Indexer is running"); } } catch (XMLStreamException e) { log.error("Unable to parse XML", e); } return indexedDocument; }

Target:
public IndexDocument getIndexedDocument(AsyncIndexer.File2Index fileData) throws SolrException, RegistryException { IndexDocument indexedDocument = super.getIndexedDocument(fileData); try { Registry registry = GovernanceUtils.getGovernanceSystemRegistry(IndexingManager.getInstance().getRegistry(fileData.tenantId)); GovernanceArtifactConfiguration configuration = GovernanceUtils.findGovernanceArtifactConfigurationByMediaType(fileData.mediaType, registry); if (configuration == null) { return indexedDocument; } GenericArtifactManager manager = new GenericArtifactManager(registry, configuration.getKey()); String xmlAsStr = RegistryUtils.decodeBytes(fileData.data); IndexableGovernanceArtifact artifact = new IndexableGovernanceArtifact((GovernanceArtifactImpl) manager.newGovernanceArtifact(AXIOMUtil.stringToOM(xmlAsStr))); Map<String, List<String>> fields = indexedDocument.getFields(); setAttributesToLowerCase(fields); Map<String, List<String>> attributes = artifact.getAttributes(); if (fileData.mediaType.matches("application/vnd.(.)+\\+xml") && attributes.size() > 0) { setAttributesToLowerCase(attributes); fields.putAll(attributes); updateTenantsUnboundedFieldMap(configuration.getContentDefinition().getParent().toString()); } else { fields.put("overview_name", Arrays.asList(RegistryUtils.getResourceName(fileData.path).toLowerCase())); } indexedDocument.setFields(fields); if (log.isDebugEnabled()) { log.debug("Registry RXT Indexer is running"); } } catch (XMLStreamException e) { log.error("Unable to parse XML", e); } return indexedDocument; }
Source:
private Map<Locator, MetricData> getStringBooleanDataForRange( List<Locator> locators, Range range, boolean isBoolean ) { Map<Locator, MetricData> metrics = new HashMap<Locator, MetricData>(); Map<Locator, ResultSetFuture> futures = new HashMap<Locator, ResultSetFuture>(); for( Locator locator : locators ) { futures.put( locator, rawIO.getStringAsync( locator, range ) ); } for( Map.Entry<Locator, ResultSetFuture> future : futures.entrySet() ) { Points points = new Points<String>(); try { for ( Row row : future.getValue().getUninterruptibly().all() ) { Object value = isBoolean ? Boolean.valueOf( row.getString( VALUE ) ) : row.getString( VALUE ); points.add( new Points.Point( row.getLong( COLUMN1 ), value ) ); } MetricData.Type type = isBoolean ? MetricData.Type.BOOLEAN : MetricData.Type.BOOLEAN; metrics.put( future.getKey(), new MetricData( points, getUnitString( future.getKey() ), type ) ); } catch (Exception e ) { LOG.error( String.format( "error writing metric %s, metrics_string", future.getKey() ), e ); } } return metrics; }

Target:
private Map<Locator, MetricData> getStringBooleanDataForRange( List<Locator> locators, Range range, boolean isBoolean ) { Timer.Context ctx = Instrumentation.getReadTimerContext( CassandraModel.CF_METRICS_STRING_NAME ); try { Map<Locator, MetricData> metrics = new HashMap<Locator, MetricData>(); Map<Locator, ResultSetFuture> futures = new HashMap<Locator, ResultSetFuture>(); for( Locator locator : locators ) { futures.put( locator, rawIO.getStringAsync( locator, range ) ); } for( Map.Entry<Locator, ResultSetFuture> future : futures.entrySet() ) { try { metrics.put( future.getKey(), rawIO.createMetricDataStringBoolean( future.getValue(), isBoolean, getUnitString( future.getKey() ) ) ); } catch (Exception e ) { Instrumentation.markReadError(); LOG.error( String.format( "error reading metric %s, metrics_string", future.getKey() ), e ); } } return metrics; } finally { ctx.stop(); } }
Source:
protected boolean bootProtocolDhcp() { Boolean dhcp = (Boolean) entry.get("dhcpv4"); return dhcp != null && dhcp; }

Target:
protected boolean bootProtocolDhcp() { return Boolean.TRUE.equals(entry.get("dhcpv4")); }
Source:
public static final TeamBuildingFragment newInstance(PokemonTeam team) { TeamBuildingFragment fragment = new TeamBuildingFragment(); Bundle bundle = new Bundle(); bundle.putSerializable("team", team); fragment.setArguments(bundle); return fragment; }

Target:
public static final TeamBuildingFragment newInstance(PokemonTeam team) { TeamBuildingFragment fragment = new TeamBuildingFragment(); Bundle bundle = new Bundle(); bundle.putSerializable(TEAMTAG, team); fragment.setArguments(bundle); return fragment; }
Source:
private boolean hasCnxSASLAuthenticated(ServerCnxn cnxn) { return cnxn.getAuthInfo().stream().filter(id -> id.getScheme().equals(SASL_AUTH_SCHEME)).count() > 0; }

Target:
private boolean hasCnxSASLAuthenticated(ServerCnxn cnxn) { return cnxn.getAuthInfo().stream().anyMatch(id -> id.getScheme().equals(SASL_AUTH_SCHEME)); }
Source:
private void updateText(Text text) { if (text == null || text.isDisposed()) { return; } text.setMessage(NLS.bind(QuickAccessMessages.QuickAccess_EnterSearch, getQuickAccessTriggerSequenceFormat())); GC gc = new GC(text); if (Util.isWin32() || Util.isGtk()) { FontMetrics fm = gc.getFontMetrics(); int wHint = QuickAccessMessages.QuickAccess_EnterSearch.length() * fm.getAverageCharWidth(); int hHint = fm.getHeight(); gc.dispose(); text.setSize(text.computeSize(wHint, hHint)); } else { Point p = gc.textExtent(QuickAccessMessages.QuickAccess_EnterSearch); Rectangle r = text.computeTrim(0, 0, p.x, p.y); gc.dispose(); GridDataFactory.fillDefaults().hint(r.width - r.x, SWT.DEFAULT).applyTo(text); } }

Target:
private void updateText(Text text) { if (text == null || text.isDisposed()) { return; } if (triggerSequence != null) { text.setMessage(NLS.bind(QuickAccessMessages.QuickAccess_EnterSearch, triggerSequence.format())); } else { text.setMessage(QuickAccessMessages.QuickAccess_EnterSearch_Empty); } GC gc = new GC(text); if (Util.isWin32() || Util.isGtk()) { FontMetrics fm = gc.getFontMetrics(); int wHint = QuickAccessMessages.QuickAccess_EnterSearch.length() * fm.getAverageCharWidth(); int hHint = fm.getHeight(); gc.dispose(); text.setSize(text.computeSize(wHint, hHint)); } else { Point p = gc.textExtent(QuickAccessMessages.QuickAccess_EnterSearch); Rectangle r = text.computeTrim(0, 0, p.x, p.y); gc.dispose(); GridDataFactory.fillDefaults().hint(r.width - r.x, SWT.DEFAULT).applyTo(text); } }