idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
230,280 | private List<Column> buildQueryColumns(DataFetchingEnvironment environment) {<NEW_LINE>List<SelectedField> valuesFields = environment.getSelectionSet().getFields("values");<NEW_LINE>if (valuesFields.isEmpty()) {<NEW_LINE>return ImmutableList.of();<NEW_LINE>}<NEW_LINE>// While convoluted, it's technically valid to reference 'values' multiple times under<NEW_LINE>// different aliases, for example:<NEW_LINE>// {<NEW_LINE>// values { id }<NEW_LINE>// values2: values { first_name last_name }<NEW_LINE>// }<NEW_LINE>// We iterate all the occurrences and build the union of their subsets.<NEW_LINE>Set<Column> <MASK><NEW_LINE>for (SelectedField valuesField : valuesFields) {<NEW_LINE>for (SelectedField selectedField : valuesField.getSelectionSet().getFields()) {<NEW_LINE>if ("__typename".equals(selectedField.getName())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String column = dbColumnGetter.getDBColumnName(table, selectedField.getName());<NEW_LINE>if (column != null) {<NEW_LINE>queryColumns.add(Column.reference(column));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ImmutableList.copyOf(queryColumns);<NEW_LINE>} | queryColumns = new LinkedHashSet<>(); |
93,630 | public Object toJson() {<NEW_LINE>Map<String, Object> jsonObj = new HashMap<String, Object>();<NEW_LINE>jsonObj.put("numberMaps", Integer.toString(numberMaps));<NEW_LINE>jsonObj.put("numberReduces", Integer.toString(numberReduces));<NEW_LINE>jsonObj.put("minMapTime", Long.toString(minMapTime));<NEW_LINE>jsonObj.put("maxMapTime", Long.toString(maxMapTime));<NEW_LINE>jsonObj.put("avgMapTime", Long.toString(avgMapTime));<NEW_LINE>jsonObj.put("minReduceTime", Long.toString(minReduceTime));<NEW_LINE>jsonObj.put("maxReduceTime", Long.toString(maxReduceTime));<NEW_LINE>jsonObj.put("avgReduceTime", Long.toString(avgReduceTime));<NEW_LINE>jsonObj.put("bytesWritten", Long.toString(bytesWritten));<NEW_LINE>jsonObj.put("hdfsBytesWritten", Long.toString(hdfsBytesWritten));<NEW_LINE>jsonObj.put("mapInputRecords", Long.toString(mapInputRecords));<NEW_LINE>jsonObj.put("mapOutputRecords", Long.toString(mapOutputRecords));<NEW_LINE>jsonObj.put("reduceInputRecords", Long.toString(reduceInputRecords));<NEW_LINE>jsonObj.put("reduceOutputRecords", Long.toString(reduceOutputRecords));<NEW_LINE>jsonObj.put("proactiveSpillCountObjects", Long.toString(proactiveSpillCountObjects));<NEW_LINE>jsonObj.put("proactiveSpillCountRecs"<MASK><NEW_LINE>jsonObj.put("recordsWritten", Long.toString(recordsWritten));<NEW_LINE>jsonObj.put("smmSpillCount", Long.toString(smmSpillCount));<NEW_LINE>jsonObj.put("errorMessage", errorMessage);<NEW_LINE>jsonObj.put("inputStats", statsToJson(inputStats));<NEW_LINE>jsonObj.put("outputStats", statsToJson(outputStats));<NEW_LINE>return jsonObj;<NEW_LINE>} | , Long.toString(proactiveSpillCountRecs)); |
1,061,212 | private static PDGRegion pdgpostorder(PDGNode node, List<PDGRegion> list) {<NEW_LINE>if (node.getVisited()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>node.setVisited(true);<NEW_LINE>PDGRegion region;<NEW_LINE>if (!node2Region.containsKey(node)) {<NEW_LINE>region = new PDGRegion(node);<NEW_LINE>node2Region.put(node, region);<NEW_LINE>} else {<NEW_LINE>region = node2Region.get(node);<NEW_LINE>}<NEW_LINE>// If there are children, push the children to the stack<NEW_LINE>for (PDGNode curNode : node.getDependents()) {<NEW_LINE>if (curNode.getVisited()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>region.addPDGNode(curNode);<NEW_LINE>if (curNode instanceof LoopedPDGNode) {<NEW_LINE>PDGNode body = ((LoopedPDGNode) curNode).getBody();<NEW_LINE>PDGRegion <MASK><NEW_LINE>if (kid != null) {<NEW_LINE>kid.setParent(region);<NEW_LINE>region.addChildRegion(kid);<NEW_LINE>// This sets the node from the old Region into a PDGRegion<NEW_LINE>body.setNode(kid);<NEW_LINE>}<NEW_LINE>} else if (curNode instanceof ConditionalPDGNode) {<NEW_LINE>for (PDGNode child : curNode.getDependents()) {<NEW_LINE>PDGRegion kid = pdgpostorder(child, list);<NEW_LINE>if (kid != null) {<NEW_LINE>kid.setParent(region);<NEW_LINE>region.addChildRegion(kid);<NEW_LINE>// This sets the node from the old Region into a PDGRegion<NEW_LINE>child.setNode(kid);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>list.add(region);<NEW_LINE>return region;<NEW_LINE>} | kid = pdgpostorder(body, list); |
1,816,290 | public void cellPaint(GC gc, TableCellSWT cell) {<NEW_LINE>Subscription sub = (Subscription) cell.getDataSource();<NEW_LINE>Rectangle bounds = cell.getBounds();<NEW_LINE>bounds.width -= 5;<NEW_LINE>bounds.height -= 7;<NEW_LINE>bounds.x += 2;<NEW_LINE>bounds.y += 3;<NEW_LINE>gc.setBackground(ColorCache.getColor(gc.getDevice(), 255, 255, 255));<NEW_LINE>gc.fillRectangle(bounds);<NEW_LINE>gc.setForeground(ColorCache.getColor(gc.getDevice(), 200, 200, 200));<NEW_LINE>gc.drawRectangle(bounds);<NEW_LINE>bounds.width -= 2;<NEW_LINE>bounds.height -= 2;<NEW_LINE>bounds.x += 1;<NEW_LINE>bounds.y += 1;<NEW_LINE>long popularity = sub.getCachedPopularity();<NEW_LINE>// Rank in pixels between 0 and 80<NEW_LINE>// 0 -> no subscriber<NEW_LINE>// 80 -> 1000 subscribers<NEW_LINE>int rank = 80 * (int) popularity / 1000;<NEW_LINE>if (rank > 80)<NEW_LINE>rank = 80;<NEW_LINE>if (rank < 5)<NEW_LINE>rank = 5;<NEW_LINE>Rectangle clipping = gc.getClipping();<NEW_LINE>bounds.width = rank;<NEW_LINE>bounds.height -= 1;<NEW_LINE>bounds.x += 1;<NEW_LINE>bounds.y += 1;<NEW_LINE>Utils.setClipping(gc, bounds);<NEW_LINE>ImageLoader imageLoader = ImageLoader.getInstance();<NEW_LINE>Image <MASK><NEW_LINE>gc.drawImage(rankingBars, bounds.x, bounds.y);<NEW_LINE>imageLoader.releaseImage("ranking_bars");<NEW_LINE>Utils.setClipping(gc, clipping);<NEW_LINE>} | rankingBars = imageLoader.getImage("ranking_bars"); |
1,355,299 | private static int[] overARGB(int[] a, int[] b) {<NEW_LINE>int[] r = new int[4];<NEW_LINE>for (int c = 0; c < 4; c++) {<NEW_LINE>assert a[c] >= 0 && a[c] <= 255 : a[c];<NEW_LINE>assert b[c] >= 0 && b[c<MASK><NEW_LINE>}<NEW_LINE>float alphaA = a[0] / 255.0f;<NEW_LINE>float alphaB = b[0] / 255.0f;<NEW_LINE>float alphaANeg = 1.0f - alphaA;<NEW_LINE>float alphaO = alphaA + alphaB * alphaANeg;<NEW_LINE>r[0] = (int) (alphaO * 255 + 0.5f);<NEW_LINE>for (int c = 1; c <= 3; c++) {<NEW_LINE>float cA = a[c] / 255.0f;<NEW_LINE>float cB = b[c] / 255.0f;<NEW_LINE>float cR = (cA * alphaA + cB * alphaB * alphaANeg) / alphaO;<NEW_LINE>r[c] = (int) (cR * 255 + 0.5f);<NEW_LINE>}<NEW_LINE>for (int c = 0; c < 4; c++) {<NEW_LINE>assert r[c] >= 0 && r[c] <= 255 : r[c];<NEW_LINE>}<NEW_LINE>// System.err.println("overARGB(" + show(a) + "," + show(b) + ")=" + show(r));<NEW_LINE>return r;<NEW_LINE>} | ] <= 255 : b[c]; |
1,186,135 | public URI normalizeTemplateLocation(URI locationUri) {<NEW_LINE>if (!"file".equals(locationUri.getScheme()))<NEW_LINE>return locationUri;<NEW_LINE><MASK><NEW_LINE>String userTemplateLocation = defaultUserTemplateDir().toURI().toString();<NEW_LINE>String normalizedLocation;<NEW_LINE>if (location.startsWith(userTemplateLocation)) {<NEW_LINE>normalizedLocation = TEMPLATE_SCHEME + ":/" + location.substring(userTemplateLocation.length());<NEW_LINE>} else {<NEW_LINE>String standardTemplateLocation = defaultStandardTemplateDir().toURI().toString();<NEW_LINE>if (location.startsWith(standardTemplateLocation)) {<NEW_LINE>normalizedLocation = TEMPLATE_SCHEME + ":/" + location.substring(standardTemplateLocation.length());<NEW_LINE>} else<NEW_LINE>return locationUri;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return new URI(normalizedLocation);<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>LogUtils.severe(e);<NEW_LINE>return locationUri;<NEW_LINE>}<NEW_LINE>} | String location = locationUri.toString(); |
462,071 | public static LinkedJSONObject toJSONObject(String string) throws org.librera.JSONException {<NEW_LINE>String name;<NEW_LINE>LinkedJSONObject jo = new LinkedJSONObject();<NEW_LINE>Object value;<NEW_LINE>org.librera.JSONTokener x = new <MASK><NEW_LINE>jo.put("name", x.nextTo('='));<NEW_LINE>x.next('=');<NEW_LINE>jo.put("value", x.nextTo(';'));<NEW_LINE>x.next();<NEW_LINE>while (x.more()) {<NEW_LINE>name = unescape(x.nextTo("=;"));<NEW_LINE>if (x.next() != '=') {<NEW_LINE>if (name.equals("secure")) {<NEW_LINE>value = Boolean.TRUE;<NEW_LINE>} else {<NEW_LINE>throw x.syntaxError("Missing '=' in cookie parameter.");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>value = unescape(x.nextTo(';'));<NEW_LINE>x.next();<NEW_LINE>}<NEW_LINE>jo.put(name, value);<NEW_LINE>}<NEW_LINE>return jo;<NEW_LINE>} | org.librera.JSONTokener(string); |
1,395,606 | protected void doExecute(Task task, MultiSearchTemplateRequest request, ActionListener<MultiSearchTemplateResponse> listener) {<NEW_LINE>List<Integer> originalSlots = new ArrayList<>();<NEW_LINE>MultiSearchRequest multiSearchRequest = new MultiSearchRequest();<NEW_LINE>multiSearchRequest.indicesOptions(request.indicesOptions());<NEW_LINE>if (request.maxConcurrentSearchRequests() != 0) {<NEW_LINE>multiSearchRequest.maxConcurrentSearchRequests(request.maxConcurrentSearchRequests());<NEW_LINE>}<NEW_LINE>MultiSearchTemplateResponse.Item[] items = new MultiSearchTemplateResponse.Item[request.requests().size()];<NEW_LINE>for (int i = 0; i < items.length; i++) {<NEW_LINE>SearchTemplateRequest searchTemplateRequest = request.requests().get(i);<NEW_LINE>SearchTemplateResponse searchTemplateResponse = new SearchTemplateResponse();<NEW_LINE>SearchRequest searchRequest;<NEW_LINE>try {<NEW_LINE>searchRequest = convert(searchTemplateRequest, searchTemplateResponse, scriptService, xContentRegistry);<NEW_LINE>} catch (Exception e) {<NEW_LINE>items[i] = new MultiSearchTemplateResponse.Item(null, e);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>items[i] = new <MASK><NEW_LINE>if (searchRequest != null) {<NEW_LINE>multiSearchRequest.add(searchRequest);<NEW_LINE>originalSlots.add(i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>client.multiSearch(multiSearchRequest, ActionListener.wrap(r -> {<NEW_LINE>for (int i = 0; i < r.getResponses().length; i++) {<NEW_LINE>MultiSearchResponse.Item item = r.getResponses()[i];<NEW_LINE>int originalSlot = originalSlots.get(i);<NEW_LINE>if (item.isFailure()) {<NEW_LINE>items[originalSlot] = new MultiSearchTemplateResponse.Item(null, item.getFailure());<NEW_LINE>} else {<NEW_LINE>items[originalSlot].getResponse().setResponse(item.getResponse());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>listener.onResponse(new MultiSearchTemplateResponse(items, r.getTook().millis()));<NEW_LINE>}, listener::onFailure));<NEW_LINE>} | MultiSearchTemplateResponse.Item(searchTemplateResponse, null); |
1,754,663 | public ListUserSettingsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListUserSettingsResult listUserSettingsResult = new ListUserSettingsResult();<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 listUserSettingsResult;<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("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listUserSettingsResult.setNextToken(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("userSettings", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listUserSettingsResult.setUserSettings(new ListUnmarshaller<UserSettingsSummary>(UserSettingsSummaryJsonUnmarshaller.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 listUserSettingsResult;<NEW_LINE>} | class).unmarshall(context)); |
1,468,372 | public static DateTimeFieldSpec convertToDateTimeFieldSpec(TimeFieldSpec timeFieldSpec) {<NEW_LINE>DateTimeFieldSpec dateTimeFieldSpec = new DateTimeFieldSpec();<NEW_LINE>TimeGranularitySpec incomingGranularitySpec = timeFieldSpec.getIncomingGranularitySpec();<NEW_LINE>TimeGranularitySpec outgoingGranularitySpec = timeFieldSpec.getOutgoingGranularitySpec();<NEW_LINE>dateTimeFieldSpec.setName(outgoingGranularitySpec.getName());<NEW_LINE>dateTimeFieldSpec.setDataType(outgoingGranularitySpec.getDataType());<NEW_LINE>int outgoingTimeSize = outgoingGranularitySpec.getTimeUnitSize();<NEW_LINE>TimeUnit outgoingTimeUnit = outgoingGranularitySpec.getTimeType();<NEW_LINE>String outgoingTimeFormat = outgoingGranularitySpec.getTimeFormat();<NEW_LINE>String[] split = StringUtils.split(outgoingTimeFormat, DateTimeFormatSpec.COLON_SEPARATOR, 2);<NEW_LINE>DateTimeFormatSpec formatSpec;<NEW_LINE>if (split[0].equals(DateTimeFieldSpec.TimeFormat.EPOCH.toString())) {<NEW_LINE>formatSpec = new DateTimeFormatSpec(outgoingTimeSize, outgoingTimeUnit.toString(), split[0]);<NEW_LINE>} else {<NEW_LINE>formatSpec = new DateTimeFormatSpec(outgoingTimeSize, outgoingTimeUnit.toString(), split[0], split[1]);<NEW_LINE>}<NEW_LINE>dateTimeFieldSpec.setFormat(formatSpec.getFormat());<NEW_LINE>DateTimeGranularitySpec granularitySpec = new DateTimeGranularitySpec(outgoingTimeSize, outgoingTimeUnit);<NEW_LINE>dateTimeFieldSpec.setGranularity(granularitySpec.getGranularity());<NEW_LINE>if (timeFieldSpec.getTransformFunction() != null) {<NEW_LINE>dateTimeFieldSpec.setTransformFunction(timeFieldSpec.getTransformFunction());<NEW_LINE>} else if (!incomingGranularitySpec.equals(outgoingGranularitySpec)) {<NEW_LINE>String incomingName = incomingGranularitySpec.getName();<NEW_LINE>int incomingTimeSize = incomingGranularitySpec.getTimeUnitSize();<NEW_LINE>TimeUnit incomingTimeUnit = incomingGranularitySpec.getTimeType();<NEW_LINE>String incomingTimeFormat = incomingGranularitySpec.getTimeFormat();<NEW_LINE>Preconditions.checkState((incomingTimeFormat.equals(DateTimeFieldSpec.TimeFormat.EPOCH.toString()) || incomingTimeFormat.equals(DateTimeFieldSpec.TimeFormat.TIMESTAMP.toString())) && outgoingTimeFormat.equals(incomingTimeFormat), "Conversion from incoming to outgoing is not supported for SIMPLE_DATE_FORMAT");<NEW_LINE>String transformFunction = constructTransformFunctionString(incomingName, <MASK><NEW_LINE>dateTimeFieldSpec.setTransformFunction(transformFunction);<NEW_LINE>}<NEW_LINE>dateTimeFieldSpec.setMaxLength(timeFieldSpec.getMaxLength());<NEW_LINE>dateTimeFieldSpec.setDefaultNullValue(timeFieldSpec.getDefaultNullValue());<NEW_LINE>return dateTimeFieldSpec;<NEW_LINE>} | incomingTimeSize, incomingTimeUnit, outgoingTimeSize, outgoingTimeUnit); |
1,345,609 | public int findLesser(String word) {<NEW_LINE>word = word.toLowerCase(locale);<NEW_LINE>List<String> dict = getDictionary();<NEW_LINE>int lower = 0;<NEW_LINE>int upper <MASK><NEW_LINE>boolean last = false;<NEW_LINE>while (true) {<NEW_LINE>if (lower == upper)<NEW_LINE>break;<NEW_LINE>if (last)<NEW_LINE>break;<NEW_LINE>if ((upper - lower) == 1)<NEW_LINE>last = true;<NEW_LINE>int current = (lower + upper) / 2;<NEW_LINE>String currentObj = dict.get(current);<NEW_LINE>int result = currentObj.toLowerCase(locale).compareTo(word);<NEW_LINE>if (result == 0)<NEW_LINE>return current;<NEW_LINE>if (result < 0) {<NEW_LINE>lower = current + 1;<NEW_LINE>}<NEW_LINE>if (result > 0) {<NEW_LINE>upper = current - 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (dict.get(lower).toLowerCase(locale).compareTo(word) == 0)<NEW_LINE>return lower;<NEW_LINE>else<NEW_LINE>return (lower + 1) < dict.size() ? lower + 1 : lower;<NEW_LINE>} | = dict.size() - 1; |
351,826 | void deleteRecordActionPerformed() {<NEW_LINE>assert dataPage.getTableMetaData().getTableCount() == 1 : "Only one table allowed in resultset if delete is invoked";<NEW_LINE>DataViewTableUI rsTable = dataViewUI.getDataViewTableUI();<NEW_LINE>if (rsTable.getSelectedRowCount() == 0) {<NEW_LINE>String msg = NbBundle.getMessage(DataViewActionHandler.class, "MSG_select_delete_rows");<NEW_LINE>dataView.setInfoStatusText(msg);<NEW_LINE>} else {<NEW_LINE>String msg = NbBundle.getMessage(DataViewActionHandler.class, "MSG_confirm_permanent_delete");<NEW_LINE>if ((showYesAllDialog(msg, NbBundle.getMessage(DataViewActionHandler.class, "MSG_confirm_delete"))).equals(NotifyDescriptor.YES_OPTION)) {<NEW_LINE>DBTable table = dataPage.<MASK><NEW_LINE>execHelper.executeDeleteRow(dataPage, table, rsTable);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getTableMetaData().getTable(0); |
1,075,455 | private Response sendVerifyEmail(KeycloakSession session, LoginFormsProvider forms, UserModel user, AuthenticationSessionModel authSession, EventBuilder event) throws UriBuilderException, IllegalArgumentException {<NEW_LINE>RealmModel realm = session.getContext().getRealm();<NEW_LINE>UriInfo uriInfo = session.getContext().getUri();<NEW_LINE>int validityInSecs = realm.getActionTokenGeneratedByUserLifespan(VerifyEmailActionToken.TOKEN_TYPE);<NEW_LINE>int absoluteExpirationInSecs = Time.currentTime() + validityInSecs;<NEW_LINE>String authSessionEncodedId = AuthenticationSessionCompoundId.<MASK><NEW_LINE>VerifyEmailActionToken token = new VerifyEmailActionToken(user.getId(), absoluteExpirationInSecs, authSessionEncodedId, user.getEmail(), authSession.getClient().getClientId());<NEW_LINE>UriBuilder builder = Urls.actionTokenBuilder(uriInfo.getBaseUri(), token.serialize(session, realm, uriInfo), authSession.getClient().getClientId(), authSession.getTabId());<NEW_LINE>String link = builder.build(realm.getName()).toString();<NEW_LINE>long expirationInMinutes = TimeUnit.SECONDS.toMinutes(validityInSecs);<NEW_LINE>try {<NEW_LINE>session.getProvider(EmailTemplateProvider.class).setAuthenticationSession(authSession).setRealm(realm).setUser(user).sendVerifyEmail(link, expirationInMinutes);<NEW_LINE>event.success();<NEW_LINE>} catch (EmailException e) {<NEW_LINE>logger.error("Failed to send verification email", e);<NEW_LINE>event.error(Errors.EMAIL_SEND_FAILED);<NEW_LINE>}<NEW_LINE>return forms.createResponse(UserModel.RequiredAction.VERIFY_EMAIL);<NEW_LINE>} | fromAuthSession(authSession).getEncodedId(); |
341,204 | Map<String, Object> mapFieldsFromJson(final String json) throws JsonProcessingException, DotDataException, DotSecurityException {<NEW_LINE>final Contentlet immutableContentlet = immutableFromJson(json);<NEW_LINE>final Map<String, Object> <MASK><NEW_LINE>final String inode = immutableContentlet.inode();<NEW_LINE>final String identifier = immutableContentlet.identifier();<NEW_LINE>final String contentTypeId = immutableContentlet.contentType();<NEW_LINE>map.put(INODE_KEY, inode);<NEW_LINE>map.put(IDENTIFIER_KEY, identifier);<NEW_LINE>map.put(STRUCTURE_INODE_KEY, contentTypeId);<NEW_LINE>map.put(MOD_DATE_KEY, Date.from(immutableContentlet.modDate()));<NEW_LINE>map.put(MOD_USER_KEY, immutableContentlet.modUser());<NEW_LINE>map.put(OWNER_KEY, immutableContentlet.owner());<NEW_LINE>map.put(TITTLE_KEY, immutableContentlet.title());<NEW_LINE>map.put(SORT_ORDER_KEY, immutableContentlet.sortOrder());<NEW_LINE>map.put(LANGUAGEID_KEY, immutableContentlet.languageId());<NEW_LINE>map.put(DISABLED_WYSIWYG_KEY, immutableContentlet.disabledWysiwyg());<NEW_LINE>final ContentType contentType = contentTypeAPI.find(contentTypeId);<NEW_LINE>final Map<String, Field> fieldsByVarName = contentType.fields().stream().collect(Collectors.toMap(Field::variable, Function.identity()));<NEW_LINE>final Map<String, FieldValue<?>> contentletFields = immutableContentlet.fields();<NEW_LINE>for (final Entry<String, Field> entry : fieldsByVarName.entrySet()) {<NEW_LINE>final Field field = entry.getValue();<NEW_LINE>if (isNotMappable(field)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Object value;<NEW_LINE>if (isSet(identifier) && isFileAsset(contentType, field)) {<NEW_LINE>value = identifierAPI.find(identifier).getAssetName();<NEW_LINE>} else {<NEW_LINE>if (field instanceof BinaryField) {<NEW_LINE>value = getBinary(field, inode).orElse(null);<NEW_LINE>} else {<NEW_LINE>value = getValue(contentletFields, field);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>map.put(field.variable(), value);<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | map = new HashMap<>(); |
80,232 | public AgentInfoBo map(TAgentInfo thriftObject) {<NEW_LINE>final String hostName = thriftObject.getHostname();<NEW_LINE>final String ip = thriftObject.getIp();<NEW_LINE>final String ports = thriftObject.getPorts();<NEW_LINE>final String agentId = thriftObject.getAgentId();<NEW_LINE>final String agentName = thriftObject.getAgentName();<NEW_LINE>final String applicationName = thriftObject.getApplicationName();<NEW_LINE>final short serviceType = thriftObject.getServiceType();<NEW_LINE>final int pid = thriftObject.getPid();<NEW_LINE>final String vmVersion = thriftObject.getVmVersion();<NEW_LINE>final String agentVersion = thriftObject.getAgentVersion();<NEW_LINE>final long startTime = thriftObject.getStartTimestamp();<NEW_LINE>final long endTimeStamp = thriftObject.getEndTimestamp();<NEW_LINE>final <MASK><NEW_LINE>final boolean container = thriftObject.isContainer();<NEW_LINE>final AgentInfoBo.Builder builder = new AgentInfoBo.Builder();<NEW_LINE>builder.setHostName(hostName);<NEW_LINE>builder.setIp(ip);<NEW_LINE>builder.setPorts(ports);<NEW_LINE>builder.setAgentId(agentId);<NEW_LINE>builder.setAgentName(agentName);<NEW_LINE>builder.setApplicationName(applicationName);<NEW_LINE>builder.setServiceTypeCode(serviceType);<NEW_LINE>builder.setPid(pid);<NEW_LINE>builder.setVmVersion(vmVersion);<NEW_LINE>builder.setAgentVersion(agentVersion);<NEW_LINE>builder.setStartTime(startTime);<NEW_LINE>builder.setEndTimeStamp(endTimeStamp);<NEW_LINE>builder.setEndStatus(endStatus);<NEW_LINE>builder.isContainer(container);<NEW_LINE>if (thriftObject.isSetServerMetaData()) {<NEW_LINE>builder.setServerMetaData(this.serverMetaDataBoMapper.map(thriftObject.getServerMetaData()));<NEW_LINE>}<NEW_LINE>if (thriftObject.isSetJvmInfo()) {<NEW_LINE>builder.setJvmInfo(this.jvmInfoBoMapper.map(thriftObject.getJvmInfo()));<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | int endStatus = thriftObject.getEndStatus(); |
160,252 | private void endTextClip() {<NEW_LINE>PDGraphicsState state = getGraphicsState();<NEW_LINE>RenderingMode renderingMode = state.getTextState().getRenderingMode();<NEW_LINE>// apply the buffered clip as one area<NEW_LINE>if (renderingMode.isClip() && !textClippings.isEmpty()) {<NEW_LINE>// PDFBOX-4150: this is much faster than using textClippingArea.add(new Area(glyph))<NEW_LINE>// https://stackoverflow.com/questions/21519007/fast-union-of-shapes-in-java<NEW_LINE>Path path = new Path();<NEW_LINE>for (Path shape : textClippings) {<NEW_LINE>path.addPath(shape);<NEW_LINE>}<NEW_LINE>state.intersectClippingPath(path);<NEW_LINE>textClippings <MASK><NEW_LINE>// PDFBOX-3681: lastClip needs to be reset, because after intersection it is still the same<NEW_LINE>// object, thus setClip() would believe that it is cached.<NEW_LINE>lastClip = null;<NEW_LINE>}<NEW_LINE>} | = new ArrayList<Path>(); |
1,748,996 | protected void onHandleIntent(Intent intent) {<NEW_LINE>mTodoText = intent.getStringExtra(TODOTEXT);<NEW_LINE>mTodoUUID = (UUID) intent.getSerializableExtra(TODOUUID);<NEW_LINE>Log.d("OskarSchindler", "onHandleIntent called");<NEW_LINE>NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);<NEW_LINE>Intent i = new Intent(this, ReminderActivity.class);<NEW_LINE>i.putExtra(TodoNotificationService.TODOUUID, mTodoUUID);<NEW_LINE>Intent deleteIntent = new <MASK><NEW_LINE>deleteIntent.putExtra(TODOUUID, mTodoUUID);<NEW_LINE>Notification notification = new Notification.Builder(this).setContentTitle(mTodoText).setSmallIcon(R.drawable.ic_done_white_24dp).setAutoCancel(true).setDefaults(Notification.DEFAULT_SOUND).setDeleteIntent(PendingIntent.getService(this, mTodoUUID.hashCode(), deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT)).setContentIntent(PendingIntent.getActivity(this, mTodoUUID.hashCode(), i, PendingIntent.FLAG_UPDATE_CURRENT)).build();<NEW_LINE>manager.notify(100, notification);<NEW_LINE>// Uri defaultRingone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);<NEW_LINE>// MediaPlayer mp = new MediaPlayer();<NEW_LINE>// try{<NEW_LINE>// mp.setDataSource(this, defaultRingone);<NEW_LINE>// mp.setAudioStreamType(AudioManager.STREAM_NOTIFICATION);<NEW_LINE>// mp.prepare();<NEW_LINE>// mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {<NEW_LINE>// @Override<NEW_LINE>// public void onCompletion(MediaPlayer mp) {<NEW_LINE>// mp.release();<NEW_LINE>// }<NEW_LINE>// });<NEW_LINE>// mp.start();<NEW_LINE>//<NEW_LINE>// }<NEW_LINE>// catch (Exception e){<NEW_LINE>// e.printStackTrace();<NEW_LINE>// }<NEW_LINE>} | Intent(this, DeleteNotificationService.class); |
839,445 | public CreateCallAnalyticsCategoryResult createCallAnalyticsCategory(CreateCallAnalyticsCategoryRequest createCallAnalyticsCategoryRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createCallAnalyticsCategoryRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateCallAnalyticsCategoryRequest> request = null;<NEW_LINE>Response<CreateCallAnalyticsCategoryResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateCallAnalyticsCategoryRequestMarshaller().marshall(createCallAnalyticsCategoryRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<CreateCallAnalyticsCategoryResult, JsonUnmarshallerContext> unmarshaller = new CreateCallAnalyticsCategoryResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<CreateCallAnalyticsCategoryResult> responseHandler = new JsonResponseHandler<CreateCallAnalyticsCategoryResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
567,445 | public MessageStore create(SessionID sessionID) {<NEW_LINE>try {<NEW_LINE>String dbDir = <MASK><NEW_LINE>String seqDbName = "seq";<NEW_LINE>if (settings.isSetting(sessionID, SETTING_SLEEPYCAT_SEQUENCE_DB_NAME)) {<NEW_LINE>seqDbName = settings.getString(sessionID, SETTING_SLEEPYCAT_SEQUENCE_DB_NAME);<NEW_LINE>}<NEW_LINE>String msgDbName = "msg";<NEW_LINE>if (settings.isSetting(sessionID, SETTING_SLEEPYCAT_MESSAGE_DB_NAME)) {<NEW_LINE>msgDbName = settings.getString(sessionID, SETTING_SLEEPYCAT_MESSAGE_DB_NAME);<NEW_LINE>}<NEW_LINE>return new SleepycatStore(sessionID, dbDir, seqDbName, msgDbName);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeError(e);<NEW_LINE>}<NEW_LINE>} | settings.getString(sessionID, SETTING_SLEEPYCAT_DATABASE_DIR); |
1,172,225 | public void main(StatCollector stat, Runnable appInitializeMark, ApplicationEx app, boolean newConfigFolder, @Nonnull CommandLineArgs args) {<NEW_LINE>appInitializeMark.run();<NEW_LINE>stat.dump("Startup statistics", LOG::info);<NEW_LINE>PluginLoadStatistics.get().dumpPluginClassStatistics(LOG::info);<NEW_LINE>SwingUtilities.invokeLater(() -> {<NEW_LINE>StartupProgress desktopSplash = mySplashRef.get();<NEW_LINE>if (desktopSplash != null) {<NEW_LINE>desktopSplash.dispose();<NEW_LINE>mySplashRef.set(null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>TopMenuInitializer.register(app);<NEW_LINE>if (myPlatform.os().isMac()) {<NEW_LINE>MacTopMenuInitializer.installAutoUpdateMenu();<NEW_LINE>} else if (myPlatform.os().isWindowsVistaOrNewer()) {<NEW_LINE>WindowsAutoRestartManager.register();<NEW_LINE>}<NEW_LINE>if (Boolean.getBoolean("consulo.first.start.testing") || newConfigFolder && !ApplicationProperties.isInSandbox()) {<NEW_LINE>SwingUtilities.invokeLater(() -> FirstStartCustomizeUtil.showDialog(true));<NEW_LINE>} else {<NEW_LINE>SystemDock.getInstance().updateMenu();<NEW_LINE>// Event queue should not be changed during initialization of application components.<NEW_LINE>// It also cannot be changed before initialization of application components because IdeEventQueue uses other<NEW_LINE>// application components. So it is proper to perform replacement only here.<NEW_LINE>DesktopWindowManagerImpl windowManager = (DesktopWindowManagerImpl) WindowManager.getInstance();<NEW_LINE>IdeEventQueue.getInstance().setWindowManager(windowManager);<NEW_LINE>RecentProjectsManagerBase recentProjectsManager = (RecentProjectsManagerBase) RecentProjectsManager.getInstance();<NEW_LINE>if (recentProjectsManager.willReopenProjectOnStart() && !args.isNoRecentProjects()) {<NEW_LINE>app.invokeLater(windowManager::<MASK><NEW_LINE>} else {<NEW_LINE>app.invokeLater(() -> WelcomeFrameManager.getInstance().showFrame(), ModalityState.any());<NEW_LINE>}<NEW_LINE>app.invokeLater(() -> {<NEW_LINE>if (!args.isNoRecentProjects()) {<NEW_LINE>AsyncResult<Project> projectFromCommandLine = AsyncResult.rejected();<NEW_LINE>if (isPerformProjectLoad()) {<NEW_LINE>projectFromCommandLine = CommandLineProcessor.processExternalCommandLine(args, null);<NEW_LINE>}<NEW_LINE>projectFromCommandLine.doWhenRejected(recentProjectsManager::doReopenLastProject);<NEW_LINE>}<NEW_LINE>if (args.getJson() != null) {<NEW_LINE>runJsonRequest(args.getJson());<NEW_LINE>}<NEW_LINE>SwingUtilities.invokeLater(() -> reportPluginError(myPluginsInitializeInfo));<NEW_LINE>UsageTrigger.trigger("consulo.app.started");<NEW_LINE>}, ModalityState.NON_MODAL);<NEW_LINE>}<NEW_LINE>} | showFrame, ModalityState.any()); |
111,738 | public CompletableFuture<Integer> start(final int tcpPort) {<NEW_LINE>if (config.isActive()) {<NEW_LINE>final String host = config.getBindHost();<NEW_LINE>final int port = config.getBindPort();<NEW_LINE>LOG.info("Starting peer discovery agent on host={}, port={}", host, port);<NEW_LINE>// override advertised host if we detect an external IP address via NAT manager<NEW_LINE>this.advertisedAddress = natService.queryExternalIPAddress(config.getAdvertisedHost());<NEW_LINE>return listenForConnections().thenApply((InetSocketAddress localAddress) -> {<NEW_LINE>// Once listener is set up, finish initializing<NEW_LINE>final int discoveryPort = localAddress.getPort();<NEW_LINE>final DiscoveryPeer ourNode = DiscoveryPeer.fromEnode(EnodeURLImpl.builder().nodeId(id).ipAddress(advertisedAddress).listeningPort(tcpPort).discoveryPort(discoveryPort).build());<NEW_LINE>this.<MASK><NEW_LINE>isActive = true;<NEW_LINE>LOG.info("P2P peer discovery agent started and listening on {}", localAddress);<NEW_LINE>updateNodeRecord();<NEW_LINE>startController(ourNode);<NEW_LINE>return discoveryPort;<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>this.isActive = false;<NEW_LINE>return CompletableFuture.completedFuture(0);<NEW_LINE>}<NEW_LINE>} | localNode = Optional.of(ourNode); |
307,356 | private static PartitionMetricSample readV0(ByteBuffer buffer) {<NEW_LINE>MetricDef metricDef = KafkaMetricDef.commonMetricDef();<NEW_LINE>int brokerId = buffer.getInt();<NEW_LINE>int <MASK><NEW_LINE>String topic = new String(buffer.array(), 49, buffer.array().length - 49, UTF_8);<NEW_LINE>PartitionMetricSample sample = new PartitionMetricSample(brokerId, new TopicPartition(topic, partition));<NEW_LINE>sample.record(metricDef.metricInfo(CPU_USAGE.name()), buffer.getDouble());<NEW_LINE>sample.record(metricDef.metricInfo(DISK_USAGE.name()), buffer.getDouble());<NEW_LINE>sample.record(metricDef.metricInfo(LEADER_BYTES_IN.name()), buffer.getDouble());<NEW_LINE>sample.record(metricDef.metricInfo(LEADER_BYTES_OUT.name()), buffer.getDouble());<NEW_LINE>sample.close(buffer.getLong());<NEW_LINE>return sample;<NEW_LINE>} | partition = buffer.getInt(45); |
1,186,778 | public static GetTaskInstanceRelationResponse unmarshall(GetTaskInstanceRelationResponse getTaskInstanceRelationResponse, UnmarshallerContext _ctx) {<NEW_LINE>getTaskInstanceRelationResponse.setRequestId(_ctx.stringValue("GetTaskInstanceRelationResponse.RequestId"));<NEW_LINE>getTaskInstanceRelationResponse.setErrorCode(_ctx.stringValue("GetTaskInstanceRelationResponse.ErrorCode"));<NEW_LINE>getTaskInstanceRelationResponse.setErrorMessage(_ctx.stringValue("GetTaskInstanceRelationResponse.ErrorMessage"));<NEW_LINE>getTaskInstanceRelationResponse.setSuccess(_ctx.booleanValue("GetTaskInstanceRelationResponse.Success"));<NEW_LINE>List<Node> nodeList = new ArrayList<Node>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetTaskInstanceRelationResponse.NodeList.Length"); i++) {<NEW_LINE>Node node = new Node();<NEW_LINE>node.setId(_ctx.longValue("GetTaskInstanceRelationResponse.NodeList[" + i + "].Id"));<NEW_LINE>node.setNodeId(_ctx.longValue("GetTaskInstanceRelationResponse.NodeList[" + i + "].NodeId"));<NEW_LINE>node.setNodeName(_ctx.stringValue("GetTaskInstanceRelationResponse.NodeList[" + i + "].NodeName"));<NEW_LINE>node.setNodeType(_ctx.integerValue("GetTaskInstanceRelationResponse.NodeList[" + i + "].NodeType"));<NEW_LINE>node.setBusinessTime(_ctx.stringValue("GetTaskInstanceRelationResponse.NodeList[" + i + "].BusinessTime"));<NEW_LINE>node.setStatus(_ctx.integerValue("GetTaskInstanceRelationResponse.NodeList[" + i + "].Status"));<NEW_LINE>node.setMessage(_ctx.stringValue("GetTaskInstanceRelationResponse.NodeList[" + i + "].Message"));<NEW_LINE>node.setExecuteTime(_ctx.longValue("GetTaskInstanceRelationResponse.NodeList[" + i + "].ExecuteTime"));<NEW_LINE>node.setEndTime(_ctx.stringValue<MASK><NEW_LINE>nodeList.add(node);<NEW_LINE>}<NEW_LINE>getTaskInstanceRelationResponse.setNodeList(nodeList);<NEW_LINE>return getTaskInstanceRelationResponse;<NEW_LINE>} | ("GetTaskInstanceRelationResponse.NodeList[" + i + "].EndTime")); |
363,854 | public void updateMessageWithNewAttachments(final String messageId, final List<File> files) {<NEW_LINE>Realm realm = MessageDatabaseManager.getInstance().getNewBackgroundRealm();<NEW_LINE>realm.executeTransaction(new Realm.Transaction() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void execute(Realm realm) {<NEW_LINE>MessageItem messageItem = realm.where(MessageItem.class).equalTo(MessageItem.Fields.UNIQUE_ID, messageId).findFirst();<NEW_LINE>if (messageItem != null) {<NEW_LINE>RealmList<Attachment> attachments = messageItem.getAttachments();<NEW_LINE>// remove temporary attachments created from uri<NEW_LINE>// to replace it with attachments created from files<NEW_LINE>attachments.deleteAllFromRealm();<NEW_LINE>for (File file : files) {<NEW_LINE>Attachment attachment = new Attachment();<NEW_LINE>attachment.setFilePath(file.getPath());<NEW_LINE>attachment.setFileSize(file.length());<NEW_LINE>attachment.setTitle(file.getName());<NEW_LINE>attachment.setIsImage(FileManager.fileIsImage(file));<NEW_LINE>attachment.setMimeType(HttpFileUploadManager.getMimeType(file.getPath()));<NEW_LINE>attachment.setDuration((long) 0);<NEW_LINE>if (attachment.isImage()) {<NEW_LINE>HttpFileUploadManager.ImageSize imageSize = HttpFileUploadManager.getImageSizes(file.getPath());<NEW_LINE>attachment.setImageHeight(imageSize.getHeight());<NEW_LINE>attachment.<MASK><NEW_LINE>}<NEW_LINE>attachments.add(attachment);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | setImageWidth(imageSize.getWidth()); |
232,633 | final DeleteCrossAccountAuthorizationResult executeDeleteCrossAccountAuthorization(DeleteCrossAccountAuthorizationRequest deleteCrossAccountAuthorizationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteCrossAccountAuthorizationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteCrossAccountAuthorizationRequest> request = null;<NEW_LINE>Response<DeleteCrossAccountAuthorizationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteCrossAccountAuthorizationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteCrossAccountAuthorizationRequest));<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, "Route53 Recovery Readiness");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteCrossAccountAuthorization");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteCrossAccountAuthorizationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteCrossAccountAuthorizationResultJsonUnmarshaller());<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.endEvent(Field.RequestMarshallTime); |
1,666,839 | protected ListBuffer<JCStatement> generatePluralMethodStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType, JavacNode source) {<NEW_LINE>List<JCExpression<MASK><NEW_LINE>ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();<NEW_LINE>long baseFlags = JavacHandlerUtil.addFinalIfNeeded(0, builderType.getContext());<NEW_LINE>Name entryName = builderType.toName("$lombokEntry");<NEW_LINE>JCExpression forEachType = chainDots(builderType, "java", "util", "Map", "Entry");<NEW_LINE>forEachType = addTypeArgs(2, true, builderType, forEachType, data.getTypeArgs(), source);<NEW_LINE>JCExpression keyArg = maker.Apply(List.<JCExpression>nil(), maker.Select(maker.Ident(entryName), builderType.toName("getKey")), List.<JCExpression>nil());<NEW_LINE>JCExpression valueArg = maker.Apply(List.<JCExpression>nil(), maker.Select(maker.Ident(entryName), builderType.toName("getValue")), List.<JCExpression>nil());<NEW_LINE>JCExpression addKey = maker.Apply(List.<JCExpression>nil(), chainDots(builderType, "this", data.getPluralName() + "$key", "add"), List.of(keyArg));<NEW_LINE>JCExpression addValue = maker.Apply(List.<JCExpression>nil(), chainDots(builderType, "this", data.getPluralName() + "$value", "add"), List.of(valueArg));<NEW_LINE>JCBlock forEachBody = maker.Block(0, List.<JCStatement>of(maker.Exec(addKey), maker.Exec(addValue)));<NEW_LINE>JCExpression entrySetInvocation = maker.Apply(jceBlank, maker.Select(maker.Ident(data.getPluralName()), builderType.toName("entrySet")), jceBlank);<NEW_LINE>JCStatement forEach = maker.ForeachLoop(maker.VarDef(maker.Modifiers(baseFlags), entryName, forEachType, null), entrySetInvocation, forEachBody);<NEW_LINE>statements.append(forEach);<NEW_LINE>return statements;<NEW_LINE>} | > jceBlank = List.nil(); |
1,395,461 | public IRubyObject to_s() {<NEW_LINE>final Ruby runtime = metaClass.runtime;<NEW_LINE>if (Double.isInfinite(value)) {<NEW_LINE>return RubyString.newString(runtime, value < 0 ? "-Infinity" : "Infinity");<NEW_LINE>}<NEW_LINE>if (Double.isNaN(value)) {<NEW_LINE>return RubyString.newString(runtime, "NaN");<NEW_LINE>}<NEW_LINE>ByteList buf = new ByteList();<NEW_LINE>// Under 1.9, use full-precision float formatting (JRUBY-4846).<NEW_LINE>// Double-precision can represent around 16 decimal digits;<NEW_LINE>// we use 20 to ensure full representation.<NEW_LINE>Sprintf.sprintf(buf, Locale.US, "%#.20g", this);<NEW_LINE>int <MASK><NEW_LINE>if (e == -1)<NEW_LINE>e = buf.getRealSize();<NEW_LINE>ASCIIEncoding ascii = ASCIIEncoding.INSTANCE;<NEW_LINE>if (!ascii.isDigit(buf.get(e - 1))) {<NEW_LINE>buf.setRealSize(0);<NEW_LINE>Sprintf.sprintf(buf, Locale.US, "%#.14e", this);<NEW_LINE>e = buf.indexOf('e');<NEW_LINE>if (e == -1)<NEW_LINE>e = buf.getRealSize();<NEW_LINE>}<NEW_LINE>int p = e;<NEW_LINE>while (buf.get(p - 1) == '0' && ascii.isDigit(buf.get(p - 2))) p--;<NEW_LINE>System.arraycopy(buf.getUnsafeBytes(), e, buf.getUnsafeBytes(), p, buf.getRealSize() - e);<NEW_LINE>buf.setRealSize(p + buf.getRealSize() - e);<NEW_LINE>buf.setEncoding(USASCIIEncoding.INSTANCE);<NEW_LINE>return runtime.newString(buf);<NEW_LINE>} | e = buf.indexOf('e'); |
1,420,552 | private OResult toTraverseResult(OResult item) {<NEW_LINE>OTraverseResult res = null;<NEW_LINE>if (item instanceof OTraverseResult) {<NEW_LINE>res = (OTraverseResult) item;<NEW_LINE>} else if (item.isElement() && item.getElement().get().getIdentity().isValid()) {<NEW_LINE>res = new OTraverseResult();<NEW_LINE>res.setElement(item.getElement().get());<NEW_LINE>res.depth = 0;<NEW_LINE>} else if (item.getPropertyNames().size() == 1) {<NEW_LINE>Object val = item.getProperty(item.getPropertyNames().iterator().next());<NEW_LINE>if (val instanceof OIdentifiable) {<NEW_LINE>res = new OTraverseResult();<NEW_LINE>res<MASK><NEW_LINE>res.depth = 0;<NEW_LINE>res.setMetadata("$depth", 0);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>res = new OTraverseResult();<NEW_LINE>for (String key : item.getPropertyNames()) {<NEW_LINE>res.setProperty(key, convert(item.getProperty(key)));<NEW_LINE>}<NEW_LINE>for (String md : item.getMetadataKeys()) {<NEW_LINE>res.setMetadata(md, item.getMetadata(md));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return res;<NEW_LINE>} | .setElement((OIdentifiable) val); |
560,261 | public void onClick(@NonNull View v) {<NEW_LINE>RecyclerView rv = RecyclerViewAdapterUtils.getParentRecyclerView(v);<NEW_LINE>RecyclerView.ViewHolder vh = rv.findContainingViewHolder(v);<NEW_LINE>int rootPosition = vh.getAdapterPosition();<NEW_LINE>if (rootPosition == RecyclerView.NO_POSITION) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// need to determine adapter local position like this:<NEW_LINE>RecyclerView.<MASK><NEW_LINE>int localPosition = WrapperAdapterUtils.unwrapPosition(rootAdapter, this, rootPosition);<NEW_LINE>// get segment<NEW_LINE>long segmentedPosition = getSegmentedPosition(localPosition);<NEW_LINE>int segment = extractSegmentPart(segmentedPosition);<NEW_LINE>int offset = extractSegmentOffsetPart(segmentedPosition);<NEW_LINE>String message;<NEW_LINE>if (segment == SEGMENT_TYPE_HEADER) {<NEW_LINE>message = "CLICKED: Header item " + offset;<NEW_LINE>} else if (segment == SEGMENT_TYPE_FOOTER) {<NEW_LINE>message = "CLICKED: Footer item " + offset;<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Something wrong.");<NEW_LINE>}<NEW_LINE>mOnItemClickListener.onItemClicked(message);<NEW_LINE>} | Adapter rootAdapter = rv.getAdapter(); |
573,318 | public void expireTimeout(Timer t) {<NEW_LINE>svLogger.logp(Level.INFO, CLASSNAME, "expireTimeout", "Timeout, t == {0}", t);<NEW_LINE>svInfo = (String) t.getInfo();<NEW_LINE>svLogger.logp(Level.FINEST, CLASSNAME, "expireTimeout", "info == {0}", svInfo);<NEW_LINE>if ("testGetNextTimeoutCanceledIntervalTimer".equals(svInfo)) {<NEW_LINE>svLogger.logp(Level.FINEST, CLASSNAME, "expireTimeout", "canceling timer");<NEW_LINE>t.cancel();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>svNextTimeout = df.format(t.getNextTimeout());<NEW_LINE>} catch (NoMoreTimeoutsException ex) {<NEW_LINE>svNextTimeout = "NoMoreTimeoutsException";<NEW_LINE>} catch (NoSuchObjectLocalException ex) {<NEW_LINE>svNextTimeout = "NoSuchObjectLocalException";<NEW_LINE>} catch (Throwable th) {<NEW_LINE>String msg = "Caught unexpected exception from timer.getNextTimeout()" + th.toString();<NEW_LINE>svLogger.logp(Level.INFO, CLASSNAME, "expireTimeout", msg, th);<NEW_LINE>svNextTimeout = th<MASK><NEW_LINE>}<NEW_LINE>if (svNextTimeout == null) {<NEW_LINE>svNextTimeout = "UNKNOWN";<NEW_LINE>}<NEW_LINE>svLogger.info("svNextTimeout = " + svNextTimeout);<NEW_LINE>svNextTimeoutLatch.countDown();<NEW_LINE>svNextTimeoutLatch = new CountDownLatch(1);<NEW_LINE>} | .getClass().getSimpleName(); |
364,558 | public void doOperation(final ImportJavaRDDOfElements operation, final Context context, final AccumuloStore store) throws OperationException {<NEW_LINE>final String outputPath = operation.getOption(OUTPUT_PATH);<NEW_LINE>if (null == outputPath || outputPath.isEmpty()) {<NEW_LINE>throw new OperationException("Option outputPath must be set for this option to be run against the accumulostore");<NEW_LINE>}<NEW_LINE>final String <MASK><NEW_LINE>if (null == failurePath || failurePath.isEmpty()) {<NEW_LINE>throw new OperationException("Option failurePath must be set for this option to be run against the accumulostore");<NEW_LINE>}<NEW_LINE>final SparkContext sparkContext = SparkContextUtil.getSparkSession(context, store.getProperties()).sparkContext();<NEW_LINE>final Broadcast<AccumuloElementConverter> broadcast = JavaSparkContext.fromSparkContext(sparkContext).broadcast(store.getKeyPackage().getKeyConverter());<NEW_LINE>final ElementConverterFunction func = new ElementConverterFunction(broadcast);<NEW_LINE>final JavaPairRDD<Key, Value> rdd = operation.getInput().flatMapToPair(func);<NEW_LINE>final ImportKeyValueJavaPairRDDToAccumulo op = new ImportKeyValueJavaPairRDDToAccumulo.Builder().input(rdd).failurePath(failurePath).outputPath(outputPath).build();<NEW_LINE>store.execute(new OperationChain(op), context);<NEW_LINE>} | failurePath = operation.getOption(FAILURE_PATH); |
1,587,910 | Shape convertShapeBasics(C2jShape c2jShape, String shapeName) {<NEW_LINE>Shape shape = new Shape();<NEW_LINE>HashSet<String> shapesReferencedBy = new HashSet<String>();<NEW_LINE>shape.setReferencedBy(shapesReferencedBy);<NEW_LINE>shape.setName(CppViewHelper.convertToUpperCamel(shapeName));<NEW_LINE>String crossLinkedShapeDocs = addDocCrossLinks(c2jShape.getDocumentation(), c2jServiceModel.getMetadata().getUid(), shape.getName());<NEW_LINE>shape.setDocumentation(formatDocumentation(crossLinkedShapeDocs, 3));<NEW_LINE>if (c2jShape.getEnums() != null) {<NEW_LINE>shape.setEnumValues(new ArrayList<>(c2jShape.getEnums()));<NEW_LINE>} else {<NEW_LINE>shape.setEnumValues(Collections.emptyList());<NEW_LINE>}<NEW_LINE>shape.setMax(c2jShape.getMax());<NEW_LINE>shape.setMin(c2jShape.getMin());<NEW_LINE>shape.setType(c2jShape.getType());<NEW_LINE>shape.setLocationName(c2jShape.getLocationName());<NEW_LINE>shape.setPayload(c2jShape.getPayload());<NEW_LINE>shape.<MASK><NEW_LINE>shape.setSensitive(c2jShape.isSensitive());<NEW_LINE>if ("timestamp".equalsIgnoreCase(shape.getType())) {<NEW_LINE>// shape's specific timestampFormat overrides the timestampFormat specified in metadata (if any)<NEW_LINE>shape.setTimestampFormat(c2jShape.getTimestampFormat() != null ? c2jShape.getTimestampFormat() : c2jServiceModel.getMetadata().getTimestampFormat());<NEW_LINE>}<NEW_LINE>shape.setEventStream(c2jShape.isEventstream());<NEW_LINE>shape.setEvent(c2jShape.isEvent());<NEW_LINE>shape.setException(c2jShape.isException());<NEW_LINE>shape.setDocument(c2jShape.isDocument());<NEW_LINE>if (c2jShape.getXmlNamespace() != null) {<NEW_LINE>XmlNamespace xmlns = new XmlNamespace();<NEW_LINE>xmlns.setUri(c2jShape.getXmlNamespace().getUri());<NEW_LINE>xmlns.setPrefix(c2jShape.getXmlNamespace().getPrefix());<NEW_LINE>shape.setXmlNamespace(xmlns);<NEW_LINE>}<NEW_LINE>return shape;<NEW_LINE>} | setFlattened(c2jShape.isFlattened()); |
625,226 | public static void average(Planar<GrayS8> from, GrayS8 to) {<NEW_LINE>int numBands = from.getNumBands();<NEW_LINE>if (numBands == 1) {<NEW_LINE>to.setTo(from.getBand(0));<NEW_LINE>} else if (numBands == 3) {<NEW_LINE>GrayS8 <MASK><NEW_LINE>GrayS8 band1 = from.getBand(1);<NEW_LINE>GrayS8 band2 = from.getBand(2);<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>for (int x = 0; x < from.width; x++, indexFrom++) {<NEW_LINE>int sum = band0.data[indexFrom];<NEW_LINE>sum += band1.data[indexFrom];<NEW_LINE>sum += band2.data[indexFrom];<NEW_LINE>to.data[indexTo++] = (byte) (sum / 3);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>for (int x = 0; x < from.width; x++, indexFrom++) {<NEW_LINE>int sum = 0;<NEW_LINE>for (int b = 0; b < numBands; b++) {<NEW_LINE>sum += from.bands[b].data[indexFrom];<NEW_LINE>}<NEW_LINE>to.data[indexTo++] = (byte) (sum / numBands);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>}<NEW_LINE>} | band0 = from.getBand(0); |
1,306,256 | public static Bitfield compileFlags(final serverObjects post) {<NEW_LINE>final Bitfield b = new Bitfield(4);<NEW_LINE>if (post.get("allurl", "").equals("on")) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (post.get("flags") != null) {<NEW_LINE>if (post.get("flags", "").isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return new Bitfield(4, post.get("flags"));<NEW_LINE>}<NEW_LINE>if (post.get("description", "").equals("on")) {<NEW_LINE>b.set(WordReferenceRow.flag_app_dc_description, true);<NEW_LINE>}<NEW_LINE>if (post.get("title", "").equals("on")) {<NEW_LINE>b.set(WordReferenceRow.flag_app_dc_title, true);<NEW_LINE>}<NEW_LINE>if (post.get("creator", "").equals("on")) {<NEW_LINE>b.set(WordReferenceRow.flag_app_dc_creator, true);<NEW_LINE>}<NEW_LINE>if (post.get("subject", "").equals("on")) {<NEW_LINE>b.set(WordReferenceRow.flag_app_dc_subject, true);<NEW_LINE>}<NEW_LINE>if (post.get("url", "").equals("on")) {<NEW_LINE>b.<MASK><NEW_LINE>}<NEW_LINE>if (post.get("emphasized", "").equals("on")) {<NEW_LINE>b.set(WordReferenceRow.flag_app_emphasized, true);<NEW_LINE>}<NEW_LINE>if (post.get("image", "").equals("on")) {<NEW_LINE>b.set(Tokenizer.flag_cat_hasimage, true);<NEW_LINE>}<NEW_LINE>if (post.get("audio", "").equals("on")) {<NEW_LINE>b.set(Tokenizer.flag_cat_hasaudio, true);<NEW_LINE>}<NEW_LINE>if (post.get("video", "").equals("on")) {<NEW_LINE>b.set(Tokenizer.flag_cat_hasvideo, true);<NEW_LINE>}<NEW_LINE>if (post.get("app", "").equals("on")) {<NEW_LINE>b.set(Tokenizer.flag_cat_hasapp, true);<NEW_LINE>}<NEW_LINE>if (post.get("indexof", "").equals("on")) {<NEW_LINE>b.set(Tokenizer.flag_cat_indexof, true);<NEW_LINE>}<NEW_LINE>return b;<NEW_LINE>} | set(WordReferenceRow.flag_app_dc_identifier, true); |
1,825,679 | public HeavyReport queryHourlyReport(String domain, Date start, Date end) {<NEW_LINE>HeavyReportMerger merger = new HeavyReportMerger(new HeavyReport(domain));<NEW_LINE>long startTime = start.getTime();<NEW_LINE>long endTime = end.getTime();<NEW_LINE>String name = Constants.REPORT_HEAVY;<NEW_LINE>for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {<NEW_LINE>List<HourlyReport> reports = null;<NEW_LINE>try {<NEW_LINE>reports = m_hourlyReportDao.findAllByDomainNamePeriod(new Date(startTime), domain, name, HourlyReportEntity.READSET_FULL);<NEW_LINE>} catch (DalException e) {<NEW_LINE>Cat.logError(e);<NEW_LINE>}<NEW_LINE>if (reports != null) {<NEW_LINE>for (HourlyReport report : reports) {<NEW_LINE>try {<NEW_LINE>HeavyReport reportModel = queryFromHourlyBinary(report.getId(), report.getPeriod(), domain);<NEW_LINE>reportModel.accept(merger);<NEW_LINE>} catch (DalNotFoundException e) {<NEW_LINE>// ignore<NEW_LINE>} catch (Exception e) {<NEW_LINE>Cat.logError(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>heavyReport.setStartTime(start);<NEW_LINE>heavyReport.setEndTime(new Date(end.getTime() - 1));<NEW_LINE>return heavyReport;<NEW_LINE>} | HeavyReport heavyReport = merger.getHeavyReport(); |
89,084 | private void createTriggerChannels(RemoteopenhabThing thing, boolean addNewChannels) {<NEW_LINE>List<Channel> channels = new ArrayList<>();<NEW_LINE>for (RemoteopenhabChannel channelDTO : thing.channels) {<NEW_LINE>if (!"TRIGGER".equals(channelDTO.kind)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>ChannelTypeUID channelTypeUID = new ChannelTypeUID(BINDING_ID, CHANNEL_TYPE_TRIGGER);<NEW_LINE>ChannelUID channelUID = new ChannelUID(getThing().getUID(), channelDTO.uid.replaceAll("[^A-Za-z0-9_]", "_"));<NEW_LINE>Configuration channelConfig = new Configuration();<NEW_LINE>channelConfig.put(CHANNEL_UID, channelDTO.uid);<NEW_LINE>logger.trace("Create the channel {} of type {}", channelUID, channelTypeUID);<NEW_LINE>channels.add(ChannelBuilder.create(channelUID, null).withType(channelTypeUID).withKind(ChannelKind.TRIGGER).withLabel(channelDTO.label).withDescription(channelDTO.description).withConfiguration(channelConfig).build());<NEW_LINE>}<NEW_LINE>if (!channels.isEmpty()) {<NEW_LINE>ThingBuilder thingBuilder = editThing();<NEW_LINE>int nbRemoved = 0;<NEW_LINE>for (Channel channel : channels) {<NEW_LINE>if (getThing().getChannel(channel.getUID()) != null) {<NEW_LINE>thingBuilder.withoutChannel(channel.getUID());<NEW_LINE>nbRemoved++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (nbRemoved > 0) {<NEW_LINE>logger.debug("{} trigger channels removed for the thing {}", nbRemoved, getThing().getUID());<NEW_LINE>}<NEW_LINE>int nbAdded = 0;<NEW_LINE>if (addNewChannels) {<NEW_LINE>for (Channel channel : channels) {<NEW_LINE>thingBuilder.withChannel(channel);<NEW_LINE>}<NEW_LINE>nbAdded = channels.size();<NEW_LINE>logger.debug("{} trigger channels added for the thing {}", nbAdded, getThing().getUID());<NEW_LINE>}<NEW_LINE>if (nbRemoved > 0 || nbAdded > 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | updateThing(thingBuilder.build()); |
589,300 | private int[] packDataIntoArray(GImageFormat format, InputStream data, long dataLength) throws IOException {<NEW_LINE>int offset = 0;<NEW_LINE>int[] arr = new int[width * height];<NEW_LINE>for (int i = 0; i < arr.length; ++i) {<NEW_LINE>if (format == GImageFormat.RGB_ALPHA_4BYTE) {<NEW_LINE>int blue = 0;<NEW_LINE>int green = 0;<NEW_LINE>int red = 0;<NEW_LINE>int alpha = 0;<NEW_LINE>if (offset < dataLength) {<NEW_LINE>blue = data.read() & 0xff;<NEW_LINE>green = data.read() & 0xff;<NEW_LINE>red = data.read() & 0xff;<NEW_LINE>alpha = data.read() & 0xff;<NEW_LINE>}<NEW_LINE>// bit invert the alpha byte...<NEW_LINE>alpha = ~alpha;<NEW_LINE>int alpha_shifted = (alpha << 24) & 0xff000000;<NEW_LINE>int red_shifted = (red << 16) & 0x00ff0000;<NEW_LINE>int green_shifted = (green << 8) & 0x0000ff00;<NEW_LINE>int blue_shifted = (blue << 0) & 0x000000ff;<NEW_LINE>int argbValue = alpha_shifted | red_shifted | green_shifted | blue_shifted;<NEW_LINE>arr[i] = argbValue;<NEW_LINE>offset += 4;<NEW_LINE>} else if (format == GImageFormat.GRAY_ALPHA_2BYTE) {<NEW_LINE>int alpha = 0;<NEW_LINE>int gray = 0;<NEW_LINE>if (offset < dataLength) {<NEW_LINE>alpha <MASK><NEW_LINE>gray = data.read() & 0xff;<NEW_LINE>}<NEW_LINE>// bit invert the alpha byte...<NEW_LINE>alpha = ~alpha;<NEW_LINE>int alpha_shifted = (alpha << 24) & 0xff000000;<NEW_LINE>int red_shifted = (gray << 16) & 0x00ff0000;<NEW_LINE>int green_shifted = (gray << 8) & 0x0000ff00;<NEW_LINE>int blue_shifted = (gray << 0) & 0x000000ff;<NEW_LINE>int argbValue = alpha_shifted | red_shifted | green_shifted | blue_shifted;<NEW_LINE>arr[i] = argbValue;<NEW_LINE>offset += 2;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return arr;<NEW_LINE>} | = data.read() & 0xff; |
400,070 | /* Vertical B Filtering */<NEW_LINE>static void vp8_loop_filter_bv(FullAccessIntArrPointer y_ptr, FullAccessIntArrPointer u_ptr, FullAccessIntArrPointer v_ptr, int y_stride, int uv_stride, LoopFilterInfo lfi) {<NEW_LINE>loop_filter_vertical_edge(y_ptr.shallowCopyWithPosInc(4), y_stride, lfi.blim, lfi.<MASK><NEW_LINE>loop_filter_vertical_edge(y_ptr.shallowCopyWithPosInc(8), y_stride, lfi.blim, lfi.lim, lfi.hev_thr, 2);<NEW_LINE>loop_filter_vertical_edge(y_ptr.shallowCopyWithPosInc(12), y_stride, lfi.blim, lfi.lim, lfi.hev_thr, 2);<NEW_LINE>if (u_ptr != null) {<NEW_LINE>loop_filter_vertical_edge(u_ptr.shallowCopyWithPosInc(4), uv_stride, lfi.blim, lfi.lim, lfi.hev_thr, 1);<NEW_LINE>}<NEW_LINE>if (v_ptr != null) {<NEW_LINE>loop_filter_vertical_edge(v_ptr.shallowCopyWithPosInc(4), uv_stride, lfi.blim, lfi.lim, lfi.hev_thr, 1);<NEW_LINE>}<NEW_LINE>} | lim, lfi.hev_thr, 2); |
1,359,167 | public int addFilesFromZip(ZipFile z) throws IOException {<NEW_LINE>try {<NEW_LINE>// get meta info first<NEW_LINE>JSONObject meta = new JSONObject(Utils.convertStreamToString(z.getInputStream(z.getEntry("_meta"))));<NEW_LINE>// then loop through all files<NEW_LINE>int cnt = 0;<NEW_LINE>ArrayList<? extends ZipEntry> zipEntries = Collections.list(z.entries());<NEW_LINE>List<Object[]> media = new ArrayList<>(zipEntries.size());<NEW_LINE>for (ZipEntry i : zipEntries) {<NEW_LINE>String fileName = i.getName();<NEW_LINE>if ("_meta".equals(fileName)) {<NEW_LINE>// ignore previously-retrieved meta<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String name = meta.getString(fileName);<NEW_LINE>// normalize name for platform<NEW_LINE>name = Utils.nfcNormalized(name);<NEW_LINE>// save file<NEW_LINE>String destPath = (dir() + File.separator) + name;<NEW_LINE>try (InputStream zipInputStream = z.getInputStream(i)) {<NEW_LINE>Utils.writeToFile(zipInputStream, destPath);<NEW_LINE>}<NEW_LINE>String csum = Utils.fileChecksum(destPath);<NEW_LINE>// update db<NEW_LINE>media.add(new Object[] { name, csum, _mtime(destPath), 0 });<NEW_LINE>cnt += 1;<NEW_LINE>}<NEW_LINE>if (!media.isEmpty()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return cnt;<NEW_LINE>} finally {<NEW_LINE>z.close();<NEW_LINE>}<NEW_LINE>} | mDb.executeMany("insert or replace into media values (?,?,?,?)", media); |
331,727 | public void marshall(CloneStackRequest cloneStackRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (cloneStackRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getSourceStackId(), SOURCESTACKID_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getRegion(), REGION_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getVpcId(), VPCID_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getAttributes(), ATTRIBUTES_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getServiceRoleArn(), SERVICEROLEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getDefaultInstanceProfileArn(), DEFAULTINSTANCEPROFILEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getDefaultOs(), DEFAULTOS_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getHostnameTheme(), HOSTNAMETHEME_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getDefaultAvailabilityZone(), DEFAULTAVAILABILITYZONE_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getDefaultSubnetId(), DEFAULTSUBNETID_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getCustomJson(), CUSTOMJSON_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getConfigurationManager(), CONFIGURATIONMANAGER_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getChefConfiguration(), CHEFCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getUseCustomCookbooks(), USECUSTOMCOOKBOOKS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getCustomCookbooksSource(), CUSTOMCOOKBOOKSSOURCE_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getDefaultSshKeyName(), DEFAULTSSHKEYNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getClonePermissions(), CLONEPERMISSIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getCloneAppIds(), CLONEAPPIDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getDefaultRootDeviceType(), DEFAULTROOTDEVICETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(cloneStackRequest.getAgentVersion(), AGENTVERSION_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | cloneStackRequest.getUseOpsworksSecurityGroups(), USEOPSWORKSSECURITYGROUPS_BINDING); |
1,526,406 | public void checkDefaultRules(String hostUuid, Completion completion) {<NEW_LINE>CheckDefaultSecurityGroupCmd cmd = new CheckDefaultSecurityGroupCmd();<NEW_LINE>cmd.skipIpv6 = NetworkGlobalProperty.SKIP_IPV6;<NEW_LINE>KVMHostAsyncHttpCallMsg msg = new KVMHostAsyncHttpCallMsg();<NEW_LINE>msg.setHostUuid(hostUuid);<NEW_LINE>msg.setPath(SECURITY_GROUP_CHECK_DEFAULT_RULES_ON_HOST_PATH);<NEW_LINE>msg.setCommand(cmd);<NEW_LINE>msg.setNoStatusCheck(true);<NEW_LINE>bus.makeTargetServiceIdByResourceUuid(msg, HostConstant.SERVICE_ID, hostUuid);<NEW_LINE>bus.send(msg, new CloudBusCallBack(completion) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(MessageReply reply) {<NEW_LINE>if (!reply.isSuccess()) {<NEW_LINE>completion.fail(reply.getError());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>CheckDefaultSecurityGroupResponse rsp = hreply.toResponse(CheckDefaultSecurityGroupResponse.class);<NEW_LINE>if (!rsp.isSuccess()) {<NEW_LINE>ErrorCode err = operr("failed to check default rules of security group on kvm host[uuid:%s], because %s", hostUuid, rsp.getError());<NEW_LINE>completion.fail(err);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String info = String.format("successfully applied rules of security group rules to kvm host[uuid:%s]", hostUuid);<NEW_LINE>logger.debug(info);<NEW_LINE>completion.success();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | KVMHostAsyncHttpCallReply hreply = reply.castReply(); |
1,709,813 | private Resource evaluateObservationCriteria(Context context, Patient patient, Resource resource, Measure.MeasureGroupPopulationComponent pop, MeasureReport report) {<NEW_LINE>if (pop == null || !pop.hasCriteria()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>context.setContextValue("Patient", patient.getIdElement().getIdPart());<NEW_LINE>clearExpressionCache(context);<NEW_LINE>String observationName = pop.getCriteria();<NEW_LINE>ExpressionDef ed = context.resolveExpressionRef(observationName);<NEW_LINE>if (!(ed instanceof FunctionDef)) {<NEW_LINE>throw new IllegalArgumentException(Msg.code(1648) + String.format("Measure observation %s does not reference a function definition", observationName));<NEW_LINE>}<NEW_LINE>Object result = null;<NEW_LINE>context.pushWindow();<NEW_LINE>try {<NEW_LINE>context.push(new Variable().withName(((FunctionDef) ed).getOperand().get(0).getName()).withValue(resource));<NEW_LINE>result = ed.getExpression().evaluate(context);<NEW_LINE>} finally {<NEW_LINE>context.popWindow();<NEW_LINE>}<NEW_LINE>if (result instanceof Resource) {<NEW_LINE>return (Resource) result;<NEW_LINE>}<NEW_LINE>Observation obs = new Observation();<NEW_LINE>obs.setStatus(Observation.ObservationStatus.FINAL);<NEW_LINE>obs.setId(UUID.<MASK><NEW_LINE>CodeableConcept cc = new CodeableConcept();<NEW_LINE>cc.setText(observationName);<NEW_LINE>obs.setCode(cc);<NEW_LINE>Extension obsExtension = new Extension().setUrl("http://hl7.org/fhir/StructureDefinition/cqf-measureInfo");<NEW_LINE>Extension extExtMeasure = new Extension().setUrl("measure").setValue(new UriType("http://hl7.org/fhir/us/cqfmeasures/" + report.getMeasure()));<NEW_LINE>obsExtension.addExtension(extExtMeasure);<NEW_LINE>Extension extExtPop = new Extension().setUrl("populationId").setValue(new StringType(observationName));<NEW_LINE>obsExtension.addExtension(extExtPop);<NEW_LINE>obs.addExtension(obsExtension);<NEW_LINE>return obs;<NEW_LINE>} | randomUUID().toString()); |
1,449,809 | public boolean autoImportReferenceAtCursor(@NotNull Editor editor, @NotNull PsiFile file) {<NEW_LINE>if (!file.getViewProvider().getLanguages().contains(GoLanguage.INSTANCE) || !DaemonListeners.canChangeFileSilently(file)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>int caretOffset = editor.getCaretModel().getOffset();<NEW_LINE>Document document = editor.getDocument();<NEW_LINE>int lineNumber = document.getLineNumber(caretOffset);<NEW_LINE>int startOffset = document.getLineStartOffset(lineNumber);<NEW_LINE>int endOffset = document.getLineEndOffset(lineNumber);<NEW_LINE>List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(file, startOffset, endOffset);<NEW_LINE>for (PsiElement element : elements) {<NEW_LINE>if (element instanceof GoCompositeElement) {<NEW_LINE>for (PsiReference reference : element.getReferences()) {<NEW_LINE><MASK><NEW_LINE>if (fix.doAutoImportOrShowHint(editor, false)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | GoImportPackageQuickFix fix = new GoImportPackageQuickFix(reference); |
1,479,900 | private static RemoteScreenshot[] takeCurrent(JPDADebugger debugger, DebuggerEngine engine) throws RetrievalException {<NEW_LINE>List<JPDAThread> allThreads = debugger<MASK><NEW_LINE>if (logger.isLoggable(Level.FINE)) {<NEW_LINE>logger.log(Level.FINE, "Threads = {0}", allThreads);<NEW_LINE>}<NEW_LINE>RemoteScreenshot[] rs = NO_SCREENSHOTS;<NEW_LINE>for (JPDAThread t : allThreads) {<NEW_LINE>if (t.getName().startsWith(AWTThreadName)) {<NEW_LINE>long t1 = System.nanoTime();<NEW_LINE>try {<NEW_LINE>RemoteScreenshot[] rst = take(t, engine);<NEW_LINE>if (rst.length > 0) {<NEW_LINE>if (rs.length > 0) {<NEW_LINE>RemoteScreenshot[] nrs = new RemoteScreenshot[rs.length + rst.length];<NEW_LINE>System.arraycopy(rs, 0, nrs, 0, rs.length);<NEW_LINE>System.arraycopy(rst, 0, nrs, rs.length, rst.length);<NEW_LINE>rs = nrs;<NEW_LINE>} else {<NEW_LINE>rs = rst;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// break;<NEW_LINE>} finally {<NEW_LINE>long t2 = System.nanoTime();<NEW_LINE>long ns = t2 - t1;<NEW_LINE>long ms = ns / 1000000;<NEW_LINE>logger.info("GUI Snaphot taken in " + ((ms > 0) ? (ms + " ms " + (ns - ms * 1000000) + " ns.") : (ns + " ns.")));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return rs;<NEW_LINE>} | .getThreadsCollector().getAllThreads(); |
1,254,013 | public static void main(String[] args) throws IOException {<NEW_LINE>if (args.length < 2) {<NEW_LINE>_log.error("Usage: PegasusDataTemplateGenerator targetDirectoryPath [sourceFile or sourceDirectory or schemaName]+");<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>final String generateImportedProperty = System.getProperty(PegasusDataTemplateGenerator.GENERATOR_GENERATE_IMPORTED);<NEW_LINE>final boolean generateImported = generateImportedProperty == null ? true : Boolean.parseBoolean(generateImportedProperty);<NEW_LINE>final String generateLowercasePathProperty = System.getProperty(PegasusDataTemplateGenerator.GENERATOR_GENERATE_LOWERCASE_PATH);<NEW_LINE>final boolean generateLowercasePath = generateLowercasePathProperty == null ? <MASK><NEW_LINE>final String generateFieldMaskProperty = System.getProperty(PegasusDataTemplateGenerator.GENERATOR_GENERATE_FIELD_MASK);<NEW_LINE>final boolean generateFieldMask = Boolean.parseBoolean(generateFieldMaskProperty);<NEW_LINE>String resolverPath = System.getProperty(AbstractGenerator.GENERATOR_RESOLVER_PATH);<NEW_LINE>if (resolverPath != null && ArgumentFileProcessor.isArgFile(resolverPath)) {<NEW_LINE>// The resolver path is an arg file, prefixed with '@' and containing the actual resolverPath<NEW_LINE>String[] argFileContents = ArgumentFileProcessor.getContentsAsArray(resolverPath);<NEW_LINE>resolverPath = argFileContents.length > 0 ? argFileContents[0] : null;<NEW_LINE>}<NEW_LINE>_log.debug("Resolver Path: " + resolverPath);<NEW_LINE>String[] schemaFiles = Arrays.copyOfRange(args, 1, args.length);<NEW_LINE>PegasusDataTemplateGenerator.run(resolverPath, System.getProperty(JavaCodeGeneratorBase.GENERATOR_DEFAULT_PACKAGE), System.getProperty(JavaCodeGeneratorBase.ROOT_PATH), generateImported, args[0], schemaFiles, generateLowercasePath, generateFieldMask);<NEW_LINE>} | true : Boolean.parseBoolean(generateLowercasePathProperty); |
663,464 | private void addRequestParameters(RequestData rd, HttpServletRequest request) {<NEW_LINE>// NOI18N<NEW_LINE>String method = rd.getAttributeValue("method");<NEW_LINE>// If it is a POST request we check if it was URL encoded<NEW_LINE>// Not sure this matters if we record the parameters after the<NEW_LINE>// request has been processed<NEW_LINE>boolean urlencoded = true;<NEW_LINE>// NOI18N<NEW_LINE>if (debug)<NEW_LINE>log(" doing parameters");<NEW_LINE>if (method.equals("POST")) {<NEW_LINE>// NOI18N<NEW_LINE><MASK><NEW_LINE>// NOI18N<NEW_LINE>String urlencodedS = "application/x-www-form-urlencoded";<NEW_LINE>// NOI18N<NEW_LINE>String typeS = "Content-type";<NEW_LINE>if (headers.containsHeader(typeS) && !(headers.getHeader(typeS).equalsIgnoreCase(urlencodedS)))<NEW_LINE>urlencoded = false;<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>rd.// NOI18N<NEW_LINE>setAttributeValue("urlencoded", String.valueOf(urlencoded));<NEW_LINE>if (method.equals("GET")) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>if (debug)<NEW_LINE>log("GET");<NEW_LINE>try {<NEW_LINE>Enumeration e = request.getParameterNames();<NEW_LINE>while (e.hasMoreElements()) {<NEW_LINE>String name = (String) e.nextElement();<NEW_LINE>if (debug)<NEW_LINE>// NOI18N<NEW_LINE>log("Parameter name: " + name);<NEW_LINE>String[] vals = request.getParameterValues(name);<NEW_LINE>for (int i = 0; i < vals.length; ++i) rd.addParam(new Param(name, vals[i]));<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>// The query string was not parameterized. This is<NEW_LINE>// legal. If this happens we simply don't record<NEW_LINE>// anything here, since the query string is recorded<NEW_LINE>// separately.<NEW_LINE>// NOI18N<NEW_LINE>if (debug)<NEW_LINE>log("Non parameterized query string");<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>if (debug)<NEW_LINE>log("GET end");<NEW_LINE>} else if (method.equals("POST") && urlencoded) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>if (debug)<NEW_LINE>log("POST");<NEW_LINE>Enumeration e = null;<NEW_LINE>try {<NEW_LINE>e = request.getParameterNames();<NEW_LINE>while (e.hasMoreElements()) {<NEW_LINE>String name = (String) e.nextElement();<NEW_LINE>if (debug)<NEW_LINE>// NOI18N<NEW_LINE>log("Parameter name: " + name);<NEW_LINE>String[] vals = request.getParameterValues(name);<NEW_LINE>for (int i = 0; i < vals.length; ++i) rd.addParam(new Param(name, vals[i]));<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>// PENDING: this could also be because the user choose<NEW_LINE>// to parse the parameters themselves. Need to fix<NEW_LINE>// this message.<NEW_LINE>// NOI18N<NEW_LINE>rd.setAttributeValue("urlencoded", "bad");<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>if (debug)<NEW_LINE>log("POST");<NEW_LINE>}<NEW_LINE>} | Headers headers = rd.getHeaders(); |
121,675 | public DescribeChannelMembershipForAppInstanceUserResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeChannelMembershipForAppInstanceUserResult describeChannelMembershipForAppInstanceUserResult = new DescribeChannelMembershipForAppInstanceUserResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return describeChannelMembershipForAppInstanceUserResult;<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("ChannelMembership", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeChannelMembershipForAppInstanceUserResult.setChannelMembership(ChannelMembershipForAppInstanceUserSummaryJsonUnmarshaller.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 describeChannelMembershipForAppInstanceUserResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,132,911 | final CreateVPCEConfigurationResult executeCreateVPCEConfiguration(CreateVPCEConfigurationRequest createVPCEConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createVPCEConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateVPCEConfigurationRequest> request = null;<NEW_LINE>Response<CreateVPCEConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateVPCEConfigurationRequestProtocolMarshaller(protocolFactory).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, "Device Farm");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateVPCEConfiguration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateVPCEConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateVPCEConfigurationResultJsonUnmarshaller());<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(createVPCEConfigurationRequest)); |
441,522 | public OutgoingVariant convertToOutgoingVariant() {<NEW_LINE>return new OutgoingVariant() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public DisplayName asDescribable() {<NEW_LINE>return displayName;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public AttributeContainerInternal getAttributes() {<NEW_LINE>return attributes;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Set<? extends PublishArtifact> getArtifacts() {<NEW_LINE>return artifacts;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Set<? extends OutgoingVariant> getChildren() {<NEW_LINE>PublishArtifactSet allArtifactSet = allArtifacts.getPublishArtifactSet();<NEW_LINE>LeafOutgoingVariant leafOutgoingVariant = new LeafOutgoingVariant(displayName, attributes, allArtifactSet);<NEW_LINE>if (variants == null || variants.isEmpty()) {<NEW_LINE>return Collections.singleton(leafOutgoingVariant);<NEW_LINE>}<NEW_LINE>boolean hasArtifacts = !allArtifactSet.isEmpty();<NEW_LINE>Set<OutgoingVariant> result = Sets.newLinkedHashSetWithExpectedSize(hasArtifacts ? 1 + variants.size(<MASK><NEW_LINE>if (hasArtifacts) {<NEW_LINE>result.add(leafOutgoingVariant);<NEW_LINE>}<NEW_LINE>for (DefaultVariant variant : variants.withType(DefaultVariant.class)) {<NEW_LINE>result.add(variant.convertToOutgoingVariant());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | ) : variants.size()); |
1,664,169 | private static Set<Pair<String, Formula>> collectLexemeFormulaPairs(Example ex) {<NEW_LINE>Set<Pair<String, Formula>> res = new HashSet<>();<NEW_LINE>Set<Pair<String, Formula>> temp = new HashSet<>();<NEW_LINE>for (Derivation correctDerivation : ex.getCorrectDerivations()) {<NEW_LINE>// get all join formulas<NEW_LINE>List<Formula> relations = correctDerivation.formula.mapToList(formula -> {<NEW_LINE>List<Formula> res1 = new ArrayList<>();<NEW_LINE>if (formula instanceof JoinFormula)<NEW_LINE>res1.add(((JoinFormula) formula).relation);<NEW_LINE>return res1;<NEW_LINE>}, false);<NEW_LINE>Set<Integer> validIndices = new HashSet<>();<NEW_LINE>findValidIndices(correctDerivation, validIndices);<NEW_LINE>// match formulas<NEW_LINE>for (Formula relation : relations) {<NEW_LINE>for (int i = 0; i < ex.numTokens(); ++i) {<NEW_LINE>if (LanguageInfo.isContentWord(ex.posTag(i)) && validIndices.contains(i)) {<NEW_LINE>temp.add(Pair.newPair(ex.languageInfo.lemmaTokens.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// reverse invalid relations<NEW_LINE>for (Pair<String, Formula> pair : temp) {<NEW_LINE>if (!BinaryLexicon.getInstance().validBinaryFormula(pair.getSecond())) {<NEW_LINE>pair.setSecond(FbFormulasInfo.getSingleton().equivalentFormula(pair.getSecond()));<NEW_LINE>}<NEW_LINE>res.add(pair);<NEW_LINE>}<NEW_LINE>return res;<NEW_LINE>} | get(i), relation)); |
1,574,290 | private HttpTransport createHttpTransport(AddressManager kieAddressManager, RequestConfig requestConfig, Configuration localConfiguration) {<NEW_LINE>List<AuthHeaderProvider> authHeaderProviders = SPIServiceUtils.getOrLoadSortedService(AuthHeaderProvider.class);<NEW_LINE>if (ConfigCenterConfig.INSTANCE.isProxyEnable()) {<NEW_LINE>HttpClientBuilder httpClientBuilder = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig);<NEW_LINE>HttpHost proxy = new // now only support http proxy<NEW_LINE>HttpHost(// now only support http proxy<NEW_LINE>ConfigCenterConfig.INSTANCE.getProxyHost(), // now only support http proxy<NEW_LINE>ConfigCenterConfig.INSTANCE.getProxyPort(), "http");<NEW_LINE>httpClientBuilder.setProxy(proxy);<NEW_LINE>CredentialsProvider credentialsProvider = new BasicCredentialsProvider();<NEW_LINE>credentialsProvider.setCredentials(new AuthScope(proxy), new UsernamePasswordCredentials(ConfigCenterConfig.INSTANCE.getProxyUsername(), ConfigCenterConfig.INSTANCE.getProxyPasswd()));<NEW_LINE>httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);<NEW_LINE>return HttpTransportFactory.createHttpTransport(TransportUtils.createSSLProperties(kieAddressManager.sslEnabled(), localConfiguration, ConfigCenterConfig.SSL_TAG)<MASK><NEW_LINE>}<NEW_LINE>return HttpTransportFactory.createHttpTransport(TransportUtils.createSSLProperties(kieAddressManager.sslEnabled(), localConfiguration, ConfigCenterConfig.SSL_TAG), getRequestAuthHeaderProvider(authHeaderProviders), requestConfig);<NEW_LINE>} | , getRequestAuthHeaderProvider(authHeaderProviders), httpClientBuilder); |
704,701 | public void handleTransaction(SocBusTransaction trans) {<NEW_LINE>if (!canHandleTransaction(trans))<NEW_LINE>return;<NEW_LINE>trans.setTransactionResponder(attachedBus.getComponent());<NEW_LINE>long addr = SocSupport.convUnsignedInt(trans.getAddress());<NEW_LINE>long start = SocSupport.convUnsignedInt(startAddress);<NEW_LINE>if (trans.getAccessType() != SocBusTransaction.WORD_ACCESS) {<NEW_LINE>trans.setError(SocBusTransaction.ACCESS_TYPE_NOT_SUPPORTED_ERROR);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>JtagUartFifoState state = (JtagUartFifoState) attachedBus.getSocSimulationManager().getdata(attachedBus.getComponent());<NEW_LINE>long index = (addr - start);<NEW_LINE>if (index == 0) {<NEW_LINE>if (trans.isReadTransaction()) {<NEW_LINE>trans.setReadData(state.readDataRegister());<NEW_LINE>}<NEW_LINE>if (trans.isWriteTransaction()) {<NEW_LINE>state.writeDataRegister(trans.getWriteData());<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (index == 4) {<NEW_LINE>if (trans.isReadTransaction()) {<NEW_LINE>trans.setReadData(state.readControlRegister());<NEW_LINE>}<NEW_LINE>if (trans.isWriteTransaction()) {<NEW_LINE>state.<MASK><NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>trans.setError(SocBusTransaction.MISALIGNED_ADDRESS_ERROR);<NEW_LINE>} | writeControlRegister(trans.getWriteData()); |
62,739 | private Mono<Response<RolloutInner>> restartWithResponseAsync(String resourceGroupName, String rolloutName, Boolean skipSucceeded, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (rolloutName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.restart(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, rolloutName, skipSucceeded, this.client.getApiVersion(), accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); |
1,233,976 | protected DBTraceBreakpoint addBreakpoint(String path, Range<Long> lifespan, AddressRange range, Collection<TraceThread> threads, Collection<TraceBreakpointKind> kinds, boolean enabled, String comment) {<NEW_LINE>// NOTE: thread here is not about address/register spaces.<NEW_LINE>// It's about which thread to trap<NEW_LINE>try (LockHold hold = LockHold.lock(lock.writeLock())) {<NEW_LINE>DBTraceThreadManager threadManager = trace.getThreadManager();<NEW_LINE>for (TraceThread t : threads) {<NEW_LINE>threadManager.assertIsMine(t);<NEW_LINE>}<NEW_LINE>DBTraceBreakpoint breakpoint = breakpointMapSpace.put(new ImmutableTraceAddressSnapRange<MASK><NEW_LINE>breakpoint.set(path, path, threads, kinds, enabled, comment);<NEW_LINE>trace.setChanged(new TraceChangeRecord<>(TraceBreakpointChangeType.ADDED, this, breakpoint));<NEW_LINE>return breakpoint;<NEW_LINE>}<NEW_LINE>} | (range, lifespan), null); |
1,334,492 | public void validateOptionalJoin(Join join) {<NEW_LINE>for (ValidationCapability c : getCapabilities()) {<NEW_LINE>validateFeature(c, Feature.join);<NEW_LINE>validateFeature(c, join.isSimple() && join.isOuter(), Feature.joinOuterSimple);<NEW_LINE>validateFeature(c, join.isSimple(), Feature.joinSimple);<NEW_LINE>validateFeature(c, join.isRight(), Feature.joinRight);<NEW_LINE>validateFeature(c, join.isNatural(), Feature.joinNatural);<NEW_LINE>validateFeature(c, join.isFull(), Feature.joinFull);<NEW_LINE>validateFeature(c, join.isLeft(), Feature.joinLeft);<NEW_LINE>validateFeature(c, join.isCross(), Feature.joinCross);<NEW_LINE>validateFeature(c, join.isOuter(), Feature.joinOuter);<NEW_LINE>validateFeature(c, join.<MASK><NEW_LINE>validateFeature(c, join.isSemi(), Feature.joinSemi);<NEW_LINE>validateFeature(c, join.isStraight(), Feature.joinStraight);<NEW_LINE>validateFeature(c, join.isApply(), Feature.joinApply);<NEW_LINE>validateFeature(c, join.isWindowJoin(), Feature.joinWindow);<NEW_LINE>validateOptionalFeature(c, join.getUsingColumns(), Feature.joinUsingColumns);<NEW_LINE>}<NEW_LINE>validateOptionalFromItem(join.getRightItem());<NEW_LINE>for (Expression onExpression : join.getOnExpressions()) {<NEW_LINE>validateOptionalExpression(onExpression);<NEW_LINE>}<NEW_LINE>validateOptionalExpressions(join.getUsingColumns());<NEW_LINE>} | isInner(), Feature.joinInner); |
123,301 | public File prepareDownloadFile(Response response) throws IOException {<NEW_LINE>String filename = null;<NEW_LINE>String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition");<NEW_LINE>if (contentDisposition != null && !"".equals(contentDisposition)) {<NEW_LINE>// Get filename from the Content-Disposition header.<NEW_LINE>Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");<NEW_LINE>Matcher <MASK><NEW_LINE>if (matcher.find())<NEW_LINE>filename = matcher.group(1);<NEW_LINE>}<NEW_LINE>String prefix = null;<NEW_LINE>String suffix = null;<NEW_LINE>if (filename == null) {<NEW_LINE>prefix = "download-";<NEW_LINE>suffix = "";<NEW_LINE>} else {<NEW_LINE>int pos = filename.lastIndexOf(".");<NEW_LINE>if (pos == -1) {<NEW_LINE>prefix = filename + "-";<NEW_LINE>} else {<NEW_LINE>prefix = filename.substring(0, pos) + "-";<NEW_LINE>suffix = filename.substring(pos);<NEW_LINE>}<NEW_LINE>// Files.createTempFile requires the prefix to be at least three characters long<NEW_LINE>if (prefix.length() < 3)<NEW_LINE>prefix = "download-";<NEW_LINE>}<NEW_LINE>if (tempFolderPath == null)<NEW_LINE>return Files.createTempFile(prefix, suffix).toFile();<NEW_LINE>else<NEW_LINE>return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile();<NEW_LINE>} | matcher = pattern.matcher(contentDisposition); |
567,186 | public StepExecutionResult execute(ExecutionContext context) throws IOException {<NEW_LINE>if (skeletonManifestPath.getNameCount() == 0) {<NEW_LINE>throw new HumanReadableException("Skeleton manifest filepath is missing");<NEW_LINE>}<NEW_LINE>if (outManifestPath.getNameCount() == 0) {<NEW_LINE>throw new HumanReadableException("Output Manifest filepath is missing");<NEW_LINE>}<NEW_LINE>Path resolvedOutManifestPath = filesystem.resolve(outManifestPath);<NEW_LINE>Files.createParentDirs(resolvedOutManifestPath.toFile());<NEW_LINE>List<File> libraryManifestFiles = new ArrayList<>();<NEW_LINE>for (Path path : libraryManifestPaths) {<NEW_LINE>Path manifestPath = filesystem.getPathForRelativeExistingPath(path).toAbsolutePath();<NEW_LINE>libraryManifestFiles.add(manifestPath.toFile());<NEW_LINE>}<NEW_LINE>File skeletonManifestFile = filesystem.getPathForRelativeExistingPath(skeletonManifestPath).toAbsolutePath().toFile();<NEW_LINE>BuckEventAndroidLogger logger = new <MASK><NEW_LINE>MergingReport mergingReport = mergeManifests(skeletonManifestFile, libraryManifestFiles, logger);<NEW_LINE>String xmlText = mergingReport.getMergedDocument(MergingReport.MergedManifestKind.MERGED);<NEW_LINE>if (context.getPlatform() == Platform.WINDOWS) {<NEW_LINE>// Convert line endings to Lf on Windows.<NEW_LINE>xmlText = xmlText.replace("\r\n", "\n");<NEW_LINE>}<NEW_LINE>filesystem.writeContentsToPath(xmlText, resolvedOutManifestPath);<NEW_LINE>return StepExecutionResults.SUCCESS;<NEW_LINE>} | ManifestMergerLogger(context.getBuckEventBus()); |
1,702,387 | private void buildRestOfGuiPages(GuiAutotest guiTest) {<NEW_LINE>// directory page<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_SPACE);<NEW_LINE>// java selection page<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>JavaHomeHandler javaHomeHandler = guiTest.getJavaHomeHandler();<NEW_LINE>boolean isValidDeviation = javaHomeHandler.isDeviation() && javaHomeHandler.isValidHome();<NEW_LINE>if (isValidDeviation) {<NEW_LINE>// need 2 more tabs<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_TAB);<NEW_LINE>}<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_SPACE);<NEW_LINE>// overview page<NEW_LINE>if (isValidDeviation) {<NEW_LINE>// enough time to check the java version<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_SPACE, 3000);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// installation page (skipped)<NEW_LINE>// readme page<NEW_LINE>// wait for the installation to finish<NEW_LINE>guiTest.addWaitingKeyAction(KeyEvent.VK_TAB);<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_SPACE);<NEW_LINE>// success page<NEW_LINE>guiTest.addKeyAction(KeyEvent.VK_SPACE);<NEW_LINE>} | guiTest.addKeyAction(KeyEvent.VK_SPACE); |
324,658 | public Result listByRegion(UUID customerUUID, UUID providerUUID, UUID regionUUID, Boolean includeMetadata) {<NEW_LINE>Customer customer = Customer.getOrBadRequest(customerUUID);<NEW_LINE>Region region = Region.getOrBadRequest(customerUUID, providerUUID, regionUUID);<NEW_LINE>Map<String, Object> releases = releaseManager.getReleaseMetadata();<NEW_LINE>Architecture arch = region.getArchitecture();<NEW_LINE>// Old region without architecture. Return all releases.<NEW_LINE>if (arch == null) {<NEW_LINE>LOG.<MASK><NEW_LINE>return list(customerUUID, includeMetadata);<NEW_LINE>}<NEW_LINE>// Filter for active and matching region releases<NEW_LINE>Map<String, Object> filtered = releases.entrySet().stream().filter(f -> !Json.toJson(f.getValue()).get("state").asText().equals("DELETED")).filter(f -> releaseManager.metadataFromObject(f.getValue()).matchesRegion(region)).collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));<NEW_LINE>return PlatformResults.withData(includeMetadata ? CommonUtils.maskObject(filtered) : filtered.keySet());<NEW_LINE>} | info("ReleaseController: Could not determine region {} architecture. Listing all releases.", region.code); |
92,418 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>infoLabel = new JLabel();<NEW_LINE>optionsLabel = new JLabel();<NEW_LINE>noteLabel = new JLabel();<NEW_LINE>// NOI18N<NEW_LINE>Mnemonics.setLocalizedText(infoLabel, "INFO");<NEW_LINE>// NOI18N<NEW_LINE>Mnemonics.setLocalizedText(optionsLabel, NbBundle.getMessage<MASK><NEW_LINE>optionsLabel.addMouseListener(new MouseAdapter() {<NEW_LINE><NEW_LINE>public void mouseEntered(MouseEvent evt) {<NEW_LINE>optionsLabelMouseEntered(evt);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void mousePressed(MouseEvent evt) {<NEW_LINE>optionsLabelMousePressed(evt);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// NOI18N<NEW_LINE>Mnemonics.setLocalizedText(noteLabel, NbBundle.getMessage(NewProjectConfigurationPanel.class, "NewProjectConfigurationPanel.noteLabel.text"));<NEW_LINE>GroupLayout layout = new GroupLayout(this);<NEW_LINE>this.setLayout(layout);<NEW_LINE>layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addComponent(infoLabel).addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(optionsLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addComponent(noteLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE)));<NEW_LINE>layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(optionsLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(infoLabel)).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(noteLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));<NEW_LINE>} | (NewProjectConfigurationPanel.class, "NewProjectConfigurationPanel.optionsLabel.text")); |
1,757,624 | public T call() throws IOException {<NEW_LINE>URL u = new URL(url);<NEW_LINE>InputStream stream = null;<NEW_LINE>final String protocol = u.getProtocol();<NEW_LINE>if (protocol.equals("http") || protocol.equals("https")) {<NEW_LINE>HttpURLConnection conn = (HttpURLConnection) u.openConnection();<NEW_LINE>conn.setRequestMethod(method);<NEW_LINE>conn.setDoInput(true);<NEW_LINE>for (Map.Entry<String, String> entry : headers.entrySet()) {<NEW_LINE>String key = entry.getKey();<NEW_LINE>String value = entry.getValue();<NEW_LINE>if (value != null && !value.equals(""))<NEW_LINE>conn.setRequestProperty(key, value);<NEW_LINE>}<NEW_LINE>if (outboundContent != null && method.equals("POST")) {<NEW_LINE>conn.setDoOutput(true);<NEW_LINE>byte[] outBytes = outboundContent.getBytes("utf-8");<NEW_LINE>conn.setRequestProperty("Content-Length", String<MASK><NEW_LINE>OutputStream out = conn.getOutputStream();<NEW_LINE>out.write(outBytes);<NEW_LINE>out.close();<NEW_LINE>}<NEW_LINE>conn.connect();<NEW_LINE>fileSize = conn.getContentLength();<NEW_LINE>setProgressMax(fileSize);<NEW_LINE>responseHeaders = conn.getHeaderFields();<NEW_LINE>stream = new ProgressInputStream(conn.getInputStream());<NEW_LINE>} else {<NEW_LINE>// protocol is something other than http...<NEW_LINE>URLConnection con = u.openConnection();<NEW_LINE>setProgressMax(con.getContentLength());<NEW_LINE>stream = new ProgressInputStream(con.getInputStream());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return processStream(stream);<NEW_LINE>} finally {<NEW_LINE>stream.close();<NEW_LINE>}<NEW_LINE>} | .valueOf(outBytes.length)); |
292,166 | // GEN-LAST:event_saveButtonActionPerformed<NEW_LINE>private void saveGUISize() {<NEW_LINE>Preferences prefs = MageFrame.getPreferences();<NEW_LINE>// GUI Size<NEW_LINE>save(prefs, dialog.sliderFontSize, KEY_GUI_TABLE_FONT_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderChatFontSize, <MASK><NEW_LINE>save(prefs, dialog.sliderCardSizeHand, KEY_GUI_CARD_HAND_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderEditorCardSize, KEY_GUI_CARD_EDITOR_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderEditorCardOffset, KEY_GUI_CARD_OFFSET_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderEnlargedImageSize, KEY_GUI_ENLARGED_IMAGE_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderStackWidth, KEY_GUI_STACK_WIDTH, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderTooltipSize, KEY_GUI_TOOLTIP_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderDialogFont, KEY_GUI_DIALOG_FONT_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderGameFeedbackArea, KEY_GUI_FEEDBACK_AREA_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderCardSizeOtherZones, KEY_GUI_CARD_OTHER_ZONES_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderCardSizeMinBattlefield, KEY_GUI_CARD_BATTLEFIELD_MIN_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>save(prefs, dialog.sliderCardSizeMaxBattlefield, KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE, "true", "false", UPDATE_CACHE_POLICY);<NEW_LINE>// do as worker job<NEW_LINE>GUISizeHelper.changeGUISize();<NEW_LINE>} | KEY_GUI_CHAT_FONT_SIZE, "true", "false", UPDATE_CACHE_POLICY); |
1,170,030 | public void actionPerformed(ActionEvent e) {<NEW_LINE>Object source = e.getSource();<NEW_LINE>if (source == saveCallsToCheckBox) {<NEW_LINE>boolean selected = saveCallsToCheckBox.isSelected();<NEW_LINE>callDirTextField.setEnabled(selected);<NEW_LINE>callDirChooseButton.setEnabled(selected);<NEW_LINE>if (selected) {<NEW_LINE>// set default directory<NEW_LINE>try {<NEW_LINE>changeCallsDir(NeomediaActivator.getFileAccessService(<MASK><NEW_LINE>} catch (IOException ioex) {<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// remove default directory prop<NEW_LINE>NeomediaActivator.getConfigurationService().setProperty(Recorder.SAVED_CALLS_PATH, null);<NEW_LINE>callDirTextField.setText(null);<NEW_LINE>}<NEW_LINE>} else if (source == callDirChooseButton) {<NEW_LINE>File newDir = dirChooser.getFileFromDialog();<NEW_LINE>changeCallsDir(newDir, true);<NEW_LINE>} else if (source == callDirTextField) {<NEW_LINE>File newDir = new File(callDirTextField.getText());<NEW_LINE>changeCallsDir(newDir, true);<NEW_LINE>}<NEW_LINE>} | ).getDefaultDownloadDirectory(), true); |
533,493 | public final XmldeclContext xmldecl() throws RecognitionException {<NEW_LINE>XmldeclContext _localctx = new XmldeclContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 4, RULE_xmldecl);<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(45);<NEW_LINE>match(SPECIAL_OPEN_XML);<NEW_LINE>setState(49);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>while (_la == Name) {<NEW_LINE>{<NEW_LINE>{<NEW_LINE>setState(46);<NEW_LINE>attribute();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(51);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>}<NEW_LINE>setState(52);<NEW_LINE>match(SPECIAL_CLOSE);<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE><MASK><NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _errHandler.reportError(this, re); |
284,279 | protected void computeOutlierScores(KNNSearcher<DBIDRef> knnq, final DBIDs ids, WritableDataStore<double[]> densities, WritableDoubleDataStore kdeos, DoubleMinMax minmax) {<NEW_LINE>final int knum = kmax + 1 - kmin;<NEW_LINE>FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Computing KDEOS scores", ids.size(), LOG) : null;<NEW_LINE>double[][] scratch = new double[knum][kmax + 5];<NEW_LINE>MeanVariance mv = new MeanVariance();<NEW_LINE>for (DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {<NEW_LINE>double[] dens = densities.get(iter);<NEW_LINE>KNNList neighbors = knnq.getKNN(iter, kmax + 1);<NEW_LINE>if (scratch[0].length < neighbors.size()) {<NEW_LINE>// Resize scratch. Add some extra margin again.<NEW_LINE>scratch = new double[knum][neighbors.size() + 5];<NEW_LINE>}<NEW_LINE>{<NEW_LINE>// Store density matrix of neighbors<NEW_LINE>int i = 0;<NEW_LINE>for (DoubleDBIDListIter neighbor = neighbors.iter(); neighbor.valid(); neighbor.advance(), i++) {<NEW_LINE>double[] ndens = densities.get(neighbor);<NEW_LINE>for (int k = 0; k < knum; k++) {<NEW_LINE>scratch[k]<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>assert (i == neighbors.size());<NEW_LINE>}<NEW_LINE>// Compute means and stddevs for each k<NEW_LINE>double score = 0.;<NEW_LINE>for (int i = 0; i < knum; i++) {<NEW_LINE>mv.reset();<NEW_LINE>for (int j = 0; j < neighbors.size(); j++) {<NEW_LINE>mv.put(scratch[i][j]);<NEW_LINE>}<NEW_LINE>final double mean = mv.getMean(), stddev = mv.getSampleStddev();<NEW_LINE>if (stddev > 0.) {<NEW_LINE>score += (mean - dens[i]) / stddev;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// average<NEW_LINE>score /= knum;<NEW_LINE>score = NormalDistribution.standardNormalCDF(score);<NEW_LINE>minmax.put(score);<NEW_LINE>kdeos.put(iter, score);<NEW_LINE>LOG.incrementProcessed(prog);<NEW_LINE>}<NEW_LINE>LOG.ensureCompleted(prog);<NEW_LINE>} | [i] = ndens[k]; |
509,375 | public DeleteIdentitiesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DeleteIdentitiesResult deleteIdentitiesResult = new DeleteIdentitiesResult();<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 deleteIdentitiesResult;<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("UnprocessedIdentityIds", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deleteIdentitiesResult.setUnprocessedIdentityIds(new ListUnmarshaller<UnprocessedIdentityId>(UnprocessedIdentityIdJsonUnmarshaller.getInstance(<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 deleteIdentitiesResult;<NEW_LINE>} | )).unmarshall(context)); |
1,306,980 | public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) {<NEW_LINE>final RelDataTypeFactory typeFactory = validator.getTypeFactory();<NEW_LINE>List<RelDataTypeFieldImpl> columns = new LinkedList<>();<NEW_LINE>columns.add(new RelDataTypeFieldImpl("Rule_Name", 0, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("SQL_Type", 1, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("User", 2, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("Table", 3, typeFactory.<MASK><NEW_LINE>columns.add(new RelDataTypeFieldImpl("Parallelism", 4, typeFactory.createSqlType(SqlTypeName.INTEGER_UNSIGNED)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("Keywords", 5, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("TemplateId", 6, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("Queue_Size", 7, typeFactory.createSqlType(SqlTypeName.INTEGER_UNSIGNED)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("Running", 8, typeFactory.createSqlType(SqlTypeName.INTEGER_UNSIGNED)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("Waiting", 9, typeFactory.createSqlType(SqlTypeName.INTEGER_UNSIGNED)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("Killed", 10, typeFactory.createSqlType(SqlTypeName.INTEGER_UNSIGNED)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("Created_Time", 11, typeFactory.createSqlType(SqlTypeName.DATETIME)));<NEW_LINE>return typeFactory.createStructType(columns);<NEW_LINE>} | createSqlType(SqlTypeName.VARCHAR))); |
808,598 | private static Map<String, Object> defToMap(Map<FieldDef, String> entMap) {<NEW_LINE>Map<String, Object> dataMap = new HashMap<>();<NEW_LINE>dataMap.computeIfAbsent("pub_id", s -> entMap.get(ID));<NEW_LINE>dataMap.computeIfAbsent("pub_api_id", s -> entMap.get(API_ID));<NEW_LINE>dataMap.computeIfAbsent("pub_method", s -> entMap.get(METHOD));<NEW_LINE>dataMap.computeIfAbsent("pub_path", s -> entMap.get(PATH));<NEW_LINE>dataMap.computeIfAbsent("pub_status", s <MASK><NEW_LINE>dataMap.computeIfAbsent("pub_comment", s -> entMap.get(COMMENT));<NEW_LINE>dataMap.computeIfAbsent("pub_type", s -> entMap.get(TYPE));<NEW_LINE>dataMap.computeIfAbsent("pub_script", s -> entMap.get(SCRIPT));<NEW_LINE>dataMap.computeIfAbsent("pub_script_ori", s -> entMap.get(SCRIPT_ORI));<NEW_LINE>//<NEW_LINE>dataMap.computeIfAbsent("pub_schema", s -> {<NEW_LINE>StringBuilder schemaData = new StringBuilder();<NEW_LINE>schemaData.append("{");<NEW_LINE>schemaData.append("\"requestHeader\":" + entMap.get(REQ_HEADER_SCHEMA) + ",");<NEW_LINE>schemaData.append("\"requestBody\":" + entMap.get(REQ_BODY_SCHEMA) + ",");<NEW_LINE>schemaData.append("\"responseHeader\":" + entMap.get(RES_HEADER_SCHEMA) + ",");<NEW_LINE>schemaData.append("\"responseBody\":" + entMap.get(RES_BODY_SCHEMA));<NEW_LINE>schemaData.append("}");<NEW_LINE>return schemaData.toString();<NEW_LINE>});<NEW_LINE>//<NEW_LINE>dataMap.computeIfAbsent("pub_sample", s -> {<NEW_LINE>StringBuffer sampleData = new StringBuffer();<NEW_LINE>sampleData.append("{");<NEW_LINE>sampleData.append("\"requestHeader\":" + JSON.toJSONString(entMap.get(REQ_HEADER_SAMPLE)) + ",");<NEW_LINE>sampleData.append("\"requestBody\":" + JSON.toJSONString(entMap.get(REQ_BODY_SAMPLE)) + ",");<NEW_LINE>sampleData.append("\"responseHeader\":" + JSON.toJSONString(entMap.get(RES_HEADER_SAMPLE)) + ",");<NEW_LINE>sampleData.append("\"responseBody\":" + JSON.toJSONString(entMap.get(RES_BODY_SAMPLE)));<NEW_LINE>sampleData.append("}");<NEW_LINE>return sampleData.toString();<NEW_LINE>});<NEW_LINE>//<NEW_LINE>dataMap.computeIfAbsent("pub_option", s -> entMap.get(OPTION));<NEW_LINE>dataMap.computeIfAbsent("pub_release_time", s -> entMap.get(RELEASE_TIME));<NEW_LINE>return dataMap;<NEW_LINE>} | -> entMap.get(STATUS)); |
963,457 | public static int run(String[] args) {<NEW_LINE>Args parameters = new Args();<NEW_LINE>JCommander jc = JCommander.newBuilder().addObject(parameters).build();<NEW_LINE>jc.parse(args);<NEW_LINE>if (parameters.help) {<NEW_LINE>jc.usage();<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>File dbDirectory = new File(parameters.databaseDirectory);<NEW_LINE>if (!dbDirectory.exists()) {<NEW_LINE>logger.info("Directory {} does not exist.", parameters.databaseDirectory);<NEW_LINE>return 404;<NEW_LINE>}<NEW_LINE>List<File> files = Arrays.stream(Objects.requireNonNull(dbDirectory.listFiles())).filter(File::isDirectory).collect(Collectors.toList());<NEW_LINE>if (files.isEmpty()) {<NEW_LINE>logger.info("Directory {} does not contain any database.", parameters.databaseDirectory);<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>final long time = System.currentTimeMillis();<NEW_LINE>final List<Future<Boolean>> res = new ArrayList<>();<NEW_LINE>final ThreadPoolExecutor executor = new ThreadPoolExecutor(CPUS, 16 * CPUS, 1, TimeUnit.MINUTES, new ArrayBlockingQueue<>(CPUS, true), Executors.defaultThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy());<NEW_LINE>executor.allowCoreThreadTimeOut(true);<NEW_LINE>files.forEach(f -> res.add(executor.submit(new ArchiveManifest(parameters.databaseDirectory, f.getName(), parameters.maxManifestSize, parameters.maxBatchSize))));<NEW_LINE>int fails = res.size();<NEW_LINE>for (Future<Boolean> re : res) {<NEW_LINE>try {<NEW_LINE>if (Boolean.TRUE.equals(re.get())) {<NEW_LINE>fails--;<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>logger.error("{}", e);<NEW_LINE>Thread<MASK><NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>logger.error("{}", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>executor.shutdown();<NEW_LINE>logger.info("DatabaseDirectory:{}, maxManifestSize:{}, maxBatchSize:{}," + "database reopen use {} seconds total.", parameters.databaseDirectory, parameters.maxManifestSize, parameters.maxBatchSize, (System.currentTimeMillis() - time) / 1000);<NEW_LINE>if (fails > 0) {<NEW_LINE>logger.error("Failed!!!!!!!!!!!!!!!!!!!!!!!! size:{}", fails);<NEW_LINE>}<NEW_LINE>return fails;<NEW_LINE>} | .currentThread().interrupt(); |
1,714,966 | public Future<Boolean> startModule(ExtendedModuleInfo moduleInfo) throws StateChangeException {<NEW_LINE>try {<NEW_LINE>latch.await(5, TimeUnit.SECONDS);<NEW_LINE>} catch (InterruptedException e1) {<NEW_LINE>AccessController.doPrivileged(new PrivilegedAction<Void>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Void run() {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// well, we waited for a while, go ahead and try to start the client.<NEW_LINE>}<NEW_LINE>ClientModuleMetaData cmmd = (ClientModuleMetaData) moduleInfo.getMetaData();<NEW_LINE>ComponentMetaData cmd = new ClientComponentMetaDataImpl(cmmd);<NEW_LINE>ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().setDefaultCMD(cmd);<NEW_LINE>String[] args = libertyProcess.getArgs();<NEW_LINE>appContextClassLoader = classLoadingService.createThreadContextClassLoader(moduleInfo.getClassLoader());<NEW_LINE>ClassLoader origLoader = AccessController.doPrivileged(new GetTCCL());<NEW_LINE>ClassLoader newLoader = AccessController.doPrivileged(new SetTCCL(appContextClassLoader));<NEW_LINE>try {<NEW_LINE>ComponentMetaDataAccessorImpl.<MASK><NEW_LINE>ApplicationClientBnd appClientBnd = appClientBnds.get(cmmd);<NEW_LINE>CallbackHandler callbackHandler = callbackHandlers.get(cmmd);<NEW_LINE>ClientModuleInjection cmi = new ClientModuleInjection(cmmd, appClientBnd, resourceRefConfigFactory, injectionEngine, managedObjectServiceRef, callbackHandler, runningInClient);<NEW_LINE>cmi.processReferences();<NEW_LINE>activeCMDs.put(cmmd.getJ2EEName(), cmd);<NEW_LINE>clientRunner.readyToRun(cmi, args, cmd, newLoader);<NEW_LINE>} catch (ClassNotFoundException e) {<NEW_LINE>clientRunner.setupFailure();<NEW_LINE>throw new StateChangeException(e);<NEW_LINE>} catch (InjectionException e) {<NEW_LINE>clientRunner.setupFailure();<NEW_LINE>throw new StateChangeException(e);<NEW_LINE>} finally {<NEW_LINE>ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().endContext();<NEW_LINE>if (origLoader != newLoader) {<NEW_LINE>AccessController.doPrivileged(new SetTCCL(origLoader));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return futureMonitor.createFutureWithResult(true);<NEW_LINE>} | getComponentMetaDataAccessor().beginContext(cmd); |
214,661 | public void deserialize(String name, String value, boolean isSecure, String encryptedValue) throws CryptoException {<NEW_LINE>setName(name);<NEW_LINE>setIsSecure(isSecure);<NEW_LINE>if (!isSecure && StringUtils.isNotBlank(encryptedValue)) {<NEW_LINE>errors(<MASK><NEW_LINE>}<NEW_LINE>if (StringUtils.isNotBlank(value) && StringUtils.isNotBlank(encryptedValue)) {<NEW_LINE>addError("value", "You may only specify `value` or `encrypted_value`, not both!");<NEW_LINE>addError(ENCRYPTEDVALUE, "You may only specify `value` or `encrypted_value`, not both!");<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotBlank(encryptedValue)) {<NEW_LINE>setEncryptedValue(encryptedValue);<NEW_LINE>}<NEW_LINE>if (isSecure) {<NEW_LINE>if (value != null) {<NEW_LINE>setEncryptedValue(new EncryptedVariableValueConfig(new GoCipher().encrypt(value)));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>setValue(new VariableValueConfig(value));<NEW_LINE>}<NEW_LINE>} | ).add(ENCRYPTEDVALUE, "You may specify encrypted value only when option 'secure' is true."); |
291,184 | // pkg private for testing<NEW_LINE>final void verifyAfterCleanup(MetadataSnapshot sourceMetadata, MetadataSnapshot targetMetadata) {<NEW_LINE>final RecoveryDiff recoveryDiff = targetMetadata.recoveryDiff(sourceMetadata);<NEW_LINE>if (recoveryDiff.identical.size() != recoveryDiff.size()) {<NEW_LINE>if (recoveryDiff.missing.isEmpty()) {<NEW_LINE>for (StoreFileMetadata meta : recoveryDiff.different) {<NEW_LINE>StoreFileMetadata local = targetMetadata.<MASK><NEW_LINE>StoreFileMetadata remote = sourceMetadata.get(meta.name());<NEW_LINE>// if we have different files then they must have no checksums; otherwise something went wrong during recovery.<NEW_LINE>// we have that problem when we have an empty index is only a segments_1 file so we can't tell if it's a Lucene 4.8 file<NEW_LINE>// and therefore no checksum is included. That isn't a problem since we simply copy it over anyway but those files come out as<NEW_LINE>// different in the diff. That's why we have to double check here again if the rest of it matches.<NEW_LINE>// all is fine this file is just part of a commit or a segment that is different<NEW_LINE>if (local.isSame(remote) == false) {<NEW_LINE>logger.debug("Files are different on the recovery target: {} ", recoveryDiff);<NEW_LINE>throw new IllegalStateException("local version: " + local + " is different from remote version after recovery: " + remote, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.debug("Files are missing on the recovery target: {} ", recoveryDiff);<NEW_LINE>throw new IllegalStateException("Files are missing on the recovery target: [different=" + recoveryDiff.different + ", missing=" + recoveryDiff.missing + ']', null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | get(meta.name()); |
411,897 | public static GetMainPartListResponse unmarshall(GetMainPartListResponse getMainPartListResponse, UnmarshallerContext _ctx) {<NEW_LINE>getMainPartListResponse.setRequestId(_ctx.stringValue("GetMainPartListResponse.RequestId"));<NEW_LINE>getMainPartListResponse.setCode<MASK><NEW_LINE>getMainPartListResponse.setSuccess(_ctx.booleanValue("GetMainPartListResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setCount(_ctx.longValue("GetMainPartListResponse.Data.Count"));<NEW_LINE>List<MainPartBizs> list = new ArrayList<MainPartBizs>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetMainPartListResponse.Data.List.Length"); i++) {<NEW_LINE>MainPartBizs mainPartBizs = new MainPartBizs();<NEW_LINE>mainPartBizs.setAccountNo(_ctx.stringValue("GetMainPartListResponse.Data.List[" + i + "].AccountNo"));<NEW_LINE>mainPartBizs.setAccountType(_ctx.stringValue("GetMainPartListResponse.Data.List[" + i + "].AccountType"));<NEW_LINE>mainPartBizs.setBrandUserId(_ctx.longValue("GetMainPartListResponse.Data.List[" + i + "].BrandUserId"));<NEW_LINE>mainPartBizs.setBrandUserNick(_ctx.stringValue("GetMainPartListResponse.Data.List[" + i + "].BrandUserNick"));<NEW_LINE>mainPartBizs.setMainId(_ctx.longValue("GetMainPartListResponse.Data.List[" + i + "].MainId"));<NEW_LINE>mainPartBizs.setMainName(_ctx.stringValue("GetMainPartListResponse.Data.List[" + i + "].MainName"));<NEW_LINE>mainPartBizs.setProxyUserId(_ctx.longValue("GetMainPartListResponse.Data.List[" + i + "].ProxyUserId"));<NEW_LINE>list.add(mainPartBizs);<NEW_LINE>}<NEW_LINE>data.setList(list);<NEW_LINE>getMainPartListResponse.setData(data);<NEW_LINE>return getMainPartListResponse;<NEW_LINE>} | (_ctx.longValue("GetMainPartListResponse.Code")); |
56,678 | public void testRxFlowableInvoker_get3WithGenericType(Map<String, String> param, StringBuilder ret) {<NEW_LINE>String serverIP = param.get("serverIP");<NEW_LINE>String serverPort = param.get("serverPort");<NEW_LINE>final String threadName = "jaxrs21Thread";<NEW_LINE><MASK><NEW_LINE>Thread jaxrs21Thread = jaxrs21ThreadFactory.newThread(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>String runThreadName = Thread.currentThread().getName();<NEW_LINE>if (!(runThreadName.equals(threadName))) {<NEW_LINE>throw new RuntimeException("testRxFlowable_get3WithGenericType: incorrect thread name");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>jaxrs21Thread.setName(threadName);<NEW_LINE>ExecutorService executorService = Executors.newSingleThreadExecutor(jaxrs21ThreadFactory);<NEW_LINE>ClientBuilder cb = ClientBuilder.newBuilder().executorService(executorService);<NEW_LINE>Client c = cb.build();<NEW_LINE>c.register(RxFlowableInvokerProvider.class);<NEW_LINE>WebTarget t = c.target("http://" + serverIP + ":" + serverPort + "/jaxrs21bookstore/JAXRS21bookstore2/rxget3");<NEW_LINE>Builder builder = t.request();<NEW_LINE>builder.accept("application/xml");<NEW_LINE>GenericType<List<JAXRS21Book>> genericResponseType = new GenericType<List<JAXRS21Book>>() {<NEW_LINE>};<NEW_LINE>Flowable<List<JAXRS21Book>> flowable = builder.rx(RxFlowableInvoker.class).get(genericResponseType);<NEW_LINE>final Holder<List<JAXRS21Book>> holder = new Holder<List<JAXRS21Book>>();<NEW_LINE>final CountDownLatch countDownLatch = new CountDownLatch(1);<NEW_LINE>flowable.subscribe(v -> {<NEW_LINE>// OnNext<NEW_LINE>holder.value = v;<NEW_LINE>countDownLatch.countDown();<NEW_LINE>}, throwable -> {<NEW_LINE>// OnError<NEW_LINE>throw new RuntimeException("testRxFlowable_get3WithGenericType: onError " + throwable.getStackTrace());<NEW_LINE>});<NEW_LINE>try {<NEW_LINE>if (!(countDownLatch.await(complexTimeout, TimeUnit.SECONDS))) {<NEW_LINE>throw new RuntimeException("testRxFlowable_get3WithGenericType: Response took too long. Waited " + complexTimeout);<NEW_LINE>}<NEW_LINE>} catch (InterruptedException ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>List<JAXRS21Book> response = holder.value;<NEW_LINE>ret.append(response != null);<NEW_LINE>c.close();<NEW_LINE>} | ThreadFactory jaxrs21ThreadFactory = Executors.defaultThreadFactory(); |
248,949 | private void buildPreliminaryGraphs(Program program, MethodDependencyInfo thisMethodDep) {<NEW_LINE>GraphBuildingVisitor visitor = new GraphBuildingVisitor(program.variableCount(), dependencyInfo);<NEW_LINE>visitor.thisMethodDep = thisMethodDep;<NEW_LINE>for (BasicBlock block : program.getBasicBlocks()) {<NEW_LINE>visitor.currentBlock = block;<NEW_LINE>for (Phi phi : block.getPhis()) {<NEW_LINE>visitor.visit(phi);<NEW_LINE>}<NEW_LINE>for (Instruction insn : block) {<NEW_LINE>insn.acceptVisitor(visitor);<NEW_LINE>}<NEW_LINE>if (block.getExceptionVariable() != null) {<NEW_LINE>getNodeTypes(packNodeAndDegree(block.getExceptionVariable().getIndex(), 0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>assignmentGraph = visitor.assignmentGraphBuilder.build();<NEW_LINE>cloneGraph = visitor.cloneGraphBuilder.build();<NEW_LINE>arrayGraph = visitor.arrayGraphBuilder.build();<NEW_LINE>itemGraph = visitor.itemGraphBuilder.build();<NEW_LINE>casts = visitor.casts.<MASK><NEW_LINE>exceptions = visitor.exceptions.getAll();<NEW_LINE>virtualCallSites = visitor.virtualCallSites.toArray(new VirtualCallSite[0]);<NEW_LINE>GraphBuilder arrayAssignmentGraphBuilder = new GraphBuilder(assignmentGraph.size());<NEW_LINE>for (int i = 0; i < assignmentGraph.size(); ++i) {<NEW_LINE>for (int j : assignmentGraph.outgoingEdges(i)) {<NEW_LINE>arrayAssignmentGraphBuilder.addEdge(i, j);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (ValueCast cast : casts) {<NEW_LINE>arrayAssignmentGraphBuilder.addEdge(cast.fromVariable, cast.toVariable);<NEW_LINE>}<NEW_LINE>arrayDataAssignmentGraph = arrayAssignmentGraphBuilder.build();<NEW_LINE>} | toArray(new ValueCast[0]); |
1,063,367 | public void init(boolean delay) {<NEW_LINE>final Account account = message.getConversation().getAccount();<NEW_LINE>this.file = mXmppConnectionService.getFileBackend().getFile(message, false);<NEW_LINE>final String mime;<NEW_LINE>if (message.getEncryption() == Message.ENCRYPTION_PGP || message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {<NEW_LINE>mime = "application/pgp-encrypted";<NEW_LINE>} else {<NEW_LINE>mime = this.file.getMimeType();<NEW_LINE>}<NEW_LINE>final long originalFileSize = file.getSize();<NEW_LINE>this.delayed = delay;<NEW_LINE>if (Config.ENCRYPT_ON_HTTP_UPLOADED || message.getEncryption() == Message.ENCRYPTION_AXOLOTL || message.getEncryption() == Message.ENCRYPTION_OTR) {<NEW_LINE>this.key = new byte[44];<NEW_LINE>mXmppConnectionService.getRNG().nextBytes(this.key);<NEW_LINE>this.file.setKeyAndIv(this.key);<NEW_LINE>}<NEW_LINE>this.file.setExpectedSize(originalFileSize + (file.getKey() != null ? 16 : 0));<NEW_LINE>message.resetFileParams();<NEW_LINE>this.slotFuture = new SlotRequester(mXmppConnectionService).request(method, account, file, mime);<NEW_LINE>Futures.addCallback(this.slotFuture, new FutureCallback<SlotRequester.Slot>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(@NullableDecl SlotRequester.Slot result) {<NEW_LINE>HttpUploadConnection.this.slot = result;<NEW_LINE>try {<NEW_LINE>HttpUploadConnection.this.upload();<NEW_LINE>} catch (final Exception e) {<NEW_LINE>fail(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(@NotNull final Throwable throwable) {<NEW_LINE>Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": unable to request slot", throwable);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}, MoreExecutors.directExecutor());<NEW_LINE>message.setTransferable(this);<NEW_LINE>mXmppConnectionService.markMessage(message, Message.STATUS_UNSEND);<NEW_LINE>} | fail(throwable.getMessage()); |
1,209,885 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {<NEW_LINE>JsonObject input = InputParser.parseJsonObjectOrThrowError(req);<NEW_LINE>String method = InputParser.parseStringOrThrowError(input, "method", false);<NEW_LINE>String token = InputParser.parseStringOrThrowError(input, "token", false);<NEW_LINE>assert method != null;<NEW_LINE>assert token != null;<NEW_LINE>// used to be according to logic in https://github.com/supertokens/supertokens-core/issues/141<NEW_LINE>// but then changed slightly when extracting this into its own recipe<NEW_LINE>if (!method.equals("token")) {<NEW_LINE>throw new ServletException(new BadRequestException("Unsupported method for email verification"));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>User user = EmailVerification.<MASK><NEW_LINE>JsonObject result = new JsonObject();<NEW_LINE>result.addProperty("status", "OK");<NEW_LINE>result.addProperty("userId", user.id);<NEW_LINE>result.addProperty("email", user.email);<NEW_LINE>super.sendJsonResponse(200, result, resp);<NEW_LINE>} catch (EmailVerificationInvalidTokenException e) {<NEW_LINE>Logging.debug(main, Utils.exceptionStacktraceToString(e));<NEW_LINE>JsonObject result = new JsonObject();<NEW_LINE>result.addProperty("status", "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR");<NEW_LINE>super.sendJsonResponse(200, result, resp);<NEW_LINE>} catch (StorageQueryException | NoSuchAlgorithmException | StorageTransactionLogicException e) {<NEW_LINE>throw new ServletException(e);<NEW_LINE>}<NEW_LINE>} | verifyEmail(super.main, token); |
909,353 | private void decorate(Element el, Component cmp) {<NEW_LINE>String classAttr = el.getAttribute("class");<NEW_LINE>if (classAttr != null && classAttr.length() > 0) {<NEW_LINE>String[] tags = Util.split(classAttr, " ");<NEW_LINE>$(cmp).addTags(tags);<NEW_LINE>}<NEW_LINE>String uiid = el.getAttribute("uiid");<NEW_LINE>if (uiid != null && uiid.length() > 0) {<NEW_LINE>cmp.setUIID(uiid);<NEW_LINE>}<NEW_LINE>String id = el.getAttribute("id");<NEW_LINE>if (id != null && id.length() > 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>String name = el.getAttribute("name");<NEW_LINE>if (name != null && name.length() > 0) {<NEW_LINE>cmp.setName(name);<NEW_LINE>}<NEW_LINE>String flags = el.getAttribute("flags");<NEW_LINE>if (flags != null && flags.indexOf("safeArea") >= 0 && (cmp instanceof Container)) {<NEW_LINE>((Container) cmp).setSafeArea(true);<NEW_LINE>}<NEW_LINE>} | index.put(id, cmp); |
1,089,925 | public List<NetworkAddressAlias> loadLastUpdate(long timeBucketInMinute) {<NEW_LINE>List<NetworkAddressAlias> networkAddressAliases = new ArrayList<>();<NEW_LINE>try {<NEW_LINE>final int batchSize = Math.min(resultWindowMaxSize, scrollingBatchSize);<NEW_LINE>final Search search = Search.builder().query(Query.range(NetworkAddressAlias.LAST_UPDATE_TIME_BUCKET).gte(timeBucketInMinute)).size(batchSize).build();<NEW_LINE>final SearchParams params = new SearchParams().scroll(SCROLL_CONTEXT_RETENTION);<NEW_LINE>final NetworkAddressAlias.Builder <MASK><NEW_LINE>SearchResponse results = getClient().search(NetworkAddressAlias.INDEX_NAME, search, params);<NEW_LINE>while (results.getHits().getTotal() > 0) {<NEW_LINE>for (SearchHit searchHit : results.getHits()) {<NEW_LINE>networkAddressAliases.add(builder.storage2Entity(new HashMapConverter.ToEntity(searchHit.getSource())));<NEW_LINE>}<NEW_LINE>if (results.getHits().getTotal() < batchSize) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (networkAddressAliases.size() >= resultWindowMaxSize) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>results = getClient().scroll(SCROLL_CONTEXT_RETENTION, results.getScrollId());<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>log.error(t.getMessage(), t);<NEW_LINE>}<NEW_LINE>return networkAddressAliases;<NEW_LINE>} | builder = new NetworkAddressAlias.Builder(); |
654,684 | private void assertCanWrite() throws IOException {<NEW_LINE>for (Path path : nodeDataPaths()) {<NEW_LINE>// check node-paths are writable<NEW_LINE>tryWriteTempFile(path);<NEW_LINE>}<NEW_LINE>for (String indexFolderName : this.availableIndexFolders()) {<NEW_LINE>for (Path indexPath : this.resolveIndexFolder(indexFolderName)) {<NEW_LINE>// check index paths are writable<NEW_LINE>Path indexStatePath = <MASK><NEW_LINE>tryWriteTempFile(indexStatePath);<NEW_LINE>tryWriteTempFile(indexPath);<NEW_LINE>try (DirectoryStream<Path> stream = Files.newDirectoryStream(indexPath)) {<NEW_LINE>for (Path shardPath : stream) {<NEW_LINE>String fileName = shardPath.getFileName().toString();<NEW_LINE>if (Files.isDirectory(shardPath) && fileName.chars().allMatch(Character::isDigit)) {<NEW_LINE>Path indexDir = shardPath.resolve(ShardPath.INDEX_FOLDER_NAME);<NEW_LINE>Path statePath = shardPath.resolve(MetadataStateFormat.STATE_DIR_NAME);<NEW_LINE>Path translogDir = shardPath.resolve(ShardPath.TRANSLOG_FOLDER_NAME);<NEW_LINE>tryWriteTempFile(indexDir);<NEW_LINE>tryWriteTempFile(translogDir);<NEW_LINE>tryWriteTempFile(statePath);<NEW_LINE>tryWriteTempFile(shardPath);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | indexPath.resolve(MetadataStateFormat.STATE_DIR_NAME); |
1,157,938 | public void execute(GenshinPlayer sender, List<String> args) {<NEW_LINE>if (sender == null) {<NEW_LINE>CommandHandler.sendMessage(null, "Run this command in-game.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>sender.getTeamManager().getActiveTeam().forEach(entity -> {<NEW_LINE><MASK><NEW_LINE>entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, entity.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP));<NEW_LINE>entity.getWorld().broadcastPacket(new PacketAvatarFightPropUpdateNotify(entity.getAvatar(), FightProperty.FIGHT_PROP_CUR_HP));<NEW_LINE>if (!isAlive) {<NEW_LINE>entity.getWorld().broadcastPacket(new PacketAvatarLifeStateChangeNotify(entity.getAvatar()));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>CommandHandler.sendMessage(sender, "All characters are healed.");<NEW_LINE>} | boolean isAlive = entity.isAlive(); |
1,511,898 | public void marshall(UpdateLaunchProfileRequest updateLaunchProfileRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (updateLaunchProfileRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(updateLaunchProfileRequest.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateLaunchProfileRequest.getLaunchProfileId(), LAUNCHPROFILEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateLaunchProfileRequest.getLaunchProfileProtocolVersions(), LAUNCHPROFILEPROTOCOLVERSIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateLaunchProfileRequest.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateLaunchProfileRequest.getStreamConfiguration(), STREAMCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateLaunchProfileRequest.getStudioComponentIds(), STUDIOCOMPONENTIDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateLaunchProfileRequest.getStudioId(), STUDIOID_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | updateLaunchProfileRequest.getClientToken(), CLIENTTOKEN_BINDING); |
1,835,713 | private void killLoadsOfObjectsPassed(InvokeInstruction ins) {<NEW_LINE>try {<NEW_LINE>XMethod called = Hierarchy2.findExactMethod(ins, methodGen.getConstantPool(), Hierarchy.ANY_METHOD);<NEW_LINE>if (called != null) {<NEW_LINE>NoSideEffectMethodsDatabase nse = Global.getAnalysisCache().getOptionalDatabase(NoSideEffectMethodsDatabase.class);<NEW_LINE>if (nse != null && !nse.is(called.getMethodDescriptor(), MethodSideEffectStatus.SE, MethodSideEffectStatus.OBJ)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>FieldSummary fieldSummary = AnalysisContext.currentAnalysisContext().getFieldSummary();<NEW_LINE>Set<XField> touched = fieldSummary.getFieldsWritten(called);<NEW_LINE>if (!touched.isEmpty()) {<NEW_LINE>getFrame().killLoadsOf(touched);<NEW_LINE>}<NEW_LINE>int passed = getNumWordsConsumed(ins);<NEW_LINE>ValueNumber<MASK><NEW_LINE>getFrame().killLoadsWithSimilarName(ins.getClassName(cpg), ins.getMethodName(cpg));<NEW_LINE>getFrame().getTopStackWords(arguments);<NEW_LINE>for (ValueNumber v : arguments) {<NEW_LINE>getFrame().killAllLoadsOf(v);<NEW_LINE>}<NEW_LINE>// Too many false-positives for primitives without transitive FieldSummary analysis,<NEW_LINE>// so currently we simply kill any writable primitive on any method call<NEW_LINE>// TODO: implement transitive FieldSummary<NEW_LINE>getFrame().killAllLoads(true);<NEW_LINE>} catch (DataflowAnalysisException e) {<NEW_LINE>AnalysisContext.logError("Error in killLoadsOfObjectsPassed", e);<NEW_LINE>}<NEW_LINE>} | [] arguments = allocateValueNumberArray(passed); |
1,054,995 | public Request<DeleteLanguageModelRequest> marshall(DeleteLanguageModelRequest deleteLanguageModelRequest) {<NEW_LINE>if (deleteLanguageModelRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(DeleteLanguageModelRequest)");<NEW_LINE>}<NEW_LINE>Request<DeleteLanguageModelRequest> request = new DefaultRequest<DeleteLanguageModelRequest>(deleteLanguageModelRequest, "AmazonTranscribe");<NEW_LINE>String target = "Transcribe.DeleteLanguageModel";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (deleteLanguageModelRequest.getModelName() != null) {<NEW_LINE>String modelName = deleteLanguageModelRequest.getModelName();<NEW_LINE>jsonWriter.name("ModelName");<NEW_LINE>jsonWriter.value(modelName);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | request.addHeader("Content-Type", "application/x-amz-json-1.1"); |
213,115 | private static Object readCheckedCollectionFrom(Input input, Schema<?> schema, Object owner, IdStrategy strategy, boolean graph, Object collection, boolean ss, boolean list) throws IOException {<NEW_LINE>if (graph) {<NEW_LINE>// update the actual reference.<NEW_LINE>((GraphInput) input).updateLast(collection, owner);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>Object c = input.mergeObject(wrapper, strategy.POLYMORPHIC_COLLECTION_SCHEMA);<NEW_LINE>if (!graph || !((GraphInput) input).isCurrentMessageReference())<NEW_LINE>c = wrapper.value;<NEW_LINE>if (1 != input.readFieldNumber(schema))<NEW_LINE>throw new ProtostuffException("Corrupt input.");<NEW_LINE>Object type = input.mergeObject(wrapper, strategy.CLASS_SCHEMA);<NEW_LINE>if (!graph || !((GraphInput) input).isCurrentMessageReference())<NEW_LINE>type = wrapper.value;<NEW_LINE>try {<NEW_LINE>fCheckedCollection_c.set(collection, c);<NEW_LINE>fCheckedCollection_type.set(collection, type);<NEW_LINE>if (ss)<NEW_LINE>fCheckedSortedSet_ss.set(collection, c);<NEW_LINE>if (list)<NEW_LINE>fCheckedList_list.set(collection, c);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>return collection;<NEW_LINE>} | final Wrapper wrapper = new Wrapper(); |
1,159,961 | protected Record rebalance(int id1, Record r1, int id2, Record r2) {<NEW_LINE>RecordBufferPageMgr mgr = bpt.getRecordsMgr().getRecordBufferPageMgr();<NEW_LINE>RecordBufferPage page1 = mgr.getWrite(id1);<NEW_LINE>RecordBufferPage page2 = mgr.getWrite(id2);<NEW_LINE>// Wrong calculation.<NEW_LINE>for (int i = page2.getCount(); i < page1.getMaxSize() / 2; i++) {<NEW_LINE>// shiftOneup(node1, node2) ;<NEW_LINE>Record r = page1.getRecordBuffer().getHigh();<NEW_LINE>page1.getRecordBuffer().removeTop();<NEW_LINE>page2.getRecordBuffer(<MASK><NEW_LINE>}<NEW_LINE>mgr.put(page1);<NEW_LINE>mgr.put(page2);<NEW_LINE>Record splitPoint = page1.getRecordBuffer().getHigh();<NEW_LINE>splitPoint = bpt.getRecordFactory().createKeyOnly(splitPoint);<NEW_LINE>// Record splitPoint = node1.maxRecord() ;<NEW_LINE>return splitPoint;<NEW_LINE>} | ).add(0, r); |
1,041,417 | public boolean startForeground(Service service, @NonNull Repository.PlaylistsRepository playlistsRepository, @NonNull Repository.SongsRepository songsRepository, @NonNull Song song, boolean isPlaying, @NonNull MediaSessionCompat.Token mediaSessionToken, SettingsManager settingsManager, FavoritesPlaylistManager favoritesPlaylistManager) {<NEW_LINE>notify(service, playlistsRepository, songsRepository, song, isPlaying, mediaSessionToken, settingsManager, favoritesPlaylistManager);<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>Log.w(TAG, "service.startForeground called");<NEW_LINE>service.startForeground(NOTIFICATION_ID, notification);<NEW_LINE>return true;<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>Log.e(TAG, "startForeground not called, error: " + e);<NEW_LINE>LogUtils.logException(TAG, "Error starting foreground notification", e);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | analyticsManager.dropBreadcrumb(TAG, "startForeground() called"); |
850,383 | // Liberty Change<NEW_LINE>@FFDCIgnore(value = { Exception.class })<NEW_LINE>private static Object evaluateFactoryMethods(String value, ParameterType pType, Object result, Class<?> cls, String[] methodNames) {<NEW_LINE>Exception factoryMethodEx = null;<NEW_LINE>for (String mName : methodNames) {<NEW_LINE>try {<NEW_LINE>result = <MASK><NEW_LINE>if (result != null) {<NEW_LINE>factoryMethodEx = null;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>// If it is enum and the method name is "fromValue" then don't throw<NEW_LINE>// the exception immediately but try the next factory method<NEW_LINE>factoryMethodEx = ex;<NEW_LINE>if (!cls.isEnum() || !"fromValue".equals(mName)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (factoryMethodEx != null) {<NEW_LINE>Throwable t = getOrThrowActualException(factoryMethodEx);<NEW_LINE>Tr.error(tc, new org.apache.cxf.common.i18n.Message("CLASS_VALUE_OF_FAILURE", BUNDLE, cls.getName()).toString());<NEW_LINE>throw new WebApplicationException(t, HttpUtils.getParameterFailureStatus(pType));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | evaluateFactoryMethod(value, cls, mName); |
696,865 | private List<Folder> findContainersAssetsByContentType(final String contentTypeVarNameFileName) {<NEW_LINE>List<Contentlet> containers = null;<NEW_LINE>final List<Folder> folders = new ArrayList<>();<NEW_LINE>final User user = APILocator.systemUser();<NEW_LINE>final StringBuilder sqlQuery = new StringBuilder("select cvi.working_inode as inode from contentlet_version_info cvi, identifier id where" + " id.parent_path like ? and id.asset_name = ? and cvi.identifier = id.id");<NEW_LINE>final List<Object> parameters = new ArrayList<>();<NEW_LINE>parameters.add(Constants.CONTAINER_FOLDER_PATH + <MASK><NEW_LINE>parameters.add(contentTypeVarNameFileName + StringPool.PERIOD + "vtl");<NEW_LINE>sqlQuery.append(" and cvi.deleted = " + DbConnectionFactory.getDBFalse());<NEW_LINE>final DotConnect dc = new DotConnect().setSQL(sqlQuery.toString());<NEW_LINE>parameters.forEach(param -> dc.addParam(param));<NEW_LINE>try {<NEW_LINE>final List<Map<String, String>> inodesMapList = dc.loadResults();<NEW_LINE>final List<String> inodes = new ArrayList<>();<NEW_LINE>for (final Map<String, String> versionInfoMap : inodesMapList) {<NEW_LINE>inodes.add(versionInfoMap.get("inode"));<NEW_LINE>}<NEW_LINE>containers = APILocator.getContentletAPI().findContentlets(inodes);<NEW_LINE>for (final Contentlet container : containers) {<NEW_LINE>folders.add(this.folderAPI.find(container.getFolder(), user, false));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(this.getClass(), e.getMessage(), e);<NEW_LINE>throw new DotRuntimeException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>return folders;<NEW_LINE>} | StringPool.FORWARD_SLASH + StringPool.PERCENT); |
199,821 | protected Enumeration<URL> findResources(String name) throws IOException {<NEW_LINE>Enumeration<URL> <MASK><NEW_LINE>ConcurrentLinkedQueue<String> providerNames = clSvc.metaInfServicesProviders.get(name);<NEW_LINE>if (providerNames != null && !providerNames.isEmpty()) {<NEW_LINE>Set<URL> urls = new LinkedHashSet<URL>();<NEW_LINE>while (urlEnum.hasMoreElements()) urls.add(urlEnum.nextElement());<NEW_LINE>for (String providerImplClassName : providerNames) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())<NEW_LINE>Tr.debug(this, tc, providerImplClassName);<NEW_LINE>ServiceReference<MetaInfServicesProvider> ref = clSvc.metaInfServicesRefs.getReference(providerImplClassName);<NEW_LINE>if (ref != null) {<NEW_LINE>urls.add((URL) ref.getProperty("file.url"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>urlEnum = Collections.enumeration(urls);<NEW_LINE>}<NEW_LINE>return urlEnum;<NEW_LINE>} | urlEnum = super.findResources(name); |
1,797,569 | public static void convertMillisToReadable(HandlerContext handlerCtx) {<NEW_LINE>Long milliseconds = (<MASK><NEW_LINE>final long MSEC_PER_SECOND = 1000;<NEW_LINE>final long MSEC_PER_MINUTE = 60 * MSEC_PER_SECOND;<NEW_LINE>final long MSEC_PER_HOUR = MSEC_PER_MINUTE * 60;<NEW_LINE>final long MSEC_PER_DAY = MSEC_PER_HOUR * 24;<NEW_LINE>final long MSEC_PER_WEEK = MSEC_PER_DAY * 7;<NEW_LINE>String FORMAT2 = "%d %s %d %s";<NEW_LINE>String FORMAT1 = "%d %s";<NEW_LINE>String readableString = "";<NEW_LINE>long msecLeftover = milliseconds != null ? milliseconds : 0L;<NEW_LINE>long numWeeks = msecLeftover / MSEC_PER_WEEK;<NEW_LINE>msecLeftover -= numWeeks * MSEC_PER_WEEK;<NEW_LINE>long numDays = msecLeftover / MSEC_PER_DAY;<NEW_LINE>msecLeftover -= numDays * MSEC_PER_DAY;<NEW_LINE>long numHours = msecLeftover / MSEC_PER_HOUR;<NEW_LINE>msecLeftover -= numHours * MSEC_PER_HOUR;<NEW_LINE>long numMinutes = msecLeftover / MSEC_PER_MINUTE;<NEW_LINE>msecLeftover -= numMinutes * MSEC_PER_MINUTE;<NEW_LINE>long numSeconds = msecLeftover / MSEC_PER_SECOND;<NEW_LINE>msecLeftover -= numSeconds * MSEC_PER_SECOND;<NEW_LINE>long numMilliSeconds = msecLeftover;<NEW_LINE>if (numWeeks > 0) {<NEW_LINE>readableString = String.format(FORMAT2, numWeeks, GuiUtil.getMessage("common.Weeks"), numDays, GuiUtil.getMessage("common.Days"));<NEW_LINE>} else if (numDays > 0) {<NEW_LINE>readableString = String.format(FORMAT1, numDays, GuiUtil.getMessage("common.Days"));<NEW_LINE>} else if (numHours > 0) {<NEW_LINE>readableString = String.format(FORMAT2, numHours, GuiUtil.getMessage("common.Hours"), numMinutes, GuiUtil.getMessage("common.Minutes"));<NEW_LINE>} else if (numMinutes > 0) {<NEW_LINE>readableString = String.format(FORMAT2, numMinutes, GuiUtil.getMessage("common.Minutes"), numSeconds, GuiUtil.getMessage("common.Seconds"));<NEW_LINE>} else if (numSeconds > 0) {<NEW_LINE>readableString = String.format(FORMAT1, numSeconds, GuiUtil.getMessage("common.Seconds"));<NEW_LINE>} else {<NEW_LINE>readableString = String.format(FORMAT1, numMilliSeconds, GuiUtil.getMessage("common.Milliseconds"));<NEW_LINE>}<NEW_LINE>handlerCtx.setOutputValue("readableString", readableString);<NEW_LINE>} | Long) handlerCtx.getInputValue("milliseconds"); |
1,632,396 | public static Collection<EventPayloadInstance> createEventPayloadInstances(VariableScope variableScope, ExpressionManager expressionManager, BaseElement baseElement, EventModel eventDefinition) {<NEW_LINE>List<EventPayloadInstance> eventPayloadInstances = new ArrayList<>();<NEW_LINE>List<ExtensionElement> inParameters = baseElement.getExtensionElements().getOrDefault(CmmnXmlConstants.ELEMENT_EVENT_IN_PARAMETER, Collections.emptyList());<NEW_LINE>if (!inParameters.isEmpty()) {<NEW_LINE>for (ExtensionElement inParameter : inParameters) {<NEW_LINE>String source = inParameter.<MASK><NEW_LINE>String target = inParameter.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_IOPARAMETER_TARGET);<NEW_LINE>EventPayload eventPayloadDefinition = eventDefinition.getPayload(target);<NEW_LINE>if (eventPayloadDefinition != null) {<NEW_LINE>Expression sourceExpression = expressionManager.createExpression(source);<NEW_LINE>Object value = sourceExpression.getValue(variableScope);<NEW_LINE>eventPayloadInstances.add(new EventPayloadInstanceImpl(eventPayloadDefinition, value));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return eventPayloadInstances;<NEW_LINE>} | getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_IOPARAMETER_SOURCE); |
908,251 | public void update(long bytesRead, long contentLength, boolean done) {<NEW_LINE>EventEmitter eventEmitter = mModuleRegistry.getModule(EventEmitter.class);<NEW_LINE>if (eventEmitter != null) {<NEW_LINE>Bundle downloadProgress = new Bundle();<NEW_LINE>Bundle downloadProgressData = new Bundle();<NEW_LINE>long totalBytesWritten = isResume ? bytesRead + <MASK><NEW_LINE>long totalBytesExpectedToWrite = isResume ? contentLength + Long.parseLong(resumeData) : contentLength;<NEW_LINE>long currentTime = System.currentTimeMillis();<NEW_LINE>// Throttle events. Sending too many events will block the JS event loop.<NEW_LINE>// Make sure to send the last event when we're at 100%.<NEW_LINE>if (currentTime > mLastUpdate + MIN_EVENT_DT_MS || totalBytesWritten == totalBytesExpectedToWrite) {<NEW_LINE>mLastUpdate = currentTime;<NEW_LINE>downloadProgressData.putDouble("totalBytesWritten", totalBytesWritten);<NEW_LINE>downloadProgressData.putDouble("totalBytesExpectedToWrite", totalBytesExpectedToWrite);<NEW_LINE>downloadProgress.putString("uuid", uuid);<NEW_LINE>downloadProgress.putBundle("data", downloadProgressData);<NEW_LINE>eventEmitter.emit(EXDownloadProgressEventName, downloadProgress);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Long.parseLong(resumeData) : bytesRead; |
57,701 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {<NEW_LINE>View root = inflater.inflate(R.layout.fragment_wallet, container, false);<NEW_LINE>loadingRecentContainer = root.findViewById(R.id.wallet_loading_recent_container);<NEW_LINE>layoutAccountRecommended = root.findViewById(R.id.wallet_account_recommended_container);<NEW_LINE>layoutSdkInitializing = root.findViewById(R.id.container_sdk_initializing);<NEW_LINE>linkSkipAccount = root.findViewById(R.id.wallet_skip_account_link);<NEW_LINE>buttonSignUp = root.findViewById(R.id.wallet_sign_up_button);<NEW_LINE>inlineBalanceContainer = root.findViewById(R.id.wallet_inline_balance_container);<NEW_LINE>textWalletInlineBalance = root.findViewById(R.id.wallet_inline_balance_value);<NEW_LINE>walletSendProgress = root.findViewById(R.id.wallet_send_progress);<NEW_LINE>walletTotalBalanceView = root.findViewById(R.id.wallet_total_balance);<NEW_LINE>walletSpendableBalanceView = root.findViewById(R.id.wallet_spendable_balance);<NEW_LINE>walletSupportingBalanceView = root.findViewById(R.id.wallet_supporting_balance);<NEW_LINE>textWalletBalanceUSD = root.findViewById(R.id.wallet_balance_usd_value);<NEW_LINE>textWalletBalanceDesc = root.findViewById(R.id.total_balance_desc);<NEW_LINE>textWalletHintSyncStatus = root.findViewById(R.id.wallet_hint_sync_status);<NEW_LINE>buttonViewMore = root.findViewById(R.id.view_more_button);<NEW_LINE>detailListView = root.findViewById(R.id.balance_detail_listview);<NEW_LINE>recentTransactionsList = root.findViewById(R.id.wallet_recent_transactions_list);<NEW_LINE>linkViewAll = root.findViewById(R.id.wallet_link_view_all);<NEW_LINE>textNoRecentTransactions = root.findViewById(R.id.wallet_no_recent_transactions);<NEW_LINE>buttonBuyLBC = root.findViewById(R.id.wallet_buy_lbc_button);<NEW_LINE>textConvertCredits = root.findViewById(R.id.wallet_hint_convert_credits);<NEW_LINE>textConvertCreditsBittrex = root.findViewById(R.id.wallet_hint_convert_credits_bittrex);<NEW_LINE>textWhatSyncMeans = root.<MASK><NEW_LINE>textWalletReceiveAddress = root.findViewById(R.id.wallet_receive_address);<NEW_LINE>buttonCopyReceiveAddress = root.findViewById(R.id.wallet_copy_receive_address);<NEW_LINE>buttonGetNewAddress = root.findViewById(R.id.wallet_get_new_address);<NEW_LINE>inputSendAddress = root.findViewById(R.id.wallet_input_send_address);<NEW_LINE>buttonQRScanAddress = root.findViewById(R.id.wallet_qr_scan_address);<NEW_LINE>inputSendAmount = root.findViewById(R.id.wallet_input_amount);<NEW_LINE>buttonSend = root.findViewById(R.id.wallet_send);<NEW_LINE>textConnectedEmail = root.findViewById(R.id.wallet_connected_email);<NEW_LINE>switchSyncStatus = root.findViewById(R.id.wallet_switch_sync_status);<NEW_LINE>linkManualBackup = root.findViewById(R.id.wallet_link_manual_backup);<NEW_LINE>linkSyncFAQ = root.findViewById(R.id.wallet_link_sync_faq);<NEW_LINE>initUi();<NEW_LINE>return root;<NEW_LINE>} | findViewById(R.id.wallet_hint_what_sync_means); |
24,226 | public SpringProcessLiveData retrieveLiveData(JMXConnector jmxConnector, String processID, String processName, String urlScheme, String host, String contextPath, String port, SpringProcessLiveData currentData) {<NEW_LINE>try {<NEW_LINE>MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();<NEW_LINE>String domain = getDomainForActuator(connection);<NEW_LINE>String environment = getEnvironment(connection, domain);<NEW_LINE>String[] <MASK><NEW_LINE>LiveProperties properties = getProperties(connection, environment);<NEW_LINE>if (processID == null) {<NEW_LINE>processID = getProcessID(connection);<NEW_LINE>}<NEW_LINE>if (processName == null) {<NEW_LINE>Properties systemProperties = getSystemProperties(connection);<NEW_LINE>if (systemProperties != null) {<NEW_LINE>String javaCommand = getJavaCommand(systemProperties);<NEW_LINE>processName = getProcessName(javaCommand);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LiveConditional[] conditionals = getConditionals(connection, domain, processID, processName);<NEW_LINE>LiveRequestMapping[] requestMappings = getRequestMappings(connection, domain);<NEW_LINE>LiveBeansModel beans = getBeans(connection, domain);<NEW_LINE>LiveMetricsModel metrics = getMetrics(connection, domain);<NEW_LINE>StartupMetricsModel startup = getStartupMetrics(connection, domain, currentData == null ? null : currentData.getStartupMetrics());<NEW_LINE>if (contextPath == null) {<NEW_LINE>contextPath = getContextPath(connection, domain, environment);<NEW_LINE>}<NEW_LINE>if (port == null) {<NEW_LINE>port = getPort(connection, environment);<NEW_LINE>}<NEW_LINE>return new SpringProcessLiveData(processName, processID, contextPath, urlScheme, port, host, beans, activeProfiles, requestMappings, conditionals, properties, metrics, startup);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("error reading live data from: " + processID + " - " + processName, e);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | activeProfiles = getActiveProfiles(connection, environment); |
1,358,969 | private void writeInternal(ByteBuffer buffer) throws IOException {<NEW_LINE>Platform.blockGuardOnNetwork();<NEW_LINE>checkOpen();<NEW_LINE>init();<NEW_LINE>// Need to loop through at least once to enable handshaking where no application<NEW_LINE>// bytes are processed.<NEW_LINE>int len = buffer.remaining();<NEW_LINE>SSLEngineResult engineResult;<NEW_LINE>do {<NEW_LINE>target.clear();<NEW_LINE>engineResult = engine.wrap(buffer, target);<NEW_LINE>if (engineResult.getStatus() != OK && engineResult.getStatus() != CLOSED) {<NEW_LINE>throw new SSLException(<MASK><NEW_LINE>}<NEW_LINE>if (target.position() != engineResult.bytesProduced()) {<NEW_LINE>throw new SSLException("Engine bytesProduced " + engineResult.bytesProduced() + " does not match bytes written " + target.position());<NEW_LINE>}<NEW_LINE>len -= engineResult.bytesConsumed();<NEW_LINE>if (len != buffer.remaining()) {<NEW_LINE>throw new SSLException("Engine did not read the correct number of bytes");<NEW_LINE>}<NEW_LINE>if (engineResult.getStatus() == CLOSED && engineResult.bytesProduced() == 0) {<NEW_LINE>if (len > 0) {<NEW_LINE>throw new SocketException("Socket closed");<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>target.flip();<NEW_LINE>// Write the data to the socket.<NEW_LINE>writeToSocket();<NEW_LINE>} while (len > 0);<NEW_LINE>} | "Unexpected engine result " + engineResult.getStatus()); |
73,231 | public void paintTrack(Graphics graphic) {<NEW_LINE>// This rectangle is the bounding box for the progress bar<NEW_LINE>// portion of the slider. The track is painted in the middle<NEW_LINE>// of this rectangle and the thumb laid overtop.<NEW_LINE>Rectangle track = this.trackRect;<NEW_LINE>// Get the location of the thumb, this point splits the<NEW_LINE>// progress bar into 2 line segments, seen and unseen.<NEW_LINE>Rectangle thumb = this.thumbRect;<NEW_LINE>int thumbX = thumb.x;<NEW_LINE>int thumbY = thumb.y;<NEW_LINE><MASK><NEW_LINE>// Paint the seen side<NEW_LINE>graphic.setColor(trackSeen);<NEW_LINE>graphic.drawLine(track.x, track.y + track.height / 2, thumbX, thumbY + track.height / 2);<NEW_LINE>// Paint the unseen side<NEW_LINE>graphic.setColor(trackUnseen);<NEW_LINE>graphic.drawLine(thumbX, thumbY + track.height / 2, track.x + track.width, track.y + track.height / 2);<NEW_LINE>// Preserve the graphics color.<NEW_LINE>graphic.setColor(original);<NEW_LINE>} | Color original = graphic.getColor(); |
848,906 | protected void initData() {<NEW_LINE>RxRun.runOn(new RxRunnable<List<UserModel>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public List<UserModel> execute() {<NEW_LINE>List<UserEntity> temp = AppDatabase.getAppDatabase(mContext).downloadDao().getAllUser();<NEW_LINE>allItems = new ArrayList<>();<NEW_LINE>for (int i = 0; i < temp.size(); i++) {<NEW_LINE>allItems.add(Shaft.sGson.fromJson(temp.get(i).getUserGson<MASK><NEW_LINE>}<NEW_LINE>return allItems;<NEW_LINE>}<NEW_LINE>}, new NullCtrl<List<UserModel>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success(List<UserModel> userModels) {<NEW_LINE>if (userModels.size() != 0) {<NEW_LINE>for (int i = 0; i < userModels.size(); i++) {<NEW_LINE>bindData(userModels.get(i));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | (), UserModel.class)); |
69,345 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>String test = request.getParameter("test");<NEW_LINE>PrintWriter out = response.getWriter();<NEW_LINE>try {<NEW_LINE>out.println(getClass().getSimpleName() + " is starting " + test + "<br>");<NEW_LINE>System.out.<MASK><NEW_LINE>getClass().getMethod(test, HttpServletRequest.class, PrintWriter.class).invoke(this, request, out);<NEW_LINE>System.out.println("<----- " + test + " successful");<NEW_LINE>out.println(test + " " + SUCCESS_MESSAGE);<NEW_LINE>} catch (Throwable x) {<NEW_LINE>if (x instanceof InvocationTargetException)<NEW_LINE>x = x.getCause();<NEW_LINE>System.out.println("<----- " + test + " failed:");<NEW_LINE>x.printStackTrace(System.out);<NEW_LINE>out.println("<pre>ERROR in " + test + ":");<NEW_LINE>x.printStackTrace(out);<NEW_LINE>out.println("</pre>");<NEW_LINE>} finally {<NEW_LINE>out.flush();<NEW_LINE>out.close();<NEW_LINE>}<NEW_LINE>} | println("-----> " + test + " starting"); |
661,379 | public void visit(OWLAnnotationPropertyRangeAxiom ax) {<NEW_LINE>OWLProperty prop = dup(ax.getProperty());<NEW_LINE>IRI range = dup(ax.getRange());<NEW_LINE>if (prop.isObjectPropertyExpression()) {<NEW_LINE>// turn to object property domain<NEW_LINE>OWLClassExpression d = df.getOWLClass(range);<NEW_LINE>LOGGER.warn("Annotation property range axiom turned to object property range after parsing. This could introduce errors if the original range was an anonymous expression: {} is the new domain.", range);<NEW_LINE>obj = df.getOWLObjectPropertyRangeAxiom(prop.asOWLObjectProperty(), d, asList(ax.annotations()));<NEW_LINE>return;<NEW_LINE>} else if (prop.isDataPropertyExpression()) {<NEW_LINE>// turn to data property domain<NEW_LINE>OWLDataRange d = df.getOWLDatatype(range);<NEW_LINE><MASK><NEW_LINE>obj = df.getOWLDataPropertyRangeAxiom(prop.asOWLDataProperty(), d, asList(ax.annotations()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>obj = df.getOWLAnnotationPropertyRangeAxiom(prop.asOWLAnnotationProperty(), range, anns(ax));<NEW_LINE>} | LOGGER.warn("Annotation property range axiom turned to data property range after parsing. This could introduce errors if the original range was an anonymous expression: {} is the new domain.", range); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.