idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
858,241 | void assertIsSorted(AssertionInfo info, Failures failures, Object array) {<NEW_LINE>assertNotNull(info, array);<NEW_LINE>if (comparisonStrategy instanceof ComparatorBasedComparisonStrategy) {<NEW_LINE>// instead of comparing array elements with their natural comparator, use the one set by client.<NEW_LINE>Comparator<?> comparator = ((ComparatorBasedComparisonStrategy) comparisonStrategy).getComparator();<NEW_LINE>assertIsSortedAccordingToComparator(info, failures, array, comparator);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// empty arrays are considered sorted even if component type is not sortable.<NEW_LINE>if (sizeOf(array) == 0)<NEW_LINE>return;<NEW_LINE>assertThatArrayComponentTypeIsSortable(info, failures, array);<NEW_LINE>try {<NEW_LINE>// sorted assertion is only relevant if array elements are Comparable<NEW_LINE>// => we should be able to build a Comparable array<NEW_LINE>Comparable<Object>[] comparableArray = arrayOfComparableItems(array);<NEW_LINE>// array with 0 or 1 element are considered sorted.<NEW_LINE>if (comparableArray.length <= 1)<NEW_LINE>return;<NEW_LINE>for (int i = 0; i < comparableArray.length - 1; i++) {<NEW_LINE>// array is sorted in ascending order iif element i is less or equal than element i+1<NEW_LINE>if (comparableArray[i].compareTo(comparableArray[i + 1]) > 0)<NEW_LINE>throw failures.failure(info, shouldBeSorted(i, array));<NEW_LINE>}<NEW_LINE>} catch (ClassCastException e) {<NEW_LINE>// elements are either not Comparable or not mutually Comparable (e.g. array with String and Integer)<NEW_LINE>throw failures.failure<MASK><NEW_LINE>}<NEW_LINE>} | (info, shouldHaveMutuallyComparableElements(array)); |
1,013,369 | public static void writeCustomAttributes(Collection<List<ExtensionAttribute>> attributes, XMLStreamWriter xtw, Map<String, String> namespaceMap, List<ExtensionAttribute>... blackLists) throws XMLStreamException {<NEW_LINE>for (List<ExtensionAttribute> attributeList : attributes) {<NEW_LINE>if (attributeList != null && !attributeList.isEmpty()) {<NEW_LINE>for (ExtensionAttribute attribute : attributeList) {<NEW_LINE>if (!isBlacklisted(attribute, blackLists)) {<NEW_LINE>if (attribute.getNamespacePrefix() == null) {<NEW_LINE>if (attribute.getNamespace() == null) {<NEW_LINE>xtw.writeAttribute(attribute.getName(), attribute.getValue());<NEW_LINE>} else {<NEW_LINE>xtw.writeAttribute(attribute.getNamespace(), attribute.getName(), attribute.getValue());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!namespaceMap.containsKey(attribute.getNamespacePrefix())) {<NEW_LINE>namespaceMap.put(attribute.getNamespacePrefix(), attribute.getNamespace());<NEW_LINE>xtw.writeNamespace(attribute.getNamespacePrefix(<MASK><NEW_LINE>}<NEW_LINE>xtw.writeAttribute(attribute.getNamespacePrefix(), attribute.getNamespace(), attribute.getName(), attribute.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), attribute.getNamespace()); |
1,066,708 | protected boolean allSubmittedJobsRejected(JobAcquisitionContext context) {<NEW_LINE>for (Map.Entry<String, AcquiredJobs> acquiredJobsForEngine : context.getAcquiredJobsByEngine().entrySet()) {<NEW_LINE>String engineName = acquiredJobsForEngine.getKey();<NEW_LINE>List<List<String>> acquiredJobBatches = acquiredJobsForEngine.getValue().getJobIdBatches();<NEW_LINE>List<List<String>> resubmittedJobBatches = context.getAdditionalJobsByEngine().get(engineName);<NEW_LINE>List<List<String>> rejectedJobBatches = context.<MASK><NEW_LINE>int numJobsSubmittedForExecution = acquiredJobBatches.size();<NEW_LINE>if (resubmittedJobBatches != null) {<NEW_LINE>numJobsSubmittedForExecution += resubmittedJobBatches.size();<NEW_LINE>}<NEW_LINE>int numJobsRejected = 0;<NEW_LINE>if (rejectedJobBatches != null) {<NEW_LINE>numJobsRejected += rejectedJobBatches.size();<NEW_LINE>}<NEW_LINE>// if not all jobs scheduled for execution have been rejected<NEW_LINE>if (numJobsRejected == 0 || numJobsSubmittedForExecution > numJobsRejected) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | getRejectedJobsByEngine().get(engineName); |
1,422,782 | Optional<AbstractOAuth2AuthenticationProvider> parseStateFromRequest(@NotNull String state) {<NEW_LINE>if (state == null || state.trim().equals("")) {<NEW_LINE>logger.<MASK><NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>String[] topFields = state.split("~", 2);<NEW_LINE>if (topFields.length != 2) {<NEW_LINE>logger.log(Level.INFO, "Wrong number of fields in state string", state);<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>AbstractOAuth2AuthenticationProvider idp = authenticationSvc.getOAuth2Provider(topFields[0]);<NEW_LINE>if (idp == null) {<NEW_LINE>logger.log(Level.INFO, "Can''t find IDP ''{0}''", topFields[0]);<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>// Verify the response by decrypting values and check for state valid timeout<NEW_LINE>String raw = StringUtil.decrypt(topFields[1], idp.clientSecret);<NEW_LINE>String[] stateFields = raw.split("~", -1);<NEW_LINE>if (idp.getId().equals(stateFields[0])) {<NEW_LINE>long timeOrigin = Long.parseLong(stateFields[1]);<NEW_LINE>long timeDifference = this.clock.millis() - timeOrigin;<NEW_LINE>if (timeDifference > 0 && timeDifference < STATE_TIMEOUT) {<NEW_LINE>if (stateFields.length > 3) {<NEW_LINE>this.redirectPage = Optional.ofNullable(stateFields[3]);<NEW_LINE>}<NEW_LINE>return Optional.of(idp);<NEW_LINE>} else {<NEW_LINE>logger.info("State timeout");<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.log(Level.INFO, "Invalid id field: ''{0}''", stateFields[0]);<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>} | log(Level.INFO, "No state present in request"); |
906,095 | @Produces(MediaType.APPLICATION_JSON)<NEW_LINE>public Response indexSearch(@Context HttpServletRequest request, @Context final HttpServletResponse response, @PathParam("query") String query, @PathParam("sortby") String sortBy, @PathParam("limit") int limit, @PathParam("offset") int offset, @PathParam("type") String type, @PathParam("callback") String callback) throws DotDataException, JSONException {<NEW_LINE>InitDataObject initData = webResource.init(null, request, response, false, null);<NEW_LINE>Map<String, String> paramsMap = new HashMap<String, String>();<NEW_LINE>paramsMap.put("type", type);<NEW_LINE>paramsMap.put("callback", callback);<NEW_LINE>// Creating an utility response object<NEW_LINE>ResourceResponse responseResource = new ResourceResponse(paramsMap);<NEW_LINE>try {<NEW_LINE>List<ContentletSearch> searchIndex = APILocator.getContentletAPI().searchIndex(query, limit, offset, sortBy, initData.getUser(), true);<NEW_LINE>JSONArray array = new JSONArray();<NEW_LINE>for (ContentletSearch cs : searchIndex) {<NEW_LINE>array.put(new JSONObject().put("inode", cs.getInode()).put("identifier"<MASK><NEW_LINE>}<NEW_LINE>return responseResource.response(array.toString());<NEW_LINE>} catch (DotSecurityException e) {<NEW_LINE>throw new ForbiddenException(e);<NEW_LINE>}<NEW_LINE>} | , cs.getIdentifier())); |
1,261,721 | private void renderCornerAxes(GLAutoDrawable drawable) {<NEW_LINE>final GL2 gl = drawable.getGL().getGL2();<NEW_LINE>gl.glLineWidth(4);<NEW_LINE>float ar = (float) xSize / ySize;<NEW_LINE>float size = 0.1f;<NEW_LINE>float size2 = size / 2;<NEW_LINE>float fromEdge = 0.8f;<NEW_LINE>gl.glPushMatrix();<NEW_LINE>gl.glTranslated(-0.51 * ar * fromEdge, 0.51 * fromEdge, -0.5f);<NEW_LINE>gl.glRotated(this.rotation.x, 0.0, 1.0, 0.0);<NEW_LINE>gl.glRotated(this.rotation.y, 1.0, 0.0, 0.0);<NEW_LINE>gl.glBegin(GL_LINES);<NEW_LINE>// X-Axis<NEW_LINE>gl.<MASK><NEW_LINE>gl.glVertex3f(0, 0f, 0f);<NEW_LINE>gl.glVertex3f(1, 0f, 0f);<NEW_LINE>// Y-Axis<NEW_LINE>gl.glColor3f(0, 1, 0);<NEW_LINE>gl.glVertex3f(0, 0f, 0f);<NEW_LINE>gl.glVertex3f(0, 1f, 0f);<NEW_LINE>// Z-Axis<NEW_LINE>gl.glColor3f(0, 1, 1);<NEW_LINE>gl.glVertex3f(0, 0f, 0f);<NEW_LINE>gl.glVertex3f(0, 0f, 1f);<NEW_LINE>gl.glEnd();<NEW_LINE>gl.glPopMatrix();<NEW_LINE>// # Draw number 50 on x/y-axis line.<NEW_LINE>// glRasterPos2f(50,-5)<NEW_LINE>// glutInit()<NEW_LINE>// A = 53<NEW_LINE>// glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, A)<NEW_LINE>// glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, 48)<NEW_LINE>// glRasterPos2f(-5,50)<NEW_LINE>// glutInit()<NEW_LINE>// A = 53<NEW_LINE>// glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, A)<NEW_LINE>// glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, 48)<NEW_LINE>} | glColor3f(1, 0, 0); |
1,669,022 | protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException {<NEW_LINE>if (!(example instanceof Catalog)) {<NEW_LINE>throw new UnexpectedLiquibaseException("Unexpected example type: " + example.getClass().getName());<NEW_LINE>}<NEW_LINE>Database database = snapshot.getDatabase();<NEW_LINE>Catalog match = null;<NEW_LINE>String catalogName = example.getName();<NEW_LINE>if ((catalogName == null) && database.supportsCatalogs()) {<NEW_LINE>catalogName = database.getDefaultCatalogName();<NEW_LINE>}<NEW_LINE>example = new Catalog(catalogName);<NEW_LINE>try {<NEW_LINE>for (String potentialCatalogName : getDatabaseCatalogNames(database)) {<NEW_LINE><MASK><NEW_LINE>if (DatabaseObjectComparatorFactory.getInstance().isSameObject(catalog, example, snapshot.getSchemaComparisons(), database)) {<NEW_LINE>if (match == null) {<NEW_LINE>match = catalog;<NEW_LINE>} else {<NEW_LINE>throw new InvalidExampleException("Found multiple catalogs matching " + example.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new DatabaseException(e);<NEW_LINE>}<NEW_LINE>if ((match != null) && isDefaultCatalog(match, database)) {<NEW_LINE>match.setDefault(true);<NEW_LINE>}<NEW_LINE>return match;<NEW_LINE>} | Catalog catalog = new Catalog(potentialCatalogName); |
1,082,103 | private void output(final LazyElementCell elementCell, final Properties aggregatedProperties, final List<LazyElementCell> output) {<NEW_LINE>if (null == aggregatedProperties) {<NEW_LINE>if (null != elementCell) {<NEW_LINE>output.add(elementCell);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>final Cell firstCell = elementCell.getCell();<NEW_LINE>final Element element = elementCell.getElement();<NEW_LINE>element.copyProperties(aggregatedProperties);<NEW_LINE>final Cell aggregatedCell = CellUtil.createCell(CellUtil.cloneRow(firstCell), CellUtil.cloneFamily(firstCell), CellUtil.cloneQualifier(firstCell), serialisation.getTimestamp(element), firstCell.getTypeByte(), serialisation.getValue(element), CellUtil<MASK><NEW_LINE>elementCell.setCell(aggregatedCell);<NEW_LINE>elementCell.setElement(element);<NEW_LINE>output.add(elementCell);<NEW_LINE>} catch (final SerialisationException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getTagArray(firstCell), 0); |
1,308,262 | public void updateContractStatusInOrder(final I_C_Flatrate_Term term) {<NEW_LINE>final IOrderDAO orderDAO = Services.get(IOrderDAO.class);<NEW_LINE>final IContractsDAO contractsDAO = Services.get(IContractsDAO.class);<NEW_LINE>final ISubscriptionBL subscriptionBL = Services.get(ISubscriptionBL.class);<NEW_LINE>final OrderId orderId = contractOrderService.getContractOrderId(term);<NEW_LINE>if (orderId == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (InterfaceWrapperHelper.isNew(term) && !contractsDAO.termHasAPredecessor(term)) {<NEW_LINE>final I_C_Order contractOrder = orderDAO.<MASK><NEW_LINE>contractOrderService.setOrderContractStatusAndSave(contractOrder, I_C_Order.CONTRACTSTATUS_Active);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Set<OrderId> orderIds = contractOrderService.retrieveAllContractOrderList(orderId);<NEW_LINE>final UpdateContractOrderStatus updateContractStatus = UpdateContractOrderStatus.builder().contractOrderService(contractOrderService).orderDAO(orderDAO).contractsDAO(contractsDAO).subscriptionBL(subscriptionBL).build();<NEW_LINE>updateContractStatus.updateStatusIfNeededWhenExtendind(term, orderIds);<NEW_LINE>updateContractStatus.updateStatusIfNeededWhenCancelling(term, orderIds);<NEW_LINE>updateContractStatus.updateStausIfNeededWhenVoiding(term);<NEW_LINE>} | getById(orderId, I_C_Order.class); |
1,036,583 | protected void initColumnAndType() {<NEW_LINE>columns.put(COLUMN_INDEX, new ColumnMeta(COLUMN_INDEX, "int(11)", false, true));<NEW_LINE>columnsType.put(COLUMN_INDEX, Fields.FIELD_TYPE_LONG);<NEW_LINE>columns.put(COLUMN_CLUSTER, new ColumnMeta(COLUMN_CLUSTER, "varchar(20)", false));<NEW_LINE>columnsType.put(COLUMN_CLUSTER, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_RELOAD_TYPE, new ColumnMeta(COLUMN_RELOAD_TYPE, "varchar(20)", false));<NEW_LINE>columnsType.put(COLUMN_RELOAD_TYPE, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_RELOAD_STATUS, new ColumnMeta(COLUMN_RELOAD_STATUS, "varchar(20)", false));<NEW_LINE>columnsType.put(COLUMN_RELOAD_STATUS, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_LAST_RELOAD_START, new ColumnMeta(COLUMN_LAST_RELOAD_START, "varchar(19)", false));<NEW_LINE>columnsType.put(COLUMN_LAST_RELOAD_START, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_LAST_RELOAD_END, new ColumnMeta(COLUMN_LAST_RELOAD_END, "varchar(19)", false));<NEW_LINE>columnsType.put(COLUMN_LAST_RELOAD_END, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_TRIGGER_TYPE, new ColumnMeta(COLUMN_TRIGGER_TYPE, "varchar(20)", false));<NEW_LINE>columnsType.put(COLUMN_TRIGGER_TYPE, Fields.FIELD_TYPE_VAR_STRING);<NEW_LINE>columns.put(COLUMN_END_TYPE, new ColumnMeta(COLUMN_END_TYPE, "varchar(20)", false));<NEW_LINE>columnsType.<MASK><NEW_LINE>} | put(COLUMN_END_TYPE, Fields.FIELD_TYPE_VAR_STRING); |
250,283 | static ASelectableCondition load(final XMLElement element) {<NEW_LINE>final Object attr = AttributeConditionController.toAttributeObject(element.getAttribute(ATTRIBUTE, null));<NEW_LINE>Object value = element.<MASK><NEW_LINE>if (value == null) {<NEW_LINE>final String spec = element.getAttribute(CompareConditionAdapter.OBJECT, null);<NEW_LINE>value = TypeReference.create(spec);<NEW_LINE>}<NEW_LINE>final boolean matchCase = TreeXmlReader.xmlToBoolean(element.getAttribute(CompareConditionAdapter.MATCH_CASE, null));<NEW_LINE>final int compResult = Integer.parseInt(element.getAttribute(COMPARATION_RESULT, null));<NEW_LINE>final boolean succeed = TreeXmlReader.xmlToBoolean(element.getAttribute(SUCCEED, null));<NEW_LINE>final boolean matchApproximately = TreeXmlReader.xmlToBoolean(element.getAttribute(MATCH_APPROXIMATELY, null));<NEW_LINE>return new AttributeCompareCondition(attr, value, matchCase, compResult, succeed, matchApproximately, Boolean.valueOf(element.getAttribute(IGNORE_DIACRITICS, null)));<NEW_LINE>} | getAttribute(CompareConditionAdapter.VALUE, null); |
929,941 | public CompletableFuture<Void> start(String[] args) {<NEW_LINE>state.set(<MASK><NEW_LINE>boolean create = true;<NEW_LINE>if (args.length == 0) {<NEW_LINE>engThread = new DbgModelClientThreadExecutor(() -> DbgModel.debugCreate());<NEW_LINE>} else {<NEW_LINE>String remoteOptions = String.join(" ", args);<NEW_LINE>engThread = new DbgModelClientThreadExecutor(() -> DbgModel.debugConnect(remoteOptions));<NEW_LINE>create = false;<NEW_LINE>}<NEW_LINE>engThread.setManager(this);<NEW_LINE>AtomicReference<Boolean> creat = new AtomicReference<>(create);<NEW_LINE>return sequence(TypeSpec.VOID).then(engThread, (seq) -> {<NEW_LINE>doExecute(creat.get());<NEW_LINE>seq.exit();<NEW_LINE>}).finish().exceptionally((exc) -> {<NEW_LINE>Msg.error(this, "start failed");<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>} | DbgState.STARTING, Causes.UNCLAIMED); |
631,636 | private static Pipeline substitutePipeline(String id, ElasticsearchParseException e) {<NEW_LINE>String tag = e.getHeaderKeys().contains("processor_tag") ? e.getHeader("processor_tag").get(0) : null;<NEW_LINE>String type = e.getHeaderKeys().contains("processor_type") ? e.getHeader("processor_type").get(0) : "unknown";<NEW_LINE>String errorMessage = "pipeline with id [" + id + "] could not be loaded, caused by [" <MASK><NEW_LINE>Processor failureProcessor = new AbstractProcessor(tag) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public IngestDocument execute(IngestDocument ingestDocument) {<NEW_LINE>throw new IllegalStateException(errorMessage);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getType() {<NEW_LINE>return type;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>String description = "this is a place holder pipeline, because pipeline with id [" + id + "] could not be loaded";<NEW_LINE>return new Pipeline(id, description, null, new CompoundProcessor(failureProcessor));<NEW_LINE>} | + e.getDetailedMessage() + "]"; |
1,359,612 | public static long addMonths(final long micros, int months) {<NEW_LINE>if (months == 0) {<NEW_LINE>return micros;<NEW_LINE>}<NEW_LINE>int y = Timestamps.getYear(micros);<NEW_LINE>boolean l = Timestamps.isLeapYear(y);<NEW_LINE>int m = getMonthOfYear(micros, y, l);<NEW_LINE>int _y;<NEW_LINE>int _m = m - 1 + months;<NEW_LINE>if (_m > -1) {<NEW_LINE>_y = y + _m / 12;<NEW_LINE>_m = (_m % 12) + 1;<NEW_LINE>} else {<NEW_LINE>_y = y + _m / 12 - 1;<NEW_LINE>_m = -_m % 12;<NEW_LINE>if (_m == 0) {<NEW_LINE>_m = 12;<NEW_LINE>}<NEW_LINE>_m = 12 - _m + 1;<NEW_LINE>if (_m == 1) {<NEW_LINE>_y += 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int _d = getDayOfMonth(micros, y, m, l);<NEW_LINE>int maxDay = getDaysPerMonth(_m, isLeapYear(_y));<NEW_LINE>if (_d > maxDay) {<NEW_LINE>_d = maxDay;<NEW_LINE>}<NEW_LINE>return toMicros(_y, _m, _d) + getTimeMicros(micros) + (<MASK><NEW_LINE>} | micros < 0 ? 1 : 0); |
65,860 | public void listOrder() {<NEW_LINE>String sql = new String("SELECT o.C_Order_ID " + "FROM C_Order o " + "WHERE o.IsSOTrx='Y' " + "AND o.Processed = 'N' " + "AND o.AD_Client_ID = ? " + "AND o.C_POS_ID = ? " + "AND o.SalesRep_ID = ? " + "ORDER BY o.Updated");<NEW_LINE>PreparedStatement preparedStatement = null;<NEW_LINE>ResultSet resultSet = null;<NEW_LINE>orderList = new ArrayList<Integer>();<NEW_LINE>try {<NEW_LINE>// Set Parameter<NEW_LINE>preparedStatement = DB.prepareStatement(sql, null);<NEW_LINE>preparedStatement.setInt(1, Env.getAD_Client_ID(Env.getCtx()));<NEW_LINE>preparedStatement.setInt(2, getC_POS_ID());<NEW_LINE>preparedStatement.setInt(3, getSalesRep_ID());<NEW_LINE>// Execute<NEW_LINE>resultSet = preparedStatement.executeQuery();<NEW_LINE>// Add to List<NEW_LINE>while (resultSet.next()) {<NEW_LINE>orderList.add(resultSet.getInt(1));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.severe(<MASK><NEW_LINE>} finally {<NEW_LINE>DB.close(resultSet);<NEW_LINE>DB.close(preparedStatement);<NEW_LINE>}<NEW_LINE>// Seek Position<NEW_LINE>if (hasRecord())<NEW_LINE>recordPosition = orderList.size() - 1;<NEW_LINE>else<NEW_LINE>recordPosition = -1;<NEW_LINE>} | "SubOrder.listOrder: " + e + " -> " + sql); |
897,676 | // continue to trace the request that has been determined to be sampled on previous nodes<NEW_LINE>@Override<NEW_LINE>public Trace continueTraceObject(final TraceId traceId) {<NEW_LINE>// TODO need to modify how to bind a datasender<NEW_LINE>// always set true because the decision of sampling has been made on previous nodes<NEW_LINE>// TODO need to consider as a target to sample in case Trace object has a sampling flag (true) marked on previous node.<NEW_LINE>// Check max throughput(permits per seconds)<NEW_LINE>final TraceSampler.State state = traceSampler.isContinueSampled();<NEW_LINE>if (state.isSampled()) {<NEW_LINE>final TraceRoot traceRoot = traceRootFactory.continueTraceRoot(traceId, state.nextId());<NEW_LINE>final Span span = spanFactory.newSpan(traceRoot);<NEW_LINE>final SpanChunkFactory spanChunkFactory = new DefaultSpanChunkFactory(traceRoot);<NEW_LINE>final Storage storage = storageFactory.createStorage(spanChunkFactory);<NEW_LINE>final CallStack<SpanEvent> callStack = callStackFactory.newCallStack();<NEW_LINE>final boolean samplingEnable = true;<NEW_LINE>final SpanRecorder spanRecorder = recorderFactory.newSpanRecorder(span, traceId.isRoot(), samplingEnable);<NEW_LINE>final WrappedSpanEventRecorder wrappedSpanEventRecorder = recorderFactory.newWrappedSpanEventRecorder(traceRoot);<NEW_LINE><MASK><NEW_LINE>final DefaultTrace trace = new DefaultTrace(span, callStack, storage, samplingEnable, spanRecorder, wrappedSpanEventRecorder, handle);<NEW_LINE>return trace;<NEW_LINE>} else {<NEW_LINE>return newDisableTrace(state.nextId());<NEW_LINE>}<NEW_LINE>} | final ActiveTraceHandle handle = registerActiveTrace(traceRoot); |
1,394,698 | protected DeploymentManager createPippoDeploymentManager() {<NEW_LINE>DeploymentInfo info = Servlets.deployment();<NEW_LINE>info.setDeploymentName("Pippo");<NEW_LINE>info.setClassLoader(this.<MASK><NEW_LINE>info.setContextPath(getSettings().getContextPath());<NEW_LINE>info.setIgnoreFlush(true);<NEW_LINE>// inject application as context attribute<NEW_LINE>info.addServletContextAttribute(PIPPO_APPLICATION, getApplication());<NEW_LINE>// add pippo filter<NEW_LINE>addPippoFilter(info);<NEW_LINE>// add initializers<NEW_LINE>info.addListener(new ListenerInfo(PippoServletContextListener.class));<NEW_LINE>// add listeners<NEW_LINE>listeners.forEach(listener -> info.addListener(new ListenerInfo(listener)));<NEW_LINE>ServletInfo defaultServlet = new ServletInfo("DefaultServlet", DefaultServlet.class);<NEW_LINE>defaultServlet.addMapping("/");<NEW_LINE>MultipartConfigElement multipartConfig = createMultipartConfigElement();<NEW_LINE>defaultServlet.setMultipartConfig(multipartConfig);<NEW_LINE>info.addServlets(defaultServlet);<NEW_LINE>DeploymentManager deploymentManager = Servlets.defaultContainer().addDeployment(info);<NEW_LINE>deploymentManager.deploy();<NEW_LINE>return deploymentManager;<NEW_LINE>} | getClass().getClassLoader()); |
620,237 | private Subject authenticateRunAsUser(RunAs runAs) throws AuthenticationException {<NEW_LINE>String username = runAs.getUserid();<NEW_LINE>String password = PasswordUtil.passwordDecode(runAs.getPassword());<NEW_LINE>IdentityStoreHandlerService identityStoreHandlerService = getIdentityStoreHandlerService();<NEW_LINE>if (identityStoreHandlerService != null && identityStoreHandlerService.isIdentityStoreAvailable()) {<NEW_LINE>Subject inSubject;<NEW_LINE>if (password != null) {<NEW_LINE>inSubject = identityStoreHandlerService.createHashtableInSubject(username, password);<NEW_LINE>} else {<NEW_LINE>inSubject = identityStoreHandlerService.createHashtableInSubject(username);<NEW_LINE>}<NEW_LINE>return getAuthenticationService().authenticate(JaasLoginConfigConstants.SYSTEM_WEB_INBOUND, inSubject);<NEW_LINE>} else if (password != null) {<NEW_LINE>AuthenticationData <MASK><NEW_LINE>return getAuthenticationService().authenticate(JaasLoginConfigConstants.SYSTEM_WEB_INBOUND, authenticationData, null);<NEW_LINE>} else {<NEW_LINE>AuthenticateUserHelper authHelper = new AuthenticateUserHelper();<NEW_LINE>return authHelper.authenticateUser(getAuthenticationService(), username, JaasLoginConfigConstants.SYSTEM_WEB_INBOUND);<NEW_LINE>}<NEW_LINE>} | authenticationData = createAuthenticationData(username, password); |
1,364,633 | final CreateConfigResult executeCreateConfig(CreateConfigRequest createConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateConfigRequest> request = null;<NEW_LINE>Response<CreateConfigResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateConfigRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createConfigRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "GroundStation");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateConfigResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateConfigResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateConfig"); |
1,060,212 | public void run() {<NEW_LINE>try {<NEW_LINE>Injector injector = makeInjector();<NEW_LINE>config = getHadoopDruidIndexerConfig();<NEW_LINE>MetadataStorageUpdaterJobSpec metadataSpec = config.getSchema().getIOConfig().getMetadataUpdateSpec();<NEW_LINE>// override metadata storage type based on HadoopIOConfig<NEW_LINE>Preconditions.checkNotNull(metadataSpec.getType(), "type in metadataUpdateSpec must not be null");<NEW_LINE>injector.getInstance(Properties.class).setProperty("druid.metadata.storage.type", metadataSpec.getType());<NEW_LINE>HadoopIngestionSpec.updateSegmentListIfDatasourcePathSpecIsUsed(config.getSchema(), HadoopDruidIndexerConfig.JSON_MAPPER, new MetadataStoreBasedUsedSegmentsRetriever(injector.getInstance(IndexerMetadataStorageCoordinator.class)));<NEW_LINE>List<Jobby> jobs = new ArrayList<>();<NEW_LINE>HadoopDruidIndexerJob indexerJob = new HadoopDruidIndexerJob(config, injector<MASK><NEW_LINE>jobs.add(new HadoopDruidDetermineConfigurationJob(config));<NEW_LINE>jobs.add(indexerJob);<NEW_LINE>boolean jobsSucceeded = JobHelper.runJobs(jobs);<NEW_LINE>JobHelper.renameIndexFilesForSegments(config.getSchema(), indexerJob.getPublishedSegmentAndIndexZipFilePaths());<NEW_LINE>JobHelper.maybeDeleteIntermediatePath(jobsSucceeded, config.getSchema());<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | .getInstance(MetadataStorageUpdaterJobHandler.class)); |
1,724,112 | public void testEventLoggingFeatureRemoval() throws Exception {<NEW_LINE>server.setMarkToEndOfLog();<NEW_LINE>CommonTasks.<MASK><NEW_LINE>server.setServerConfigurationFile("server_EL.xml");<NEW_LINE>waitForFeatureAddition();<NEW_LINE>createRequest(5000);<NEW_LINE>int end = fetchNoENDWarnings();<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "----> END Warnings : " + fetchNoENDWarnings());<NEW_LINE>assertTrue("Expected EventLogging features to be enabled.", isEventLoggingEnabled());<NEW_LINE>assertTrue("No EventLogging warning found!", (end > 0));<NEW_LINE>server.setMarkToEndOfLog();<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "$$$$ ---->Updating server configuration : REMOVING EventLogging , ADDING RequestTiming");<NEW_LINE>server.setServerConfigurationFile("server_RT.xml");<NEW_LINE>waitForFeatureRemoval();<NEW_LINE>createRequest(5000);<NEW_LINE>int slow = fetchNoOfslowRequestWarnings();<NEW_LINE>// Retry the request again<NEW_LINE>if (slow == 0) {<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "$$$$ -----> Retry because no slow request warning found!");<NEW_LINE>createRequest(5000);<NEW_LINE>slow = fetchNoOfslowRequestWarnings();<NEW_LINE>}<NEW_LINE>int end_new = fetchNoENDWarnings() - end;<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "----> Slow Warnings : " + slow);<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "----> END Warnings : " + end_new);<NEW_LINE>assertTrue("EventLogging feature is not removed!", isEventLoggingRemoved());<NEW_LINE>assertTrue("Expected RequestTiming warning.", (slow > 0));<NEW_LINE>assertTrue("Found EventLogging warning!", (end_new == 0));<NEW_LINE>} | writeLogMsg(Level.INFO, "$$$$ ---->Updating server configuration : ADDING EventLogging Feature"); |
520,845 | public void handleRequest(final HttpServerExchange exchange) throws Exception {<NEW_LINE>if (exchange.isInIoThread()) {<NEW_LINE>exchange.dispatch(this);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isEnabled()) {<NEW_LINE>Map<String, Object> result = new LinkedHashMap<>();<NEW_LINE>// create rootDumper which will do dumping.<NEW_LINE>RootDumper rootDumper = new RootDumper(config, exchange);<NEW_LINE>// dump request info into result right away<NEW_LINE>rootDumper.dumpRequest(result);<NEW_LINE>// only add response wrapper when response config is not set to "false"<NEW_LINE>if (config.isResponseEnabled()) {<NEW_LINE>// set Conduit to the conduit chain to store response body<NEW_LINE>exchange.addResponseWrapper((factory, exchange12) -> new StoreResponseStreamSinkConduit(factory.create(), exchange12));<NEW_LINE>}<NEW_LINE>// when complete exchange, dump response info to result, and log the result.<NEW_LINE>exchange.addExchangeCompleteListener((exchange1, nextListener) -> {<NEW_LINE>rootDumper.dumpResponse(result);<NEW_LINE>// log the result<NEW_LINE>DumpHelper.logResult(result, config);<NEW_LINE>nextListener.proceed();<NEW_LINE>});<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | Handler.next(exchange, next); |
1,324,049 | protected void runCheck() throws MojoExecutionException, MojoFailureException {<NEW_LINE>try (Engine engine = initializeEngine()) {<NEW_LINE>try {<NEW_LINE>if (!engine.getSettings().getBoolean(Settings.KEYS.AUTO_UPDATE)) {<NEW_LINE>engine.getSettings().setBoolean(Settings.KEYS.AUTO_UPDATE, true);<NEW_LINE>}<NEW_LINE>} catch (InvalidSettingException ex) {<NEW_LINE>engine.getSettings().setBoolean(Settings.KEYS.AUTO_UPDATE, true);<NEW_LINE>}<NEW_LINE>engine.doUpdates();<NEW_LINE>} catch (DatabaseException ex) {<NEW_LINE>if (getLog().isDebugEnabled()) {<NEW_LINE>getLog().debug("Database connection error", ex);<NEW_LINE>}<NEW_LINE>final String msg = "An exception occurred connecting to the local database. Please see the log file for more details.";<NEW_LINE>if (this.isFailOnError()) {<NEW_LINE>throw new MojoExecutionException(msg, ex);<NEW_LINE>}<NEW_LINE>getLog().error(msg);<NEW_LINE>} catch (UpdateException ex) {<NEW_LINE>final String msg = "An exception occurred while downloading updates. Please see the log file for more details.";<NEW_LINE>if (this.isFailOnError()) {<NEW_LINE>throw new MojoExecutionException(msg, ex);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} finally {<NEW_LINE>getSettings().cleanup();<NEW_LINE>}<NEW_LINE>} | getLog().error(msg); |
921,601 | public static void planarToBuffered_U8(Planar<GrayU8> src, BufferedImage dst) {<NEW_LINE>if (src.getNumBands() != 3)<NEW_LINE>throw new IllegalArgumentException("src must have three bands");<NEW_LINE>final int width = dst.getWidth();<NEW_LINE>final int height = dst.getHeight();<NEW_LINE>byte[] band1 = src.getBand(0).data;<NEW_LINE>byte[] band2 = src.getBand(1).data;<NEW_LINE>byte[] band3 = src.getBand(2).data;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, height, y -> {<NEW_LINE>for (int y = 0; y < height; y++) {<NEW_LINE>int indexSrc = src.startIndex + src.stride * y;<NEW_LINE>for (int x = 0; x < width; x++, indexSrc++) {<NEW_LINE>int c1 = band1[indexSrc] & 0xFF;<NEW_LINE>int c2 = band2[indexSrc] & 0xFF;<NEW_LINE>int <MASK><NEW_LINE>int argb = c1 << 16 | c2 << 8 | c3;<NEW_LINE>dst.setRGB(x, y, argb);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | c3 = band3[indexSrc] & 0xFF; |
875,803 | public BuiltInScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, FunctionAndTypeManager functionAndTypeManager) {<NEW_LINE>ImmutableList.Builder<MethodHandle> argumentMethods = ImmutableList.builder();<NEW_LINE>Type type = boundVariables.getTypeVariable("T");<NEW_LINE>for (Type parameterType : type.getTypeParameters()) {<NEW_LINE>FunctionHandle operatorHandle = functionAndTypeManager.resolveOperator(IS_DISTINCT_FROM, fromTypes(parameterType, parameterType));<NEW_LINE>FunctionInvoker functionInvoker = functionAndTypeManager.getFunctionInvokerProvider().createFunctionInvoker(operatorHandle, Optional.of(new InvocationConvention(ImmutableList.of(NULL_FLAG, NULL_FLAG), InvocationConvention.InvocationReturnConvention.FAIL_ON_NULL, false)));<NEW_LINE>argumentMethods.add(functionInvoker.methodHandle());<NEW_LINE>}<NEW_LINE>return new BuiltInScalarFunctionImplementation(ImmutableList.of(new ScalarFunctionImplementationChoice(false, ImmutableList.of(valueTypeArgumentProperty(USE_NULL_FLAG), valueTypeArgumentProperty(USE_NULL_FLAG)), ReturnPlaceConvention.STACK, METHOD_HANDLE_NULL_FLAG.bindTo(type).bindTo(argumentMethods.build()), Optional.empty()), new ScalarFunctionImplementationChoice(false, ImmutableList.of(valueTypeArgumentProperty(BLOCK_AND_POSITION), valueTypeArgumentProperty(BLOCK_AND_POSITION)), ReturnPlaceConvention.STACK, METHOD_HANDLE_BLOCK_POSITION.bindTo(type).bindTo(argumentMethods.build()), <MASK><NEW_LINE>} | Optional.empty()))); |
1,122,933 | public void write(Encoder encoder, CachedExternalResource value) throws Exception {<NEW_LINE>encoder.writeBoolean(value.getCachedFile() != null);<NEW_LINE>if (value.getCachedFile() != null) {<NEW_LINE>encoder.writeString(relativizeAndNormalizeFilePath(value.getCachedFile()));<NEW_LINE>}<NEW_LINE>encoder.<MASK><NEW_LINE>ExternalResourceMetaData metaData = value.getExternalResourceMetaData();<NEW_LINE>encoder.writeBoolean(metaData != null);<NEW_LINE>if (metaData != null) {<NEW_LINE>encoder.writeString(metaData.getLocation().toASCIIString());<NEW_LINE>encoder.writeBoolean(metaData.getLastModified() != null);<NEW_LINE>if (metaData.getLastModified() != null) {<NEW_LINE>encoder.writeLong(metaData.getLastModified().getTime());<NEW_LINE>}<NEW_LINE>encoder.writeNullableString(metaData.getContentType());<NEW_LINE>encoder.writeSmallLong(metaData.getContentLength());<NEW_LINE>encoder.writeNullableString(metaData.getEtag());<NEW_LINE>encoder.writeBoolean(metaData.getSha1() != null);<NEW_LINE>if (metaData.getSha1() != null) {<NEW_LINE>encoder.writeString(metaData.getSha1().toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | writeLong(value.getCachedAt()); |
1,222,042 | public static Map<String, List<Cluster>> fetchEMRInfo(BasicSessionCredentials temporaryCredentials, String skipRegions, String accountId, String accountName) {<NEW_LINE>Map<String, List<Cluster>> clusterList = new LinkedHashMap<>();<NEW_LINE>String expPrefix = InventoryConstants.ERROR_PREFIX_CODE + accountId + "\",\"Message\": \"Exception in fetching info for resource in specific region\" ,\"type\": \"EMR\" , \"region\":\"";<NEW_LINE>for (Region region : RegionUtils.getRegions()) {<NEW_LINE>try {<NEW_LINE>if (!skipRegions.contains(region.getName())) {<NEW_LINE>AmazonElasticMapReduce emrClient = AmazonElasticMapReduceClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();<NEW_LINE>List<ClusterSummary> clusters = new ArrayList<>();<NEW_LINE>String marker = null;<NEW_LINE>ListClustersResult clusterResult;<NEW_LINE>do {<NEW_LINE>clusterResult = emrClient.listClusters(new ListClustersRequest().withMarker(marker));<NEW_LINE>clusters.addAll(clusterResult.getClusters());<NEW_LINE>marker = clusterResult.getMarker();<NEW_LINE>} while (marker != null);<NEW_LINE>List<Cluster> <MASK><NEW_LINE>clusters.forEach(cluster -> {<NEW_LINE>DescribeClusterResult descClstrRslt = emrClient.describeCluster(new DescribeClusterRequest().withClusterId(cluster.getId()));<NEW_LINE>clustersList.add(descClstrRslt.getCluster());<NEW_LINE>});<NEW_LINE>if (!clustersList.isEmpty()) {<NEW_LINE>log.debug(InventoryConstants.ACCOUNT + accountId + " Type : EMR " + region.getName() + " >> " + clustersList.size());<NEW_LINE>clusterList.put(accountId + delimiter + accountName + delimiter + region.getName(), clustersList);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (region.isServiceSupported(AmazonElasticMapReduce.ENDPOINT_PREFIX)) {<NEW_LINE>log.warn(expPrefix + region.getName() + InventoryConstants.ERROR_CAUSE + e.getMessage() + "\"}");<NEW_LINE>ErrorManageUtil.uploadError(accountId, region.getName(), "emr", e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return clusterList;<NEW_LINE>} | clustersList = new ArrayList<>(); |
238,231 | // Note: Do not call on the absolute root path '/'.<NEW_LINE>private void putDigest(Path path, String digest) {<NEW_LINE><MASK><NEW_LINE>String dirname;<NEW_LINE>if (parent != null) {<NEW_LINE>dirname = parent.toString();<NEW_LINE>} else if (path.isAbsolute()) {<NEW_LINE>// path.getFileName() below will return null on the path '/', leading to an NPE.<NEW_LINE>throw new IllegalArgumentException("The path '/' cannot be used here.");<NEW_LINE>} else {<NEW_LINE>dirname = ".";<NEW_LINE>}<NEW_LINE>String basename = path.getFileName().toString();<NEW_LINE>Map<String, String> dir = dirs.computeIfAbsent(dirname, k -> new HashMap<>());<NEW_LINE>String existing = dir.get(digest);<NEW_LINE>if (existing != null && !existing.equals(digest)) {<NEW_LINE>throw new IllegalStateException("Trying to register conflicting digests for the same path");<NEW_LINE>}<NEW_LINE>dir.put(basename, digest);<NEW_LINE>} | Path parent = path.getParent(); |
636,663 | public void call(String[] args) throws CmdException {<NEW_LINE>// process special commands<NEW_LINE>boolean refresh = false;<NEW_LINE>if (args.length > 0 && args[0].startsWith("-"))<NEW_LINE>switch(args[0]) {<NEW_LINE>case "-debug":<NEW_LINE>debugMode.setChecked(!debugMode.isChecked());<NEW_LINE>ChatUtils.message("Debug mode " + (debugMode.isChecked() <MASK><NEW_LINE>return;<NEW_LINE>case "-depth":<NEW_LINE>depthTest.setChecked(!depthTest.isChecked());<NEW_LINE>ChatUtils.message("Depth test " + (depthTest.isChecked() ? "on" : "off") + ".");<NEW_LINE>return;<NEW_LINE>case "-refresh":<NEW_LINE>if (lastGoal == null)<NEW_LINE>throw new CmdError("Cannot refresh: no previous path.");<NEW_LINE>refresh = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// disable if enabled<NEW_LINE>if (enabled) {<NEW_LINE>EVENTS.remove(UpdateListener.class, this);<NEW_LINE>EVENTS.remove(RenderListener.class, this);<NEW_LINE>enabled = false;<NEW_LINE>if (args.length == 0)<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// set PathFinder<NEW_LINE>final BlockPos goal;<NEW_LINE>if (refresh)<NEW_LINE>goal = lastGoal;<NEW_LINE>else {<NEW_LINE>goal = argsToPos(args);<NEW_LINE>lastGoal = goal;<NEW_LINE>}<NEW_LINE>pathFinder = new PathFinder(goal);<NEW_LINE>// start<NEW_LINE>enabled = true;<NEW_LINE>EVENTS.add(UpdateListener.class, this);<NEW_LINE>EVENTS.add(RenderListener.class, this);<NEW_LINE>System.out.println("Finding path...");<NEW_LINE>startTime = System.nanoTime();<NEW_LINE>} | ? "on" : "off") + "."); |
752,966 | public void updated(Dictionary<String, ?> config) throws ConfigurationException {<NEW_LINE>if (config != null) {<NEW_LINE>Enumeration<String<MASK><NEW_LINE>while (keys.hasMoreElements()) {<NEW_LINE>String key = keys.nextElement();<NEW_LINE>// the config-key enumeration contains additional keys that we<NEW_LINE>// don't want to process here ...<NEW_LINE>if ("service.pid".equals(key)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Matcher matcher = EXTRACT_TV_CONFIG_PATTERN.matcher(key);<NEW_LINE>if (!matcher.matches()) {<NEW_LINE>logger.debug("given config key '" + key + "' does not follow the expected pattern '<id>.<host|port>'");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>matcher.reset();<NEW_LINE>matcher.find();<NEW_LINE>String deviceId = matcher.group(1);<NEW_LINE>DeviceConfig deviceConfig = deviceConfigCache.get(deviceId);<NEW_LINE>if (deviceConfig == null) {<NEW_LINE>deviceConfig = new DeviceConfig(deviceId);<NEW_LINE>deviceConfigCache.put(deviceId, deviceConfig);<NEW_LINE>}<NEW_LINE>String configKey = matcher.group(2);<NEW_LINE>String value = (String) config.get(key);<NEW_LINE>if ("host".equals(configKey)) {<NEW_LINE>deviceConfig.host = value;<NEW_LINE>} else if ("port".equals(configKey)) {<NEW_LINE>deviceConfig.port = Integer.valueOf(value);<NEW_LINE>} else {<NEW_LINE>throw new ConfigurationException(configKey, "the given configKey '" + configKey + "' is unknown");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | > keys = config.keys(); |
718,238 | // ================================== Edit Tab Functions =======================================<NEW_LINE>// Starting up MTV, or user clicked Create New Event from edit menu<NEW_LINE>@Action<NEW_LINE>public void edit_new_event() {<NEW_LINE>if (edit_not_saved) {<NEW_LINE>Object[] options = { "Yes, Forget current edits!", "Cancel" };<NEW_LINE>int answer = JOptionPane.showOptionDialog(editPanel, "You have not saved the event to a file. Do you wish to lose the current edits you've made?", "Current Edit Not Saved", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]);<NEW_LINE>if (answer != JOptionPane.OK_OPTION) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>edit_table_rows.removeAllElements();<NEW_LINE>edit_condition_count = 1;<NEW_LINE>edit_action_count = 1;<NEW_LINE>edit_event_name = "put_new_event_name_here";<NEW_LINE>eventTextField.setText(edit_event_name);<NEW_LINE>Vector<Object> row;<NEW_LINE>row = new Vector<Object>(Arrays.asList("### Event Configuration", "", "", ""));<NEW_LINE>edit_table_rows.addElement(row);<NEW_LINE>row = new Vector<Object>(Arrays.asList(edit_event_name + " = trick.new_event", "(\"", edit_event_name, "\")"));<NEW_LINE>edit_table_rows.addElement(row);<NEW_LINE>row = new Vector<Object>(Arrays.asList(edit_event_name + ".cycle = ", "", "0.5", ""));<NEW_LINE>edit_table_rows.addElement(row);<NEW_LINE>row = new Vector<Object>(Arrays.asList(edit_event_name + ".activate", "(", "", " )"));<NEW_LINE>edit_table_rows.addElement(row);<NEW_LINE>row = new Vector<Object>(Arrays.asList("trick.add_event"<MASK><NEW_LINE>edit_table_rows.addElement(row);<NEW_LINE>row = new Vector<Object>(Arrays.asList("### Conditions", "", "", ""));<NEW_LINE>edit_table_rows.addElement(row);<NEW_LINE>row = new Vector<Object>(Arrays.asList(edit_event_name + ".condition", "(0,\"\"\"", "False", "\"\"\")"));<NEW_LINE>edit_table_rows.addElement(row);<NEW_LINE>row = new Vector<Object>(Arrays.asList("### Actions", "", "", ""));<NEW_LINE>edit_table_rows.addElement(row);<NEW_LINE>row = new Vector<Object>(Arrays.asList(edit_event_name + ".action", "(0,\"\"\"", "print \"ACTION0\"", "\"\"\")"));<NEW_LINE>edit_table_rows.addElement(row);<NEW_LINE>// disable table and edit menu until user sets event name<NEW_LINE>edit_table.setEnabled(false);<NEW_LINE>editMenu.setEnabled(false);<NEW_LINE>// redraw table so rows are shown grayed out<NEW_LINE>TableModelEvent tme = new TableModelEvent(edit_table.getModel());<NEW_LINE>edit_table.tableChanged(tme);<NEW_LINE>} | , "(", edit_event_name, " )")); |
1,333,609 | protected void onTaskConcurrentInc(final String key, final int hashcode) {<NEW_LINE>mCore.getHandler().post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>Pair<? extends List<Integer>, Long> workingTasks;<NEW_LINE>synchronized (mTaskConcurrentTrace) {<NEW_LINE>workingTasks = mTaskConcurrentTrace.get(key);<NEW_LINE>if (workingTasks == null) {<NEW_LINE>workingTasks = new Pair<>(new LinkedList<Integer>(), SystemClock.uptimeMillis());<NEW_LINE>}<NEW_LINE>// noinspection ConstantConditions<NEW_LINE><MASK><NEW_LINE>mTaskConcurrentTrace.put(key, workingTasks);<NEW_LINE>}<NEW_LINE>if (workingTasks.first.size() > mConcurrentLimit) {<NEW_LINE>MatrixLog.w(TAG, "reach task concurrent limit, count = " + workingTasks.first.size() + ", key = " + key);<NEW_LINE>// noinspection ConstantConditions<NEW_LINE>long duringMillis = SystemClock.uptimeMillis() - workingTasks.second;<NEW_LINE>MatrixLog.w(TAG, "onConcurrentOverHeat, during = " + duringMillis);<NEW_LINE>onConcurrentOverHeat(key, workingTasks.first.size(), duringMillis);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | workingTasks.first.add(hashcode); |
572,435 | protected Subscriber createSubscriber(boolean noLocal) throws JMSException {<NEW_LINE>try {<NEW_LINE>Logger logger = connection.getLogger();<NEW_LINE>SubscriberQosHolder holder = new SubscriberQosHolder(QosPolicies.newSubscriberQos());<NEW_LINE>DomainParticipant participant = connection.getParticipant();<NEW_LINE>participant.get_default_subscriber_qos(holder);<NEW_LINE>SubscriberQosPolicy policy = cxRequestInfo.getSubscriberQosPolicy();<NEW_LINE>policy.setQos(holder.value);<NEW_LINE>// Set PARTITION QosPolicy to support the noLocal client<NEW_LINE>// specifier on created MessageConsumer instances:<NEW_LINE>if (noLocal) {<NEW_LINE>holder.value.partition = PartitionHelper.negate(connection.getConnectionId());<NEW_LINE>} else {<NEW_LINE>holder.value.partition = PartitionHelper.matchAll();<NEW_LINE>}<NEW_LINE>Subscriber subscriber = participant.create_subscriber(holder.value, null, DEFAULT_STATUS_MASK.value);<NEW_LINE>if (subscriber == null) {<NEW_LINE>throw new JMSException("Unable to create Subscriber; please check logs");<NEW_LINE>}<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("Created %s -> %s", subscriber, policy);<NEW_LINE>logger.debug("%s using PARTITION %s", subscriber, Arrays.deepToString(holder<MASK><NEW_LINE>}<NEW_LINE>TransportConfig transport = transportManager.getTransport();<NEW_LINE>TheTransportRegistry.bind_config(transport, subscriber);<NEW_LINE>logger.debug("Attached %s to %s", subscriber, transport);<NEW_LINE>return subscriber;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw ExceptionHelper.notify(connection, e);<NEW_LINE>}<NEW_LINE>} | .value.partition.name)); |
1,308,892 | static GraphQLOutputType convertType(FieldDescriptor fieldDescriptor, SchemaOptions schemaOptions) {<NEW_LINE>final GraphQLOutputType type;<NEW_LINE>if (fieldDescriptor.getType() == Type.MESSAGE) {<NEW_LINE>type = getReference(fieldDescriptor.getMessageType());<NEW_LINE>} else if (fieldDescriptor.getType() == Type.GROUP) {<NEW_LINE>type = getReference(fieldDescriptor.getMessageType());<NEW_LINE>} else if (fieldDescriptor.getType() == Type.ENUM) {<NEW_LINE>type = getReference(fieldDescriptor.getEnumType());<NEW_LINE>} else if (schemaOptions.useProtoScalarTypes()) {<NEW_LINE>type = PROTO_TYPE_MAP.<MASK><NEW_LINE>} else {<NEW_LINE>type = TYPE_MAP.get(fieldDescriptor.getType());<NEW_LINE>}<NEW_LINE>if (type == null) {<NEW_LINE>throw new RuntimeException("Unknown type: " + fieldDescriptor.getType());<NEW_LINE>}<NEW_LINE>if (fieldDescriptor.isRepeated()) {<NEW_LINE>return new GraphQLList(type);<NEW_LINE>} else {<NEW_LINE>return type;<NEW_LINE>}<NEW_LINE>} | get(fieldDescriptor.getType()); |
1,826,202 | public Object doWork() {<NEW_LINE>final Pair<String, List<PileupSummary>> sampleAndsites = PileupSummary.readFromFile(inputPileupSummariesTable);<NEW_LINE>final String sample = sampleAndsites.getLeft();<NEW_LINE>final List<PileupSummary> sites = filterSitesByCoverage(sampleAndsites.getRight());<NEW_LINE>// used the matched normal to genotype (i.e. find hom alt sites) if available<NEW_LINE>final List<PileupSummary> genotypingSites = matchedPileupSummariesTable == null ? sites : filterSitesByCoverage(PileupSummary.readFromFile(matchedPileupSummariesTable).getRight());<NEW_LINE>final ContaminationModel genotypingModel = new ContaminationModel(genotypingSites);<NEW_LINE>if (outputTumorSegmentation != null) {<NEW_LINE>final ContaminationModel tumorModel = matchedPileupSummariesTable == null ? genotypingModel : new ContaminationModel(sites);<NEW_LINE>MinorAlleleFractionRecord.writeToFile(sample, tumorModel.segmentationRecords(), outputTumorSegmentation);<NEW_LINE>}<NEW_LINE>final Pair<Double, Double> <MASK><NEW_LINE>ContaminationRecord.writeToFile(Arrays.asList(new ContaminationRecord(sample, contaminationAndError.getLeft(), contaminationAndError.getRight())), outputTable);<NEW_LINE>return "SUCCESS";<NEW_LINE>} | contaminationAndError = genotypingModel.calculateContaminationFromHoms(sites); |
1,521,922 | private void switchProfile(String profileKey) {<NEW_LINE>executor.execute(() -> {<NEW_LINE>// Current queued loot is for the previous profile, so save it first with the current profile key<NEW_LINE>submitLoot();<NEW_LINE>this.profileKey = profileKey;<NEW_LINE>log.debug("Switched to profile {}", profileKey);<NEW_LINE>if (!config.syncPanel()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int drops = 0;<NEW_LINE>List<ConfigLoot> loots = new ArrayList<>();<NEW_LINE>Instant old = Instant.now().minus(MAX_AGE);<NEW_LINE>for (String key : configManager.getRSProfileConfigurationKeys(LootTrackerConfig.GROUP, profileKey, "drops_")) {<NEW_LINE>String json = configManager.getConfiguration(LootTrackerConfig.GROUP, profileKey, key);<NEW_LINE>ConfigLoot configLoot;<NEW_LINE>try {<NEW_LINE>configLoot = gson.fromJson(json, ConfigLoot.class);<NEW_LINE>} catch (JsonSyntaxException ex) {<NEW_LINE>log.warn("Removing loot with malformed json: {}", json, ex);<NEW_LINE>configManager.unsetConfiguration(LootTrackerConfig.GROUP, profileKey, key);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (configLoot.last.isBefore(old)) {<NEW_LINE>log.debug("Removing old loot for {} {}", configLoot.type, configLoot.name);<NEW_LINE>configManager.unsetConfiguration(LootTrackerConfig.GROUP, profileKey, key);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (drops >= MAX_DROPS && !loots.isEmpty() && loots.get(0).last.isAfter(configLoot.last)) {<NEW_LINE>// fast drop<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>sortedInsert(loots, configLoot, Comparator.comparing(ConfigLoot::getLast));<NEW_LINE>drops += configLoot.numDrops();<NEW_LINE>if (drops >= MAX_DROPS) {<NEW_LINE>ConfigLoot <MASK><NEW_LINE>drops -= top.numDrops();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.debug("Loaded {} records", loots.size());<NEW_LINE>clientThread.invokeLater(() -> {<NEW_LINE>// convertToLootTrackerRecord requires item compositions to be available to get the item name,<NEW_LINE>// so it can't be run while the client is starting<NEW_LINE>if (client.getGameState().getState() < GameState.LOGIN_SCREEN.getState()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// convertToLootTrackerRecord must be called on client thread<NEW_LINE>List<LootTrackerRecord> records = loots.stream().map(this::convertToLootTrackerRecord).collect(Collectors.toList());<NEW_LINE>SwingUtilities.invokeLater(() -> {<NEW_LINE>panel.clearRecords();<NEW_LINE>panel.addRecords(records);<NEW_LINE>});<NEW_LINE>return true;<NEW_LINE>});<NEW_LINE>});<NEW_LINE>} | top = loots.remove(0); |
1,020,997 | public void save() throws IOException {<NEW_LINE>if (fFile == null || !fFile.exists()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Create Manifest as JDOM<NEW_LINE>Document doc = new Document();<NEW_LINE>Element root = new Element(ITemplateXMLTags.XML_TEMPLATE_ELEMENT_MANIFEST);<NEW_LINE>doc.setRootElement(root);<NEW_LINE>Element elementName = new Element(ITemplateXMLTags.XML_TEMPLATE_ELEMENT_NAME);<NEW_LINE>elementName.setText(getName());<NEW_LINE>root.addContent(elementName);<NEW_LINE>Element elementDescription = new Element(ITemplateXMLTags.XML_TEMPLATE_ELEMENT_DESCRIPTION);<NEW_LINE>elementDescription.setText(getDescription());<NEW_LINE>root.addContent(elementDescription);<NEW_LINE>if (fKeyThumbnailPath != null) {<NEW_LINE>Element elementKeyThumb = new Element(ITemplateXMLTags.XML_TEMPLATE_ELEMENT_KEY_THUMBNAIL);<NEW_LINE>elementKeyThumb.setText(fKeyThumbnailPath);<NEW_LINE>root.addContent(elementKeyThumb);<NEW_LINE>}<NEW_LINE>// Open a zip stream<NEW_LINE>File tmpFile = File.createTempFile("architemplate", null);<NEW_LINE>BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(tmpFile));<NEW_LINE>ZipOutputStream zOut = new ZipOutputStream(out);<NEW_LINE>// Add Manifest<NEW_LINE>String manifest = JDOMUtils.write2XMLString(doc);<NEW_LINE>ZipUtils.addStringToZip(manifest, TemplateManager.ZIP_ENTRY_MANIFEST, zOut<MASK><NEW_LINE>// Add Model<NEW_LINE>// Save to temporary file rather than string because the actual encoding can either be ANSI or UTF-8 depending on content<NEW_LINE>File modelFile = ZipUtils.extractZipEntry(fFile, TemplateManager.ZIP_ENTRY_MODEL, File.createTempFile("archi", null));<NEW_LINE>ZipUtils.addFileToZip(modelFile, TemplateManager.ZIP_ENTRY_MODEL, zOut);<NEW_LINE>modelFile.delete();<NEW_LINE>// Thumbnails<NEW_LINE>for (int i = 0; i < getThumbnailCount(); i++) {<NEW_LINE>Image image = getThumbnail(i);<NEW_LINE>if (image != null) {<NEW_LINE>ZipUtils.addImageToZip(image, getThumbnailEntryName(i), zOut, SWT.IMAGE_PNG, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>zOut.flush();<NEW_LINE>zOut.close();<NEW_LINE>// Delete and copy<NEW_LINE>fFile.delete();<NEW_LINE>FileUtils.copyFile(tmpFile, fFile, false);<NEW_LINE>tmpFile.delete();<NEW_LINE>} | , Charset.forName("UTF-8")); |
1,800,942 | /* (non-Javadoc)<NEW_LINE>* @see ghidra.app.merge.listing.ListingMerger#mergeConflicts(ghidra.app.merge.tool.ListingMergePanel, ghidra.program.model.address.Address, int, ghidra.util.task.TaskMonitor)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void mergeConflicts(ListingMergePanel listingPanel, Address addr, int chosenConflictOption, TaskMonitor monitor) throws CancelledException, MemoryAccessException {<NEW_LINE>monitor.setMessage("Resolving Bookmark conflicts.");<NEW_LINE>if (!hasConflict(addr)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// At address get the BookmarkUid ArrayList for each conflict.<NEW_LINE>boolean askUser = chosenConflictOption == ASK_USER;<NEW_LINE>ArrayList<BookmarkUid> <MASK><NEW_LINE>int size = list.size();<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>BookmarkUid bmuid = list.get(i);<NEW_LINE>// If we have a bookmark choice then a "Use For All" has already occurred.<NEW_LINE>if ((bookmarkChoice == ASK_USER) && askUser && mergeManager != null) {<NEW_LINE>showMergePanel(listingPanel, bmuid.address, bmuid.bookmarkType, bmuid.bookmarkCategory, monitor);<NEW_LINE>monitor.checkCanceled();<NEW_LINE>} else {<NEW_LINE>int optionToUse = (bookmarkChoice == ASK_USER) ? chosenConflictOption : bookmarkChoice;<NEW_LINE>merge(bmuid.address, bmuid.bookmarkType, bmuid.bookmarkCategory, optionToUse, monitor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>resolvedSet.addRange(addr, addr);<NEW_LINE>} | list = conflicts.get(addr); |
582,365 | public Scalar<Integer> evaluate(final QueryElement<Scalar<Integer>> query) {<NEW_LINE>return new BaseScalar<Integer>(configuration.getWriteExecutor()) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Integer evaluate() {<NEW_LINE>// doesn't use the query params, just maps to the parameterBinder callback<NEW_LINE>QueryBuilder qb = new QueryBuilder(configuration.getQueryBuilderOptions());<NEW_LINE>DefaultOutput output = new DefaultOutput(configuration, query, qb, null, false);<NEW_LINE><MASK><NEW_LINE>int result;<NEW_LINE>try (Connection connection = configuration.getConnection()) {<NEW_LINE>StatementListener listener = configuration.getStatementListener();<NEW_LINE>try (PreparedStatement statement = prepare(sql, connection)) {<NEW_LINE>bindParameters(statement);<NEW_LINE>listener.beforeExecuteUpdate(statement, sql, null);<NEW_LINE>result = statement.executeUpdate();<NEW_LINE>listener.afterExecuteUpdate(statement, result);<NEW_LINE>readGeneratedKeys(0, statement);<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new StatementExecutionException(e, sql);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | String sql = output.toSql(); |
326,871 | public void run() {<NEW_LINE>final <MASK><NEW_LINE>LOG.info("Starting MapCollections...");<NEW_LINE>int numThreads = args.threads;<NEW_LINE>final ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(numThreads);<NEW_LINE>final List segmentPaths = collection.getSegmentPaths();<NEW_LINE>final int segmentCnt = segmentPaths.size();<NEW_LINE>LOG.info(segmentCnt + " files found in " + collectionPath.toString());<NEW_LINE>for (int i = 0; i < segmentCnt; i++) {<NEW_LINE>executor.execute(new ReaderThread(collection, (Path) segmentPaths.get(i)));<NEW_LINE>}<NEW_LINE>executor.shutdown();<NEW_LINE>try {<NEW_LINE>// Wait for existing tasks to terminate<NEW_LINE>while (!executor.awaitTermination(1, TimeUnit.MINUTES)) {<NEW_LINE>LOG.info(String.format("%.2f percent completed", (double) executor.getCompletedTaskCount() / segmentCnt * 100.0d));<NEW_LINE>}<NEW_LINE>} catch (InterruptedException ie) {<NEW_LINE>// (Re-)Cancel if current thread also interrupted<NEW_LINE>executor.shutdownNow();<NEW_LINE>// Preserve interrupt status<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>}<NEW_LINE>if (segmentCnt != executor.getCompletedTaskCount()) {<NEW_LINE>throw new RuntimeException("totalFiles = " + segmentCnt + " is not equal to completedTaskCount = " + executor.getCompletedTaskCount());<NEW_LINE>}<NEW_LINE>final long durationMillis = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS);<NEW_LINE>System.out.println("Total running time: " + durationMillis + "ms");<NEW_LINE>} | long start = System.nanoTime(); |
811,322 | public void generateProjectBuildScript(String projectName, InitSettings settings, BuildScriptBuilder buildScriptBuilder) {<NEW_LINE>buildScriptBuilder.repositories().mavenCentral("Use Maven Central for resolving dependencies.");<NEW_LINE>String pluginId = settings.getPackageName() + ".greeting";<NEW_LINE>String pluginClassName = StringUtils.capitalize(GUtil.toCamelCase(settings.getProjectName())) + "Plugin";<NEW_LINE>buildScriptBuilder.fileComment("This generated file contains a sample Gradle plugin project to get you started.").fileComment("For more details take a look at the Writing Custom Plugins chapter in the Gradle").fileComment("User Manual available at " + documentationRegistry.getDocumentationFor("custom_plugins"));<NEW_LINE>buildScriptBuilder.plugin("Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins", "java-gradle-plugin");<NEW_LINE>buildScriptBuilder.block(null, "gradlePlugin", b -> b.containerElement("Define the plugin", "plugins", "greeting", null, g -> {<NEW_LINE>g.propertyAssignment(null, "id", pluginId, true);<NEW_LINE>g.propertyAssignment(null, "implementationClass", withPackage(settings, pluginClassName), true);<NEW_LINE>}));<NEW_LINE>final BuildScriptBuilder.Expression functionalTestSourceSet;<NEW_LINE>if (settings.isUseTestSuites()) {<NEW_LINE>configureDefaultTestSuite(buildScriptBuilder, settings.getTestFramework(), libraryVersionProvider);<NEW_LINE>addTestSuite("functionalTest", buildScriptBuilder, settings.getTestFramework(), libraryVersionProvider);<NEW_LINE>functionalTestSourceSet = buildScriptBuilder.containerElementExpression("sourceSets", "functionalTest");<NEW_LINE>} else {<NEW_LINE>functionalTestSourceSet = buildScriptBuilder.createContainerElement("Add a source set for the functional test suite", "sourceSets", "functionalTest", "functionalTestSourceSet");<NEW_LINE>BuildScriptBuilder.Expression functionalTestConfiguration = buildScriptBuilder.containerElementExpression("configurations", "functionalTestImplementation");<NEW_LINE>BuildScriptBuilder.Expression testConfiguration = buildScriptBuilder.containerElementExpression("configurations", "testImplementation");<NEW_LINE>buildScriptBuilder.methodInvocation(<MASK><NEW_LINE>BuildScriptBuilder.Expression functionalTest = buildScriptBuilder.taskRegistration("Add a task to run the functional tests", "functionalTest", "Test", b -> {<NEW_LINE>b.propertyAssignment(null, "testClassesDirs", buildScriptBuilder.propertyExpression(functionalTestSourceSet, "output.classesDirs"), true);<NEW_LINE>b.propertyAssignment(null, "classpath", buildScriptBuilder.propertyExpression(functionalTestSourceSet, "runtimeClasspath"), true);<NEW_LINE>if (getTestFrameworks().contains(BuildInitTestFramework.SPOCK) || getTestFrameworks().contains(BuildInitTestFramework.JUNIT_JUPITER)) {<NEW_LINE>b.methodInvocation(null, "useJUnitPlatform");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>buildScriptBuilder.taskMethodInvocation("Run the functional tests as part of `check`", "check", "Task", "dependsOn", functionalTest);<NEW_LINE>if (getTestFrameworks().contains(BuildInitTestFramework.SPOCK) || getTestFrameworks().contains(BuildInitTestFramework.JUNIT_JUPITER)) {<NEW_LINE>buildScriptBuilder.taskMethodInvocation("Use JUnit Jupiter for unit tests.", "test", "Test", "useJUnitPlatform");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>buildScriptBuilder.methodInvocation(null, "gradlePlugin.testSourceSets", functionalTestSourceSet);<NEW_LINE>} | null, functionalTestConfiguration, "extendsFrom", testConfiguration); |
1,389,013 | public static void write(ServiceInfo dom, String dir) {<NEW_LINE>try {<NEW_LINE>makeSureCacheDirExists(dir);<NEW_LINE>File file = new File(dir, dom.getKeyEncoded());<NEW_LINE>if (!file.exists()) {<NEW_LINE>// add another !file.exists() to avoid conflicted creating-new-file from multi-instances<NEW_LINE>if (!file.createNewFile() && !file.exists()) {<NEW_LINE>throw new IllegalStateException("failed to create cache file");<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>String json = dom.getJsonFromServer();<NEW_LINE>if (StringUtils.isEmpty(json)) {<NEW_LINE>json = JSON.toJSONString(dom);<NEW_LINE>}<NEW_LINE>keyContentBuffer.append(json);<NEW_LINE>// Use the concurrent API to ensure the consistency.<NEW_LINE>ConcurrentDiskUtil.writeFileContent(file, keyContentBuffer.toString(), Charset.defaultCharset().toString());<NEW_LINE>} catch (Throwable e) {<NEW_LINE>NAMING_LOGGER.error("[NA] failed to write cache for dom:" + dom.getName(), e);<NEW_LINE>}<NEW_LINE>} | StringBuilder keyContentBuffer = new StringBuilder(""); |
1,507,007 | public void accept(ProjectionResult result) {<NEW_LINE>if (result.isBroken()) {<NEW_LINE>// Write out validation errors as they occur.<NEW_LINE>failedProjections.add(result.getProjectionName());<NEW_LINE>StringBuilder message = new StringBuilder(System.lineSeparator());<NEW_LINE>message.append(result.getProjectionName()).append(" has a model that failed validation").append(System.lineSeparator());<NEW_LINE>result.getEvents().forEach(event -> {<NEW_LINE>if (event.getSeverity() == Severity.DANGER || event.getSeverity() == Severity.ERROR) {<NEW_LINE>message.append(event).append(System.lineSeparator());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>Colors.RED.out(message.toString());<NEW_LINE>} else {<NEW_LINE>// Only increment the projection count if it succeeded.<NEW_LINE>projectionCount.incrementAndGet();<NEW_LINE>}<NEW_LINE>pluginCount.addAndGet(result.getPluginManifests().size());<NEW_LINE>// Get the base directory of the projection.<NEW_LINE>Iterator<FileManifest> manifestIterator = result.getPluginManifests().values().iterator();<NEW_LINE>Path root = manifestIterator.hasNext() ? manifestIterator.next().getBaseDir<MASK><NEW_LINE>Colors.GREEN.out(String.format("Completed projection %s (%d shapes): %s", result.getProjectionName(), result.getModel().toSet().size(), root));<NEW_LINE>// Increment the total number of artifacts written.<NEW_LINE>for (FileManifest manifest : result.getPluginManifests().values()) {<NEW_LINE>artifactCount.addAndGet(manifest.getFiles().size());<NEW_LINE>}<NEW_LINE>} | ().getParent() : null; |
806,921 | protected void appendNullAnnotation(StringBuffer nameBuffer, CompilerOptions options) {<NEW_LINE>int oldSize = nameBuffer.length();<NEW_LINE><MASK><NEW_LINE>if (oldSize == nameBuffer.length()) {<NEW_LINE>// nothing appended in super.appendNullAnnotation()?<NEW_LINE>if (hasNullTypeAnnotations()) {<NEW_LINE>// see if the prototype has null type annotations:<NEW_LINE>TypeVariableBinding[] typeVariables = null;<NEW_LINE>if (this.declaringElement instanceof ReferenceBinding) {<NEW_LINE>typeVariables = ((ReferenceBinding) this.declaringElement).typeVariables();<NEW_LINE>} else if (this.declaringElement instanceof MethodBinding) {<NEW_LINE>typeVariables = ((MethodBinding) this.declaringElement).typeVariables();<NEW_LINE>}<NEW_LINE>if (typeVariables != null && typeVariables.length > this.rank) {<NEW_LINE>TypeVariableBinding prototype = typeVariables[this.rank];<NEW_LINE>if (// $IDENTITY-COMPARISON$<NEW_LINE>prototype != this)<NEW_LINE>prototype.appendNullAnnotation(nameBuffer, options);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | super.appendNullAnnotation(nameBuffer, options); |
231,606 | public void initialize(CmdLineOpts configuration) {<NEW_LINE>synchronized (tickers) {<NEW_LINE>LOG.info("Initializing CassandraStockTicker app...");<NEW_LINE>// If the datasources have already been created, we have already initialized the static<NEW_LINE>// variables, so nothing to do.<NEW_LINE>if (!tickers.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Read the various params from the command line.<NEW_LINE>CommandLine commandLine = configuration.getCommandLine();<NEW_LINE>if (commandLine.hasOption("num_ticker_symbols")) {<NEW_LINE>num_ticker_symbols = Integer.parseInt(commandLine.getOptionValue("num_ticker_symbols"));<NEW_LINE>LOG.info("num_ticker_symbols: " + num_ticker_symbols);<NEW_LINE>}<NEW_LINE>if (commandLine.hasOption("data_emit_rate_millis")) {<NEW_LINE>data_emit_rate_millis = Long.parseLong(commandLine.getOptionValue("data_emit_rate_millis"));<NEW_LINE>LOG.info("data_emit_rate_millis: " + data_emit_rate_millis);<NEW_LINE>}<NEW_LINE>int ticker_symbol_idx = 0;<NEW_LINE>while (ticker_symbol_idx < num_ticker_symbols) {<NEW_LINE>// Create the data source.<NEW_LINE>TickerInfo dataSource = new TickerInfo(ticker_symbol_idx, data_emit_rate_millis);<NEW_LINE>tickers.add(dataSource);<NEW_LINE>ticker_symbol_idx++;<NEW_LINE>if (ticker_symbol_idx % 1000 == 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("");<NEW_LINE>// Initialize the number of rows read.<NEW_LINE>num_rows_read = new AtomicLong(0);<NEW_LINE>LOG.info("CassandraStockTicker app is ready.");<NEW_LINE>}<NEW_LINE>} | System.out.print("."); |
411,761 | public static void onItemsRegistration(final RegistryEvent.Register<Item> itemRegisterEvent) {<NEW_LINE>// we create two new ItemGroups:<NEW_LINE>// - a simple one called mbe08_item_group which is used like normal vanilla ItemGroups<NEW_LINE>// - a more complicated one called mbe08_item_group_all_MBE which lists all mbe items and blocks<NEW_LINE>// Because the CreativeTabs class only has one abstract method, we can easily use an anonymous class.<NEW_LINE>// For more information about anonymous classes, see this link:<NEW_LINE>// http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html<NEW_LINE>// To set the actual name of the tab, you have to go into your .lang file and add the line<NEW_LINE>// itemGroup.mbe08_creative_tab=Gold Nugget Tab<NEW_LINE>// where gold_nugget_tab is the unlocalized name of your creative tab, and Gold Nugget Tab<NEW_LINE>// is the actual name of your tab<NEW_LINE>customItemGroup = new ItemGroup("mbe08_item_group") {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ItemStack createIcon() {<NEW_LINE>return new ItemStack(Items.GOLD_NUGGET);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>allMbeItemsItemGroup = new AllMbeItemsItemGroup("mbe08_item_group_all_MBE");<NEW_LINE>// We need to create a BlockItem so the player can carry this block in their hand and it can appear in the inventory<NEW_LINE>// player can hold 64 of this block in their hand at once<NEW_LINE>final int MAXIMUM_STACK_SIZE_TESTBLOCK = 64;<NEW_LINE>Item.Properties properties = // which ItemGroup is this located on?<NEW_LINE>new Item.Properties().maxStackSize(MAXIMUM_STACK_SIZE_TESTBLOCK).// which ItemGroup is this located on?<NEW_LINE>group(customItemGroup);<NEW_LINE>// register the itemblock corresponding to the block<NEW_LINE>testItemBlock = new BlockItem(testBlock, properties);<NEW_LINE>testItemBlock.setRegistryName(testBlock.getRegistryName());<NEW_LINE>itemRegisterEvent.getRegistry().register(testItemBlock);<NEW_LINE>// player can only hold 1 of this block in their hand at once<NEW_LINE>final int MAXIMUM_STACK_SIZE_TESTITEM = 1;<NEW_LINE>properties = new Item.Properties().maxStackSize<MASK><NEW_LINE>final int ATTACK_DAMAGE = 30;<NEW_LINE>final float ATTACK_SPEED = -2.4F;<NEW_LINE>// add an item (an item without a corresponding block)<NEW_LINE>testItem = new SwordItem(ItemTier.GOLD, ATTACK_DAMAGE, ATTACK_SPEED, properties);<NEW_LINE>testItem.setRegistryName("mbe08_itemgroup_item_registry_name");<NEW_LINE>itemRegisterEvent.getRegistry().register(testItem);<NEW_LINE>} | (MAXIMUM_STACK_SIZE_TESTITEM).group(customItemGroup); |
519,999 | public boolean isDaylight(TimeZone timeZone) {<NEW_LINE>Date riseDate = getDailyForecast().get(0).sun().getRiseDate();<NEW_LINE>Date setDate = getDailyForecast().get(0).sun().getSetDate();<NEW_LINE>if (riseDate != null && setDate != null) {<NEW_LINE><MASK><NEW_LINE>calendar.setTimeZone(timeZone);<NEW_LINE>int time = 60 * calendar.get(Calendar.HOUR_OF_DAY) + calendar.get(Calendar.MINUTE);<NEW_LINE>calendar.setTimeZone(TimeZone.getDefault());<NEW_LINE>calendar.setTime(riseDate);<NEW_LINE>int sunrise = 60 * calendar.get(Calendar.HOUR_OF_DAY) + calendar.get(Calendar.MINUTE);<NEW_LINE>calendar.setTime(setDate);<NEW_LINE>int sunset = 60 * calendar.get(Calendar.HOUR_OF_DAY) + calendar.get(Calendar.MINUTE);<NEW_LINE>return sunrise < time && time < sunset;<NEW_LINE>}<NEW_LINE>return DisplayUtils.isDaylight(timeZone);<NEW_LINE>} | Calendar calendar = Calendar.getInstance(); |
608,914 | private static void writeByteArrayToArrowBufHelper(byte[] bytes, ArrowBuf bytebuf, int index, int byteWidth) {<NEW_LINE>final long startIndex = (long) index * byteWidth;<NEW_LINE>if (bytes.length > byteWidth) {<NEW_LINE>throw new UnsupportedOperationException("Decimal size greater than " + byteWidth + " bytes: " + bytes.length);<NEW_LINE>}<NEW_LINE>byte[] padBytes = bytes[0] < 0 ? minus_one : zeroes;<NEW_LINE>if (LITTLE_ENDIAN) {<NEW_LINE>// Decimal stored as native-endian, need to swap data bytes before writing to ArrowBuf if LE<NEW_LINE>byte[] bytesLE = new byte[bytes.length];<NEW_LINE>for (int i = 0; i < bytes.length; i++) {<NEW_LINE>bytesLE[i] = bytes[bytes.length - 1 - i];<NEW_LINE>}<NEW_LINE>// Write LE data<NEW_LINE>bytebuf.setBytes(startIndex, bytesLE, 0, bytes.length);<NEW_LINE>bytebuf.setBytes(startIndex + bytes.length, padBytes, 0, byteWidth - bytes.length);<NEW_LINE>} else {<NEW_LINE>// Write BE data<NEW_LINE>bytebuf.setBytes(startIndex + byteWidth - bytes.length, bytes, 0, bytes.length);<NEW_LINE>bytebuf.setBytes(startIndex, padBytes, <MASK><NEW_LINE>}<NEW_LINE>} | 0, byteWidth - bytes.length); |
622,575 | private void defaultPrefixes() {<NEW_LINE>mi2PrefixMap.put("-exec-interrupt", GdbCommandEchoInterruptEvent::new);<NEW_LINE>mi2PrefixMap.put("-", GdbCommandEchoEvent::new);<NEW_LINE>mi2PrefixMap.put("~", GdbConsoleOutputEvent::fromMi2);<NEW_LINE>mi2PrefixMap.put("@", GdbTargetOutputEvent::new);<NEW_LINE>mi2PrefixMap.put("&", GdbDebugOutputEvent::new);<NEW_LINE>mi2PrefixMap.put("^done", GdbCommandDoneEvent::new);<NEW_LINE>mi2PrefixMap.put("^running", GdbCommandRunningEvent::new);<NEW_LINE>mi2PrefixMap.put("^connected", GdbCommandConnectedEvent::new);<NEW_LINE>mi2PrefixMap.put("^exit", GdbCommandExitEvent::new);<NEW_LINE>mi2PrefixMap.put("^error", GdbCommandErrorEvent::fromMi2);<NEW_LINE>mi2PrefixMap.put("*running", GdbRunningEvent::new);<NEW_LINE>mi2PrefixMap.put("*stopped", GdbStoppedEvent::new);<NEW_LINE>mi2PrefixMap.put("=thread-group-added", GdbThreadGroupAddedEvent::new);<NEW_LINE>mi2PrefixMap.put("=thread-group-removed", GdbThreadGroupRemovedEvent::new);<NEW_LINE>mi2PrefixMap.<MASK><NEW_LINE>mi2PrefixMap.put("=thread-group-exited", GdbThreadGroupExitedEvent::new);<NEW_LINE>mi2PrefixMap.put("=thread-created", GdbThreadCreatedEvent::new);<NEW_LINE>mi2PrefixMap.put("=thread-exited", GdbThreadExitedEvent::new);<NEW_LINE>mi2PrefixMap.put("=thread-selected", GdbThreadSelectedEvent::new);<NEW_LINE>mi2PrefixMap.put("=library-loaded", GdbLibraryLoadedEvent::new);<NEW_LINE>mi2PrefixMap.put("=library-unloaded", GdbLibraryUnloadedEvent::new);<NEW_LINE>mi2PrefixMap.put("=breakpoint-created", t -> new GdbBreakpointCreatedEvent(t, this));<NEW_LINE>mi2PrefixMap.put("=breakpoint-modified", GdbBreakpointModifiedEvent::new);<NEW_LINE>mi2PrefixMap.put("=breakpoint-deleted", GdbBreakpointDeletedEvent::new);<NEW_LINE>mi2PrefixMap.put("=memory-changed", GdbMemoryChangedEvent::new);<NEW_LINE>mi2PrefixMap.put("=cmd-param-changed", GdbParamChangedEvent::new);<NEW_LINE>} | put("=thread-group-started", GdbThreadGroupStartedEvent::new); |
1,234,669 | public void testAfterApplyEnum() {<NEW_LINE>createEnum_myEnum();<NEW_LINE>AddressFactory addrFactory = program.getAddressFactory();<NEW_LINE>Address addr1 = addrFactory.getAddress("004019ac");<NEW_LINE>Address addr2 = addrFactory.getAddress("004019c2");<NEW_LINE>selectRange(addr1, addr2);<NEW_LINE>performAction(applyEnum, <MASK><NEW_LINE>ApplyEnumDialog dialog = waitForDialogComponent(ApplyEnumDialog.class);<NEW_LINE>JTextField tf = findComponent(dialog, JTextField.class);<NEW_LINE>triggerText(tf, "myEnum");<NEW_LINE>triggerEnter(tf);<NEW_LINE>positionListingTop(0x004019aa);<NEW_LINE>long start = 0x004019aa;<NEW_LINE>long end = 0x004019c8;<NEW_LINE>captureListingRange(start, end, 630);<NEW_LINE>// remove sidebar from image<NEW_LINE>int h = image.getHeight(null);<NEW_LINE>int w = image.getWidth(null);<NEW_LINE>crop(new Rectangle(40, 0, w, h));<NEW_LINE>} | cb.getProvider(), false); |
1,228,251 | public void process(int row, float[] scores) {<NEW_LINE>int indexDisparity = imageDisparity.startIndex + row * imageDisparity.stride;<NEW_LINE>// Mark all pixels as invalid which can't be estimate due to disparityMin<NEW_LINE>for (int col = 0; col < disparityMin; col++) {<NEW_LINE>imageDisparity.data[indexDisparity++] = (byte) disparityRange;<NEW_LINE>}<NEW_LINE>// Select the best disparity from all the rest<NEW_LINE>for (int col = disparityMin; col < imageWidth; col++) {<NEW_LINE>int localRange = disparityMaxAtColumnL2R(col) - disparityMin + 1;<NEW_LINE>int indexScore = col - disparityMin;<NEW_LINE>int bestDisparity = 0;<NEW_LINE>float scoreBest = scores[indexScore];<NEW_LINE>indexScore += imageWidth;<NEW_LINE>for (int disparity = 1; disparity < localRange; disparity++, indexScore += imageWidth) {<NEW_LINE>float s = scores[indexScore];<NEW_LINE>if (s < scoreBest) {<NEW_LINE>scoreBest = s;<NEW_LINE>bestDisparity = disparity;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>imageDisparity.data[<MASK><NEW_LINE>}<NEW_LINE>} | indexDisparity++] = (byte) bestDisparity; |
1,133,159 | private TimestampPeriod createNewCache(long timestampInMillis, String formatted) {<NEW_LINE>// Examples of the supported formats:<NEW_LINE>//<NEW_LINE>// ISO_OFFSET_DATE_TIME 2020-01-01T10:20:30.123+01:00<NEW_LINE>// ISO_ZONED_DATE_TIME 2020-01-01T10:20:30.123+01:00[Europe/Brussels]<NEW_LINE>// ISO_LOCAL_DATE_TIME 2020-01-01T10:20:30.123<NEW_LINE>// ISO_DATE_TIME 2020-01-01T10:20:30.123+01:00[Europe/Brussels]<NEW_LINE>// ISO_INSTANT 2020-01-01T09:20:30.123Z<NEW_LINE>// +---------------+ +---------------------+<NEW_LINE>// prefix suffix<NEW_LINE>//<NEW_LINE>// Seconds start at position 17 and are two digits long.<NEW_LINE>// Millis are optional.<NEW_LINE>// The part up to the minutes (included)<NEW_LINE>String prefix = formatted.substring(0, 17);<NEW_LINE>// The part of after the millis (i.e. the timezone)<NEW_LINE>int pos = formatted.indexOf('+', 17);<NEW_LINE>if (pos == -1) {<NEW_LINE>pos = formatted.indexOf('-', 17);<NEW_LINE>}<NEW_LINE>if (pos == -1 && formatted.charAt(formatted.length() - 1) == 'Z') {<NEW_LINE>pos = formatted.length() - 1;<NEW_LINE>}<NEW_LINE>String suffix = pos == -1 ? <MASK><NEW_LINE>// Determine how long we can use this cache<NEW_LINE>long timstampInMinutes = timestampInMillis / MILLISECONDS_PER_MINUTE;<NEW_LINE>long minuteStartInMillis = timstampInMinutes * MILLISECONDS_PER_MINUTE;<NEW_LINE>long minuteStopInMillis = (timstampInMinutes + 1) * MILLISECONDS_PER_MINUTE;<NEW_LINE>// Store in cache<NEW_LINE>return new TimestampPeriod(minuteStartInMillis, minuteStopInMillis, prefix, suffix);<NEW_LINE>} | "" : formatted.substring(pos); |
150,703 | public RemotingCommand processRequest(Channel channel, RemotingCommand request) throws RemotingCommandException {<NEW_LINE>BizLogSendRequest requestBody = request.getBody();<NEW_LINE>List<BizLog> bizLogs = requestBody.getBizLogs();<NEW_LINE>if (CollectionUtils.isNotEmpty(bizLogs)) {<NEW_LINE>for (BizLog bizLog : bizLogs) {<NEW_LINE>JobLogPo jobLogPo = new JobLogPo();<NEW_LINE>jobLogPo.setGmtCreated(SystemClock.now());<NEW_LINE>jobLogPo.<MASK><NEW_LINE>jobLogPo.setTaskTrackerNodeGroup(bizLog.getTaskTrackerNodeGroup());<NEW_LINE>jobLogPo.setTaskTrackerIdentity(bizLog.getTaskTrackerIdentity());<NEW_LINE>jobLogPo.setJobId(bizLog.getJobId());<NEW_LINE>jobLogPo.setTaskId(bizLog.getTaskId());<NEW_LINE>jobLogPo.setRealTaskId(bizLog.getRealTaskId());<NEW_LINE>jobLogPo.setJobType(bizLog.getJobType());<NEW_LINE>jobLogPo.setMsg(bizLog.getMsg());<NEW_LINE>jobLogPo.setSuccess(true);<NEW_LINE>jobLogPo.setLevel(bizLog.getLevel());<NEW_LINE>jobLogPo.setLogType(LogType.BIZ);<NEW_LINE>appContext.getJobLogger().log(jobLogPo);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return RemotingCommand.createResponseCommand(JobProtos.ResponseCode.BIZ_LOG_SEND_SUCCESS.code(), "");<NEW_LINE>} | setLogTime(bizLog.getLogTime()); |
1,598,581 | public void postAuthentication(RoutingContext ctx) {<NEW_LINE><MASK><NEW_LINE>Session session = ctx.session();<NEW_LINE>if (session != null) {<NEW_LINE>String returnURL = session.remove(returnURLParam);<NEW_LINE>if (returnURL != null) {<NEW_LINE>// Now redirect back to the original url<NEW_LINE>ctx.redirect(returnURL);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Either no session or no return url<NEW_LINE>if (directLoggedInOKURL != null) {<NEW_LINE>// Redirect to the default logged in OK page - this would occur<NEW_LINE>// if the user logged in directly at this URL without being redirected here first from another<NEW_LINE>// url<NEW_LINE>ctx.redirect(directLoggedInOKURL);<NEW_LINE>} else {<NEW_LINE>// Just show a basic page<NEW_LINE>req.response().putHeader(HttpHeaders.CONTENT_TYPE, "text/html; charset=utf-8").end(DEFAULT_DIRECT_LOGGED_IN_OK_PAGE);<NEW_LINE>}<NEW_LINE>} | HttpServerRequest req = ctx.request(); |
756,778 | public StemmerOverrideItem write(final StemmerOverrideItem oldItem) {<NEW_LINE>try {<NEW_LINE>if ((item == null) || (item.getId() != oldItem.getId()) || !item.isUpdated()) {<NEW_LINE>writer.write(oldItem.toLineString());<NEW_LINE>writer.write(Constants.LINE_SEPARATOR);<NEW_LINE>return oldItem;<NEW_LINE>}<NEW_LINE>if (!item.equals(oldItem)) {<NEW_LINE>throw new DictionaryException("StemmerOverride file was updated: old=" + oldItem + " : new=" + item);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (!item.isDeleted()) {<NEW_LINE>// update<NEW_LINE>writer.write(item.toLineString());<NEW_LINE>writer.write(Constants.LINE_SEPARATOR);<NEW_LINE>return new StemmerOverrideItem(item.getId(), item.getNewInput(), item.getNewOutput());<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} finally {<NEW_LINE>item.setNewInput(null);<NEW_LINE>item.setNewOutput(null);<NEW_LINE>}<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new DictionaryException("Failed to write: " + <MASK><NEW_LINE>}<NEW_LINE>} | oldItem + " -> " + item, e); |
1,040,013 | private void renderQuadsForGroups(String[] groups, IOBJModelCallback<ItemStack> callback, IESmartObjModel model, ItemStack stack, ShaderCase sCase, PoseStack matrix, MultiBufferSource buffer, Set<String> visible, int light, int overlay) {<NEW_LINE>List<ShadedQuads> quadsByLayer = new ArrayList<>();<NEW_LINE>for (String g : groups) {<NEW_LINE>if (visible.contains(g) && callback.shouldRenderGroup(stack, g))<NEW_LINE>quadsByLayer.addAll(model.addQuadsForGroup(callback, stack, g, sCase, true).stream().filter(Objects::nonNull).collect(Collectors.toList()));<NEW_LINE>visible.remove(g);<NEW_LINE>}<NEW_LINE>matrix.pushPose();<NEW_LINE>for (ShadedQuads quadsForLayer : quadsByLayer) {<NEW_LINE>boolean bright = callback.areGroupsFullbright(stack, groups);<NEW_LINE>RenderType baseType;<NEW_LINE>ResourceLocation atlas = InventoryMenu.BLOCK_ATLAS;<NEW_LINE>if (bright)<NEW_LINE>baseType = IERenderTypes.getFullbrightTranslucent(atlas);<NEW_LINE>else if (quadsForLayer.layer.isTranslucent())<NEW_LINE>baseType = RenderType.entityTranslucent(atlas);<NEW_LINE>else<NEW_LINE><MASK><NEW_LINE>RenderType actualType = quadsForLayer.layer.getRenderType(baseType);<NEW_LINE>VertexConsumer builder = IERenderTypes.disableCull(buffer).getBuffer(actualType);<NEW_LINE>Vector4f color = quadsForLayer.layer.getColor();<NEW_LINE>for (BakedQuad quad : quadsForLayer.quadsInLayer) builder.addVertexData(matrix.last(), quad, color.x(), color.y(), color.z(), color.w(), light, overlay);<NEW_LINE>matrix.scale(1.01F, 1.01F, 1.01F);<NEW_LINE>}<NEW_LINE>matrix.popPose();<NEW_LINE>} | baseType = RenderType.entityCutout(atlas); |
1,788,660 | public void moveViewportAndContent(final double yDelta) {<NEW_LINE>if (yDelta == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>double newTop = tBodyScrollTop + yDelta;<NEW_LINE>verticalScrollbar.setScrollPos(newTop);<NEW_LINE>final double defaultRowHeight = getDefaultRowHeight();<NEW_LINE>double rowPxDelta = yDelta - (yDelta % defaultRowHeight);<NEW_LINE>int rowIndexDelta = (int) (yDelta / defaultRowHeight);<NEW_LINE>if (!WidgetUtil.pixelValuesEqual(rowPxDelta, 0)) {<NEW_LINE>Collection<SpacerContainer.SpacerImpl> spacers = spacerContainer.getSpacersAfterPx(tBodyScrollTop, SpacerInclusionStrategy.PARTIAL);<NEW_LINE>for (SpacerContainer.SpacerImpl spacer : spacers) {<NEW_LINE>spacer.setPositionDiff(0, rowPxDelta);<NEW_LINE>spacer.setRowIndex(spacer.getRow() + rowIndexDelta);<NEW_LINE>}<NEW_LINE>for (TableRowElement tr : visualRowOrder) {<NEW_LINE>setRowPosition(tr, 0<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>setBodyScrollPosition(tBodyScrollLeft, newTop);<NEW_LINE>} | , getRowTop(tr) + rowPxDelta); |
675,952 | public RegisterDeviceResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>RegisterDeviceResult registerDeviceResult = new RegisterDeviceResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return registerDeviceResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("DeviceId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>registerDeviceResult.setDeviceId(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return registerDeviceResult;<NEW_LINE>} | class).unmarshall(context)); |
1,162,198 | private void buildAccountList() {<NEW_LINE>int i = 0;<NEW_LINE>int accountProviders = 0;<NEW_LINE>mGoogleAccounts = AccountManager.get(this).getAccountsByType(GTalkOAuth2.TYPE_GOOGLE_ACCT);<NEW_LINE>if (mGoogleAccounts.length > 0) {<NEW_LINE>// potentialProviders + google + create account + burner<NEW_LINE>accountProviders = 5;<NEW_LINE>mAccountList = new String[accountProviders][3];<NEW_LINE>mAccountList[i][0] = getString(R.string.i_want_to_chat_using_my_google_account);<NEW_LINE>mAccountList[i][1] = getString(R.string.account_google_full);<NEW_LINE>mAccountList[i][2] = GOOGLE_ACCOUNT;<NEW_LINE>i++;<NEW_LINE>} else {<NEW_LINE>// listProviders.size() + 2; //potentialProviders + create account + burner<NEW_LINE>accountProviders = 4;<NEW_LINE>mAccountList = new String[accountProviders][3];<NEW_LINE>}<NEW_LINE>mAccountList[i][0] = getString(R.string.i_have_an_existing_xmpp_account);<NEW_LINE>mAccountList[i][1] = getString(R.string.account_existing_full);<NEW_LINE>mAccountList[i][2] = EXISTING_ACCOUNT;<NEW_LINE>i++;<NEW_LINE>mAccountList[i][0] = getString(R.string.i_need_a_new_account);<NEW_LINE>mAccountList[i][1] = getString(R.string.account_new_full);<NEW_LINE>mAccountList[i][2] = NEW_ACCOUNT;<NEW_LINE>i++;<NEW_LINE>mAccountList[i][0] = getString(R.string.i_want_to_chat_on_my_local_wifi_network_bonjour_zeroconf_);<NEW_LINE>mAccountList[i][1] = getString(R.string.account_wifi_full);<NEW_LINE>mAccountList<MASK><NEW_LINE>i++;<NEW_LINE>mAccountList[i][0] = getString(R.string.i_need_a_burner_one_time_throwaway_account_);<NEW_LINE>mAccountList[i][1] = getString(R.string.account_burner_full);<NEW_LINE>mAccountList[i][2] = BURNER_ACCOUNT;<NEW_LINE>i++;<NEW_LINE>} | [i][2] = BONJOUR_ACCOUNT; |
1,221,017 | public void init() {<NEW_LINE>int threads = Math.max(1, apocConfig.getInt(ApocConfig.APOC_CONFIG_JOBS_POOL_NUM_THREADS, DEFAULT_POOL_THREADS));<NEW_LINE>int queueSize = Math.max(1, apocConfig.getInt(ApocConfig.APOC_CONFIG_JOBS_QUEUE_SIZE, threads * 5));<NEW_LINE>// ensure we use daemon threads everywhere<NEW_LINE>ThreadFactory threadFactory = r -> {<NEW_LINE>Thread t = Executors.defaultThreadFactory().newThread(r);<NEW_LINE>t.setDaemon(true);<NEW_LINE>return t;<NEW_LINE>};<NEW_LINE>this.singleExecutorService = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(queueSize), threadFactory, new CallerBlocksPolicy());<NEW_LINE>this.defaultExecutorService = new ThreadPoolExecutor(threads / 2, threads, 30L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(queueSize), threadFactory, new CallerBlocksPolicy());<NEW_LINE>this.scheduledExecutorService = Executors.newScheduledThreadPool(Math.max(1, apocConfig.getInt(ApocConfig.APOC_CONFIG_JOBS_SCHEDULED_NUM_THREADS, DEFAULT_SCHEDULED_THREADS)), threadFactory);<NEW_LINE>scheduledExecutorService.scheduleAtFixedRate(() -> {<NEW_LINE>for (Iterator<Map.Entry<Periodic.JobInfo, Future>> it = jobList.entrySet().iterator(); it.hasNext(); ) {<NEW_LINE>Map.Entry<Periodic.JobInfo, Future> entry = it.next();<NEW_LINE>if (entry.getValue().isDone() || entry.getValue().isCancelled())<NEW_LINE>it.remove();<NEW_LINE>}<NEW_LINE>}, <MASK><NEW_LINE>} | 10, 10, TimeUnit.SECONDS); |
307,131 | public void preferenceChange(PreferenceChangeEvent evt) {<NEW_LINE>String settingName = evt == null ? null : evt.getKey();<NEW_LINE>if (settingName == null || COMPLETION_CASE_SENSITIVE.equals(settingName)) {<NEW_LINE>caseSensitive = preferences.getBoolean(COMPLETION_CASE_SENSITIVE, COMPLETION_CASE_SENSITIVE_DEFAULT);<NEW_LINE>}<NEW_LINE>if (settingName == null || SHOW_DEPRECATED_MEMBERS.equals(settingName)) {<NEW_LINE>showDeprecatedMembers = preferences.getBoolean(SHOW_DEPRECATED_MEMBERS, SHOW_DEPRECATED_MEMBERS_DEFAULT);<NEW_LINE>}<NEW_LINE>if (settingName == null || JAVA_COMPLETION_BLACKLIST.equals(settingName)) {<NEW_LINE>String blacklist = preferences.get(JAVA_COMPLETION_BLACKLIST, EMPTY);<NEW_LINE>updateExcluder(excludeRef, blacklist);<NEW_LINE>}<NEW_LINE>if (settingName == null || JAVA_COMPLETION_WHITELIST.equals(settingName)) {<NEW_LINE>String whitelist = preferences.get(JAVA_COMPLETION_WHITELIST, EMPTY);<NEW_LINE>updateExcluder(includeRef, whitelist);<NEW_LINE>}<NEW_LINE>if (settingName == null || JAVA_COMPLETION_EXCLUDER_METHODS.equals(settingName)) {<NEW_LINE>javaCompletionExcluderMethods = <MASK><NEW_LINE>}<NEW_LINE>if (settingName == null || JAVA_COMPLETION_SUBWORDS.equals(settingName)) {<NEW_LINE>javaCompletionSubwords = preferences.getBoolean(JAVA_COMPLETION_SUBWORDS, JAVA_COMPLETION_SUBWORDS_DEFAULT);<NEW_LINE>}<NEW_LINE>} | preferences.getBoolean(JAVA_COMPLETION_EXCLUDER_METHODS, JAVA_COMPLETION_EXCLUDER_METHODS_DEFAULT); |
1,217,538 | private PCode readCode() {<NEW_LINE>String fileName = readString().intern();<NEW_LINE>int flags = readInt();<NEW_LINE>int codeLen = readSize();<NEW_LINE>byte[] codeString = new byte[codeLen + Long.BYTES];<NEW_LINE>try {<NEW_LINE>in.read(codeString, 0, codeLen);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw CompilerDirectives.shouldNotReachHere();<NEW_LINE>}<NEW_LINE>// get a new ID every time we deserialize the same filename in the same context. We use<NEW_LINE>// slow-path context lookup, since this code is likely dominated by the deserialization<NEW_LINE>// time<NEW_LINE>PythonContext <MASK><NEW_LINE>ByteBuffer.wrap(codeString).putLong(codeLen, context.getDeserializationId(fileName));<NEW_LINE>int firstLineNo = readInt();<NEW_LINE>byte[] lnoTab = readBytes();<NEW_LINE>return CreateCodeNode.createCode(context, flags, codeString, fileName, firstLineNo, lnoTab);<NEW_LINE>} | context = PythonContext.get(null); |
595,464 | private void computeCellInfos(XWPFTableRow row) {<NEW_LINE>if (nbColumns == null) {<NEW_LINE>nbColumns = XWPFTableUtil.computeColWidths(row.getTable()).length;<NEW_LINE>}<NEW_LINE>int rowIndex = table.getRows().indexOf(row);<NEW_LINE>boolean firstRow = rowIndex == 0;<NEW_LINE>boolean lastRow = rowIndex == (table.getRows().size() - 1);<NEW_LINE>boolean firstCol = true;<NEW_LINE>boolean lastCol = false;<NEW_LINE>int cellIndex = -1;<NEW_LINE>CTRow ctRow = row.getCtRow();<NEW_LINE>XmlCursor c = ctRow.newCursor();<NEW_LINE>c.selectPath("./*");<NEW_LINE>while (c.toNextSelection()) {<NEW_LINE>XmlObject o = c.getObject();<NEW_LINE>if (o instanceof CTTc) {<NEW_LINE>CTTc tc = (CTTc) o;<NEW_LINE>XWPFTableCell cell = row.getTableCell(tc);<NEW_LINE>cellIndex = getCellIndex(cellIndex, cell);<NEW_LINE>lastCol = (cellIndex == nbColumns - 1);<NEW_LINE>addCellInfo(cell, <MASK><NEW_LINE>firstCol = false;<NEW_LINE>} else if (o instanceof CTSdtCell) {<NEW_LINE>// Fix bug of POI<NEW_LINE>CTSdtCell sdtCell = (CTSdtCell) o;<NEW_LINE>List<CTTc> tcList = sdtCell.getSdtContent().getTcList();<NEW_LINE>for (CTTc ctTc : tcList) {<NEW_LINE>XWPFTableCell cell = new XWPFTableCell(ctTc, row, row.getTable().getBody());<NEW_LINE>cellIndex = getCellIndex(cellIndex, cell);<NEW_LINE>lastCol = (cellIndex == nbColumns - 1);<NEW_LINE>addCellInfo(row.getTableCell(ctTc), firstRow, lastRow, firstCol, lastCol);<NEW_LINE>firstCol = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>c.dispose();<NEW_LINE>} | firstRow, lastRow, firstCol, lastCol); |
1,380,925 | protected Event mapEventRow(Row row) {<NEW_LINE>Event e = new Event();<NEW_LINE>e.setAction(row.getString(AUDIT_ATT_ACTION));<NEW_LINE>e.setDuration(row.getInt(AUDIT_ATT_DURATION));<NEW_LINE>e.setHostName(row.getString(AUDIT_ATT_HOSTNAME));<NEW_LINE>e.setName(row.getString(AUDIT_ATT_NAME));<NEW_LINE>e.setSource(row.getString(AUDIT_ATT_SOURCE));<NEW_LINE>e.setTimestamp(row.getInstant<MASK><NEW_LINE>e.setType(row.getString(AUDIT_ATT_TYPE));<NEW_LINE>e.setUser(row.getString(AUDIT_ATT_USER));<NEW_LINE>e.setValue(row.getString(AUDIT_ATT_VALUE));<NEW_LINE>e.setUuid(row.getUuid(AUDIT_ATT_UID).toString());<NEW_LINE>e.setCustomKeys(row.getMap(AUDIT_ATT_CUSTOM, String.class, String.class));<NEW_LINE>return e;<NEW_LINE>} | (AUDIT_ATT_TIME).getEpochSecond()); |
1,616,592 | protected OVFPropertyTO createOVFPropertyFromNode(Node node, int index, String category) {<NEW_LINE>Element element = (Element) node;<NEW_LINE>String key = ovfParser.getNodeAttribute(element, "key");<NEW_LINE>if (StringUtils.isBlank(key)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String value = ovfParser.getNodeAttribute(element, "value");<NEW_LINE>String type = ovfParser.getNodeAttribute(element, "type");<NEW_LINE>String qualifiers = ovfParser.getNodeAttribute(element, "qualifiers");<NEW_LINE>String userConfigurableStr = ovfParser.getNodeAttribute(element, "userConfigurable");<NEW_LINE>boolean userConfigurable = StringUtils.isNotBlank(userConfigurableStr) && userConfigurableStr.equalsIgnoreCase("true");<NEW_LINE>String passStr = ovfParser.getNodeAttribute(element, "password");<NEW_LINE>boolean password = StringUtils.isNotBlank(passStr) && passStr.equalsIgnoreCase("true");<NEW_LINE>String label = ovfParser.getChildNodeValue(node, "Label");<NEW_LINE>String description = <MASK><NEW_LINE>s_logger.debug("Creating OVF property index " + index + (category == null ? "" : " for category " + category) + " with key = " + key);<NEW_LINE>return new OVFPropertyTO(key, type, value, qualifiers, userConfigurable, label, description, password, index, category);<NEW_LINE>} | ovfParser.getChildNodeValue(node, "Description"); |
1,710,658 | public void delete(final String path, final int version, final VoidCallback cb, final Object context) {<NEW_LINE>final Runnable proc = new ZkRetryRunnable(operationRetryPolicy, rateLimiter, deleteStats) {<NEW_LINE><NEW_LINE>final VoidCallback deleteCb = new VoidCallback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void processResult(int rc, String path, Object ctx) {<NEW_LINE>ZooWorker worker = (ZooWorker) ctx;<NEW_LINE>if (allowRetry(worker, rc)) {<NEW_LINE>backOffAndRetry(<MASK><NEW_LINE>} else {<NEW_LINE>cb.processResult(rc, path, context);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE><NEW_LINE>@Override<NEW_LINE>void zkRun() {<NEW_LINE>ZooKeeper zkHandle = zk.get();<NEW_LINE>if (null == zkHandle) {<NEW_LINE>PulsarZooKeeperClient.super.delete(path, version, deleteCb, worker);<NEW_LINE>} else {<NEW_LINE>zkHandle.delete(path, version, deleteCb, worker);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String toString() {<NEW_LINE>return String.format("delete (%s, version = %d)", path, version);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// execute it immediately<NEW_LINE>proc.run();<NEW_LINE>} | that, worker.nextRetryWaitTime()); |
703,039 | private // issue#9386<NEW_LINE>boolean findAndSetServletInfo(IFilterMapping fmInfo) {<NEW_LINE>if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {<NEW_LINE>logger.logp(Level.FINE, CLASS_NAME, "findAndSetServletInfo", "filter mapping -> " + fmInfo);<NEW_LINE>}<NEW_LINE>String servletName = ((IFilterMappingExtended) fmInfo).getServletFilterMappingName();<NEW_LINE>if (servletName != null) {<NEW_LINE>if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {<NEW_LINE>logger.logp(Level.FINE, CLASS_NAME, "findAndSetServletInfo", "found saved servlet name -> " + servletName);<NEW_LINE>}<NEW_LINE>IServletConfig sConfig = this.webAppConfig.getServletInfo(servletName);<NEW_LINE>if (sConfig != null) {<NEW_LINE>((IFilterMappingExtended) fmInfo).setServletConfig(sConfig);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.logp(Level.WARNING, CLASS_NAME, "findAndSetServletInfo", "no.servlet.defined.for.servlet.filter.name.mapping", new Object[] { servletName, fmInfo.getFilterConfig<MASK><NEW_LINE>return false;<NEW_LINE>} | ().getFilterName() }); |
225,045 | protected Void visitQuery(Query node, Integer indent) {<NEW_LINE>node.getWith().ifPresent(with -> {<NEW_LINE>append(indent, "WITH");<NEW_LINE>if (with.isRecursive()) {<NEW_LINE>builder.append(" RECURSIVE");<NEW_LINE>}<NEW_LINE>builder.append("\n ");<NEW_LINE>Iterator<WithQuery> queries = with.getQueries().iterator();<NEW_LINE>while (queries.hasNext()) {<NEW_LINE>WithQuery query = queries.next();<NEW_LINE>append(indent, formatExpression<MASK><NEW_LINE>query.getColumnNames().ifPresent(columnNames -> appendAliasColumns(builder, columnNames));<NEW_LINE>builder.append(" AS ");<NEW_LINE>process(new TableSubquery(query.getQuery()), indent);<NEW_LINE>builder.append('\n');<NEW_LINE>if (queries.hasNext()) {<NEW_LINE>builder.append(", ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>processRelation(node.getQueryBody(), indent);<NEW_LINE>node.getOrderBy().ifPresent(orderBy -> process(orderBy, indent));<NEW_LINE>node.getOffset().ifPresent(offset -> process(offset, indent));<NEW_LINE>node.getLimit().ifPresent(limit -> process(limit, indent));<NEW_LINE>return null;<NEW_LINE>} | (query.getName())); |
1,277,836 | protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {<NEW_LINE>stateLayout.setEmptyText(R.string.no_search_results);<NEW_LINE>getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());<NEW_LINE>stateLayout.setOnReloadListener(this);<NEW_LINE>refresh.setOnRefreshListener(this);<NEW_LINE>recycler.setEmptyView(stateLayout, refresh);<NEW_LINE>adapter = new IssuesAdapter(getPresenter().getIssues(), false, true, true);<NEW_LINE><MASK><NEW_LINE>recycler.setAdapter(adapter);<NEW_LINE>recycler.addDivider();<NEW_LINE>if (!InputHelper.isEmpty(searchQuery) && getPresenter().getIssues().isEmpty() && !getPresenter().isApiCalled()) {<NEW_LINE>onRefresh();<NEW_LINE>}<NEW_LINE>if (InputHelper.isEmpty(searchQuery)) {<NEW_LINE>stateLayout.showEmptyState();<NEW_LINE>}<NEW_LINE>fastScroller.attachRecyclerView(recycler);<NEW_LINE>} | adapter.setListener(getPresenter()); |
1,556,810 | private void init(String pluginsDirectories, String pluginsInclude) {<NEW_LINE>if (StringUtils.isEmpty(pluginsDirectories)) {<NEW_LINE>LOGGER.info("Env variable '{}' is not specified. Set this env variable to load additional plugins.", PLUGINS_DIR_PROPERTY_NAME);<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>HashMap<String, File> plugins = getPluginsToLoad(pluginsDirectories, pluginsInclude);<NEW_LINE>LOGGER.info(<MASK><NEW_LINE>for (Map.Entry<String, File> entry : plugins.entrySet()) {<NEW_LINE>String pluginName = entry.getKey();<NEW_LINE>File pluginDir = entry.getValue();<NEW_LINE>try {<NEW_LINE>load(pluginName, pluginDir);<NEW_LINE>LOGGER.info("Successfully Loaded plugin [{}] from dir [{}]", pluginName, pluginDir);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Failed to load plugin [{}] from dir [{}]", pluginName, pluginDir, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>initRecordReaderClassMap();<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>LOGGER.warn(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "#getPluginsToLoad has produced {} plugins to load", plugins.size()); |
877,307 | final GetVpnConnectionDeviceTypesResult executeGetVpnConnectionDeviceTypes(GetVpnConnectionDeviceTypesRequest getVpnConnectionDeviceTypesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getVpnConnectionDeviceTypesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetVpnConnectionDeviceTypesRequest> request = null;<NEW_LINE>Response<GetVpnConnectionDeviceTypesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetVpnConnectionDeviceTypesRequestMarshaller().marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetVpnConnectionDeviceTypes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetVpnConnectionDeviceTypesResult> responseHandler = new StaxResponseHandler<GetVpnConnectionDeviceTypesResult>(new GetVpnConnectionDeviceTypesResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(getVpnConnectionDeviceTypesRequest)); |
244,669 | public void configure(TestElement element) {<NEW_LINE>super.configure(element);<NEW_LINE>servername.setText(element.getPropertyAsString(LDAPSampler.SERVERNAME));<NEW_LINE>port.setText(element.getPropertyAsString(LDAPSampler.PORT));<NEW_LINE>rootdn.setText(element.getPropertyAsString(LDAPSampler.ROOTDN));<NEW_LINE>CardLayout cl = (CardLayout) cards.getLayout();<NEW_LINE>final String testType = element.getPropertyAsString(LDAPSampler.TEST);<NEW_LINE>if (testType.equals(LDAPSampler.ADD)) {<NEW_LINE>addTest.setSelected(true);<NEW_LINE>add.setText(element.getPropertyAsString(LDAPSampler.BASE_ENTRY_DN));<NEW_LINE>tableAddPanel.configure((TestElement) element.getProperty(LDAPSampler.ARGUMENTS).getObjectValue());<NEW_LINE>cl.show(cards, "Add");<NEW_LINE>} else if (testType.equals(LDAPSampler.MODIFY)) {<NEW_LINE>modifyTest.setSelected(true);<NEW_LINE>modify.setText(element.getPropertyAsString(LDAPSampler.BASE_ENTRY_DN));<NEW_LINE>tableModifyPanel.configure((TestElement) element.getProperty(LDAPSampler.ARGUMENTS).getObjectValue());<NEW_LINE><MASK><NEW_LINE>} else if (testType.equals(LDAPSampler.DELETE)) {<NEW_LINE>deleteTest.setSelected(true);<NEW_LINE>delete.setText(element.getPropertyAsString(LDAPSampler.DELETE));<NEW_LINE>cl.show(cards, "Delete");<NEW_LINE>} else if (testType.equals(LDAPSampler.SEARCHBASE)) {<NEW_LINE>searchTest.setSelected(true);<NEW_LINE>searchbase.setText(element.getPropertyAsString(LDAPSampler.SEARCHBASE));<NEW_LINE>searchfilter.setText(element.getPropertyAsString(LDAPSampler.SEARCHFILTER));<NEW_LINE>cl.show(cards, "Search");<NEW_LINE>}<NEW_LINE>if (element.getPropertyAsBoolean(LDAPSampler.USER_DEFINED)) {<NEW_LINE>userDefined.setSelected(true);<NEW_LINE>} else {<NEW_LINE>userDefined.setSelected(false);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>cl.show(cards, "");<NEW_LINE>}<NEW_LINE>} | cl.show(cards, "Modify"); |
1,479,817 | protected String processTextRegex(Repository repository, String repositoryName, String text) {<NEW_LINE>Map<String, String> map = new <MASK><NEW_LINE>// global regex keys<NEW_LINE>if (settings.getBoolean(Keys.regex.global, false)) {<NEW_LINE>for (String key : settings.getAllKeys(Keys.regex.global)) {<NEW_LINE>if (!key.equals(Keys.regex.global)) {<NEW_LINE>String subKey = key.substring(key.lastIndexOf('.') + 1);<NEW_LINE>map.put(subKey, settings.getString(key, ""));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// repository-specific regex keys<NEW_LINE>List<String> keys = settings.getAllKeys(Keys.regex._ROOT + "." + repositoryName.toLowerCase());<NEW_LINE>for (String key : keys) {<NEW_LINE>String subKey = key.substring(key.lastIndexOf('.') + 1);<NEW_LINE>map.put(subKey, settings.getString(key, ""));<NEW_LINE>}<NEW_LINE>for (Entry<String, String> entry : map.entrySet()) {<NEW_LINE>String definition = entry.getValue().trim();<NEW_LINE>String[] chunks = definition.split("!!!");<NEW_LINE>if (chunks.length == 2) {<NEW_LINE>text = text.replaceAll(chunks[0], chunks[1]);<NEW_LINE>} else {<NEW_LINE>logger.warn(entry.getKey() + " improperly formatted. Use !!! to separate match from replacement: " + definition);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// parse bugtraq repo config<NEW_LINE>BugtraqConfig config = BugtraqConfig.read(repository);<NEW_LINE>if (config != null) {<NEW_LINE>BugtraqFormatter formatter = new BugtraqFormatter(config);<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>formatter.formatLogMessage(text, new BugtraqOutputHandler(sb));<NEW_LINE>text = sb.toString();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.error(MessageFormat.format("Bugtraq config for {0} is invalid!", repositoryName), e);<NEW_LINE>} catch (ConfigInvalidException e) {<NEW_LINE>logger.error(MessageFormat.format("Bugtraq config for {0} is invalid!", repositoryName), e);<NEW_LINE>}<NEW_LINE>return text;<NEW_LINE>} | HashMap<String, String>(); |
1,466,169 | public synchronized void dropTable(HdfsContext context, String databaseName, String tableName) {<NEW_LINE>setShared();<NEW_LINE>// Dropping table with partition actions requires cleaning up staging data, which is not implemented yet.<NEW_LINE>checkNoPartitionAction(databaseName, tableName);<NEW_LINE>SchemaTableName schemaTableName = new SchemaTableName(databaseName, tableName);<NEW_LINE>Action<TableAndMore> <MASK><NEW_LINE>if (oldTableAction == null || oldTableAction.getType() == ActionType.ALTER) {<NEW_LINE>tableActions.put(schemaTableName, new Action<>(ActionType.DROP, null, context));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>switch(oldTableAction.getType()) {<NEW_LINE>case DROP:<NEW_LINE>throw new TableNotFoundException(schemaTableName);<NEW_LINE>case ADD:<NEW_LINE>case ALTER:<NEW_LINE>case INSERT_EXISTING:<NEW_LINE>throw new UnsupportedOperationException("dropping a table added/modified in the same transaction is not supported");<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("Unknown action type");<NEW_LINE>}<NEW_LINE>} | oldTableAction = tableActions.get(schemaTableName); |
374,494 | private void buildOverlays() {<NEW_LINE>db.runTransaction("build overlays", () -> {<NEW_LINE>Set<String> userIds = getAllUserIds();<NEW_LINE>RemoteDocumentCache remoteDocumentCache = db.getRemoteDocumentCache();<NEW_LINE>for (String uid : userIds) {<NEW_LINE>User user = new User(uid);<NEW_LINE>MutationQueue mutationQueue = db.getMutationQueue(user, db.getIndexManager(user));<NEW_LINE>// Get all document keys that have local mutations<NEW_LINE>Set<DocumentKey> <MASK><NEW_LINE>List<MutationBatch> batches = mutationQueue.getAllMutationBatches();<NEW_LINE>for (MutationBatch batch : batches) {<NEW_LINE>allDocumentKeys.addAll(batch.getKeys());<NEW_LINE>}<NEW_LINE>// Recalculate and save overlays<NEW_LINE>DocumentOverlayCache documentOverlayCache = db.getDocumentOverlayCache(user);<NEW_LINE>LocalDocumentsView localView = new LocalDocumentsView(remoteDocumentCache, mutationQueue, documentOverlayCache, db.getIndexManager(user));<NEW_LINE>localView.recalculateAndSaveOverlays(allDocumentKeys);<NEW_LINE>}<NEW_LINE>removePendingOverlayMigrations();<NEW_LINE>});<NEW_LINE>} | allDocumentKeys = new HashSet<>(); |
1,665,842 | final DeleteUsagePlanResult executeDeleteUsagePlan(DeleteUsagePlanRequest deleteUsagePlanRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteUsagePlanRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteUsagePlanRequest> request = null;<NEW_LINE>Response<DeleteUsagePlanResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteUsagePlanRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteUsagePlanRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "API Gateway");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteUsagePlan");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteUsagePlanResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteUsagePlanResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,535,642 | private <T> T singleHeader(String name, Function<String, T> converter, boolean convertNull) {<NEW_LINE>final List<String> values = this.headers.get(name);<NEW_LINE>if (values == null || values.isEmpty()) {<NEW_LINE>return convertNull ? converter.apply(null) : null;<NEW_LINE>}<NEW_LINE>if (values.size() > 1) {<NEW_LINE>throw new HeaderValueException(LocalizationMessages.TOO_MANY_HEADER_VALUES(name, values.toString()), HeaderValueException.Context.INBOUND);<NEW_LINE>}<NEW_LINE>Object value = values.get(0);<NEW_LINE>if (value == null) {<NEW_LINE>return convertNull ? converter.apply(null) : null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return converter.apply(HeaderUtils.asString(value, configuration));<NEW_LINE>} catch (ProcessingException ex) {<NEW_LINE>throw <MASK><NEW_LINE>}<NEW_LINE>} | exception(name, value, ex); |
1,530,534 | public void actionPerformed(ActionEvent e) {<NEW_LINE>// Create a file chooser<NEW_LINE>final JFileChooser fc = new JFileChooser();<NEW_LINE>if (doc.getFile() != null) {<NEW_LINE>fc.setCurrentDirectory(doc.getFile().getParentFile());<NEW_LINE>}<NEW_LINE>fc.setFileFilter(new FileNameExtensionFilter("Openrocket file", "ork"));<NEW_LINE>fc.setAcceptAllFileFilterUsed(false);<NEW_LINE>int returnVal = fc.showOpenDialog(CustomExpressionPanel.this);<NEW_LINE>if (returnVal == JFileChooser.APPROVE_OPTION) {<NEW_LINE><MASK><NEW_LINE>log.info("User selected a file to import expressions from " + fc.getSelectedFile().toString());<NEW_LINE>// TODO: This should probably be somewhere else and ideally we would use an alternative minimal rocket loader. Still, it doesn't seem particularly slow this way.<NEW_LINE>// Load expressions from selected document<NEW_LINE>GeneralRocketLoader loader = new GeneralRocketLoader(importFile);<NEW_LINE>try {<NEW_LINE>OpenRocketDocument importedDocument = loader.load();<NEW_LINE>for (CustomExpression exp : importedDocument.getCustomExpressions()) {<NEW_LINE>doc.addCustomExpression(exp);<NEW_LINE>}<NEW_LINE>} catch (RocketLoadException e1) {<NEW_LINE>log.info(Markers.USER_MARKER, "Error opening document to import expressions from.");<NEW_LINE>}<NEW_LINE>updateExpressions();<NEW_LINE>}<NEW_LINE>} | File importFile = fc.getSelectedFile(); |
22,270 | public com.atlassian.jira.rpc.soap.beans.RemoteProjectRole createProjectRole(java.lang.String in0, com.atlassian.jira.rpc.soap.beans.RemoteProjectRole in1) throws java.rmi.RemoteException, com.atlassian.jira.rpc.exception.RemoteException {<NEW_LINE>if (super.cachedEndpoint == null) {<NEW_LINE>throw new org.apache.axis.NoEndPointException();<NEW_LINE>}<NEW_LINE>org.apache.axis.client.Call _call = createCall();<NEW_LINE>_call<MASK><NEW_LINE>_call.setUseSOAPAction(true);<NEW_LINE>_call.setSOAPActionURI("");<NEW_LINE>_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);<NEW_LINE>_call.setOperationName(new javax.xml.namespace.QName("http://soap.rpc.jira.atlassian.com", "createProjectRole"));<NEW_LINE>setRequestHeaders(_call);<NEW_LINE>setAttachments(_call);<NEW_LINE>try {<NEW_LINE>java.lang.Object _resp = _call.invoke(new java.lang.Object[] { in0, in1 });<NEW_LINE>if (_resp instanceof java.rmi.RemoteException) {<NEW_LINE>throw (java.rmi.RemoteException) _resp;<NEW_LINE>} else {<NEW_LINE>extractAttachments(_call);<NEW_LINE>try {<NEW_LINE>return (com.atlassian.jira.rpc.soap.beans.RemoteProjectRole) _resp;<NEW_LINE>} catch (java.lang.Exception _exception) {<NEW_LINE>return (com.atlassian.jira.rpc.soap.beans.RemoteProjectRole) org.apache.axis.utils.JavaUtils.convert(_resp, com.atlassian.jira.rpc.soap.beans.RemoteProjectRole.class);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (org.apache.axis.AxisFault axisFaultException) {<NEW_LINE>if (axisFaultException.detail != null) {<NEW_LINE>if (axisFaultException.detail instanceof java.rmi.RemoteException) {<NEW_LINE>throw (java.rmi.RemoteException) axisFaultException.detail;<NEW_LINE>}<NEW_LINE>if (axisFaultException.detail instanceof com.atlassian.jira.rpc.exception.RemoteException) {<NEW_LINE>throw (com.atlassian.jira.rpc.exception.RemoteException) axisFaultException.detail;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw axisFaultException;<NEW_LINE>}<NEW_LINE>} | .setOperation(_operations[28]); |
1,395,620 | public ExportEC2InstanceRecommendationsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ExportEC2InstanceRecommendationsResult exportEC2InstanceRecommendationsResult = new ExportEC2InstanceRecommendationsResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return exportEC2InstanceRecommendationsResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("jobId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>exportEC2InstanceRecommendationsResult.setJobId(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("s3Destination", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>exportEC2InstanceRecommendationsResult.setS3Destination(S3DestinationJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return exportEC2InstanceRecommendationsResult;<NEW_LINE>} | class).unmarshall(context)); |
857,048 | public void importEbicsUsers(ActionRequest request, ActionResponse response) {<NEW_LINE>String config = "/data-import/import-ebics-user-config.xml";<NEW_LINE>try {<NEW_LINE>InputStream inputStream = this.getClass().getResourceAsStream(config);<NEW_LINE>File configFile = File.createTempFile("config", ".xml");<NEW_LINE>FileOutputStream fout = new FileOutputStream(configFile);<NEW_LINE>IOUtil.copyCompletely(inputStream, fout);<NEW_LINE>Path path = MetaFiles.getPath((String) ((Map) request.getContext().get("dataFile")).get("filePath"));<NEW_LINE>File tempDir = Files.createTempDir();<NEW_LINE>File importFile = new File(tempDir, "ebics-user.xml");<NEW_LINE>Files.copy(path.toFile(), importFile);<NEW_LINE>XMLImporter importer = new XMLImporter(configFile.getAbsolutePath(), tempDir.getAbsolutePath());<NEW_LINE>ImporterListener listner = new ImporterListener("EbicsUser");<NEW_LINE>importer.addListener(listner);<NEW_LINE>importer.run();<NEW_LINE>FileUtils.forceDelete(configFile);<NEW_LINE>FileUtils.forceDelete(tempDir);<NEW_LINE>response.setValue(<MASK><NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | "importLog", listner.getImportLog()); |
408,592 | public void addAttributeDescriptions(ST st, StringTree node, Set<String> names) {<NEW_LINE>Map<String, Object<MASK><NEW_LINE>if (attrs == null)<NEW_LINE>return;<NEW_LINE>for (String a : attrs.keySet()) {<NEW_LINE>String descr;<NEW_LINE>if (st.debugState != null && st.debugState.addAttrEvents != null) {<NEW_LINE>List<AddAttributeEvent> events = st.debugState.addAttrEvents.get(a);<NEW_LINE>StringBuilder locations = new StringBuilder();<NEW_LINE>int i = 0;<NEW_LINE>if (events != null) {<NEW_LINE>for (AddAttributeEvent ae : events) {<NEW_LINE>if (i > 0)<NEW_LINE>locations.append(", ");<NEW_LINE>locations.append(ae.getFileName() + ":" + ae.getLine());<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (locations.length() > 0) {<NEW_LINE>descr = a + " = " + attrs.get(a) + " @ " + locations.toString();<NEW_LINE>} else {<NEW_LINE>descr = a + " = " + attrs.get(a);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>descr = a + " = " + attrs.get(a);<NEW_LINE>}<NEW_LINE>if (!names.add(a)) {<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>builder.append("<html><font color=\"gray\">");<NEW_LINE>builder.append(StringRenderer.escapeHTML(descr));<NEW_LINE>builder.append("</font></html>");<NEW_LINE>descr = builder.toString();<NEW_LINE>}<NEW_LINE>node.addChild(new StringTree(descr));<NEW_LINE>}<NEW_LINE>} | > attrs = st.getAttributes(); |
708,734 | public SPluginConfiguration convertToSObject(PluginConfiguration input) {<NEW_LINE>if (input == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (input instanceof DeserializerPluginConfiguration) {<NEW_LINE><MASK><NEW_LINE>} else if (input instanceof InternalServicePluginConfiguration) {<NEW_LINE>return convertToSObject((InternalServicePluginConfiguration) input);<NEW_LINE>} else if (input instanceof ModelComparePluginConfiguration) {<NEW_LINE>return convertToSObject((ModelComparePluginConfiguration) input);<NEW_LINE>} else if (input instanceof ModelMergerPluginConfiguration) {<NEW_LINE>return convertToSObject((ModelMergerPluginConfiguration) input);<NEW_LINE>} else if (input instanceof ObjectIDMPluginConfiguration) {<NEW_LINE>return convertToSObject((ObjectIDMPluginConfiguration) input);<NEW_LINE>} else if (input instanceof QueryEnginePluginConfiguration) {<NEW_LINE>return convertToSObject((QueryEnginePluginConfiguration) input);<NEW_LINE>} else if (input instanceof RenderEnginePluginConfiguration) {<NEW_LINE>return convertToSObject((RenderEnginePluginConfiguration) input);<NEW_LINE>} else if (input instanceof SerializerPluginConfiguration) {<NEW_LINE>return convertToSObject((SerializerPluginConfiguration) input);<NEW_LINE>} else if (input instanceof WebModulePluginConfiguration) {<NEW_LINE>return convertToSObject((WebModulePluginConfiguration) input);<NEW_LINE>}<NEW_LINE>SPluginConfiguration result = new SPluginConfiguration();<NEW_LINE>result.setOid(input.getOid());<NEW_LINE>result.setUuid(input.getUuid());<NEW_LINE>result.setRid(input.getRid());<NEW_LINE>result.setName(input.getName());<NEW_LINE>result.setEnabled(input.getEnabled());<NEW_LINE>result.setDescription(input.getDescription());<NEW_LINE>PluginDescriptor pluginDescriptorVal = input.getPluginDescriptor();<NEW_LINE>result.setPluginDescriptorId(pluginDescriptorVal == null ? -1 : pluginDescriptorVal.getOid());<NEW_LINE>ObjectType settingsVal = input.getSettings();<NEW_LINE>result.setSettingsId(settingsVal == null ? -1 : settingsVal.getOid());<NEW_LINE>return result;<NEW_LINE>} | return convertToSObject((DeserializerPluginConfiguration) input); |
399,879 | public DocumentData parse(JsonReader reader, float scale) throws IOException {<NEW_LINE>String text = null;<NEW_LINE>String fontName = null;<NEW_LINE>float size = 0f;<NEW_LINE>Justification justification = Justification.CENTER;<NEW_LINE>int tracking = 0;<NEW_LINE>float lineHeight = 0f;<NEW_LINE>float baselineShift = 0f;<NEW_LINE>int fillColor = 0;<NEW_LINE>int strokeColor = 0;<NEW_LINE>float strokeWidth = 0f;<NEW_LINE>boolean strokeOverFill = true;<NEW_LINE>reader.beginObject();<NEW_LINE>while (reader.hasNext()) {<NEW_LINE>switch(reader.selectName(NAMES)) {<NEW_LINE>case 0:<NEW_LINE>text = reader.nextString();<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>fontName = reader.nextString();<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>size = (float) reader.nextDouble();<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>int justificationInt = reader.nextInt();<NEW_LINE>if (justificationInt > Justification.CENTER.ordinal() || justificationInt < 0) {<NEW_LINE>justification = Justification.CENTER;<NEW_LINE>} else {<NEW_LINE>justification = Justification.values()[justificationInt];<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>tracking = reader.nextInt();<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>lineHeight = <MASK><NEW_LINE>break;<NEW_LINE>case 6:<NEW_LINE>baselineShift = (float) reader.nextDouble();<NEW_LINE>break;<NEW_LINE>case 7:<NEW_LINE>fillColor = JsonUtils.jsonToColor(reader);<NEW_LINE>break;<NEW_LINE>case 8:<NEW_LINE>strokeColor = JsonUtils.jsonToColor(reader);<NEW_LINE>break;<NEW_LINE>case 9:<NEW_LINE>strokeWidth = (float) reader.nextDouble();<NEW_LINE>break;<NEW_LINE>case 10:<NEW_LINE>strokeOverFill = reader.nextBoolean();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>reader.skipName();<NEW_LINE>reader.skipValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>reader.endObject();<NEW_LINE>return new DocumentData(text, fontName, size, justification, tracking, lineHeight, baselineShift, fillColor, strokeColor, strokeWidth, strokeOverFill);<NEW_LINE>} | (float) reader.nextDouble(); |
1,211,196 | protected void invalidated() {<NEW_LINE>final Timeline t = get();<NEW_LINE>if (old != null) {<NEW_LINE>currentTimeAsPercentage.unbind();<NEW_LINE>end<MASK><NEW_LINE>}<NEW_LINE>if (t == null) {<NEW_LINE>setVisible(false);<NEW_LINE>} else {<NEW_LINE>setVisible(true);<NEW_LINE>currentTimeAsPercentage.bind(new DoubleBinding() {<NEW_LINE><NEW_LINE>{<NEW_LINE>bind(t.currentTimeProperty(), t.cycleDurationProperty());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected double computeValue() {<NEW_LINE>return t.getCurrentTime().toMillis() / t.getCycleDuration().toMillis();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>end.textProperty().bind(new StringBinding() {<NEW_LINE><NEW_LINE>{<NEW_LINE>bind(t.cycleDurationProperty());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected String computeValue() {<NEW_LINE>return String.format("%.2fs", t.getCycleDuration().toSeconds());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>current.textProperty().bind(new StringBinding() {<NEW_LINE><NEW_LINE>{<NEW_LINE>bind(t.currentTimeProperty());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected String computeValue() {<NEW_LINE>return String.format("%.2fs", t.getCurrentTime().toSeconds());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>old = t;<NEW_LINE>} | .textProperty().unbind(); |
795,761 | private PdfPCell createStrip(final Streamer component) {<NEW_LINE>PdfPCell result = new PdfPCell();<NEW_LINE>Phrase p = new Phrase();<NEW_LINE>p.setLeading(12f);<NEW_LINE>result.setVerticalAlignment(Element.ALIGN_TOP);<NEW_LINE>result.setBorder(Rectangle.BOTTOM);<NEW_LINE>Chunk c = new Chunk();<NEW_LINE>c.setFont(PrintUtilities.NORMAL);<NEW_LINE>c.append(LENGTH);<NEW_LINE>p.add(c);<NEW_LINE>c = new Chunk();<NEW_LINE>c.setFont(PrintUtilities.NORMAL);<NEW_LINE>c.append(" " + toLength(component.getStripLength()));<NEW_LINE>p.add(c);<NEW_LINE>result.addElement(p);<NEW_LINE>Phrase pw = new Phrase();<NEW_LINE>pw.setLeading(14f);<NEW_LINE>c = new Chunk();<NEW_LINE>c.setFont(PrintUtilities.NORMAL);<NEW_LINE>c.append(WIDTH);<NEW_LINE>pw.add(c);<NEW_LINE>c = new Chunk();<NEW_LINE>c.setFont(PrintUtilities.NORMAL);<NEW_LINE>c.append(" " + toLength<MASK><NEW_LINE>pw.add(c);<NEW_LINE>result.addElement(pw);<NEW_LINE>return result;<NEW_LINE>} | (component.getStripWidth())); |
1,380,738 | // adapted from org.netbeans.modules.java.hints.declarative.conditionapi.Matcher.referencedIn<NEW_LINE>private static boolean uses(final HintContext ctx, Collection<? extends TreePath> statements, TreePath var) {<NEW_LINE>final Element e = ctx.getInfo().getTrees().getElement(var);<NEW_LINE>if (e == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (TreePath tp : statements) {<NEW_LINE>boolean occurs = Boolean.TRUE.equals(new ErrorAwareTreePathScanner<Boolean, Void>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Boolean scan(Tree tree, Void p) {<NEW_LINE>if (tree == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>TreePath currentPath = new TreePath(getCurrentPath(), tree);<NEW_LINE>Element currentElement = ctx.getInfo().getTrees().getElement(currentPath);<NEW_LINE>if (e.equals(currentElement)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Boolean reduce(Boolean r1, Boolean r2) {<NEW_LINE>if (r1 == null) {<NEW_LINE>return r2;<NEW_LINE>}<NEW_LINE>if (r2 == null) {<NEW_LINE>return r1;<NEW_LINE>}<NEW_LINE>return r1 || r2;<NEW_LINE>}<NEW_LINE>}.scan(tp, null));<NEW_LINE>if (occurs) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | super.scan(tree, p); |
204,776 | static private List<JavaProblem> checkForMissingBraces(PreprocSketch ps) {<NEW_LINE>List<JavaProblem> problems = new ArrayList<>(0);<NEW_LINE>for (int tabIndex = 0; tabIndex < ps.tabStartOffsets.length; tabIndex++) {<NEW_LINE>int tabStartOffset = ps.tabStartOffsets[tabIndex];<NEW_LINE>int tabEndOffset = (tabIndex < ps.tabStartOffsets.length - 1) ? ps.tabStartOffsets[tabIndex + 1] : ps.scrubbedPdeCode.length();<NEW_LINE>int[] braceResult = SourceUtil.checkForMissingBraces(ps.scrubbedPdeCode, tabStartOffset, tabEndOffset);<NEW_LINE>if (braceResult[0] != 0) {<NEW_LINE>JavaProblem problem = new JavaProblem(braceResult[0] < 0 ? Language.interpolate("editor.status.missing.left_curly_bracket") : Language.interpolate("editor.status.missing.right_curly_bracket"), JavaProblem.ERROR, tabIndex, braceResult[1]);<NEW_LINE>problem.setPDEOffsets(braceResult[3], braceResult[3] + 1);<NEW_LINE>problems.add(problem);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (problems.isEmpty()) {<NEW_LINE>return problems;<NEW_LINE>}<NEW_LINE>int problemTabIndex = problems.<MASK><NEW_LINE>IProblem missingBraceProblem = // Ignore if it is at the end of file<NEW_LINE>Arrays.stream(ps.compilationUnit.getProblems()).filter(ErrorChecker::isMissingBraceProblem).filter(// Ignore if the tab number does not match our detected tab number<NEW_LINE>p -> p.getSourceEnd() + 1 < ps.javaCode.length()).filter(p -> problemTabIndex == ps.mapJavaToSketch(p).tabIndex).findFirst().orElse(null);<NEW_LINE>// Prefer ECJ problem, shows location more accurately<NEW_LINE>if (missingBraceProblem != null) {<NEW_LINE>JavaProblem p = convertIProblem(missingBraceProblem, ps);<NEW_LINE>if (p != null) {<NEW_LINE>problems.clear();<NEW_LINE>problems.add(p);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return problems;<NEW_LINE>} | get(0).getTabIndex(); |
1,302,165 | protected void charBackspaced(BaseDocument document, int offset, Caret caret, char character) throws BadLocationException {<NEW_LINE>TokenSequence tokenSequence = Utils.getTokenSequence(document, offset);<NEW_LINE>if (tokenSequence != null) {<NEW_LINE>String mimeType = tokenSequence.language().mimeType();<NEW_LINE>try {<NEW_LINE>Language l = LanguagesManager.getDefault().getLanguage(mimeType);<NEW_LINE>List<Feature> completes = l.getFeatureList().getFeatures("COMPLETE");<NEW_LINE>Iterator<Feature> it = completes.iterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>Feature complete = it.next();<NEW_LINE>if (complete.getType() != Feature.Type.STRING)<NEW_LINE>continue;<NEW_LINE>String s = (String) complete.getValue();<NEW_LINE>int i = s.indexOf(':');<NEW_LINE>if (i != 1)<NEW_LINE>continue;<NEW_LINE>String ss = document.getText(caret.getDot(), s.length() - i - 1);<NEW_LINE>if (s.endsWith(ss) && s.charAt(0) == character) {<NEW_LINE>document.remove(caret.getDot(), s.<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (LanguageDefinitionNotFoundException ex) {<NEW_LINE>// ignore the exception<NEW_LINE>}<NEW_LINE>}<NEW_LINE>super.charBackspaced(document, offset, caret, character);<NEW_LINE>} | length() - i - 1); |
511,599 | private void registerHideSqliteDbFileReceiver(@NonNull MapActivity mapActivity) {<NEW_LINE>final WeakReference<MapActivity> mapActivityRef = new WeakReference<>(mapActivity);<NEW_LINE>BroadcastReceiver hideSqliteDbFileReceiver = new BroadcastReceiver() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onReceive(Context context, Intent intent) {<NEW_LINE>OsmandSettings settings = app.getSettings();<NEW_LINE>String fileName = intent.getStringExtra(AIDL_FILE_NAME);<NEW_LINE>if (!Algorithms.isEmpty(fileName) && fileName.equals(settings.MAP_OVERLAY.get())) {<NEW_LINE>settings.MAP_OVERLAY.set(null);<NEW_LINE>settings.MAP_OVERLAY_PREVIOUS.set(null);<NEW_LINE>MapActivity mapActivity = mapActivityRef.get();<NEW_LINE>if (mapActivity != null) {<NEW_LINE>OsmandRasterMapsPlugin plugin = <MASK><NEW_LINE>if (plugin != null) {<NEW_LINE>plugin.updateMapLayers(mapActivity, mapActivity, settings.MAP_OVERLAY);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>registerReceiver(hideSqliteDbFileReceiver, mapActivity, AIDL_HIDE_SQLITEDB_FILE);<NEW_LINE>} | OsmandPlugin.getActivePlugin(OsmandRasterMapsPlugin.class); |
1,828,725 | public void validate(Mesh mesh) {<NEW_LINE>if (!(mesh instanceof TriangleMesh)) {<NEW_LINE>throw new AssertionError("Mesh is not TriangleMesh: " + mesh.getClass() + ", mesh = " + mesh);<NEW_LINE>}<NEW_LINE>TriangleMesh tMesh = (TriangleMesh) mesh;<NEW_LINE>int numPoints = tMesh.getPoints().size() / tMesh.getPointElementSize();<NEW_LINE>int numTexCoords = tMesh.getTexCoords().size() / tMesh.getTexCoordElementSize();<NEW_LINE>int numFaces = tMesh.getFaces().size() / tMesh.getFaceElementSize();<NEW_LINE>if (numPoints == 0 || numPoints * tMesh.getPointElementSize() != tMesh.getPoints().size()) {<NEW_LINE>throw new AssertionError("Points array size is not correct: " + tMesh.getPoints().size());<NEW_LINE>}<NEW_LINE>if (numTexCoords == 0 || numTexCoords * tMesh.getTexCoordElementSize() != tMesh.getTexCoords().size()) {<NEW_LINE>throw new AssertionError("TexCoords array size is not correct: " + tMesh.getPoints().size());<NEW_LINE>}<NEW_LINE>if (numFaces == 0 || numFaces * tMesh.getFaceElementSize() != tMesh.getFaces().size()) {<NEW_LINE>throw new AssertionError("Faces array size is not correct: " + tMesh.getPoints().size());<NEW_LINE>}<NEW_LINE>if (numFaces != tMesh.getFaceSmoothingGroups().size() && tMesh.getFaceSmoothingGroups().size() > 0) {<NEW_LINE>throw new AssertionError("FaceSmoothingGroups array size is not correct: " + tMesh.getPoints().size() + ", numFaces = " + numFaces);<NEW_LINE>}<NEW_LINE>ObservableIntegerArray faces = tMesh.getFaces();<NEW_LINE>for (int i = 0; i < faces.size(); i += 2) {<NEW_LINE>int pIndex = faces.get(i);<NEW_LINE>if (pIndex < 0 || pIndex > numPoints) {<NEW_LINE>throw new AssertionError(<MASK><NEW_LINE>}<NEW_LINE>int tcIndex = faces.get(i + 1);<NEW_LINE>if (tcIndex < 0 || tcIndex > numTexCoords) {<NEW_LINE>throw new AssertionError("Incorrect texCoord index: " + tcIndex + ", numTexCoords = " + numTexCoords);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// System.out.println("Validation successfull of " + mesh);<NEW_LINE>} | "Incorrect point index: " + pIndex + ", numPoints = " + numPoints); |
1,221,054 | public boolean canClose() {<NEW_LINE>if (query != null) {<NEW_LINE>QuerySavable savable = getSavable();<NEW_LINE>if (savable != null) {<NEW_LINE>JButton save = new JButton(Bundle.CTL_Save());<NEW_LINE>JButton discard = new JButton(Bundle.CTL_Discard());<NEW_LINE>NotifyDescriptor nd = new NotifyDescriptor(Bundle.MSG_HasChanges(getFQQueryName(query)), Bundle.LBL_Question(), NotifyDescriptor.YES_NO_CANCEL_OPTION, NotifyDescriptor.INFORMATION_MESSAGE, new Object[] { save, discard, NotifyDescriptor.CANCEL_OPTION }, null);<NEW_LINE>Object ret = DialogDisplayer.getDefault().notify(nd);<NEW_LINE>boolean canClose = false;<NEW_LINE>if (ret == save) {<NEW_LINE>canClose = save();<NEW_LINE>} else if (ret == discard) {<NEW_LINE>canClose = query<MASK><NEW_LINE>}<NEW_LINE>if (canClose) {<NEW_LINE>savable.destroy();<NEW_LINE>}<NEW_LINE>return canClose;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return super.canClose();<NEW_LINE>} | .getController().discardUnsavedChanges(); |
1,573,000 | protected void _addEnumProps(Class<?> propClass, Schema property) {<NEW_LINE>final boolean useIndex = _mapper.isEnabled(SerializationFeature.WRITE_ENUMS_USING_INDEX);<NEW_LINE>final boolean useToString = _mapper.isEnabled(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);<NEW_LINE>Optional<Method> jsonValueMethod = Arrays.stream(propClass.getMethods()).filter(m -> m.isAnnotationPresent(JsonValue.class)).filter(m -> m.getAnnotation(JsonValue.class).<MASK><NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Class<Enum<?>> enumClass = (Class<Enum<?>>) propClass;<NEW_LINE>Enum<?>[] enumConstants = enumClass.getEnumConstants();<NEW_LINE>if (enumConstants != null) {<NEW_LINE>String[] enumValues = _intr.findEnumValues(propClass, enumConstants, new String[enumConstants.length]);<NEW_LINE>for (Enum<?> en : enumConstants) {<NEW_LINE>String n;<NEW_LINE>String enumValue = enumValues[en.ordinal()];<NEW_LINE>String s = jsonValueMethod.flatMap(m -> ReflectionUtils.safeInvoke(m, en)).map(Object::toString).orElse(null);<NEW_LINE>if (s != null) {<NEW_LINE>n = s;<NEW_LINE>} else if (enumValue != null) {<NEW_LINE>n = enumValue;<NEW_LINE>} else if (useIndex) {<NEW_LINE>n = String.valueOf(en.ordinal());<NEW_LINE>} else if (useToString) {<NEW_LINE>n = en.toString();<NEW_LINE>} else {<NEW_LINE>n = _intr.findEnumValue(en);<NEW_LINE>}<NEW_LINE>if (property instanceof StringSchema) {<NEW_LINE>StringSchema sp = (StringSchema) property;<NEW_LINE>sp.addEnumItem(n);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | value()).findFirst(); |
1,284,585 | private boolean prepareQueries() {<NEW_LINE>synchronized (db) {<NEW_LINE>final Database db = this.db.get();<NEW_LINE>assert db != null;<NEW_LINE>try {<NEW_LINE>try {<NEW_LINE>if (writeQuery != null)<NEW_LINE>writeQuery.close();<NEW_LINE>} catch (final SQLException e) {<NEW_LINE>}<NEW_LINE>writeQuery = db.prepare("REPLACE INTO " + getTableName() + " (name, type, value, update_guid) VALUES (?, ?, ?, ?)");<NEW_LINE>try {<NEW_LINE>if (deleteQuery != null)<NEW_LINE>deleteQuery.close();<NEW_LINE>} catch (final SQLException e) {<NEW_LINE>}<NEW_LINE>deleteQuery = db.prepare("DELETE FROM " + getTableName() + " WHERE name = ?");<NEW_LINE>try {<NEW_LINE>if (monitorQuery != null)<NEW_LINE>monitorQuery.close();<NEW_LINE>} catch (final SQLException e) {<NEW_LINE>}<NEW_LINE>monitorQuery = db.prepare("SELECT " + SELECT_ORDER + " FROM " + getTableName() + " WHERE rowid > ? AND update_guid != ?");<NEW_LINE>try {<NEW_LINE>if (monitorCleanUpQuery != null)<NEW_LINE>monitorCleanUpQuery.close();<NEW_LINE>} catch (final SQLException e) {<NEW_LINE>}<NEW_LINE>monitorCleanUpQuery = db.prepare("DELETE FROM " + getTableName() + " WHERE value IS NULL AND rowid < ?");<NEW_LINE>} catch (final SQLException e) {<NEW_LINE>Skript.exception(e, "Could not prepare queries for the database '" + databaseName + <MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | "': " + e.getLocalizedMessage()); |
756,414 | public static FastChecker create(String schemaName, String tableName, Map<String, String> sourceTargetGroup, Map<String, Set<String>> srcPhyDbAndTables, Map<String, Set<String>> dstPhyDbAndTables, long parallelism, ExecutionContext ec) {<NEW_LINE>final SchemaManager sm = OptimizerContext.getContext(schemaName).getLatestSchemaManager();<NEW_LINE>final TableMeta <MASK><NEW_LINE>if (null == tableMeta) {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_SCALEOUT_EXECUTE, "Incorrect SCALEOUT relationship.");<NEW_LINE>}<NEW_LINE>final List<String> allColumns = tableMeta.getAllColumns().stream().map(ColumnMeta::getName).collect(Collectors.toList());<NEW_LINE>if (parallelism <= 0) {<NEW_LINE>parallelism = Math.max(PriorityWorkQueue.getInstance().getCorePoolSize() / 2, 1);<NEW_LINE>}<NEW_LINE>final int lockTimeOut = ec.getParamManager().getInt(ConnectionParams.FASTCHECKER_LOCK_TIMEOUT);<NEW_LINE>final PhysicalPlanBuilder builder = new PhysicalPlanBuilder(schemaName, ec);<NEW_LINE>return new MoveTableFastChecker(schemaName, tableName, sourceTargetGroup, srcPhyDbAndTables, dstPhyDbAndTables, allColumns, builder.buildSelectHashCheckForChecker(tableMeta, allColumns), builder.buildSelectHashCheckForChecker(tableMeta, allColumns), builder.buildIdleSelectForChecker(tableMeta, allColumns), builder.buildIdleSelectForChecker(tableMeta, allColumns), parallelism, lockTimeOut);<NEW_LINE>} | tableMeta = sm.getTable(tableName); |
951,986 | private void updateMetadataLink(MetadataItem item) {<NEW_LINE>String methodName = "updateMetadataLink";<NEW_LINE>List<String> metadata = resolver.required() ? resolver.getItemGUIDs(item) : item.getSourceGuid();<NEW_LINE>Map<String, Relationship> itemReferences = new HashMap<>();<NEW_LINE>try {<NEW_LINE>List<Relationship> list = ctx.getRepositoryHandler().getRelationshipsByType(ctx.getUserId(), item.getGuid(), IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, IdMap.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_GUID, IdMap.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_NAME, methodName);<NEW_LINE>if (list != null) {<NEW_LINE>// exclude references pointing to this item<NEW_LINE>list.forEach(relationship -> {<NEW_LINE>if (relationship.getEntityOneProxy().getGUID().equals(item.getGuid())) {<NEW_LINE>itemReferences.put(relationship.getEntityTwoProxy().getGUID(), relationship);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} catch (UserNotAuthorizedException | PropertyServerException e1) {<NEW_LINE>// log warning in execution context: relationships for item are not fetched from repository.<NEW_LINE>ctx.addMessage(AnalyticsModelingErrorCode.WARNING_UPDATE_METADATA_LINK.getMessageDefinition(item.getGuid(), e1.getLocalizedMessage()));<NEW_LINE>}<NEW_LINE>metadata.forEach(srcGUID -> {<NEW_LINE>Relationship relationship = itemReferences.remove(srcGUID);<NEW_LINE>if (relationship == null) {<NEW_LINE>// new reference to the metadata object<NEW_LINE>try {<NEW_LINE>ctx.getRepositoryHandler().createRelationship(ctx.getUserId(), IdMap.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_GUID, ctx.getServerSoftwareCapability().getGUID(), ctx.getServerSoftwareCapability().getSource(), item.getGuid(<MASK><NEW_LINE>} catch (UserNotAuthorizedException | PropertyServerException e) {<NEW_LINE>// log warning in execution context: relationship for item is not created<NEW_LINE>ctx.addMessage(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK.getMessageDefinition(item.getGuid(), srcGUID), e.getLocalizedMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// remove old references not used in the new definition<NEW_LINE>itemReferences.values().forEach(relationship -> {<NEW_LINE>try {<NEW_LINE>ctx.getRepositoryHandler().removeRelationship(ctx.getUserId(), ctx.getServerSoftwareCapability().getGUID(), ctx.getServerSoftwareCapability().getSource(), relationship, methodName);<NEW_LINE>} catch (UserNotAuthorizedException | PropertyServerException e) {<NEW_LINE>// log warning in execution context: old relationship for item is not removed<NEW_LINE>ctx.addMessage(AnalyticsModelingErrorCode.WARNING_DELETE_METADATA_LINK.getMessageDefinition(relationship.getGUID(), item.getGuid()), e.getLocalizedMessage());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | ), srcGUID, null, methodName); |
55,685 | public void constructHistogram(final boolean useInstanceCount, final int nodeSize, final int validInstanceCount, BitSet featureValid, int[] nodeIdCache, int[] validFeatureOffset, int[] aligned, double[] gradients, double[] hessions, double[] weights, ExecutorService executorService, Future<?>[] futures, double[] featureSplitHistogram) {<NEW_LINE>final int step = 4;<NEW_LINE>for (int i = 0; i < getN(); ++i) {<NEW_LINE>futures[i] = null;<NEW_LINE>if (!featureValid.get(i)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final int dataOffset = getM() * i;<NEW_LINE>final int featureSize = DataUtil.getFeatureCategoricalSize(featureMetas[i], useMissing);<NEW_LINE>final int histogramOffset = validFeatureOffset[i] * nodeSize * step;<NEW_LINE>final int nextHistogramOffset = histogramOffset + featureSize * nodeSize * step;<NEW_LINE>if (useInstanceCount) {<NEW_LINE>futures[i] = executorService.submit(() -> {<NEW_LINE>Arrays.fill(featureSplitHistogram, histogramOffset, nextHistogramOffset, 0.0);<NEW_LINE>for (int j = 0; j < validInstanceCount; ++j) {<NEW_LINE>final int val = values[dataOffset + aligned[j]];<NEW_LINE>final int node = nodeIdCache[aligned[j]];<NEW_LINE>final int counterIndex = (node * featureSize + val) * step + histogramOffset;<NEW_LINE>featureSplitHistogram[counterIndex] += gradients[aligned[j]];<NEW_LINE>featureSplitHistogram[counterIndex + 1] += hessions[aligned[j]];<NEW_LINE>featureSplitHistogram[counterIndex + 2] += weights[aligned[j]];<NEW_LINE>if (weights[aligned[j]] > PaiCriteria.PAI_EPS) {<NEW_LINE>featureSplitHistogram[counterIndex + 3] += 1.0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>futures[i] = executorService.submit(() -> {<NEW_LINE>Arrays.fill(featureSplitHistogram, histogramOffset, nextHistogramOffset, 0.0);<NEW_LINE>for (int j = 0; j < validInstanceCount; ++j) {<NEW_LINE>final int val = values[dataOffset + aligned[j]];<NEW_LINE>final int node = nodeIdCache[aligned[j]];<NEW_LINE>final int counterIndex = (node * featureSize + val) * step + histogramOffset;<NEW_LINE>featureSplitHistogram[counterIndex] <MASK><NEW_LINE>featureSplitHistogram[counterIndex + 1] += hessions[aligned[j]];<NEW_LINE>featureSplitHistogram[counterIndex + 2] += weights[aligned[j]];<NEW_LINE>featureSplitHistogram[counterIndex + 3] += 1.0;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Future<?> future : futures) {<NEW_LINE>if (future == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>future.get();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new RuntimeException(ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | += gradients[aligned[j]]; |
405,601 | public ActionRequestValidationException validate() {<NEW_LINE><MASK><NEW_LINE>if (version != Versions.MATCH_ANY && upsertRequest != null) {<NEW_LINE>validationException = addValidationError("can't provide both upsert request and a version", validationException);<NEW_LINE>}<NEW_LINE>if (upsertRequest != null && upsertRequest.version() != Versions.MATCH_ANY) {<NEW_LINE>validationException = addValidationError("can't provide version in upsert request", validationException);<NEW_LINE>}<NEW_LINE>if (Strings.isEmpty(type)) {<NEW_LINE>validationException = addValidationError("type is missing", validationException);<NEW_LINE>}<NEW_LINE>if (Strings.isEmpty(id)) {<NEW_LINE>validationException = addValidationError("id is missing", validationException);<NEW_LINE>}<NEW_LINE>if (versionType != VersionType.INTERNAL) {<NEW_LINE>validationException = addValidationError("version type [" + versionType + "] is not supported by the update API", validationException);<NEW_LINE>} else {<NEW_LINE>if (version != Versions.MATCH_ANY && retryOnConflict > 0) {<NEW_LINE>validationException = addValidationError("can't provide both retry_on_conflict and a specific version", validationException);<NEW_LINE>}<NEW_LINE>if (!versionType.validateVersionForWrites(version)) {<NEW_LINE>validationException = addValidationError("illegal version value [" + version + "] for version type [" + versionType.name() + "]", validationException);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>validationException = DocWriteRequest.validateSeqNoBasedCASParams(this, validationException);<NEW_LINE>if (ifSeqNo != UNASSIGNED_SEQ_NO && retryOnConflict > 0) {<NEW_LINE>validationException = addValidationError("compare and write operations can not be retried", validationException);<NEW_LINE>}<NEW_LINE>if (ifSeqNo != UNASSIGNED_SEQ_NO && docAsUpsert) {<NEW_LINE>validationException = addValidationError("compare and write operations can not be used with upsert", validationException);<NEW_LINE>}<NEW_LINE>if (script == null && doc == null) {<NEW_LINE>validationException = addValidationError("script or doc is missing", validationException);<NEW_LINE>}<NEW_LINE>if (script != null && doc != null) {<NEW_LINE>validationException = addValidationError("can't provide both script and doc", validationException);<NEW_LINE>}<NEW_LINE>if (doc == null && docAsUpsert) {<NEW_LINE>validationException = addValidationError("doc must be specified if doc_as_upsert is enabled", validationException);<NEW_LINE>}<NEW_LINE>return validationException;<NEW_LINE>} | ActionRequestValidationException validationException = super.validate(); |
106,829 | private Picture decodeScan(ByteBuffer data, FrameHeader header, ScanHeader scan, VLC[] huffTables, int[][] quant, byte[][] data2, int field, int step) {<NEW_LINE>int blockW = header.getHmax();<NEW_LINE>int blockH = header.getVmax();<NEW_LINE>int mcuW = blockW << 3;<NEW_LINE>int mcuH = blockH << 3;<NEW_LINE>int width = header.width;<NEW_LINE>int height = header.height;<NEW_LINE>int xBlocks = (width + mcuW - 1) >> (blockW + 2);<NEW_LINE>int yBlocks = (height + mcuH - 1) >> (blockH + 2);<NEW_LINE>int nn = blockW + blockH;<NEW_LINE>Picture result = new Picture(xBlocks << (blockW + 2), yBlocks << (blockH + 2), data2, null, nn == 4 ? ColorSpace.YUV420J : (nn == 3 ? ColorSpace.YUV422J : ColorSpace.YUV444J), 0, new Rect(0<MASK><NEW_LINE>BitReader bits = BitReader.createBitReader(data);<NEW_LINE>int[] dcPredictor = new int[] { 1024, 1024, 1024 };<NEW_LINE>for (int by = 0; by < yBlocks; by++) for (int bx = 0; bx < xBlocks && bits.moreData(); bx++) decodeMCU(bits, dcPredictor, quant, huffTables, result, bx, by, blockW, blockH, field, step);<NEW_LINE>return result;<NEW_LINE>} | , 0, width, height)); |
898,275 | private Map<String, Object> equalizerAudioEffectGetParameters() {<NEW_LINE>Equalizer equalizer = (Equalizer) audioEffectsMap.get("AndroidEqualizer");<NEW_LINE>ArrayList<Object> <MASK><NEW_LINE>for (short i = 0; i < equalizer.getNumberOfBands(); i++) {<NEW_LINE>rawBands.add(mapOf("index", i, "lowerFrequency", (double) equalizer.getBandFreqRange(i)[0] / 1000.0, "upperFrequency", (double) equalizer.getBandFreqRange(i)[1] / 1000.0, "centerFrequency", (double) equalizer.getCenterFreq(i) / 1000.0, "gain", equalizer.getBandLevel(i) / 1000.0));<NEW_LINE>}<NEW_LINE>return mapOf("parameters", mapOf("minDecibels", equalizer.getBandLevelRange()[0] / 1000.0, "maxDecibels", equalizer.getBandLevelRange()[1] / 1000.0, "bands", rawBands));<NEW_LINE>} | rawBands = new ArrayList<>(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.