idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
365,260 | protected Boolean isSupportedNamedGroup(int namedGroup) {<NEW_LINE>try {<NEW_LINE>if (NamedGroup.refersToAnXDHCurve(namedGroup)) {<NEW_LINE>switch(namedGroup) {<NEW_LINE>case NamedGroup.x25519:<NEW_LINE>{<NEW_LINE>// helper.createAlgorithmParameters("X25519");<NEW_LINE>helper.createKeyAgreement("X25519");<NEW_LINE>// helper.createKeyFactory("X25519");<NEW_LINE>// helper.createKeyPairGenerator("X25519");<NEW_LINE>return Boolean.TRUE;<NEW_LINE>}<NEW_LINE>case NamedGroup.x448:<NEW_LINE>{<NEW_LINE>// helper.createAlgorithmParameters("X448");<NEW_LINE>helper.createKeyAgreement("X448");<NEW_LINE>// helper.createKeyFactory("X448");<NEW_LINE>// helper.createKeyPairGenerator("X448");<NEW_LINE>return Boolean.TRUE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (NamedGroup.refersToAnECDSACurve(namedGroup)) {<NEW_LINE>return Boolean.valueOf(ECUtil.isCurveSupported(this, NamedGroup.getCurveName(namedGroup)));<NEW_LINE>} else if (NamedGroup.refersToASpecificFiniteField(namedGroup)) {<NEW_LINE>return Boolean.valueOf(DHUtil.isGroupSupported(this, <MASK><NEW_LINE>}<NEW_LINE>} catch (GeneralSecurityException e) {<NEW_LINE>return Boolean.FALSE;<NEW_LINE>}<NEW_LINE>// 'null' means we don't even recognize the NamedGroup<NEW_LINE>return null;<NEW_LINE>} | TlsDHUtils.getNamedDHGroup(namedGroup))); |
44,039 | synchronized long update(long timeMillis, long waitMillis) {<NEW_LINE>for (int i = 0, n = tasks.size; i < n; i++) {<NEW_LINE>Task <MASK><NEW_LINE>synchronized (task) {<NEW_LINE>if (task.executeTimeMillis > timeMillis) {<NEW_LINE>waitMillis = Math.min(waitMillis, task.executeTimeMillis - timeMillis);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (task.repeatCount == 0) {<NEW_LINE>task.timer = null;<NEW_LINE>tasks.removeIndex(i);<NEW_LINE>i--;<NEW_LINE>n--;<NEW_LINE>} else {<NEW_LINE>task.executeTimeMillis = timeMillis + task.intervalMillis;<NEW_LINE>waitMillis = Math.min(waitMillis, task.intervalMillis);<NEW_LINE>if (task.repeatCount > 0)<NEW_LINE>task.repeatCount--;<NEW_LINE>}<NEW_LINE>task.app.postRunnable(task);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return waitMillis;<NEW_LINE>} | task = tasks.get(i); |
424,200 | private void deserializePrimitive(Object parent, Map<String, Object> state, String key, Field f, Class ftype) throws IllegalAccessException {<NEW_LINE>Object value = state.get(key);<NEW_LINE>if (ftype == boolean.class)<NEW_LINE>f.set(parent, value);<NEW_LINE>else if (ftype == byte.class)<NEW_LINE>f.set(parent, ((Number) value).byteValue());<NEW_LINE>else if (ftype == char.class)<NEW_LINE>f.set(parent, value);<NEW_LINE>else if (ftype == short.class)<NEW_LINE>f.set(parent, ((Number) value).shortValue());<NEW_LINE>else if (ftype == int.class)<NEW_LINE>f.set(parent, ((Number<MASK><NEW_LINE>else if (ftype == long.class)<NEW_LINE>f.set(parent, ((Number) value).longValue());<NEW_LINE>else if (ftype == float.class)<NEW_LINE>f.set(parent, ((Number) value).floatValue());<NEW_LINE>else if (ftype == double.class)<NEW_LINE>f.set(parent, ((Number) value).doubleValue());<NEW_LINE>else<NEW_LINE>errorHandler.handle(ErrorType.UNEXPECTED_TYPE, "Unknown primitive " + ftype, null);<NEW_LINE>} | ) value).intValue()); |
433,919 | public static int multiplyColor(int c1, int c2) {<NEW_LINE>int r1 = (c1 & 0xFF0000) >> 16;<NEW_LINE>int r2 = (c2 & 0xFF0000) >> 16;<NEW_LINE>int g1 = (c1 & 0x00FF00) >> 8;<NEW_LINE>int g2 = <MASK><NEW_LINE>int b1 = (c1 & 0x0000FF);<NEW_LINE>int b2 = (c2 & 0x0000FF);<NEW_LINE>int r = (int) (r1 * (r2 / 255.0F));<NEW_LINE>int g = (int) (g1 * (g2 / 255.0F));<NEW_LINE>int b = (int) (b1 * (b2 / 255.0F));<NEW_LINE>return c1 & ~0xFFFFFF | r << 16 | g << 8 | b;<NEW_LINE>} | (c2 & 0x00FF00) >> 8; |
826,828 | public TypeVar inlineAsVar(UTypeVar var) throws CouldNotResolveImportException {<NEW_LINE>TypeVar typeVar = typeVarCache.get(var.getName());<NEW_LINE>if (typeVar != null) {<NEW_LINE>return typeVar;<NEW_LINE>}<NEW_LINE>Name name = asName(var.getName());<NEW_LINE>TypeSymbol sym = new TypeVariableSymbol(0, name, null, symtab().noSymbol);<NEW_LINE>typeVar = new TypeVar(sym, /* bound= */<NEW_LINE>null, /* lower= */<NEW_LINE>symtab().botType);<NEW_LINE>sym.type = typeVar;<NEW_LINE>typeVarCache.put(var.getName(), typeVar);<NEW_LINE>// Any recursive uses of var will point to the same TypeVar object generated above.<NEW_LINE>setUpperBound(typeVar, var.getUpperBound<MASK><NEW_LINE>typeVar.lower = var.getLowerBound().inline(this);<NEW_LINE>return typeVar;<NEW_LINE>} | ().inline(this)); |
5,403 | protected R visitClassElements(List<? extends Concrete.ClassElement> elements, P params) {<NEW_LINE>for (Concrete.ClassElement element : elements) {<NEW_LINE>if (element instanceof Concrete.ClassField) {<NEW_LINE>Concrete.ClassField field = (Concrete.ClassField) element;<NEW_LINE>R result = visitParameters(field.getParameters(), params);<NEW_LINE>if (result != null)<NEW_LINE>return null;<NEW_LINE>result = field.getResultType().accept(this, params);<NEW_LINE>if (result != null)<NEW_LINE>return null;<NEW_LINE>if (field.getResultTypeLevel() != null) {<NEW_LINE>result = field.getResultTypeLevel(<MASK><NEW_LINE>if (result != null)<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else if (element instanceof Concrete.ClassFieldImpl) {<NEW_LINE>return visitClassFieldImpl((Concrete.ClassFieldImpl) element, params);<NEW_LINE>} else if (element instanceof Concrete.OverriddenField) {<NEW_LINE>Concrete.OverriddenField field = (Concrete.OverriddenField) element;<NEW_LINE>R result = visitParameters(field.getParameters(), params);<NEW_LINE>if (result != null)<NEW_LINE>return null;<NEW_LINE>result = field.getResultType().accept(this, params);<NEW_LINE>if (result != null)<NEW_LINE>return null;<NEW_LINE>if (field.getResultTypeLevel() != null) {<NEW_LINE>result = field.getResultTypeLevel().accept(this, params);<NEW_LINE>if (result != null)<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ).accept(this, params); |
740,953 | private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) throws NoSuchColorException {<NEW_LINE>final Participant p1 = diagram.getOrCreateParticipant(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0)));<NEW_LINE>final Participant p2 = diagram.getOrCreateParticipant(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P2", 0)));<NEW_LINE>if (lines.size() > 0) {<NEW_LINE>final boolean tryMerge = line0.get("VMERGE", 0) != null;<NEW_LINE>final boolean parallel = line0.get("PARALLEL", 0) != null;<NEW_LINE>final Display display = diagram.manageVariable(lines.toDisplay());<NEW_LINE>final Note note = new Note(p1, p2, display, diagram.getSkinParam().getCurrentStyleBuilder());<NEW_LINE>Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0, diagram.getSkinParam().getIHtmlColorSet());<NEW_LINE>final String stereotypeString = line0.get("STEREO", 0);<NEW_LINE>if (stereotypeString != null) {<NEW_LINE>final Stereotype stereotype = Stereotype.build(stereotypeString);<NEW_LINE>colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), FontParam.NOTE, <MASK><NEW_LINE>note.setStereotype(stereotype);<NEW_LINE>}<NEW_LINE>note.setColors(colors);<NEW_LINE>// note.setSpecificColorTOBEREMOVED(ColorType.BACK,<NEW_LINE>// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR",<NEW_LINE>// 0)));<NEW_LINE>note.setNoteStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));<NEW_LINE>if (line0.get("URL", 0) != null) {<NEW_LINE>final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);<NEW_LINE>final Url urlLink = urlBuilder.getUrl(line0.get("URL", 0));<NEW_LINE>note.setUrl(urlLink);<NEW_LINE>}<NEW_LINE>if (parallel) {<NEW_LINE>note.goParallel();<NEW_LINE>}<NEW_LINE>diagram.addNote(note, tryMerge);<NEW_LINE>}<NEW_LINE>return CommandExecutionResult.ok();<NEW_LINE>} | ColorParam.noteBackground, ColorParam.noteBorder); |
1,162,867 | final DescribeAcceleratorsResult executeDescribeAccelerators(DescribeAcceleratorsRequest describeAcceleratorsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAcceleratorsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAcceleratorsRequest> request = null;<NEW_LINE>Response<DescribeAcceleratorsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAcceleratorsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeAcceleratorsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Elastic Inference");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAccelerators");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeAcceleratorsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeAcceleratorsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
916,051 | // -----------------------------------------------------<NEW_LINE>// Actually Crud<NEW_LINE>// -------------<NEW_LINE>@Execute<NEW_LINE>@Secured({ ROLE })<NEW_LINE>public HtmlResponse create(final CreateForm form) {<NEW_LINE>verifyCrudMode(form.crudMode, CrudMode.CREATE);<NEW_LINE>validate(form, messages -> {<NEW_LINE>}, this::asEditHtml);<NEW_LINE>validateAttributes(form.attributes, v -> throwValidationError(v, this::asEditHtml));<NEW_LINE>verifyPassword(form, this::asEditHtml);<NEW_LINE>verifyToken(this::asEditHtml);<NEW_LINE>getUser(form).ifPresent(entity -> {<NEW_LINE>try {<NEW_LINE>userService.store(entity);<NEW_LINE>saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));<NEW_LINE>} catch (final Exception e) {<NEW_LINE>logger.error("Failed to add {}", entity, e);<NEW_LINE>throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(<MASK><NEW_LINE>}<NEW_LINE>}).orElse(() -> {<NEW_LINE>throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);<NEW_LINE>});<NEW_LINE>return redirect(getClass());<NEW_LINE>} | e)), this::asEditHtml); |
1,019,966 | protected void onInitialized(Looper looper) {<NEW_LINE>mWorkerHandler = new Handler(looper);<NEW_LINE>mContentObserver = newContentObserver(mWorkerHandler, this::onWellbeingUriChanged);<NEW_LINE>if (!TextUtils.isEmpty(mWellbeingProviderPkg)) {<NEW_LINE>mContext.registerReceiver(new SimpleBroadcastReceiver(t -> restartObserver()), PackageManagerHelper.getPackageFilter(mWellbeingProviderPkg, Intent.ACTION_PACKAGE_ADDED, Intent.ACTION_PACKAGE_CHANGED, Intent.ACTION_PACKAGE_REMOVED, Intent.ACTION_PACKAGE_DATA_CLEARED, Intent.ACTION_PACKAGE_RESTARTED), null, mWorkerHandler);<NEW_LINE>IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);<NEW_LINE>filter.addAction(Intent.ACTION_PACKAGE_REMOVED);<NEW_LINE>filter.addDataScheme("package");<NEW_LINE>mContext.registerReceiver(new SimpleBroadcastReceiver(this::onAppPackageChanged<MASK><NEW_LINE>restartObserver();<NEW_LINE>}<NEW_LINE>} | ), filter, null, mWorkerHandler); |
1,770,297 | private ObjectNode mergeObjectNodes(ObjectNode targetNode, ObjectNode updateNode) {<NEW_LINE>Iterator<String> fieldNames = updateNode.fieldNames();<NEW_LINE>while (fieldNames.hasNext()) {<NEW_LINE>String fieldName = fieldNames.next();<NEW_LINE>JsonNode targetValue = targetNode.get(fieldName);<NEW_LINE>JsonNode updateValue = updateNode.get(fieldName);<NEW_LINE>if (targetValue == null) {<NEW_LINE>// Target node doesn't have this field from update node: just add it<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>// Both nodes have the same field: merge the values<NEW_LINE>if (targetValue.isObject() && updateValue.isObject()) {<NEW_LINE>// Both values are objects: recurse<NEW_LINE>targetNode.set(fieldName, mergeObjectNodes((ObjectNode) targetValue, (ObjectNode) updateValue));<NEW_LINE>} else if (targetValue.isArray() && updateValue.isArray()) {<NEW_LINE>// Both values are arrays: concatenate them to be merged later<NEW_LINE>((ArrayNode) targetValue).addAll((ArrayNode) updateValue);<NEW_LINE>} else {<NEW_LINE>// Values have different types: use the one from the update node<NEW_LINE>targetNode.set(fieldName, updateValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return targetNode;<NEW_LINE>} | targetNode.set(fieldName, updateValue); |
713,940 | final DescribeMaintenanceStartTimeResult executeDescribeMaintenanceStartTime(DescribeMaintenanceStartTimeRequest describeMaintenanceStartTimeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeMaintenanceStartTimeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeMaintenanceStartTimeRequest> request = null;<NEW_LINE>Response<DescribeMaintenanceStartTimeResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeMaintenanceStartTimeRequestProtocolMarshaller(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, "Storage Gateway");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeMaintenanceStartTime");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeMaintenanceStartTimeResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeMaintenanceStartTimeResultJsonUnmarshaller());<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(describeMaintenanceStartTimeRequest)); |
1,482,028 | private Map<String, ReportData> toReportDataMap(Set<String> newSetData) {<NEW_LINE>Map<String, ReportData> reportDataHashMap = new HashMap<String, ReportData>(100);<NEW_LINE>if (null != newSetData) {<NEW_LINE>JSONObject jsonObject = null;<NEW_LINE>String prefix = null;<NEW_LINE>ReportData reportData = null;<NEW_LINE>for (String object : newSetData) {<NEW_LINE>jsonObject = JSON.parseObject(object);<NEW_LINE>prefix = jsonObject.getString("dataType");<NEW_LINE>reportData = reportDataHashMap.get(prefix);<NEW_LINE>long itemCount = jsonObject.containsKey("itemCount") ? Long.parseLong(jsonObject.getString("itemCount")) : 0L;<NEW_LINE>long bytes = jsonObject.containsKey("bytes") ? Long.parseLong(jsonObject<MASK><NEW_LINE>if (null == reportData) {<NEW_LINE>reportData = new ReportData();<NEW_LINE>reportData.setBytes(bytes);<NEW_LINE>reportData.setCount(itemCount);<NEW_LINE>reportData.setKey(prefix);<NEW_LINE>} else {<NEW_LINE>reportData.setCount(itemCount + reportData.getCount());<NEW_LINE>reportData.setBytes(bytes + reportData.getBytes());<NEW_LINE>}<NEW_LINE>reportDataHashMap.put(prefix, reportData);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return reportDataHashMap;<NEW_LINE>} | .getString("bytes")) : 0L; |
411,296 | static CosmosUpdateTimeFindToken fromBytes(DataInputStream inputStream) throws IOException {<NEW_LINE>CosmosUpdateTimeFindToken cloudFindToken;<NEW_LINE>DataInputStream stream = new DataInputStream(inputStream);<NEW_LINE>short version = stream.readShort();<NEW_LINE>switch(version) {<NEW_LINE>case VERSION_0:<NEW_LINE>FindTokenType type = FindTokenType.values()[stream.readShort()];<NEW_LINE><MASK><NEW_LINE>long bytesRead = stream.readLong();<NEW_LINE>int numBlobs = stream.readShort();<NEW_LINE>Set<String> blobIds = new HashSet<>();<NEW_LINE>while (numBlobs > 0) {<NEW_LINE>int blobIdLength = stream.readShort();<NEW_LINE>byte[] blobIdBytes = new byte[blobIdLength];<NEW_LINE>stream.read(blobIdBytes, 0, blobIdLength);<NEW_LINE>blobIds.add(new String(blobIdBytes));<NEW_LINE>numBlobs--;<NEW_LINE>}<NEW_LINE>cloudFindToken = new CosmosUpdateTimeFindToken(version, lastUpdateTime, bytesRead, blobIds);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("Unknown version: " + version);<NEW_LINE>}<NEW_LINE>return cloudFindToken;<NEW_LINE>} | long lastUpdateTime = stream.readLong(); |
47,431 | public void start(Stage primaryStage) throws Exception {<NEW_LINE>FXMLLoader loader = new FXMLLoader(getClass().getResource("/NSLMain.fxml"));<NEW_LINE>Locale userLocale = AppPreferences.getInstance().getLocale();<NEW_LINE>ResourceBundle rb = ResourceBundle.getBundle("locale", userLocale);<NEW_LINE>NSLMain.appVersion = ResourceBundle.getBundle<MASK><NEW_LINE>loader.setResources(rb);<NEW_LINE>Parent root = loader.load();<NEW_LINE>primaryStage.getIcons().addAll(new Image(getClass().getResourceAsStream("/res/app_icon32x32.png")), new Image(getClass().getResourceAsStream("/res/app_icon48x48.png")), new Image(getClass().getResourceAsStream("/res/app_icon64x64.png")), new Image(getClass().getResourceAsStream("/res/app_icon128x128.png")));<NEW_LINE>primaryStage.setTitle("NS-USBloader " + appVersion);<NEW_LINE>primaryStage.setMinWidth(650);<NEW_LINE>primaryStage.setMinHeight(450);<NEW_LINE>Scene mainScene = new Scene(root, AppPreferences.getInstance().getSceneWidth(), AppPreferences.getInstance().getSceneHeight());<NEW_LINE>mainScene.getStylesheets().add(AppPreferences.getInstance().getTheme());<NEW_LINE>primaryStage.setScene(mainScene);<NEW_LINE>primaryStage.show();<NEW_LINE>primaryStage.setOnCloseRequest(e -> {<NEW_LINE>if (MediatorControl.getInstance().getTransferActive())<NEW_LINE>if (!ServiceWindow.getConfirmationWindow(rb.getString("windowTitleConfirmExit"), rb.getString("windowBodyConfirmExit")))<NEW_LINE>e.consume();<NEW_LINE>});<NEW_LINE>NSLMainController controller = loader.getController();<NEW_LINE>controller.setHostServices(getHostServices());<NEW_LINE>primaryStage.setOnHidden(e -> {<NEW_LINE>AppPreferences.getInstance().setSceneHeight(mainScene.getHeight());<NEW_LINE>AppPreferences.getInstance().setSceneWidth(mainScene.getWidth());<NEW_LINE>controller.exit();<NEW_LINE>});<NEW_LINE>} | ("app").getString("_version"); |
1,158,125 | protected void buildLR0Machine() {<NEW_LINE>AssemblyProduction sp = grammar.productionsOf(grammar.getStart()).iterator().next();<NEW_LINE>AssemblyParseStateItem startItem = new AssemblyParseStateItem(sp, 0);<NEW_LINE>AssemblyParseState startState = new AssemblyParseState(grammar, startItem);<NEW_LINE>states.add(startState);<NEW_LINE>// I'm using a counting loop purposefully<NEW_LINE>// Want to add things and process them later<NEW_LINE>for (int curState = 0; curState < states.size(); curState++) {<NEW_LINE>// perform a "read" or "goto" on each item, adding it to the kernel of its destination state<NEW_LINE>// NOTE: destination state is keyed ONLY from curState and symbol read<NEW_LINE>AssemblyParseState state = states.get(curState);<NEW_LINE>// Since we work with one state at a time, we need only key on symbol read<NEW_LINE>Map<AssemblySymbol, AssemblyParseState> go = LazyMap.lazyMap(new LinkedHashMap<AssemblySymbol, AssemblyParseState>(), () -> new AssemblyParseState(grammar));<NEW_LINE>// Advance each item, and add the result to the kernel<NEW_LINE>// NOTE: We must advance from the closure of the current state<NEW_LINE>for (AssemblyParseStateItem item : state.getClosure()) {<NEW_LINE>AssemblySymbol sym = item.getNext();<NEW_LINE>if (sym != null) {<NEW_LINE>AssemblyParseStateItem ni = item.read();<NEW_LINE>go.get(sym).<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Now, add the appropriate entries to the transition table<NEW_LINE>for (Map.Entry<AssemblySymbol, AssemblyParseState> ent : go.entrySet()) {<NEW_LINE>int newStateNum = addLR0State(ent.getValue());<NEW_LINE>table.put(curState, ent.getKey(), newStateNum);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getKernel().add(ni); |
701,237 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>jScrollPane1 = new javax.swing.JScrollPane();<NEW_LINE>labelsList.setModel(new javax.swing.AbstractListModel() {<NEW_LINE><NEW_LINE>String[] strings = { "item1", "item2", "item3" };<NEW_LINE><NEW_LINE>public int getSize() {<NEW_LINE>return strings.length;<NEW_LINE>}<NEW_LINE><NEW_LINE>public Object getElementAt(int i) {<NEW_LINE>return strings[i];<NEW_LINE>}<NEW_LINE>});<NEW_LINE>jScrollPane1.setViewportView(labelsList);<NEW_LINE>javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);<NEW_LINE>this.setLayout(layout);<NEW_LINE>layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE));<NEW_LINE>layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE<MASK><NEW_LINE>} | , 110, Short.MAX_VALUE)); |
1,601,862 | public void handleStatement(Statement st) {<NEW_LINE>Resource context = st.getContext();<NEW_LINE><MASK><NEW_LINE>Resource subject = st.getSubject();<NEW_LINE>Value object = st.getObject();<NEW_LINE>ContextResource sub = new ContextResource(subject.stringValue(), context != null ? context.stringValue() : null);<NEW_LINE>ContextResource obj = new ContextResource(object.stringValue(), context != null ? context.stringValue() : null);<NEW_LINE>if (parserConfig.getPredicateExclusionList() == null || !parserConfig.getPredicateExclusionList().contains(predicate.stringValue())) {<NEW_LINE>if (object instanceof Literal) {<NEW_LINE>if (setProp(sub, predicate, (Literal) object)) {<NEW_LINE>// property may be filtered because of lang filter hence the conditional increment.<NEW_LINE>mappedTripleCounter++;<NEW_LINE>}<NEW_LINE>} else if ((parserConfig.getGraphConf().getHandleRDFTypes() == GRAPHCONF_RDFTYPES_AS_LABELS && predicate.equals(RDF.TYPE) || parserConfig.getGraphConf().getHandleRDFTypes() == GRAPHCONF_RDFTYPES_AS_LABELS_AND_NODES) && !(object instanceof BNode)) {<NEW_LINE>setLabel(sub, handleIRI((IRI) object, LABEL));<NEW_LINE>if (parserConfig.getGraphConf().getHandleRDFTypes() == GRAPHCONF_RDFTYPES_AS_LABELS_AND_NODES) {<NEW_LINE>addResource(sub);<NEW_LINE>addResource(obj);<NEW_LINE>addStatement(st);<NEW_LINE>}<NEW_LINE>mappedTripleCounter++;<NEW_LINE>} else {<NEW_LINE>addResource(sub);<NEW_LINE>addResource(obj);<NEW_LINE>addStatement(st);<NEW_LINE>mappedTripleCounter++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>totalTriplesParsed++;<NEW_LINE>if (parserConfig.getCommitSize() != Long.MAX_VALUE && mappedTripleCounter % parserConfig.getCommitSize() == 0) {<NEW_LINE>periodicOperation();<NEW_LINE>}<NEW_LINE>} | IRI predicate = st.getPredicate(); |
862,272 | private IProductionMaterial createProductionMaterialIfEligible(final I_PP_Order_BOMLine ppOrderBOMLine) {<NEW_LINE>//<NEW_LINE>// Check if Product is matching the query<NEW_LINE>final <MASK><NEW_LINE>if (queryProduct != null && queryProduct.getM_Product_ID() != ppOrderBOMLine.getM_Product_ID()) {<NEW_LINE>logger.debug("Query Product {} does not match BOM Line M_Product_ID {}", new Object[] { queryProduct, ppOrderBOMLine.getM_Product_ID() });<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// In case our BOM Line is a Variant of a main component line,<NEW_LINE>// find out which is the main component line and get the main product from it<NEW_LINE>final I_M_Product mainComponentProduct;<NEW_LINE>if (PPOrderUtil.isVariant(ppOrderBOMLine)) {<NEW_LINE>final I_PP_Order_BOMLine mainComponentBOMLine = getMainComponentOrderBOMLine(ppOrderBOMLine);<NEW_LINE>final ProductId mainComponentProductId = ProductId.ofRepoId(ppOrderBOMLine.getM_Product_ID());<NEW_LINE>mainComponentProduct = productBL.getById(mainComponentProductId);<NEW_LINE>} else {<NEW_LINE>mainComponentProduct = null;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Create Production Material<NEW_LINE>final IProductionMaterial productionMaterial = new PPOrderBOMLineProductionMaterial(ppOrderBOMLine, mainComponentProduct);<NEW_LINE>//<NEW_LINE>// Check if Type is matching the query<NEW_LINE>if (!isTypeRequested(productionMaterial.getType())) {<NEW_LINE>logger.debug("IProductionMaterial {} does not match the any of the requested types {}", new Object[] { productionMaterial, types });<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return productionMaterial;<NEW_LINE>} | I_M_Product queryProduct = query.getM_Product(); |
13,060 | public void createMenuItems(Bundle savedInstanceState) {<NEW_LINE>Context ctx = getContext();<NEW_LINE>listPreference = getListPreference();<NEW_LINE>if (ctx == null || listPreference == null || listPreference.getEntries() == null || listPreference.getEntryValues() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ctx = UiUtilities.getThemedContext(ctx, nightMode);<NEW_LINE>Bundle args = getArguments();<NEW_LINE>if (args != null && args.containsKey(USE_COLLAPSIBLE_DESCRIPTION)) {<NEW_LINE>collapsibleDescription = args.getBoolean(USE_COLLAPSIBLE_DESCRIPTION);<NEW_LINE>}<NEW_LINE>if (savedInstanceState != null) {<NEW_LINE>selectedEntryIndex = savedInstanceState.getInt(SELECTED_ENTRY_INDEX_KEY);<NEW_LINE>collapsibleDescription = savedInstanceState.getBoolean(USE_COLLAPSIBLE_DESCRIPTION);<NEW_LINE>} else {<NEW_LINE>selectedEntryIndex = listPreference.findIndexOfValue(listPreference.getValue());<NEW_LINE>}<NEW_LINE>String title = listPreference.getDialogTitle().toString();<NEW_LINE>items.add(new TitleItem(title));<NEW_LINE><MASK><NEW_LINE>if (!Algorithms.isEmpty(description)) {<NEW_LINE>buildDescriptionItem(ctx, description);<NEW_LINE>}<NEW_LINE>String[] entries = listPreference.getEntries();<NEW_LINE>for (int i = 0; i < entries.length; i++) {<NEW_LINE>final BaseBottomSheetItem[] preferenceItem = new BottomSheetItemWithCompoundButton[1];<NEW_LINE>preferenceItem[0] = new BottomSheetItemWithCompoundButton.Builder().setChecked(i == selectedEntryIndex).setButtonTintList(AndroidUtils.createCheckedColorIntStateList(ContextCompat.getColor(ctx, R.color.icon_color_default_light), isProfileDependent() ? getAppMode().getProfileColor(nightMode) : ContextCompat.getColor(ctx, getActiveColorId()))).setTitle(entries[i]).setTag(i).setLayoutId(R.layout.bottom_sheet_item_with_radio_btn_left).setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>selectedEntryIndex = (int) preferenceItem[0].getTag();<NEW_LINE>updateItems();<NEW_LINE>}<NEW_LINE>}).create();<NEW_LINE>items.add(preferenceItem[0]);<NEW_LINE>}<NEW_LINE>} | String description = listPreference.getDescription(); |
1,851,502 | private void analyzeStarrocksJarUdtf() throws AnalysisException {<NEW_LINE>{<NEW_LINE>// TYPE[] process(INPUT)<NEW_LINE>Method method = mainClass.getMethod(PROCESS_METHOD_NAME, true);<NEW_LINE>mainClass.checkMethodNonStaticAndPublic(method);<NEW_LINE>mainClass.checkArgumentCount(method, argsDef.getArgTypes().length);<NEW_LINE>for (int i = 0; i < method.getParameters().length; i++) {<NEW_LINE>Parameter p = method.getParameters()[i];<NEW_LINE>mainClass.checkUdfType(method, argsDef.getArgTypes()[i], p.getType(), p.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final List<Type> argList = Arrays.stream(argsDef.getArgTypes()).collect(Collectors.toList());<NEW_LINE>TableFunction tableFunction = new TableFunction(functionName, Lists.newArrayList(functionName.getFunction()), argList, Lists.newArrayList(returnType.getType()));<NEW_LINE>tableFunction.setBinaryType(TFunctionBinaryType.SRJAR);<NEW_LINE>tableFunction.setChecksum(checksum);<NEW_LINE>tableFunction.<MASK><NEW_LINE>tableFunction.setSymbolName(mainClass.getCanonicalName());<NEW_LINE>function = tableFunction;<NEW_LINE>} | setLocation(new HdfsURI(objectFile)); |
1,200,051 | public // wrapper. -- L.A. 4.5<NEW_LINE>DatasetDTO processOAIDCxml(String DcXmlToParse) throws XMLStreamException {<NEW_LINE>// look up DC metadata mapping:<NEW_LINE>ForeignMetadataFormatMapping dublinCoreMapping = findFormatMappingByName(DCTERMS);<NEW_LINE>if (dublinCoreMapping == null) {<NEW_LINE>throw new EJBException("Failed to find metadata mapping for " + DCTERMS);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>StringReader reader = null;<NEW_LINE>XMLStreamReader xmlr = null;<NEW_LINE>try {<NEW_LINE>reader = new StringReader(DcXmlToParse);<NEW_LINE>XMLInputFactory xmlFactory = javax.xml.stream.XMLInputFactory.newInstance();<NEW_LINE>xmlr = xmlFactory.createXMLStreamReader(reader);<NEW_LINE>// while (xmlr.next() == XMLStreamConstants.COMMENT); // skip pre root comments<NEW_LINE>xmlr.nextTag();<NEW_LINE>xmlr.require(XMLStreamConstants.START_ELEMENT, null, OAI_DC_OPENING_TAG);<NEW_LINE>processXMLElement(xmlr, ":", OAI_DC_OPENING_TAG, dublinCoreMapping, datasetDTO);<NEW_LINE>} catch (XMLStreamException ex) {<NEW_LINE>throw new EJBException("ERROR occurred while parsing XML fragment (" + DcXmlToParse.substring(0, 64) + "...); ", ex);<NEW_LINE>}<NEW_LINE>datasetDTO.getDatasetVersion().setVersionState(DatasetVersion.VersionState.RELEASED);<NEW_LINE>// Our DC import handles the contents of the dc:identifier field<NEW_LINE>// as an "other id". In the context of OAI harvesting, we expect<NEW_LINE>// the identifier to be a global id, so we need to rearrange that:<NEW_LINE>String identifier = getOtherIdFromDTO(datasetDTO.getDatasetVersion());<NEW_LINE>logger.fine("Imported identifier: " + identifier);<NEW_LINE>String globalIdentifier = reassignIdentifierAsGlobalId(identifier, datasetDTO);<NEW_LINE>logger.fine("Detected global identifier: " + globalIdentifier);<NEW_LINE>if (globalIdentifier == null) {<NEW_LINE>throw new EJBException("Failed to find a global identifier in the OAI_DC XML record.");<NEW_LINE>}<NEW_LINE>return datasetDTO;<NEW_LINE>} | DatasetDTO datasetDTO = this.initializeDataset(); |
1,250,325 | final StopLabelingJobResult executeStopLabelingJob(StopLabelingJobRequest stopLabelingJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(stopLabelingJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StopLabelingJobRequest> request = null;<NEW_LINE>Response<StopLabelingJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StopLabelingJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(stopLabelingJobRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SageMaker");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopLabelingJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StopLabelingJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StopLabelingJobResultJsonUnmarshaller());<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>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
339,020 | // TODO: filter out only the needed variables, otherwise OCE has indrect access to all block level<NEW_LINE>private void addClosureMapToInit(BLangClassDefinition classDef, BVarSymbol mapSymbol) {<NEW_LINE>OCEDynamicEnvironmentData oceData = classDef.oceEnvData;<NEW_LINE>// eg : $map$block$_<num2><NEW_LINE>BLangSimpleVarRef refToBlockClosureMap = ASTBuilderUtil.createVariableRef(classDef.pos, mapSymbol);<NEW_LINE>BLangTypeInit typeInit = oceData.typeInit;<NEW_LINE>BLangInvocation initInvocation = typeInit.initInvocation;<NEW_LINE>if (typeInit.argsExpr == null) {<NEW_LINE>typeInit.<MASK><NEW_LINE>}<NEW_LINE>// update new expression<NEW_LINE>typeInit.argsExpr.add(refToBlockClosureMap);<NEW_LINE>initInvocation.requiredArgs.add(refToBlockClosureMap);<NEW_LINE>initInvocation.argExprs.add(refToBlockClosureMap);<NEW_LINE>// add closure map as a argument to init method of the object<NEW_LINE>BLangSimpleVariable blockClosureMap = ASTBuilderUtil.createVariable(symTable.builtinPos, mapSymbol.name.value, mapSymbol.getType(), null, mapSymbol);<NEW_LINE>blockClosureMap.flagSet.add(Flag.REQUIRED_PARAM);<NEW_LINE>BObjectTypeSymbol typeSymbol = ((BObjectTypeSymbol) classDef.getBType().tsymbol);<NEW_LINE>if (typeSymbol.generatedInitializerFunc != null) {<NEW_LINE>BAttachedFunction attachedInitFunction = typeSymbol.generatedInitializerFunc;<NEW_LINE>attachedInitFunction.symbol.params.add(mapSymbol);<NEW_LINE>}<NEW_LINE>// add closure map as argument to class init method<NEW_LINE>BLangFunction initFunction = classDef.generatedInitFunction;<NEW_LINE>initFunction.desugared = false;<NEW_LINE>initFunction.requiredParams.add(blockClosureMap);<NEW_LINE>SymbolEnv env = oceData.objMethodsEnv;<NEW_LINE>BVarSymbol paramSym = new BVarSymbol(Flags.FINAL, mapSymbol.name, env.scope.owner.pkgID, mapSymbol.type, initFunction.symbol, classDef.pos, VIRTUAL);<NEW_LINE>// update symbols for init method<NEW_LINE>initFunction.symbol.scope.define(paramSym.name, paramSym);<NEW_LINE>initFunction.symbol.params.add(paramSym);<NEW_LINE>BInvokableType initFuncSymbolType = (BInvokableType) initFunction.symbol.type;<NEW_LINE>initFuncSymbolType.paramTypes.add(mapSymbol.type);<NEW_LINE>BInvokableType initFnType = (BInvokableType) initFunction.getBType();<NEW_LINE>initFnType.paramTypes.add(mapSymbol.type);<NEW_LINE>BAttachedFunction attachedFunction = ((BObjectTypeSymbol) classDef.getBType().tsymbol).generatedInitializerFunc;<NEW_LINE>attachedFunction.symbol.params.add(paramSym);<NEW_LINE>classDef.generatedInitFunction = desugar.rewrite(classDef.generatedInitFunction, oceData.objMethodsEnv);<NEW_LINE>// Add map to the callee expression<NEW_LINE>addMapToCalleeExpression(mapSymbol, oceData);<NEW_LINE>} | argsExpr = new ArrayList<>(); |
1,490,417 | String pickMainScreenForm() {<NEW_LINE>if (loadedResources.getUIResourceNames() == null || loadedResources.getUIResourceNames().length < 1) {<NEW_LINE>JOptionPane.showMessageDialog(mainPanel, "You must have a UI builder entry for this feature", "Error", JOptionPane.ERROR_MESSAGE);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String[] arr = new String[loadedResources.getUIResourceNames().length];<NEW_LINE>System.arraycopy(loadedResources.getUIResourceNames(), 0, arr, 0, arr.length);<NEW_LINE>Arrays.sort(arr, String.CASE_INSENSITIVE_ORDER);<NEW_LINE><MASK><NEW_LINE>String lastPick = Preferences.userNodeForPackage(ResourceEditorView.class).get("lastMainScreenPick", null);<NEW_LINE>if (lastPick != null) {<NEW_LINE>for (int iter = 0; iter < arr.length; iter++) {<NEW_LINE>if (lastPick.equals(arr[iter])) {<NEW_LINE>main.setSelectedIndex(iter);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>JOptionPane.showMessageDialog(mainPanel, main, "Please Pick Main Screen", JOptionPane.PLAIN_MESSAGE);<NEW_LINE>return (String) main.getSelectedItem();<NEW_LINE>} | JComboBox main = new JComboBox(arr); |
167,309 | public static Tuple2<TextField, Button> addTextFieldWithEditButton(GridPane gridPane, int rowIndex, String title) {<NEW_LINE>TextField textField = new BisqTextField();<NEW_LINE>textField.setPromptText(title);<NEW_LINE>textField.setEditable(false);<NEW_LINE>textField.setFocusTraversable(false);<NEW_LINE>textField.setPrefWidth(Layout.INITIAL_WINDOW_WIDTH);<NEW_LINE>Button button = new AutoTooltipButton("...");<NEW_LINE>button.setStyle("-fx-min-width: 26; -fx-pref-height: 26; -fx-padding: 0 0 10 0; -fx-background-color: -fx-background;");<NEW_LINE>button.managedProperty().bind(button.visibleProperty());<NEW_LINE>HBox hbox = new HBox(textField, button);<NEW_LINE>hbox.setAlignment(Pos.CENTER_LEFT);<NEW_LINE>hbox.setSpacing(8);<NEW_LINE>VBox vbox = getTopLabelVBox(0);<NEW_LINE>vbox.getChildren().addAll(getTopLabel(title), hbox);<NEW_LINE>gridPane.getChildren().add(vbox);<NEW_LINE>GridPane.setRowIndex(vbox, rowIndex);<NEW_LINE>GridPane.setMargin(vbox, new Insets(Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));<NEW_LINE>return new <MASK><NEW_LINE>} | Tuple2<>(textField, button); |
830,006 | // TODO: Use one of the new text classes, like /help ?<NEW_LINE>private void warpList(final CommandSource sender, final String[] args, final IUser user) throws Exception {<NEW_LINE>final IWarps warps = ess.getWarps();<NEW_LINE>final List<String> warpNameList = getAvailableWarpsFor(user);<NEW_LINE>if (warpNameList.isEmpty()) {<NEW_LINE>throw new Exception(tl("noWarpsDefined"));<NEW_LINE>}<NEW_LINE>int page = 1;<NEW_LINE>if (args.length > 0 && NumberUtil.isInt(args[0])) {<NEW_LINE>page = Integer.parseInt(args[0]);<NEW_LINE>}<NEW_LINE>final int maxPages = (int) Math.ceil(warpNameList.size<MASK><NEW_LINE>if (page > maxPages) {<NEW_LINE>page = maxPages;<NEW_LINE>}<NEW_LINE>final int warpPage = (page - 1) * WARPS_PER_PAGE;<NEW_LINE>final String warpList = StringUtil.joinList(warpNameList.subList(warpPage, warpPage + Math.min(warpNameList.size() - warpPage, WARPS_PER_PAGE)));<NEW_LINE>if (warpNameList.size() > WARPS_PER_PAGE) {<NEW_LINE>sender.sendMessage(tl("warpsCount", warpNameList.size(), page, maxPages));<NEW_LINE>sender.sendMessage(tl("warpList", warpList));<NEW_LINE>} else {<NEW_LINE>sender.sendMessage(tl("warps", warpList));<NEW_LINE>}<NEW_LINE>} | () / (double) WARPS_PER_PAGE); |
1,639,833 | private CoreMap fromProto(CoreNLPProtos.Section section, List<CoreMap> annotationSentences) {<NEW_LINE>CoreMap map = new ArrayCoreMap();<NEW_LINE>map.set(CharacterOffsetBeginAnnotation.class, section.getCharBegin());<NEW_LINE>map.set(CharacterOffsetEndAnnotation.class, section.getCharEnd());<NEW_LINE>if (section.hasAuthor())<NEW_LINE>map.set(AuthorAnnotation.class, section.getAuthor());<NEW_LINE>if (section.hasDatetime())<NEW_LINE>map.set(SectionDateAnnotation.class, section.getDatetime());<NEW_LINE>// go through the list of sentences and add them to this section's sentence list<NEW_LINE>ArrayList<CoreMap> sentencesList = new ArrayList<>();<NEW_LINE>for (int sentenceIndex : section.getSentenceIndexesList()) {<NEW_LINE>sentencesList.add(annotationSentences.get(sentenceIndex));<NEW_LINE>}<NEW_LINE>map.<MASK><NEW_LINE>// go through the list of quotes and rebuild the quotes<NEW_LINE>map.set(QuotesAnnotation.class, new ArrayList<>());<NEW_LINE>for (CoreNLPProtos.Quote quote : section.getQuotesList()) {<NEW_LINE>int quoteCharStart = quote.getBegin();<NEW_LINE>int quoteCharEnd = quote.getEnd();<NEW_LINE>String quoteAuthor = null;<NEW_LINE>if (quote.hasAuthor()) {<NEW_LINE>quoteAuthor = quote.getAuthor();<NEW_LINE>}<NEW_LINE>CoreMap quoteCoreMap = new ArrayCoreMap();<NEW_LINE>quoteCoreMap.set(CharacterOffsetBeginAnnotation.class, quoteCharStart);<NEW_LINE>quoteCoreMap.set(CharacterOffsetEndAnnotation.class, quoteCharEnd);<NEW_LINE>quoteCoreMap.set(AuthorAnnotation.class, quoteAuthor);<NEW_LINE>map.get(QuotesAnnotation.class).add(quoteCoreMap);<NEW_LINE>}<NEW_LINE>// if there is an author character start, add it<NEW_LINE>if (section.hasAuthorCharBegin()) {<NEW_LINE>map.set(SectionAuthorCharacterOffsetBeginAnnotation.class, section.getAuthorCharBegin());<NEW_LINE>}<NEW_LINE>if (section.hasAuthorCharEnd()) {<NEW_LINE>map.set(SectionAuthorCharacterOffsetEndAnnotation.class, section.getAuthorCharEnd());<NEW_LINE>}<NEW_LINE>// add the original xml tag<NEW_LINE>map.set(SectionTagAnnotation.class, fromProto(section.getXmlTag()));<NEW_LINE>return map;<NEW_LINE>} | set(SentencesAnnotation.class, sentencesList); |
1,595,449 | private static void printInfo(String sizeMessage, String inAlluxioMessage, String path, Optional<String> inMemMessage, Optional<String> workerHostName) {<NEW_LINE>String message;<NEW_LINE>if (inMemMessage.isPresent() && workerHostName.isPresent()) {<NEW_LINE>message = String.format(GROUPED_MEMORY_OPTION_FORMAT, sizeMessage, inAlluxioMessage, inMemMessage.get(), workerHostName.get(), path);<NEW_LINE>} else if (inMemMessage.isPresent()) {<NEW_LINE>message = String.format(MEMORY_OPTION_FORMAT, sizeMessage, inAlluxioMessage, inMemMessage.get(), path);<NEW_LINE>} else if (workerHostName.isPresent()) {<NEW_LINE>message = String.format(GROUPED_OPTION_FORMAT, sizeMessage, inAlluxioMessage, workerHostName.get(), path);<NEW_LINE>} else {<NEW_LINE>message = String.format(<MASK><NEW_LINE>}<NEW_LINE>System.out.println(message);<NEW_LINE>} | SHORT_INFO_FORMAT, sizeMessage, inAlluxioMessage, path); |
967,646 | public static void createCluster(String destZkString, String destClusterName, VcrHelixConfig config) {<NEW_LINE>HelixZkClient destZkClient = getHelixZkClient(destZkString);<NEW_LINE>HelixAdmin destAdmin = new ZKHelixAdmin(destZkClient);<NEW_LINE>if (ZKUtil.isClusterSetup(destClusterName, destZkClient)) {<NEW_LINE>errorAndExit("Failed to create cluster because " + destClusterName + " already exist.");<NEW_LINE>}<NEW_LINE>ClusterSetup clusterSetup = new ClusterSetup.Builder().setZkAddress(destZkString).build();<NEW_LINE><MASK><NEW_LINE>// set ALLOW_PARTICIPANT_AUTO_JOIN<NEW_LINE>HelixConfigScope configScope = new HelixConfigScopeBuilder(HelixConfigScope.ConfigScopeProperty.CLUSTER).forCluster(destClusterName).build();<NEW_LINE>Map<String, String> helixClusterProperties = new HashMap<>();<NEW_LINE>helixClusterProperties.put(ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN, String.valueOf(config.getClusterConfigFields().isAllowAutoJoin()));<NEW_LINE>destAdmin.setConfig(configScope, helixClusterProperties);<NEW_LINE>setClusterConfig(destZkClient, destClusterName, config, false);<NEW_LINE>logger.info("Cluster {} is created successfully!", destClusterName);<NEW_LINE>} | clusterSetup.addCluster(destClusterName, true); |
355,093 | public static MockCookie parse(String setCookieHeader) {<NEW_LINE>Assert.notNull(setCookieHeader, "Set-Cookie header must not be null");<NEW_LINE>String[] cookieParts = setCookieHeader.split("\\s*=\\s*", 2);<NEW_LINE>Assert.isTrue(cookieParts.length == 2, () -> "Invalid Set-Cookie header '" + setCookieHeader + "'");<NEW_LINE>String name = cookieParts[0];<NEW_LINE>String[] valueAndAttributes = cookieParts[1].split("\\s*;\\s*", 2);<NEW_LINE>String value = valueAndAttributes[0];<NEW_LINE>String[] attributes = (valueAndAttributes.length > 1 ? valueAndAttributes[1].split("\\s*;\\s*"<MASK><NEW_LINE>MockCookie cookie = new MockCookie(name, value);<NEW_LINE>for (String attribute : attributes) {<NEW_LINE>if (StringUtils.startsWithIgnoreCase(attribute, "Domain")) {<NEW_LINE>cookie.setDomain(extractAttributeValue(attribute, setCookieHeader));<NEW_LINE>} else if (StringUtils.startsWithIgnoreCase(attribute, "Max-Age")) {<NEW_LINE>cookie.setMaxAge(Integer.parseInt(extractAttributeValue(attribute, setCookieHeader)));<NEW_LINE>} else if (StringUtils.startsWithIgnoreCase(attribute, "Expires")) {<NEW_LINE>try {<NEW_LINE>cookie.setExpires(ZonedDateTime.parse(extractAttributeValue(attribute, setCookieHeader), DateTimeFormatter.RFC_1123_DATE_TIME));<NEW_LINE>} catch (DateTimeException ex) {<NEW_LINE>// ignore invalid date formats<NEW_LINE>}<NEW_LINE>} else if (StringUtils.startsWithIgnoreCase(attribute, "Path")) {<NEW_LINE>cookie.setPath(extractAttributeValue(attribute, setCookieHeader));<NEW_LINE>} else if (StringUtils.startsWithIgnoreCase(attribute, "Secure")) {<NEW_LINE>cookie.setSecure(true);<NEW_LINE>} else if (StringUtils.startsWithIgnoreCase(attribute, "HttpOnly")) {<NEW_LINE>cookie.setHttpOnly(true);<NEW_LINE>} else if (StringUtils.startsWithIgnoreCase(attribute, "SameSite")) {<NEW_LINE>cookie.setSameSite(extractAttributeValue(attribute, setCookieHeader));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return cookie;<NEW_LINE>} | ) : new String[0]); |
1,530,309 | final BatchUpdateTableRowsResult executeBatchUpdateTableRows(BatchUpdateTableRowsRequest batchUpdateTableRowsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(batchUpdateTableRowsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<BatchUpdateTableRowsRequest> request = null;<NEW_LINE>Response<BatchUpdateTableRowsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new BatchUpdateTableRowsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchUpdateTableRowsRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Honeycode");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchUpdateTableRows");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<BatchUpdateTableRowsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchUpdateTableRowsResultJsonUnmarshaller());<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>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
124,352 | private static <T extends ReferenceListAwareEnum> ImmutableSet<ReferenceListAwareEnum> extractValuesOrNull(final Class<T> clazz) {<NEW_LINE>//<NEW_LINE>// Enum type<NEW_LINE>final T[] enumConstants = clazz.getEnumConstants();<NEW_LINE>if (enumConstants != null) {<NEW_LINE>return ImmutableSet.copyOf(enumConstants);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// static values() method<NEW_LINE>final Method valuesMethod = getMethodOrNull(clazz, "values");<NEW_LINE>if (valuesMethod != null) {<NEW_LINE>final Class<?<MASK><NEW_LINE>if (returnType.isArray()) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final T[] valuesArr = (T[]) invokeStaticMethod(valuesMethod);<NEW_LINE>return ImmutableSet.copyOf(valuesArr);<NEW_LINE>} else if (Collection.class.isAssignableFrom(returnType)) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final Collection<T> valuesCollection = (Collection<T>) invokeStaticMethod(valuesMethod);<NEW_LINE>return ImmutableSet.copyOf(valuesCollection);<NEW_LINE>} else {<NEW_LINE>throw Check.newException("Invalid values method: " + valuesMethod);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// cannot extract values<NEW_LINE>return null;<NEW_LINE>} | > returnType = valuesMethod.getReturnType(); |
980,875 | protected void createRuntimeDataComponents() {<NEW_LINE>if (rDS != null && categoriesDs != null) {<NEW_LINE>Map<String, Object> params = new HashMap<>();<NEW_LINE>params.put("runtimeDs", rDS.getId());<NEW_LINE>params.put("categoriesDs", categoriesDs.getId());<NEW_LINE>params.put("fieldWidth"<MASK><NEW_LINE>params.put("borderVisible", Boolean.TRUE);<NEW_LINE>RuntimePropertiesFrame runtimePropertiesFrame = (RuntimePropertiesFrame) openFrame(runtimePane, "runtimePropertiesFrame", params);<NEW_LINE>runtimePropertiesFrame.setFrame(this.getFrame());<NEW_LINE>runtimePropertiesFrame.setMessagesPack("com.haulmont.cuba.gui.app.core.entityinspector");<NEW_LINE>runtimePropertiesFrame.setCategoryFieldVisible(false);<NEW_LINE>runtimePropertiesFrame.setHeightAuto();<NEW_LINE>runtimePropertiesFrame.setWidthFull();<NEW_LINE>runtimePane.add(runtimePropertiesFrame);<NEW_LINE>}<NEW_LINE>} | , themeConstants.get("cuba.gui.EntityInspectorEditor.field.width")); |
209,872 | public void testWebTargetWithEncoding(Map<String, String> param, StringBuilder ret) {<NEW_LINE>String serverIP = param.get("serverIP");<NEW_LINE>String serverPort = param.get("serverPort");<NEW_LINE>ClientBuilder cb = ClientBuilder.newBuilder();<NEW_LINE>Client c = cb.build();<NEW_LINE>String encodeString = "";<NEW_LINE>String decodeString = "";<NEW_LINE>WebTarget t1 = null;<NEW_LINE>WebTarget t2 = null;<NEW_LINE>String result1 = "";<NEW_LINE>String result2 = "";<NEW_LINE>try {<NEW_LINE>encodeString = URLEncoder.encode("http://" + serverIP + ":" + serverPort + "/" + moduleName + "/ComplexClientTest/ComplexResource", "UTF-8");<NEW_LINE>decodeString = URLDecoder.decode(encodeString, "UTF-8");<NEW_LINE>} catch (UnsupportedEncodingException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>t1 = c.target(encodeString);<NEW_LINE>t1.path("echo1").path("test8").request().get(String.class);<NEW_LINE>} catch (Exception e) {<NEW_LINE>// 'java.lang.IllegalArgumentException: URI is not absolute' will be in the logs<NEW_LINE>result1 = "ECHO1:failed";<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>result2 = t2.path("echo1").path("test9").request().get(String.class);<NEW_LINE>ret.append(result1 + "," + result2);<NEW_LINE>} | t2 = c.target(decodeString); |
521,647 | public ListAppsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListAppsResult listAppsResult = new ListAppsResult();<NEW_LINE><MASK><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 listAppsResult;<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("Apps", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listAppsResult.setApps(new ListUnmarshaller<AppDetails>(AppDetailsJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listAppsResult.setNextToken(context.getUnmarshaller(String.class).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 listAppsResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,694,615 | public static int write(PyObject fd, PyObject bytes) {<NEW_LINE>try (PyBuffer buf = ((BufferProtocol) bytes).getBuffer(PyBUF.SIMPLE)) {<NEW_LINE>// Get a ByteBuffer of that data, setting the position and limit to the real data.<NEW_LINE>ByteBuffer bb = buf.getNIOByteBuffer();<NEW_LINE>Object javaobj = fd.__tojava__(RawIOBase.class);<NEW_LINE>if (javaobj != Py.NoConversion) {<NEW_LINE>try {<NEW_LINE>return ((RawIOBase) javaobj).write(bb);<NEW_LINE>} catch (PyException pye) {<NEW_LINE>throw badFD();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return posix.write(getFD(fd).getIntFD(), <MASK><NEW_LINE>}<NEW_LINE>} catch (ClassCastException e) {<NEW_LINE>throw Py.TypeError("write() argument 2 must be string or buffer, not " + bytes.getType());<NEW_LINE>}<NEW_LINE>} | bb, bb.position()); |
1,449,089 | final DeleteUserProfileResult executeDeleteUserProfile(DeleteUserProfileRequest deleteUserProfileRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteUserProfileRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteUserProfileRequest> request = null;<NEW_LINE>Response<DeleteUserProfileResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteUserProfileRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteUserProfileRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SageMaker");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteUserProfile");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteUserProfileResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteUserProfileResultJsonUnmarshaller());<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>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
303,793 | final CreateBotAliasResult executeCreateBotAlias(CreateBotAliasRequest createBotAliasRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createBotAliasRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateBotAliasRequest> request = null;<NEW_LINE>Response<CreateBotAliasResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateBotAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createBotAliasRequest));<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, "Lex Models V2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateBotAlias");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateBotAliasResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateBotAliasResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
137,523 | private SamlToken assertSamlTokens(SoapMessage message) {<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "assertSamlToken(1)");<NEW_LINE>}<NEW_LINE>AssertionInfoMap aim = message.get(AssertionInfoMap.class);<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "asserting saml (WssSamlV20Token11) policy! ");<NEW_LINE>}<NEW_LINE>org.apache.cxf.ws.security.policy.PolicyUtils.assertPolicy(aim, "WssSamlV20Token11");<NEW_LINE>Collection<AssertionInfo> ais = <MASK><NEW_LINE>SamlToken tok = null;<NEW_LINE>for (AssertionInfo ai : ais) {<NEW_LINE>tok = (SamlToken) ai.getAssertion();<NEW_LINE>ai.setAsserted(true);<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "asserting saml token, assertion = ", ai.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ais = aim.getAssertionInfo(SP12Constants.SUPPORTING_TOKENS);<NEW_LINE>for (AssertionInfo ai : ais) {<NEW_LINE>ai.setAsserted(true);<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "asserting supporting saml token!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ais = aim.getAssertionInfo(SP12Constants.SIGNED_SUPPORTING_TOKENS);<NEW_LINE>for (AssertionInfo ai : ais) {<NEW_LINE>ai.setAsserted(true);<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "asserting signed supporting saml token!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "assertSamlToken(2)" + (tok != null));<NEW_LINE>}<NEW_LINE>return tok;<NEW_LINE>} | aim.getAssertionInfo(SP12Constants.SAML_TOKEN); |
161,343 | public ByteBuffer sendToOutput(ByteBuffer buffer) {<NEW_LINE>ByteBuffer out = buffer.duplicate();<NEW_LINE>out.order(buffer.order());<NEW_LINE>final int chs = data.length;<NEW_LINE>final int mult = (sbrPresent && config.isSBREnabled()) ? 2 : 1;<NEW_LINE>final int length <MASK><NEW_LINE>float[] cur;<NEW_LINE>int i, j, off;<NEW_LINE>short s;<NEW_LINE>for (i = 0; i < chs; i++) {<NEW_LINE>cur = data[i];<NEW_LINE>for (j = 0; j < length; j++) {<NEW_LINE>s = (short) Math.max(Math.min(Math.round(cur[j]), Short.MAX_VALUE), Short.MIN_VALUE);<NEW_LINE>off = (j * chs + i) * 2;<NEW_LINE>out.putShort(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.flip();<NEW_LINE>return out;<NEW_LINE>} | = mult * config.getFrameLength(); |
1,225,752 | public int executeUpdate(final String sql, final int autoGeneratedKeys) throws SQLException {<NEW_LINE>if (RETURN_GENERATED_KEYS == autoGeneratedKeys) {<NEW_LINE>returnGeneratedKeys = true;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>LogicSQL logicSQL = createLogicSQL(sql);<NEW_LINE>trafficContext = getTrafficContext(logicSQL);<NEW_LINE>if (trafficContext.isMatchTraffic()) {<NEW_LINE>JDBCExecutionUnit executionUnit = createTrafficExecutionUnit(trafficContext, logicSQL);<NEW_LINE>return executor.getTrafficExecutor().execute(executionUnit, (statement, actualSQL) -> statement.executeUpdate(actualSQL, autoGeneratedKeys));<NEW_LINE>}<NEW_LINE>executionContext = createExecutionContext(logicSQL);<NEW_LINE>if (metaDataContexts.getMetaData(connection.getSchema()).getRuleMetaData().getRules().stream().anyMatch(each -> each instanceof RawExecutionRule)) {<NEW_LINE>return accumulate(executor.getRawExecutor().execute(createRawExecutionContext(), executionContext.getLogicSQL(), new RawSQLExecutorCallback()));<NEW_LINE>}<NEW_LINE>ExecutionGroupContext<JDBCExecutionUnit> executionGroupContext = createExecutionContext();<NEW_LINE>cacheStatements(executionGroupContext.getInputGroups());<NEW_LINE>return executeUpdate(executionGroupContext, (actualSQL, statement) -> statement.executeUpdate(actualSQL, autoGeneratedKeys), executionContext.getSqlStatementContext(), executionContext.<MASK><NEW_LINE>} catch (SQLException ex) {<NEW_LINE>handleExceptionInTransaction(connection, metaDataContexts);<NEW_LINE>throw ex;<NEW_LINE>} finally {<NEW_LINE>currentResultSet = null;<NEW_LINE>}<NEW_LINE>} | getRouteContext().getRouteUnits()); |
691,092 | public static SimpleTransformationCustomizer fromLayer(Map<String, Object> values) {<NEW_LINE>SimpleTransformationCustomizer instance = new SimpleTransformationCustomizer();<NEW_LINE>Object <MASK><NEW_LINE>boolean applied = false;<NEW_LINE>if (o instanceof String) {<NEW_LINE>boolean warn = false;<NEW_LINE>A: for (String v : o.toString().split(",")) {<NEW_LINE>v = v.trim();<NEW_LINE>switch(v) {<NEW_LINE>case VALUE_MODE_INDEXING:<NEW_LINE>processMap(values, instance.indexing);<NEW_LINE>applied = true;<NEW_LINE>break;<NEW_LINE>case VALUE_MODE_PARSING:<NEW_LINE>processMap(values, instance.parsing);<NEW_LINE>applied = true;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>applied = true;<NEW_LINE>if (!warn) {<NEW_LINE>warn = true;<NEW_LINE>LOG.log(Level.WARNING, "Unexpected value of 'apply': {1}", v);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (o != null) {<NEW_LINE>LOG.log(Level.WARNING, "Unexpected contents of 'apply': {0}", o);<NEW_LINE>applied = true;<NEW_LINE>}<NEW_LINE>if (!applied) {<NEW_LINE>// by default apply for parsing.<NEW_LINE>processMap(values, instance.parsing);<NEW_LINE>}<NEW_LINE>return instance;<NEW_LINE>} | o = values.get(ATTR_MODE); |
378,139 | public static Map<String, String> readPasswordFileOptions(final String passwordFileName, boolean withPrefix) throws CommandException {<NEW_LINE>Map<String, String> passwordOptions = new HashMap<String, String>();<NEW_LINE>boolean readStdin = passwordFileName.equals("-");<NEW_LINE>InputStream is = null;<NEW_LINE>try {<NEW_LINE>is = new BufferedInputStream(readStdin ? System.in : new FileInputStream(passwordFileName));<NEW_LINE>final Properties prop = new Properties();<NEW_LINE>prop.load(is);<NEW_LINE>for (Object key : prop.keySet()) {<NEW_LINE>final String entry = (String) key;<NEW_LINE>if (entry.startsWith(Environment.getPrefix())) {<NEW_LINE>final String optionName;<NEW_LINE>if (withPrefix) {<NEW_LINE>optionName = entry;<NEW_LINE>} else {<NEW_LINE>optionName = entry.substring(Environment.getPrefix().length()).toLowerCase(Locale.ENGLISH);<NEW_LINE>}<NEW_LINE>final String optionValue = prop.getProperty(entry);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (final Exception e) {<NEW_LINE>throw new CommandException(e);<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>if (!readStdin && is != null)<NEW_LINE>is.close();<NEW_LINE>} catch (final Exception ignore) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return passwordOptions;<NEW_LINE>} | passwordOptions.put(optionName, optionValue); |
1,046,823 | public GetResourceLFTagsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetResourceLFTagsResult getResourceLFTagsResult = new GetResourceLFTagsResult();<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 getResourceLFTagsResult;<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("LFTagOnDatabase", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getResourceLFTagsResult.setLFTagOnDatabase(new ListUnmarshaller<LFTagPair>(LFTagPairJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("LFTagsOnTable", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getResourceLFTagsResult.setLFTagsOnTable(new ListUnmarshaller<LFTagPair>(LFTagPairJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("LFTagsOnColumns", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getResourceLFTagsResult.setLFTagsOnColumns(new ListUnmarshaller<ColumnLFTag>(ColumnLFTagJsonUnmarshaller.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 getResourceLFTagsResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
641,010 | public static void main(String[] args) throws Exception {<NEW_LINE>Properties properties = Utils.readPropertiesFile(ExampleConstants.CONFIG_FILE_NAME);<NEW_LINE>final String eventMeshIp = properties.getProperty(ExampleConstants.EVENTMESH_IP);<NEW_LINE>final int eventMeshTcpPort = Integer.parseInt(properties.getProperty(ExampleConstants.EVENTMESH_TCP_PORT));<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>EventMeshTCPClientConfig eventMeshTcpClientConfig = EventMeshTCPClientConfig.builder().host(eventMeshIp).port(eventMeshTcpPort).userAgent(userAgent).build();<NEW_LINE>client = EventMeshTCPClientFactory.createEventMeshTCPClient(eventMeshTcpClientConfig, CloudEvent.class);<NEW_LINE>client.init();<NEW_LINE>for (int i = 0; i < 2; i++) {<NEW_LINE>CloudEvent event = EventMeshTestUtils.generateCloudEventV1Async();<NEW_LINE>logger.info("begin send async msg[{}]: {}", i, event);<NEW_LINE>client.publish(event, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);<NEW_LINE>Thread.sleep(1000);<NEW_LINE>}<NEW_LINE>Thread.sleep(2000);<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.warn("AsyncPublish failed", e);<NEW_LINE>}<NEW_LINE>} | UserAgent userAgent = EventMeshTestUtils.generateClient1(); |
1,609,651 | private void executeRunAction(final boolean debug) {<NEW_LINE>final GrailsServerState serverState = project.getLookup().lookup(GrailsServerState.class);<NEW_LINE>Process process = null;<NEW_LINE>if (serverState != null && serverState.isRunning()) {<NEW_LINE>if (!debug) /*|| debug == serverState.isDebug()*/<NEW_LINE>{<NEW_LINE>URL url = serverState.getRunningUrl();<NEW_LINE>if (url != null) {<NEW_LINE>GrailsCommandSupport.showURL(url, debug, project);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>process = serverState.getProcess();<NEW_LINE>if (process != null) {<NEW_LINE>process.destroy();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final Process oldProcess = process;<NEW_LINE>Callable<Process> callable = new Callable<Process>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Process call() throws Exception {<NEW_LINE>if (oldProcess != null) {<NEW_LINE>oldProcess.waitFor();<NEW_LINE>}<NEW_LINE>Callable<Process> inner = ExecutionSupport.getInstance().createRunApp(GrailsProjectConfig.forProject(project), debug);<NEW_LINE>Process process = inner.call();<NEW_LINE>final GrailsServerState serverState = project.getLookup().lookup(GrailsServerState.class);<NEW_LINE>if (serverState != null) {<NEW_LINE>serverState.setProcess(process);<NEW_LINE>serverState.setDebug(debug);<NEW_LINE>}<NEW_LINE>return process;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>ProjectInformation inf = ProjectUtils.getInformation(project);<NEW_LINE>// NOI18N<NEW_LINE>String displayName = inf.getDisplayName() + " (run-app)";<NEW_LINE>ExecutionDescriptor descriptor = project.getCommandSupport().getRunDescriptor(debug);<NEW_LINE>ExecutionService service = ExecutionService.<MASK><NEW_LINE>service.run();<NEW_LINE>} | newService(callable, descriptor, displayName); |
1,617,704 | // Generally duplicated from SpeedSearchUtil.appendFragmentsForSpeedSearch<NEW_LINE>public void appendFragmentsForSpeedSearch(@NotNull JComponent speedSearchEnabledComponent, @NotNull String text, @NotNull SimpleTextAttributes attributes, boolean selected, @NotNull MultiIconSimpleColoredComponent simpleColoredComponent) {<NEW_LINE>final SpeedSearchSupply speedSearch = SpeedSearchSupply.getSupply(speedSearchEnabledComponent);<NEW_LINE>if (speedSearch != null) {<NEW_LINE>final Iterable<TextRange> fragments = speedSearch.matchingFragments(text);<NEW_LINE>if (fragments != null) {<NEW_LINE>final <MASK><NEW_LINE>final Color bg = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();<NEW_LINE>final int style = attributes.getStyle();<NEW_LINE>final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);<NEW_LINE>final SimpleTextAttributes highlighted = new SimpleTextAttributes(bg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);<NEW_LINE>appendColoredFragments(simpleColoredComponent, text, fragments, plain, highlighted);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>simpleColoredComponent.append(text, attributes);<NEW_LINE>} | Color fg = attributes.getFgColor(); |
1,728,138 | protected void onSaveInstanceState(Bundle outState) {<NEW_LINE>super.onSaveInstanceState(outState);<NEW_LINE>outState.putInt(getString(R.string.frag_prev_mid), initalMiddleFragment);<NEW_LINE>outState.putInt(getString(R.string.frag_prev_bottom), initalBottomFragment);<NEW_LINE>outState.putInt(getString(R.string.frag_prev), mode);<NEW_LINE>outState.putBoolean("Dialogshown", exitDialog);<NEW_LINE>outState.putBoolean("exitWithoutChanges", exitWithoutChanges);<NEW_LINE><MASK><NEW_LINE>outState.putInt("checkMode", modeCheck);<NEW_LINE>outState.putInt("checkString", messageCheck);<NEW_LINE>outState.putParcelable("Edited Bitmap", mainBitmap);<NEW_LINE>outState.putInt("numberOfEdits", mOpTimes);<NEW_LINE>if (addTextFragment.isAdded()) {<NEW_LINE>getSupportFragmentManager().putFragment(outState, "addTextFragment", addTextFragment);<NEW_LINE>}<NEW_LINE>} | outState.putBoolean("modeChanges", modeChangesExit); |
1,759,214 | public UBJsonWriter value(JsonValue value) throws IOException {<NEW_LINE>if (value.isObject()) {<NEW_LINE>if (value.name != null)<NEW_LINE>object(value.name);<NEW_LINE>else<NEW_LINE>object();<NEW_LINE>for (JsonValue child = value.child; child != null; child = <MASK><NEW_LINE>pop();<NEW_LINE>} else if (value.isArray()) {<NEW_LINE>if (value.name != null)<NEW_LINE>array(value.name);<NEW_LINE>else<NEW_LINE>array();<NEW_LINE>for (JsonValue child = value.child; child != null; child = child.next) value(child);<NEW_LINE>pop();<NEW_LINE>} else if (value.isBoolean()) {<NEW_LINE>if (value.name != null)<NEW_LINE>name(value.name);<NEW_LINE>value(value.asBoolean());<NEW_LINE>} else if (value.isDouble()) {<NEW_LINE>if (value.name != null)<NEW_LINE>name(value.name);<NEW_LINE>value(value.asDouble());<NEW_LINE>} else if (value.isLong()) {<NEW_LINE>if (value.name != null)<NEW_LINE>name(value.name);<NEW_LINE>value(value.asLong());<NEW_LINE>} else if (value.isString()) {<NEW_LINE>if (value.name != null)<NEW_LINE>name(value.name);<NEW_LINE>value(value.asString());<NEW_LINE>} else if (value.isNull()) {<NEW_LINE>if (value.name != null)<NEW_LINE>name(value.name);<NEW_LINE>value();<NEW_LINE>} else {<NEW_LINE>throw new IOException("Unhandled JsonValue type");<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | child.next) value(child); |
537,812 | private void mergeModels(JSONArray rchg) throws UnexpectedSchemaChange {<NEW_LINE>for (JSONObject model : rchg.jsonObjectIterable()) {<NEW_LINE><MASK><NEW_LINE>Model l = mCol.getModels().get(r.getLong("id"));<NEW_LINE>// if missing locally or server is newer, update<NEW_LINE>if (l == null || r.getLong("mod") > l.getLong("mod")) {<NEW_LINE>// This is a hack to detect when the note type has been altered<NEW_LINE>// in an import without a full sync being forced. A future<NEW_LINE>// syncing algorithm should handle this in a better way.<NEW_LINE>if (l != null) {<NEW_LINE>if (l.getJSONArray("flds").length() != r.getJSONArray("flds").length()) {<NEW_LINE>throw new UnexpectedSchemaChange();<NEW_LINE>}<NEW_LINE>if (l.getJSONArray("tmpls").length() != r.getJSONArray("tmpls").length()) {<NEW_LINE>throw new UnexpectedSchemaChange();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mCol.getModels().update(r);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Model r = new Model(model); |
841,929 | private String createURLRegex(String url) {<NEW_LINE>String baseURL;<NEW_LINE>try {<NEW_LINE>URL u = new URL(url);<NEW_LINE>baseURL = u.getProtocol() + ":" + ((u.getAuthority() != null && u.getAuthority().length() > 0) ? "//" + u.getAuthority() : "") + ((u.getPath() != null) ? u.getPath() : "");<NEW_LINE>} catch (MalformedURLException ex) {<NEW_LINE>baseURL = url;<NEW_LINE>int i = url.indexOf('?');<NEW_LINE>if (i > 0) {<NEW_LINE>baseURL = baseURL.substring(0, i);<NEW_LINE>}<NEW_LINE>i = url.indexOf('#');<NEW_LINE>if (i > 0) {<NEW_LINE>baseURL = baseURL.substring(0, i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Escape regex special characters:<NEW_LINE>baseURL = baseURL.replace("\\", "\\\\");<NEW_LINE>baseURL = baseURL.replace(".", "\\.");<NEW_LINE>baseURL = baseURL.replace("*", "\\*");<NEW_LINE>baseURL = baseURL.replace("+", "\\+");<NEW_LINE>baseURL = baseURL.replace("(", "\\(");<NEW_LINE>baseURL = baseURL.replace(")", "\\)");<NEW_LINE>baseURL = baseURL.replace("{", "\\{");<NEW_LINE>baseURL = baseURL.replace("}", "\\}");<NEW_LINE>baseURL = <MASK><NEW_LINE>// System.err.println("Escaped baseURL = '"+baseURL+"'");<NEW_LINE>return "^" + baseURL + ".*";<NEW_LINE>} | baseURL.replace("|", "\\|"); |
1,668,276 | public static String regrace(String disgracefulName) {<NEW_LINE>final char separator = '.';<NEW_LINE>char c = '?';<NEW_LINE>GracefulNamer namer = new GracefulNamer();<NEW_LINE>if (!disgracefulName.isEmpty())<NEW_LINE>namer.finalName.append(c <MASK><NEW_LINE>boolean isGrabbingDigits = false;<NEW_LINE>boolean wasSeparator = c == '.' || c == '<' || c == '>';<NEW_LINE>for (int i = 1; i < disgracefulName.length(); i++) {<NEW_LINE>c = disgracefulName.charAt(i);<NEW_LINE>if ((Character.isUpperCase(c)) || (Character.isDigit(c) && !isGrabbingDigits) || (c == separator)) {<NEW_LINE>if (!wasSeparator)<NEW_LINE>namer.finalName.append(" ");<NEW_LINE>wasSeparator = (c == separator);<NEW_LINE>}<NEW_LINE>isGrabbingDigits = (Character.isDigit(c));<NEW_LINE>namer.finalName.append(c);<NEW_LINE>}<NEW_LINE>return namer.finalName.toString();<NEW_LINE>} | = disgracefulName.charAt(0)); |
1,809,423 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {<NEW_LINE>contentView = View.inflate(getContext(), <MASK><NEW_LINE>itemsLayout = contentView.findViewById(R.id.items_layout);<NEW_LINE>if (savedInstanceState != null) {<NEW_LINE>chatId = savedInstanceState.getLong(CHAT_ID, INVALID_HANDLE);<NEW_LINE>messageId = savedInstanceState.getLong(MESSAGE_ID, INVALID_HANDLE);<NEW_LINE>} else {<NEW_LINE>chatId = ((ChatActivity) requireActivity()).idChat;<NEW_LINE>messageId = ((ChatActivity) requireActivity()).selectedMessageId;<NEW_LINE>}<NEW_LINE>MegaChatMessage messageMega = megaChatApi.getManualSendingMessage(chatId, messageId);<NEW_LINE>if (messageMega != null) {<NEW_LINE>selectedMessage = new AndroidMegaChatMessage(messageMega);<NEW_LINE>}<NEW_LINE>selectedChat = megaChatApi.getChatRoom(chatId);<NEW_LINE>logDebug("Chat ID: " + chatId + ", Message ID: " + messageId);<NEW_LINE>return contentView;<NEW_LINE>} | R.layout.msg_not_sent_bottom_sheet, null); |
1,068,728 | public static void processBorderVertical(GrayU8 orig, GrayS16 deriv, Kernel1D_S32 kernel, ImageBorder_S32 borderType) {<NEW_LINE>borderType.setImage(orig);<NEW_LINE>ConvolveJustBorder_General_SB.vertical(kernel, borderType, deriv);<NEW_LINE>GrayU8 origSub;<NEW_LINE>GrayS16 derivSub;<NEW_LINE>origSub = orig.subimage(0, 0, 2, orig.height, null);<NEW_LINE>derivSub = deriv.subimage(0, 0, 2, orig.height, null);<NEW_LINE>ConvolveImageNoBorder.<MASK><NEW_LINE>origSub = orig.subimage(orig.width - 2, 0, orig.width, orig.height, null);<NEW_LINE>derivSub = deriv.subimage(orig.width - 2, 0, orig.width, orig.height, null);<NEW_LINE>ConvolveImageNoBorder.vertical(kernel, origSub, derivSub);<NEW_LINE>} | vertical(kernel, origSub, derivSub); |
1,194,074 | private Component createDestContactListComponent() {<NEW_LINE>destContactList = GuiActivator.getUIService().createContactListComponent(this);<NEW_LINE>destContactList.removeAllContactSources();<NEW_LINE>destContactList.setContactButtonsVisible(false);<NEW_LINE>destContactList.setRightButtonMenuEnabled(false);<NEW_LINE>destContactList.setMultipleSelectionEnabled(true);<NEW_LINE>destContactList.addContactListListener(new ContactListListener() {<NEW_LINE><NEW_LINE>public void groupSelected(ContactListEvent evt) {<NEW_LINE>}<NEW_LINE><NEW_LINE>public void groupClicked(ContactListEvent evt) {<NEW_LINE>}<NEW_LINE><NEW_LINE>public void contactSelected(ContactListEvent evt) {<NEW_LINE>}<NEW_LINE><NEW_LINE>public void contactClicked(ContactListEvent evt) {<NEW_LINE>if (evt.getClickCount() > 1)<NEW_LINE>moveContactFromRightToLeft(evt.getSourceContact());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// By default we set the current filter to be the presence filter.<NEW_LINE>JScrollPane contactListScrollPane = new JScrollPane();<NEW_LINE>contactListScrollPane.setOpaque(false);<NEW_LINE>contactListScrollPane.getViewport().setOpaque(false);<NEW_LINE>contactListScrollPane.getViewport().<MASK><NEW_LINE>contactListScrollPane.getViewport().setBorder(null);<NEW_LINE>contactListScrollPane.setViewportBorder(null);<NEW_LINE>contactListScrollPane.setBorder(null);<NEW_LINE>return contactListScrollPane;<NEW_LINE>} | add(destContactList.getComponent()); |
1,029,666 | public void importPrintTemplate(ActionRequest request, ActionResponse response) {<NEW_LINE>String config = "/data-import/import-print-template-config.xml";<NEW_LINE>try {<NEW_LINE>InputStream inputStream = this.getClass().getResourceAsStream(config);<NEW_LINE>File configFile = File.createTempFile("config", ".xml");<NEW_LINE>FileOutputStream fout = new FileOutputStream(configFile);<NEW_LINE>IOUtil.copyCompletely(inputStream, fout);<NEW_LINE>Path path = MetaFiles.getPath((String) ((Map) request.getContext().get("dataFile")).get("filePath"));<NEW_LINE>File tempDir = Files.createTempDir();<NEW_LINE>File importFile = new File(tempDir, "print-template.xml");<NEW_LINE>Files.copy(path.toFile(), importFile);<NEW_LINE>XMLImporter importer = new XMLImporter(configFile.getAbsolutePath(), tempDir.getAbsolutePath());<NEW_LINE>ImporterListener listner = new ImporterListener("PrintTemplate");<NEW_LINE>importer.addListener(listner);<NEW_LINE>importer.run();<NEW_LINE>FileUtils.forceDelete(configFile);<NEW_LINE>FileUtils.forceDelete(tempDir);<NEW_LINE>response.setValue("importLog", listner.getImportLog());<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | TraceBackService.trace(response, e); |
320,525 | public void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException {<NEW_LINE>NBTUtilBC.readCompoundList(nbt.getTag("requiredBlockOffsets")).map(NBTUtil::getPosFromTag).forEach(requiredBlockOffsets::add);<NEW_LINE>blockState = NBTUtil.readBlockState<MASK><NEW_LINE>NBTUtilBC.readStringList(nbt.getTag("ignoredProperties")).map(propertyName -> blockState.getPropertyKeys().stream().filter(property -> property.getName().equals(propertyName)).findFirst().orElse(null)).forEach(ignoredProperties::add);<NEW_LINE>if (nbt.hasKey("tileNbt")) {<NEW_LINE>tileNbt = nbt.getCompoundTag("tileNbt");<NEW_LINE>}<NEW_LINE>tileRotation = NBTUtilBC.readEnum(nbt.getTag("tileRotation"), Rotation.class);<NEW_LINE>placeBlock = Block.REGISTRY.getObject(new ResourceLocation(nbt.getString("placeBlock")));<NEW_LINE>NBTUtilBC.readCompoundList(nbt.getTag("updateBlockOffsets")).map(NBTUtil::getPosFromTag).forEach(updateBlockOffsets::add);<NEW_LINE>NBTUtilBC.readStringList(nbt.getTag("canBeReplacedWithBlocks")).map(ResourceLocation::new).map(Block.REGISTRY::getObject).forEach(canBeReplacedWithBlocks::add);<NEW_LINE>} | (nbt.getCompoundTag("blockState")); |
399,787 | public void configure(Context context) {<NEW_LINE>this.context = context;<NEW_LINE>port = context.getInteger(ConfigConstants.CONFIG_PORT);<NEW_LINE>host = context.<MASK><NEW_LINE>Configurables.ensureRequiredNonNull(context, ConfigConstants.CONFIG_PORT);<NEW_LINE>Preconditions.checkArgument(ConfStringUtils.isValidIp(host), "ip config not valid");<NEW_LINE>Preconditions.checkArgument(ConfStringUtils.isValidPort(port), "port config not valid");<NEW_LINE>maxMsgLength = context.getInteger(ConfigConstants.MAX_MSG_LENGTH, 1024 * 64);<NEW_LINE>Preconditions.checkArgument((maxMsgLength >= 4 && maxMsgLength <= ConfigConstants.MSG_MAX_LENGTH_BYTES), "maxMsgLength must be >= 4 and <= 65536");<NEW_LINE>topic = context.getString(ConfigConstants.TOPIC);<NEW_LINE>attr = context.getString(ConfigConstants.ATTR);<NEW_LINE>Configurables.ensureRequiredNonNull(context, ConfigConstants.TOPIC, ConfigConstants.ATTR);<NEW_LINE>topic = topic.trim();<NEW_LINE>Preconditions.checkArgument(!topic.isEmpty(), "topic is empty");<NEW_LINE>attr = attr.trim();<NEW_LINE>Preconditions.checkArgument(!attr.isEmpty(), "attr is empty");<NEW_LINE>messageHandlerName = context.getString(ConfigConstants.MESSAGE_HANDLER_NAME, "org.apache.inlong.dataproxy.source.ServerMessageHandler");<NEW_LINE>messageHandlerName = messageHandlerName.trim();<NEW_LINE>Preconditions.checkArgument(!messageHandlerName.isEmpty(), "messageHandlerName is empty");<NEW_LINE>filterEmptyMsg = context.getBoolean(ConfigConstants.FILTER_EMPTY_MSG, false);<NEW_LINE>statIntervalSec = context.getInteger(ConfigConstants.STAT_INTERVAL_SEC, 60);<NEW_LINE>Preconditions.checkArgument((statIntervalSec >= 0), "statIntervalSec must be >= 0");<NEW_LINE>customProcessor = context.getBoolean(ConfigConstants.CUSTOM_CHANNEL_PROCESSOR, false);<NEW_LINE>try {<NEW_LINE>maxConnections = context.getInteger(CONNECTIONS, 5000);<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>logger.warn("BaseSource connections property must specify an integer value {}", context.getString(CONNECTIONS));<NEW_LINE>}<NEW_LINE>} | getString(ConfigConstants.CONFIG_HOST, "0.0.0.0"); |
234,560 | public void run() throws JRException {<NEW_LINE>long start = System.currentTimeMillis();<NEW_LINE>// Preparing parameters<NEW_LINE>Image image = Toolkit.getDefaultToolkit().createImage("dukesign.jpg");<NEW_LINE>MediaTracker traker = new MediaTracker(new Panel());<NEW_LINE>traker.addImage(image, 0);<NEW_LINE>try {<NEW_LINE>traker.waitForID(0);<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>Map<String, Object> parameters = new HashMap<String, Object>();<NEW_LINE>parameters.put("ReportTitle", "The First Jasper Report Ever");<NEW_LINE>parameters.put("MaxOrderID", 10500);<NEW_LINE>parameters.put("SummaryImage", image);<NEW_LINE>JasperRunManager.runReportToPdfFile("build/reports/AccessibleReport.jasper", parameters, getDemoHsqldbConnection());<NEW_LINE>System.err.println("PDF running time : " + (System<MASK><NEW_LINE>} | .currentTimeMillis() - start)); |
1,781,299 | // Convert a list of futures to a future of a list<NEW_LINE>public static <T> InternalFuture<List<T>> sequence(final List<InternalFuture<T>> futures, Executor executor) {<NEW_LINE>if (futures.isEmpty()) {<NEW_LINE>return InternalFuture.completedInternalFuture(new LinkedList<>());<NEW_LINE>}<NEW_LINE>final var promise = new CompletableFuture<List<T>>();<NEW_LINE>final var values = new ArrayList<T>(futures.size());<NEW_LINE>final CompletableFuture<T>[] futuresArray = futures.stream().map(x -> x.toCompletionStage().toCompletableFuture()).collect(Collectors.toList()).toArray(new CompletableFuture[futures.size()]);<NEW_LINE>CompletableFuture.allOf(futuresArray).whenCompleteAsync((ignored, throwable) -> {<NEW_LINE>if (throwable != null) {<NEW_LINE>promise.completeExceptionally(throwable);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>for (final var future : futuresArray) {<NEW_LINE>values.<MASK><NEW_LINE>}<NEW_LINE>promise.complete(values);<NEW_LINE>} catch (RuntimeException | InterruptedException | ExecutionException t) {<NEW_LINE>if (t instanceof InterruptedException) {<NEW_LINE>// Restore interrupted state...<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>}<NEW_LINE>promise.completeExceptionally(t);<NEW_LINE>}<NEW_LINE>}, executor);<NEW_LINE>return InternalFuture.from(promise);<NEW_LINE>} | add(future.get()); |
1,344,527 | public static DescribeUserInfoListResponse unmarshall(DescribeUserInfoListResponse describeUserInfoListResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeUserInfoListResponse.setRequestId(_ctx.stringValue("DescribeUserInfoListResponse.RequestId"));<NEW_LINE>describeUserInfoListResponse.setTotalCount(_ctx.longValue("DescribeUserInfoListResponse.TotalCount"));<NEW_LINE>List<UserInfo> userInfoList = new ArrayList<UserInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeUserInfoListResponse.UserInfoList.Length"); i++) {<NEW_LINE>UserInfo userInfo = new UserInfo();<NEW_LINE>userInfo.setBirthday(_ctx.longValue("DescribeUserInfoListResponse.UserInfoList[" + i + "].Birthday"));<NEW_LINE>userInfo.setUserGroupId(_ctx.longValue("DescribeUserInfoListResponse.UserInfoList[" + i + "].UserGroupId"));<NEW_LINE>userInfo.setGroupName(_ctx.stringValue("DescribeUserInfoListResponse.UserInfoList[" + i + "].GroupName"));<NEW_LINE>userInfo.setIdentifyingImage(_ctx.stringValue("DescribeUserInfoListResponse.UserInfoList[" + i + "].IdentifyingImage"));<NEW_LINE>userInfo.setSex(_ctx.integerValue("DescribeUserInfoListResponse.UserInfoList[" + i + "].Sex"));<NEW_LINE>userInfo.setId(_ctx.longValue("DescribeUserInfoListResponse.UserInfoList[" + i + "].Id"));<NEW_LINE>userInfo.setUserName(_ctx.stringValue("DescribeUserInfoListResponse.UserInfoList[" + i + "].UserName"));<NEW_LINE>userInfo.setCertificateNo(_ctx.stringValue<MASK><NEW_LINE>userInfo.setPhoneNo(_ctx.stringValue("DescribeUserInfoListResponse.UserInfoList[" + i + "].PhoneNo"));<NEW_LINE>userInfo.setCertificateType(_ctx.stringValue("DescribeUserInfoListResponse.UserInfoList[" + i + "].CertificateType"));<NEW_LINE>userInfoList.add(userInfo);<NEW_LINE>}<NEW_LINE>describeUserInfoListResponse.setUserInfoList(userInfoList);<NEW_LINE>return describeUserInfoListResponse;<NEW_LINE>} | ("DescribeUserInfoListResponse.UserInfoList[" + i + "].CertificateNo")); |
711,851 | public boolean shouldRun(Description description) {<NEW_LINE>String methodName = description.getMethodName();<NEW_LINE>if (methodName == null) {<NEW_LINE>// JUnit will give us an org.junit.runner.Description like this for the<NEW_LINE>// test class<NEW_LINE>// itself. It's easier for our filtering to make decisions just at the method level,<NEW_LINE>// however, so just always return true here.<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>TestDescription testDescription = new TestDescription(className, methodName);<NEW_LINE>TestSelector matchingSelector = testSelectorList.findSelector(testDescription);<NEW_LINE>if (!matchingSelector.isInclusive()) {<NEW_LINE>if (shouldExplainTestSelectors) {<NEW_LINE>String reason = "Excluded by filter: " + matchingSelector.getExplanation();<NEW_LINE>filteredOut.add(TestResult.forExcluded(className, methodName, reason));<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (description.getAnnotation(Ignore.class) != null) {<NEW_LINE>filteredOut.add(TestResult.forDisabled(className, methodName));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (isDryRun) {<NEW_LINE>filteredOut.add(TestResult.forDryRun(className, methodName));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | String className = description.getClassName(); |
420,856 | public void updatePet(Pet body) throws ApiException {<NEW_LINE>Object localVarPostBody = body;<NEW_LINE>// verify the required parameter 'body' is set<NEW_LINE>if (body == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/pet".replaceAll("\\{format\\}", "json");<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE><MASK><NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = { "application/json", "application/xml" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "petstore_auth" };<NEW_LINE>apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);<NEW_LINE>} | final String[] localVarAccepts = {}; |
1,229,269 | protected ClickHouseHttpResponse post(String sql, InputStream data, List<ClickHouseExternalTable> tables, Map<String, String> headers) throws IOException {<NEW_LINE>HttpRequest.Builder reqBuilder = HttpRequest.newBuilder().uri(URI.create(url)).timeout(Duration.ofMillis<MASK><NEW_LINE>String boundary = null;<NEW_LINE>if (tables != null && !tables.isEmpty()) {<NEW_LINE>boundary = UUID.randomUUID().toString();<NEW_LINE>reqBuilder.setHeader("Content-Type", "multipart/form-data; boundary=" + boundary);<NEW_LINE>} else {<NEW_LINE>reqBuilder.setHeader("Content-Type", "text/plain; charset=UTF-8");<NEW_LINE>}<NEW_LINE>headers = mergeHeaders(headers);<NEW_LINE>if (headers != null && !headers.isEmpty()) {<NEW_LINE>for (Entry<String, String> header : headers.entrySet()) {<NEW_LINE>reqBuilder.setHeader(header.getKey(), header.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return boundary != null || data != null ? postStream(reqBuilder, boundary, sql, data, tables) : postString(reqBuilder, sql);<NEW_LINE>} | (config.getSocketTimeout())); |
141,984 | public void checkForHeaderGet(View view) {<NEW_LINE>Rx2ANRequest.GetRequestBuilder getRequestBuilder = new Rx2ANRequest.GetRequestBuilder(ApiEndPoint.BASE_URL + ApiEndPoint.CHECK_FOR_HEADER);<NEW_LINE>getRequestBuilder.addHeaders("token", "1234").build().setAnalyticsListener(new AnalyticsListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onReceived(long timeTakenInMillis, long bytesSent, long bytesReceived, boolean isFromCache) {<NEW_LINE>Log.d(TAG, " timeTakenInMillis : " + timeTakenInMillis);<NEW_LINE>Log.<MASK><NEW_LINE>Log.d(TAG, " bytesReceived : " + bytesReceived);<NEW_LINE>Log.d(TAG, " isFromCache : " + isFromCache);<NEW_LINE>}<NEW_LINE>}).getJSONObjectSingle().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<JSONObject>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSubscribe(@NonNull Disposable disposable) {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(@NonNull JSONObject jsonObject) {<NEW_LINE>Log.d(TAG, "onResponse object : " + jsonObject.toString());<NEW_LINE>Log.d(TAG, "onResponse isMainThread : " + String.valueOf(Looper.myLooper() == Looper.getMainLooper()));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(@NonNull Throwable throwable) {<NEW_LINE>Utils.logError(TAG, throwable);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | d(TAG, " bytesSent : " + bytesSent); |
858,779 | // parse swap rate calculation<NEW_LINE>private RateCalculation parseSwapCalculation(XmlElement legEl, XmlElement calcEl, PeriodicSchedule accrualSchedule, FpmlDocument document) {<NEW_LINE>// supported elements:<NEW_LINE>// 'calculationPeriodAmount/calculation/fixedRateSchedule'<NEW_LINE>// 'calculationPeriodAmount/calculation/floatingRateCalculation'<NEW_LINE>// 'calculationPeriodAmount/calculation/inflationRateCalculation'<NEW_LINE>Optional<XmlElement> fixedOptEl = calcEl.findChild("fixedRateSchedule");<NEW_LINE>Optional<XmlElement> floatingOptEl = calcEl.findChild("floatingRateCalculation");<NEW_LINE>Optional<XmlElement> inflationOptEl = calcEl.findChild("inflationRateCalculation");<NEW_LINE>if (fixedOptEl.isPresent()) {<NEW_LINE>return parseFixed(legEl, calcEl, fixedOptEl.get(), document);<NEW_LINE>} else if (floatingOptEl.isPresent()) {<NEW_LINE>return parseFloat(legEl, calcEl, floatingOptEl.<MASK><NEW_LINE>} else if (inflationOptEl.isPresent()) {<NEW_LINE>return parseInflation(legEl, calcEl, inflationOptEl.get(), accrualSchedule, document);<NEW_LINE>} else {<NEW_LINE>throw new FpmlParseException("Invalid 'calculation' type, not fixedRateSchedule, floatingRateCalculation or inflationRateCalculation");<NEW_LINE>}<NEW_LINE>} | get(), accrualSchedule, document); |
441,470 | final CreateTopicResult executeCreateTopic(CreateTopicRequest createTopicRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createTopicRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateTopicRequest> request = null;<NEW_LINE>Response<CreateTopicResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateTopicRequestMarshaller().marshall(super.beforeMarshalling(createTopicRequest));<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, "SNS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateTopic");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>StaxResponseHandler<CreateTopicResult> responseHandler = new StaxResponseHandler<CreateTopicResult>(new CreateTopicResultStaxUnmarshaller());<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,580,365 | protected Value marshalObjectToNative(Function fn, MarshalerMethod marshalerMethod, MarshaledArg marshaledArg, Type nativeType, Value env, Value object, long flags) {<NEW_LINE>Invokestatic invokestatic = marshalerMethod.getInvokeStatic(sootMethod.getDeclaringClass());<NEW_LINE>trampolines.add(invokestatic);<NEW_LINE>Value handle = call(fn, invokestatic.getFunctionRef(), env, object, new IntegerConstant(flags));<NEW_LINE>Variable nativeValue = fn.newVariable(nativeType);<NEW_LINE>if (nativeType instanceof StructureType || nativeType instanceof ArrayType) {<NEW_LINE>Variable tmp = fn.<MASK><NEW_LINE>fn.add(new Inttoptr(tmp, handle, tmp.getType()));<NEW_LINE>fn.add(new Load(nativeValue, tmp.ref()));<NEW_LINE>} else {<NEW_LINE>fn.add(new Inttoptr(nativeValue, handle, nativeType));<NEW_LINE>}<NEW_LINE>if (marshaledArg != null) {<NEW_LINE>marshaledArg.handle = handle;<NEW_LINE>marshaledArg.object = object;<NEW_LINE>}<NEW_LINE>return nativeValue.ref();<NEW_LINE>} | newVariable(new PointerType(nativeType)); |
727,836 | public void clear() {<NEW_LINE>Iterator<Map.Entry<K, MapEntryValue>> iterator = entries().entrySet().iterator();<NEW_LINE>Map<K, MapEntryValue> entriesToAdd = new HashMap<>();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>Map.Entry<K, MapEntryValue> entry = iterator.next();<NEW_LINE>K key = entry.getKey();<NEW_LINE>MapEntryValue value = entry.getValue();<NEW_LINE>if (!valueIsNull(value)) {<NEW_LINE>Versioned<byte[]> removedValue = new Versioned<>(value.value(), value.version());<NEW_LINE>publish(new AtomicMapEvent<>(AtomicMapEvent.Type.REMOVE, key, null, removedValue));<NEW_LINE>cancelTtl(value);<NEW_LINE>if (activeTransactions.isEmpty()) {<NEW_LINE>iterator.remove();<NEW_LINE>} else {<NEW_LINE>entriesToAdd.put(key, new MapEntryValue(MapEntryValue.Type.TOMBSTONE, value.version, null, 0, 0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | entries().putAll(entriesToAdd); |
1,463,252 | public Coordinate invRotate(Coordinate coord) {<NEW_LINE>double a, b, c, d;<NEW_LINE>assert (Math.abs(norm2() - 1) < 0.00001) : "Quaternion not unit length: " + this;<NEW_LINE>// (a,b,c,d) = (this)^-1 * coord = (w,-x,-y,-z) * (0,cx,cy,cz)<NEW_LINE>a = +x * coord.x + y * coord<MASK><NEW_LINE>b = w * coord.x - y * coord.z + z * coord.y;<NEW_LINE>c = w * coord.y + x * coord.z - z * coord.x;<NEW_LINE>d = w * coord.z - x * coord.y + y * coord.x;<NEW_LINE>// return = (a,b,c,d) * this = (a,b,c,d) * (w,x,y,z)<NEW_LINE>assert (Math.abs(a * w - b * x - c * y - d * z) < Math.max(coord.max(), 1) * MathUtil.EPSILON) : ("Should be zero: " + (a * w - b * x - c * y - d * z) + " in " + this + " c=" + coord);<NEW_LINE>return new Coordinate(a * x + b * w + c * z - d * y, a * y - b * z + c * w + d * x, a * z + b * y - c * x + d * w, coord.weight);<NEW_LINE>} | .y + z * coord.z; |
256,315 | public ManufOrder generateManufOrder(Product product, BigDecimal qtyRequested, int priority, boolean isToInvoice, BillOfMaterial billOfMaterial, LocalDateTime plannedStartDateT, LocalDateTime plannedEndDateT, int originType) throws AxelorException {<NEW_LINE>if (billOfMaterial == null) {<NEW_LINE>billOfMaterial = this.getBillOfMaterial(product);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>BigDecimal qty = qtyRequested.divide(billOfMaterial.getQty(), appBaseService.getNbDecimalDigitForQty(), RoundingMode.HALF_UP);<NEW_LINE>ManufOrder manufOrder = this.createManufOrder(product, qty, priority, IS_TO_INVOICE, company, billOfMaterial, plannedStartDateT, plannedEndDateT);<NEW_LINE>if (originType == ORIGIN_TYPE_SALE_ORDER && appProductionService.getAppProduction().getAutoPlanManufOrderFromSO() || originType == ORIGIN_TYPE_MRP || originType == ORIGIN_TYPE_OTHER) {<NEW_LINE>manufOrder = manufOrderWorkflowService.plan(manufOrder);<NEW_LINE>}<NEW_LINE>return manufOrderRepo.save(manufOrder);<NEW_LINE>} | Company company = billOfMaterial.getCompany(); |
1,550,209 | public <T, S> List<T> sort(SortQuery<K> query, BulkMapper<T, S> bulkMapper, @Nullable RedisSerializer<S> resultSerializer) {<NEW_LINE>List<S> values = sort(query, resultSerializer);<NEW_LINE>if (values == null || values.isEmpty()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>int bulkSize = query.getGetPattern().size();<NEW_LINE>List<T> result = new ArrayList<>(values.size() / bulkSize + 1);<NEW_LINE>List<S> bulk = new ArrayList<>(bulkSize);<NEW_LINE>for (S s : values) {<NEW_LINE>bulk.add(s);<NEW_LINE>if (bulk.size() == bulkSize) {<NEW_LINE>result.add(bulkMapper.mapBulk(Collections.unmodifiableList(bulk)));<NEW_LINE>// create a new list (we could reuse the old one but the client might hang on to it for some reason)<NEW_LINE>bulk <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | = new ArrayList<>(bulkSize); |
1,091,855 | private void initComponents() {<NEW_LINE>// NOI18N<NEW_LINE>dialog = new JDialog(parentFrame, NbBundle.getMessage(AboutDialog.class, "LBL_About"), true);<NEW_LINE>dialog.addWindowListener(new WindowAdapter() {<NEW_LINE><NEW_LINE>public void windowClosed(WindowEvent e) {<NEW_LINE>cleanup();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>JComponent contentPane = (JComponent) dialog.getContentPane();<NEW_LINE>contentPane.setLayout(new BorderLayout());<NEW_LINE>// NOI18N<NEW_LINE>contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).// NOI18N<NEW_LINE>put(// NOI18N<NEW_LINE>KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "CLOSE_ACTION");<NEW_LINE>contentPane.getActionMap().put("CLOSE_ACTION", new // NOI18N<NEW_LINE>AbstractAction() {<NEW_LINE><NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>close();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>aboutDialogPanel = new AboutDialogPanel();<NEW_LINE>aboutDialogControls = new AboutDialogControls();<NEW_LINE>contentPane.<MASK><NEW_LINE>contentPane.add(aboutDialogControls, BorderLayout.SOUTH);<NEW_LINE>dialog.getRootPane().setDefaultButton(aboutDialogControls.getDefaultButton());<NEW_LINE>dialog.setResizable(false);<NEW_LINE>dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);<NEW_LINE>} | add(aboutDialogPanel, BorderLayout.CENTER); |
523,128 | public void fetch() {<NEW_LINE>collectObj();<NEW_LINE>Iterator<Integer> itr = serverObjMap.keySet().iterator();<NEW_LINE>ActiveSpeedData a = new ActiveSpeedData();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>int serverId = itr.next();<NEW_LINE>TcpProxy tcp = TcpProxy.getTcpProxy(serverId);<NEW_LINE>try {<NEW_LINE>MapPack param = new MapPack();<NEW_LINE>param.put("objHash"<MASK><NEW_LINE>MapPack p = (MapPack) tcp.getSingle(RequestCmd.ACTIVESPEED_GROUP_REAL_TIME_GROUP, param);<NEW_LINE>if (p == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (p != null) {<NEW_LINE>a.act1 += CastUtil.cint(p.get("act1"));<NEW_LINE>a.act2 += CastUtil.cint(p.get("act2"));<NEW_LINE>a.act3 += CastUtil.cint(p.get("act3"));<NEW_LINE>a.tps += CastUtil.cint(p.get("tps"));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>ConsoleProxy.errorSafe(e.toString());<NEW_LINE>} finally {<NEW_LINE>TcpProxy.putTcpProxy(tcp);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>activeSpeedData = a;<NEW_LINE>} | , serverObjMap.get(serverId)); |
1,405,397 | private boolean existUniqueValueInStore(IndexLabel indexLabel, Object value) {<NEW_LINE>ConditionQuery query = new ConditionQuery(HugeType.UNIQUE_INDEX);<NEW_LINE>query.eq(HugeKeys.INDEX_LABEL_ID, indexLabel.id());<NEW_LINE>query.eq(HugeKeys.FIELD_VALUES, value);<NEW_LINE>boolean exist;<NEW_LINE>Iterator<BackendEntry> iterator = this.query(query).iterator();<NEW_LINE>try {<NEW_LINE>exist = iterator.hasNext();<NEW_LINE>if (exist) {<NEW_LINE>HugeIndex index = this.serializer.readIndex(graph(), query, iterator.next());<NEW_LINE>this.removeExpiredIndexIfNeeded(index, query.showExpired());<NEW_LINE>// Memory backend might return empty BackendEntry<NEW_LINE>if (index.elementIds().isEmpty()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>LOG.debug(<MASK><NEW_LINE>}<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>LOG.warn("Unique constraint conflict found by record {}", iterator.next());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>CloseableIterator.closeIterator(iterator);<NEW_LINE>}<NEW_LINE>return exist;<NEW_LINE>} | "Already has existed unique index record {}", index.elementId()); |
185,670 | private byte[] computeW(final byte[] iv, final byte[] key) throws GeneralSecurityException {<NEW_LINE>// Checks the parameter sizes for which W is defined.<NEW_LINE>// Note, that the caller ensures stricter limits.<NEW_LINE>if (key.length <= 8 || key.length > Integer.MAX_VALUE - 16 || iv.length != 8) {<NEW_LINE>throw new GeneralSecurityException("computeW called with invalid parameters");<NEW_LINE>}<NEW_LINE>byte[] data = new byte[wrappingSize(key.length)];<NEW_LINE>System.arraycopy(iv, 0, <MASK><NEW_LINE>System.arraycopy(key, 0, data, 8, key.length);<NEW_LINE>int blocks = data.length / 8 - 1;<NEW_LINE>Cipher aes = EngineFactory.CIPHER.getInstance("AES/ECB/NoPadding");<NEW_LINE>aes.init(Cipher.ENCRYPT_MODE, aesKey);<NEW_LINE>byte[] block = new byte[16];<NEW_LINE>System.arraycopy(data, 0, block, 0, 8);<NEW_LINE>for (int i = 0; i < ROUNDS; i++) {<NEW_LINE>for (int j = 0; j < blocks; j++) {<NEW_LINE>System.arraycopy(data, 8 * (j + 1), block, 8, 8);<NEW_LINE>int length = aes.doFinal(block, 0, 16, block);<NEW_LINE>assert length == 16;<NEW_LINE>// xor the round constant in bigendian order to the left half of block.<NEW_LINE>int roundConst = i * blocks + j + 1;<NEW_LINE>for (int b = 0; b < 4; b++) {<NEW_LINE>block[7 - b] ^= (byte) (roundConst & 0xff);<NEW_LINE>roundConst >>>= 8;<NEW_LINE>}<NEW_LINE>System.arraycopy(block, 8, data, 8 * (j + 1), 8);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.arraycopy(block, 0, data, 0, 8);<NEW_LINE>return data;<NEW_LINE>} | data, 0, iv.length); |
687,100 | public int readRawVarInt32() throws IOException {<NEW_LINE>int position = nioBuffer.position();<NEW_LINE>byte tmp = UnsafeDirectBufferUtil.<MASK><NEW_LINE>if (tmp >= 0) {<NEW_LINE>nioBuffer.position(position);<NEW_LINE>return tmp;<NEW_LINE>}<NEW_LINE>int result = tmp & 0x7f;<NEW_LINE>if ((tmp = UnsafeDirectBufferUtil.getByte(address(position++))) >= 0) {<NEW_LINE>result |= tmp << 7;<NEW_LINE>} else {<NEW_LINE>result |= (tmp & 0x7f) << 7;<NEW_LINE>if ((tmp = UnsafeDirectBufferUtil.getByte(address(position++))) >= 0) {<NEW_LINE>result |= tmp << 14;<NEW_LINE>} else {<NEW_LINE>result |= (tmp & 0x7f) << 14;<NEW_LINE>if ((tmp = UnsafeDirectBufferUtil.getByte(address(position++))) >= 0) {<NEW_LINE>result |= tmp << 21;<NEW_LINE>} else {<NEW_LINE>result |= (tmp & 0x7f) << 21;<NEW_LINE>result |= (tmp = UnsafeDirectBufferUtil.getByte(address(position++))) << 28;<NEW_LINE>if (tmp < 0) {<NEW_LINE>// Discard upper 32 bits.<NEW_LINE>for (int i = 0; i < 5; i++) {<NEW_LINE>if (UnsafeDirectBufferUtil.getByte(address(position++)) >= 0) {<NEW_LINE>nioBuffer.position(position);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw ProtocolException.malformedVarInt();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>nioBuffer.position(position);<NEW_LINE>return result;<NEW_LINE>} | getByte(address(position++)); |
954,836 | public void fill(Vector min, Vector max, Material outerType, int outerData, Material innerType, int innerData) {<NEW_LINE>int minX = min.getBlockX();<NEW_LINE>int minY = min.getBlockY();<NEW_LINE>int minZ = min.getBlockZ();<NEW_LINE>int maxX = max.getBlockX();<NEW_LINE><MASK><NEW_LINE>int maxZ = max.getBlockZ();<NEW_LINE>for (int y = minY; y <= maxY; y++) {<NEW_LINE>for (int x = minX; x <= maxX; x++) {<NEW_LINE>for (int z = minZ; z <= maxZ; z++) {<NEW_LINE>Material type;<NEW_LINE>int data;<NEW_LINE>if (x != minX && x != maxX && z != minZ && z != maxZ && y != minY && y != maxY) {<NEW_LINE>type = innerType;<NEW_LINE>data = innerData;<NEW_LINE>} else {<NEW_LINE>type = outerType;<NEW_LINE>data = outerData;<NEW_LINE>}<NEW_LINE>setBlock(new Vector(x, y, z), type, data);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int maxY = max.getBlockY(); |
752,071 | @Produces("application/json")<NEW_LINE>public Response deleteBundlesOlderThan(@Context final HttpServletRequest request, @Context final HttpServletResponse response, @PathParam("olderThan") final ISODateParam olderThan) {<NEW_LINE>if (olderThan.after(new Date())) {<NEW_LINE>throw new IllegalArgumentException("To avoid deleting bundles that publish in the future, the date can not be after the current date");<NEW_LINE>}<NEW_LINE>final InitDataObject initData = new WebResource.InitBuilder(webResource).requiredBackendUser(true).requiredFrontendUser(false).requestAndResponse(request, response).rejectWhenNoUser(true).init();<NEW_LINE>final Locale locale = LocaleUtil.getLocale(request);<NEW_LINE>Logger.info(this, "Deleting the bundles older than: " + olderThan + " by the user: " + initData.getUser().getUserId());<NEW_LINE>final DotSubmitter dotSubmitter = DotConcurrentFactory.getInstance().getSubmitter(BUNDLE_THREAD_POOL_SUBMITTER_NAME);<NEW_LINE>dotSubmitter.execute(() -> {<NEW_LINE>try {<NEW_LINE>final BundleDeleteResult bundleDeleteResult = this.bundleAPI.deleteBundleAndDependenciesOlderThan(olderThan, initData.getUser());<NEW_LINE>sendDeleteResultsMessage(initData, locale, bundleDeleteResult);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(this.getClass(), "Exception on deleteBundlesOlderThan, couldn't delete bundles older than: " + olderThan + ", exception message: " + e.getMessage(), e);<NEW_LINE>this.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>return Response.ok(new ResponseEntityView("Removing bundles in a separated process, the result of the operation will be notified")).build();<NEW_LINE>} | sendErrorDeleteBundleMessage(initData, locale, e); |
629,570 | final ExportServerEngineAttributeResult executeExportServerEngineAttribute(ExportServerEngineAttributeRequest exportServerEngineAttributeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(exportServerEngineAttributeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ExportServerEngineAttributeRequest> request = null;<NEW_LINE>Response<ExportServerEngineAttributeResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ExportServerEngineAttributeRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(exportServerEngineAttributeRequest));<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, "OpsWorksCM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ExportServerEngineAttribute");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ExportServerEngineAttributeResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ExportServerEngineAttributeResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
1,633,134 | private Object findObjectToSelectAfterDeletion() {<NEW_LINE>Object firstObject = fSelectedObjects[0];<NEW_LINE>TreeItem item = fViewer.findTreeItem(firstObject);<NEW_LINE>if (item == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TreeItem parentTreeItem = item.getParentItem();<NEW_LINE>// Parent Item not found so must be at top level<NEW_LINE>if (parentTreeItem == null) {<NEW_LINE>Tree tree = item.getParent();<NEW_LINE>int <MASK><NEW_LINE>if (index < 1) {<NEW_LINE>// At root or not found<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return tree.getItem(index - 1).getData();<NEW_LINE>}<NEW_LINE>Object selected = null;<NEW_LINE>// Item index is greater than 0 so select previous sibling item<NEW_LINE>int index = parentTreeItem.indexOf(item);<NEW_LINE>if (index > 0) {<NEW_LINE>selected = parentTreeItem.getItem(index - 1).getData();<NEW_LINE>}<NEW_LINE>// Was null so select parent of first object<NEW_LINE>if (selected == null && firstObject instanceof EObject) {<NEW_LINE>selected = ((EObject) firstObject).eContainer();<NEW_LINE>}<NEW_LINE>return selected;<NEW_LINE>} | index = tree.indexOf(item); |
195,979 | final DescribeUserHierarchyGroupResult executeDescribeUserHierarchyGroup(DescribeUserHierarchyGroupRequest describeUserHierarchyGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeUserHierarchyGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeUserHierarchyGroupRequest> request = null;<NEW_LINE>Response<DescribeUserHierarchyGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeUserHierarchyGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeUserHierarchyGroupRequest));<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, "Connect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeUserHierarchyGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeUserHierarchyGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><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>} | false), new DescribeUserHierarchyGroupResultJsonUnmarshaller()); |
1,841,784 | public ActionResult<Wo> call() throws Exception {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>Work work = emc.find(id, Work.class);<NEW_LINE>if (null == work) {<NEW_LINE>throw new ExceptionEntityNotExist(id, Work.class);<NEW_LINE>}<NEW_LINE>Snap snap = new Snap(work);<NEW_LINE>List<Item> items = new ArrayList<>();<NEW_LINE>List<Work> works = new ArrayList<>();<NEW_LINE>List<Task> tasks = new ArrayList<>();<NEW_LINE>List<TaskCompleted> taskCompleteds = new ArrayList<>();<NEW_LINE>List<Read> <MASK><NEW_LINE>List<ReadCompleted> readCompleteds = new ArrayList<>();<NEW_LINE>List<Review> reviews = new ArrayList<>();<NEW_LINE>List<WorkLog> workLogs = new ArrayList<>();<NEW_LINE>List<Record> records = new ArrayList<>();<NEW_LINE>List<Attachment> attachments = new ArrayList<>();<NEW_LINE>List<DocumentVersion> documentVersions = new ArrayList<>();<NEW_LINE>snap.setProperties(snap(business, work.getJob(), items, works, tasks, taskCompleteds, reads, readCompleteds, reviews, workLogs, records, attachments, documentVersions));<NEW_LINE>snap.setType(Snap.TYPE_SUSPEND);<NEW_LINE>emc.beginTransaction(Snap.class);<NEW_LINE>emc.persist(snap, CheckPersistType.all);<NEW_LINE>emc.commit();<NEW_LINE>clean(business, items, works, tasks, taskCompleteds, reads, readCompleteds, reviews, workLogs, records, attachments, documentVersions);<NEW_LINE>emc.commit();<NEW_LINE>Wo wo = new Wo();<NEW_LINE>wo.setId(snap.getId());<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | reads = new ArrayList<>(); |
1,563,639 | private void appendImageInfo(Map<String, Object> result) {<NEW_LINE>try {<NEW_LINE>List<Map<String, Object>> list = new ArrayList<>();<NEW_LINE>Map<String, Object> checkPoint = new HashMap<>();<NEW_LINE>Storage storage = new Storage(Config.meta_dir + "/image");<NEW_LINE>checkPoint.put("Name", "Version");<NEW_LINE>checkPoint.put("Value", storage.getLatestImageSeq());<NEW_LINE>list.add(checkPoint);<NEW_LINE>long lastCheckpointTime = storage.getCurrentImageFile().lastModified();<NEW_LINE>Date date = new Date(lastCheckpointTime);<NEW_LINE>Map<String, Object> checkPoint1 = new HashMap<>();<NEW_LINE>checkPoint1.put("Name", "lastCheckPointTime");<NEW_LINE>checkPoint1.put("Value", date);<NEW_LINE>list.add(checkPoint1);<NEW_LINE><MASK><NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | result.put("CheckpointInfo", list); |
189,693 | public void populateItem(final Item<NavLink> item) {<NEW_LINE>NavLink navLink = item.getModelObject();<NEW_LINE>String linkText = navLink.translationKey;<NEW_LINE>try {<NEW_LINE>// try to lookup translation key<NEW_LINE><MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>if (navLink.hiddenPhone) {<NEW_LINE>WicketUtils.setCssClass(item, "hidden-phone");<NEW_LINE>}<NEW_LINE>if (navLink instanceof ExternalNavLink) {<NEW_LINE>// other link<NEW_LINE>ExternalNavLink link = (ExternalNavLink) navLink;<NEW_LINE>Component c = new LinkPanel("link", null, linkText, link.url);<NEW_LINE>c.setRenderBodyOnly(true);<NEW_LINE>item.add(c);<NEW_LINE>} else if (navLink instanceof DropDownPageMenuNavLink) {<NEW_LINE>// drop down menu<NEW_LINE>DropDownPageMenuNavLink reg = (DropDownPageMenuNavLink) navLink;<NEW_LINE>Component c = new DropDownMenu("link", linkText, reg);<NEW_LINE>c.setRenderBodyOnly(true);<NEW_LINE>item.add(c);<NEW_LINE>WicketUtils.setCssClass(item, "dropdown");<NEW_LINE>} else if (navLink instanceof DropDownMenuNavLink) {<NEW_LINE>// drop down menu<NEW_LINE>DropDownMenuNavLink reg = (DropDownMenuNavLink) navLink;<NEW_LINE>Component c = new DropDownMenu("link", linkText, reg);<NEW_LINE>c.setRenderBodyOnly(true);<NEW_LINE>item.add(c);<NEW_LINE>WicketUtils.setCssClass(item, "dropdown");<NEW_LINE>} else if (navLink instanceof PageNavLink) {<NEW_LINE>PageNavLink reg = (PageNavLink) navLink;<NEW_LINE>// standard page link<NEW_LINE>Component c = new LinkPanel("link", null, linkText, reg.pageClass, reg.params);<NEW_LINE>c.setRenderBodyOnly(true);<NEW_LINE>if (reg.pageClass.equals(pageClass)) {<NEW_LINE>WicketUtils.setCssClass(item, "active");<NEW_LINE>}<NEW_LINE>item.add(c);<NEW_LINE>}<NEW_LINE>} | linkText = getString(navLink.translationKey); |
1,438,980 | public CreateHttpNamespaceResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateHttpNamespaceResult createHttpNamespaceResult = new CreateHttpNamespaceResult();<NEW_LINE><MASK><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 createHttpNamespaceResult;<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("OperationId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createHttpNamespaceResult.setOperationId(context.getUnmarshaller(String.class).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 createHttpNamespaceResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,808,297 | final UpdateCanaryResult executeUpdateCanary(UpdateCanaryRequest updateCanaryRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateCanaryRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateCanaryRequest> request = null;<NEW_LINE>Response<UpdateCanaryResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateCanaryRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateCanaryRequest));<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, "synthetics");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateCanary");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateCanaryResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateCanaryResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
324,850 | public void write(org.apache.thrift.protocol.TProtocol oprot, LocalStateData struct) throws org.apache.thrift.TException {<NEW_LINE>struct.validate();<NEW_LINE>oprot.writeStructBegin(STRUCT_DESC);<NEW_LINE>if (struct.serialized_parts != null) {<NEW_LINE>oprot.writeFieldBegin(SERIALIZED_PARTS_FIELD_DESC);<NEW_LINE>{<NEW_LINE>oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct<MASK><NEW_LINE>for (Map.Entry<String, ThriftSerializedObject> _iter208 : struct.serialized_parts.entrySet()) {<NEW_LINE>oprot.writeString(_iter208.getKey());<NEW_LINE>_iter208.getValue().write(oprot);<NEW_LINE>}<NEW_LINE>oprot.writeMapEnd();<NEW_LINE>}<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>}<NEW_LINE>oprot.writeFieldStop();<NEW_LINE>oprot.writeStructEnd();<NEW_LINE>} | .serialized_parts.size())); |
1,121,224 | public void refresh(TableCell cell) {<NEW_LINE>DownloadManager dm = (DownloadManager) cell.getDataSource();<NEW_LINE>int sr = (dm == null) ? 0 : dm<MASK><NEW_LINE>if (sr == Integer.MAX_VALUE) {<NEW_LINE>sr = Integer.MAX_VALUE - 1;<NEW_LINE>}<NEW_LINE>if (sr == -1) {<NEW_LINE>sr = Integer.MAX_VALUE;<NEW_LINE>}<NEW_LINE>if (!cell.setSortValue(sr) && cell.isValid())<NEW_LINE>return;<NEW_LINE>String shareRatio = "";<NEW_LINE>if (sr == Integer.MAX_VALUE) {<NEW_LINE>shareRatio = Constants.INFINITY_STRING;<NEW_LINE>} else {<NEW_LINE>shareRatio = DisplayFormatters.formatDecimal((double) sr / 1000, 3);<NEW_LINE>}<NEW_LINE>if (cell.setText(shareRatio) && changeFG) {<NEW_LINE>Color color = sr < iMinShareRatio ? Colors.colorWarning : null;<NEW_LINE>cell.setForeground(Utils.colorToIntArray(color));<NEW_LINE>}<NEW_LINE>} | .getStats().getShareRatio(); |
813,327 | // gadgetBytes will be null only if gadget_ == null AND empty == true<NEW_LINE>@SuppressWarnings("null")<NEW_LINE>public byte[] toByteArray() {<NEW_LINE>final int preLongs, outBytes;<NEW_LINE>final boolean empty = gadget_ == null;<NEW_LINE>final byte[] gadgetBytes = (gadget_ != null ? gadget_.toByteArray() : null);<NEW_LINE>if (empty) {<NEW_LINE>preLongs = Family.RESERVOIR_UNION.getMinPreLongs();<NEW_LINE>outBytes = 8;<NEW_LINE>} else {<NEW_LINE>preLongs = Family.RESERVOIR_UNION.getMaxPreLongs();<NEW_LINE>// longs, so we know the size<NEW_LINE>outBytes = (<MASK><NEW_LINE>}<NEW_LINE>final byte[] outArr = new byte[outBytes];<NEW_LINE>final WritableMemory mem = WritableMemory.writableWrap(outArr);<NEW_LINE>// construct header<NEW_LINE>// Byte 0<NEW_LINE>PreambleUtil.insertPreLongs(mem, preLongs);<NEW_LINE>// Byte 1<NEW_LINE>PreambleUtil.insertSerVer(mem, SER_VER);<NEW_LINE>// Byte 2<NEW_LINE>PreambleUtil.insertFamilyID(mem, Family.RESERVOIR_UNION.getID());<NEW_LINE>if (empty) {<NEW_LINE>// Byte 3<NEW_LINE>PreambleUtil.insertFlags(mem, EMPTY_FLAG_MASK);<NEW_LINE>} else {<NEW_LINE>PreambleUtil.insertFlags(mem, 0);<NEW_LINE>}<NEW_LINE>// Bytes 4-7<NEW_LINE>PreambleUtil.insertMaxK(mem, maxK_);<NEW_LINE>if (!empty) {<NEW_LINE>final int preBytes = preLongs << 3;<NEW_LINE>mem.putByteArray(preBytes, gadgetBytes, 0, gadgetBytes.length);<NEW_LINE>}<NEW_LINE>return outArr;<NEW_LINE>} | preLongs << 3) + gadgetBytes.length; |
433,806 | public static Collection<RegressionExecution> executions() {<NEW_LINE>ArrayList<RegressionExecution> execs = new ArrayList<>();<NEW_LINE>execs.add(new ResultSetQueryTypePatternNoWindow());<NEW_LINE>execs.add(new ResultSetQueryTypePatternWithWindow());<NEW_LINE>execs<MASK><NEW_LINE>execs.add(new ResultSetQueryTypeOrderByProps());<NEW_LINE>execs.add(new ResultSetQueryTypeFilter());<NEW_LINE>execs.add(new ResultSetQueryTypeRowPerGroupOrdered());<NEW_LINE>execs.add(new ResultSetQueryTypeRowPerGroup());<NEW_LINE>execs.add(new ResultSetQueryTypeRowPerGroupHaving());<NEW_LINE>execs.add(new ResultSetQueryTypeRowPerGroupComplex());<NEW_LINE>execs.add(new ResultSetQueryTypeAggregateGroupedOrdered());<NEW_LINE>execs.add(new ResultSetQueryTypeAggregateGrouped());<NEW_LINE>execs.add(new ResultSetQueryTypeAggregateGroupedHaving());<NEW_LINE>execs.add(new ResultSetQueryTypeRowPerEvent());<NEW_LINE>execs.add(new ResultSetQueryTypeRowPerEventOrdered());<NEW_LINE>execs.add(new ResultSetQueryTypeRowPerEventHaving());<NEW_LINE>execs.add(new ResultSetQueryTypeRowForAll());<NEW_LINE>execs.add(new ResultSetQueryTypeRowForAllHaving());<NEW_LINE>return execs;<NEW_LINE>} | .add(new ResultSetQueryTypeOrderByWildcard()); |
529,322 | public SinkStatus.SinkInstanceStatus.SinkInstanceStatusData fromFunctionStatusProto(InstanceCommunication.FunctionStatus status, String assignedWorkerId) {<NEW_LINE>SinkStatus.SinkInstanceStatus.SinkInstanceStatusData sinkInstanceStatusData = new SinkStatus.SinkInstanceStatus.SinkInstanceStatusData();<NEW_LINE>sinkInstanceStatusData.setRunning(status.getRunning());<NEW_LINE>sinkInstanceStatusData.setError(status.getFailureException());<NEW_LINE>sinkInstanceStatusData.setNumRestarts(status.getNumRestarts());<NEW_LINE>sinkInstanceStatusData.<MASK><NEW_LINE>// We treat source/user/system exceptions returned from function as system exceptions<NEW_LINE>sinkInstanceStatusData.setNumSystemExceptions(status.getNumSystemExceptions() + status.getNumUserExceptions() + status.getNumSourceExceptions());<NEW_LINE>List<ExceptionInformation> systemExceptionInformationList = new LinkedList<>();<NEW_LINE>for (InstanceCommunication.FunctionStatus.ExceptionInformation exceptionEntry : status.getLatestUserExceptionsList()) {<NEW_LINE>ExceptionInformation exceptionInformation = getExceptionInformation(exceptionEntry);<NEW_LINE>systemExceptionInformationList.add(exceptionInformation);<NEW_LINE>}<NEW_LINE>for (InstanceCommunication.FunctionStatus.ExceptionInformation exceptionEntry : status.getLatestSystemExceptionsList()) {<NEW_LINE>ExceptionInformation exceptionInformation = getExceptionInformation(exceptionEntry);<NEW_LINE>systemExceptionInformationList.add(exceptionInformation);<NEW_LINE>}<NEW_LINE>for (InstanceCommunication.FunctionStatus.ExceptionInformation exceptionEntry : status.getLatestSourceExceptionsList()) {<NEW_LINE>ExceptionInformation exceptionInformation = getExceptionInformation(exceptionEntry);<NEW_LINE>systemExceptionInformationList.add(exceptionInformation);<NEW_LINE>}<NEW_LINE>sinkInstanceStatusData.setLatestSystemExceptions(systemExceptionInformationList);<NEW_LINE>sinkInstanceStatusData.setNumSinkExceptions(status.getNumSinkExceptions());<NEW_LINE>List<ExceptionInformation> sinkExceptionInformationList = new LinkedList<>();<NEW_LINE>for (InstanceCommunication.FunctionStatus.ExceptionInformation exceptionEntry : status.getLatestSinkExceptionsList()) {<NEW_LINE>ExceptionInformation exceptionInformation = getExceptionInformation(exceptionEntry);<NEW_LINE>sinkExceptionInformationList.add(exceptionInformation);<NEW_LINE>}<NEW_LINE>sinkInstanceStatusData.setLatestSinkExceptions(sinkExceptionInformationList);<NEW_LINE>sinkInstanceStatusData.setNumWrittenToSink(status.getNumSuccessfullyProcessed());<NEW_LINE>sinkInstanceStatusData.setLastReceivedTime(status.getLastInvocationTime());<NEW_LINE>sinkInstanceStatusData.setWorkerId(assignedWorkerId);<NEW_LINE>return sinkInstanceStatusData;<NEW_LINE>} | setNumReadFromPulsar(status.getNumReceived()); |
1,539,768 | private static org.apache.rocketmq.common.message.Message doConvert(String topic, Message<?> message) {<NEW_LINE>Charset charset = Charset.defaultCharset();<NEW_LINE>Object payloadObj = message.getPayload();<NEW_LINE>byte[] payloads;<NEW_LINE>try {<NEW_LINE>if (payloadObj instanceof String) {<NEW_LINE>payloads = ((String) payloadObj).getBytes(charset);<NEW_LINE>} else if (payloadObj instanceof byte[]) {<NEW_LINE>payloads = (byte<MASK><NEW_LINE>} else {<NEW_LINE>String jsonObj = (String) MESSAGE_CONVERTER.fromMessage(message, payloadObj.getClass());<NEW_LINE>if (null == jsonObj) {<NEW_LINE>throw new RuntimeException(String.format("empty after conversion [messageConverter:%s,payloadClass:%s,payloadObj:%s]", MESSAGE_CONVERTER.getClass(), payloadObj.getClass(), payloadObj));<NEW_LINE>}<NEW_LINE>payloads = jsonObj.getBytes(charset);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("convert to RocketMQ message failed.", e);<NEW_LINE>}<NEW_LINE>return getAndWrapMessage(topic, message.getHeaders(), payloads);<NEW_LINE>} | []) message.getPayload(); |
1,729,511 | private static void storeInitialTextForOneNode(Node node, List<JavaToken> nodeTokens) {<NEW_LINE>if (nodeTokens == null) {<NEW_LINE>nodeTokens = Collections.emptyList();<NEW_LINE>}<NEW_LINE>List<Pair<Range, TextElement>> elements = new LinkedList<>();<NEW_LINE>for (Node child : node.getChildNodes()) {<NEW_LINE>if (!child.isPhantom()) {<NEW_LINE>if (!child.getRange().isPresent()) {<NEW_LINE>throw new RuntimeException("Range not present on node " + child);<NEW_LINE>}<NEW_LINE>elements.add(new Pair<>(child.getRange().get(), new ChildTextElement(child)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (JavaToken token : nodeTokens) {<NEW_LINE>elements.add(new Pair<>(token.getRange().get(), new TokenTextElement(token)));<NEW_LINE>}<NEW_LINE>elements.sort(comparing(e -> e.a.begin));<NEW_LINE>node.setData(NODE_TEXT_DATA, new NodeText(elements.stream().map(p -> p.b).<MASK><NEW_LINE>} | collect(toList()))); |
311,471 | private void trackProgress() {<NEW_LINE>if (!mTrackingEnabled)<NEW_LINE>return;<NEW_LINE>DownloadManager.Query query = new DownloadManager.Query();<NEW_LINE>query.setFilterByStatus(DownloadManager.STATUS_RUNNING);<NEW_LINE>Cursor cursor = null;<NEW_LINE>try {<NEW_LINE>cursor = mDownloadManager.query(query);<NEW_LINE>cursor.moveToFirst();<NEW_LINE><MASK><NEW_LINE>for (int i = 0; i < count; ++i) {<NEW_LINE>long id = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_ID));<NEW_LINE>if (!mTrackingIds.contains(id))<NEW_LINE>continue;<NEW_LINE>long bytesDownloaded = cursor.getLong(cursor.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));<NEW_LINE>long bytesTotal = cursor.getLong(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));<NEW_LINE>MapManager.nativeOnDownloadProgress(id, bytesDownloaded, bytesTotal);<NEW_LINE>cursor.moveToNext();<NEW_LINE>}<NEW_LINE>UiThread.runLater(mTrackingMethod, PROGRESS_TRACKING_INTERVAL_MILLISECONDS);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.e(TAG, "Downloading progress tracking failed. Exception: " + e);<NEW_LINE>stop();<NEW_LINE>} finally {<NEW_LINE>Utils.closeSafely(cursor);<NEW_LINE>}<NEW_LINE>} | int count = cursor.getCount(); |
1,846,196 | public static void outputResultSet(ResultSet results, Prologue prologue, ResultsFormat outputFormat, PrintStream output) {<NEW_LINE>if (outputFormat.equals(ResultsFormat.FMT_UNKNOWN))<NEW_LINE>outputFormat = ResultsFormat.FMT_TEXT;<NEW_LINE>// Proper ResultSet formats.<NEW_LINE>if (prologue == null)<NEW_LINE>prologue = new Prologue(globalPrefixMap);<NEW_LINE>Lang lang = ResultsFormat.convert(outputFormat);<NEW_LINE>if (lang != null) {<NEW_LINE>Context context = ARQ.getContext().copy();<NEW_LINE>if (prologue != null)<NEW_LINE>context.set(ARQConstants.symPrologue, prologue);<NEW_LINE>ResultsWriter.create().context(context).lang(lang).build(<MASK><NEW_LINE>output.flush();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean done = ResultsFormat.oldWrite(output, outputFormat, prologue, results);<NEW_LINE>if (!done)<NEW_LINE>System.err.println("Unknown format request: " + outputFormat);<NEW_LINE>output.flush();<NEW_LINE>} | ).write(output, results); |
1,154,764 | public static void createOvfFile(VmwareHypervisorHost host, String diskFileName, String ovfName, String datastorePath, String templatePath, long diskCapacity, long fileSize, ManagedObjectReference morDs) throws Exception {<NEW_LINE><MASK><NEW_LINE>ManagedObjectReference morOvf = context.getServiceContent().getOvfManager();<NEW_LINE>VirtualMachineMO workerVmMo = HypervisorHostHelper.createWorkerVM(host, new DatastoreMO(context, morDs), ovfName, null);<NEW_LINE>if (workerVmMo == null)<NEW_LINE>throw new Exception("Unable to find just-created worker VM");<NEW_LINE>String[] disks = { datastorePath + File.separator + diskFileName };<NEW_LINE>try {<NEW_LINE>VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();<NEW_LINE>VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();<NEW_LINE>// Reconfigure worker VM with datadisk<NEW_LINE>VirtualDevice device = VmwareHelper.prepareDiskDevice(workerVmMo, null, -1, disks, morDs, -1, 1);<NEW_LINE>deviceConfigSpec.setDevice(device);<NEW_LINE>deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);<NEW_LINE>vmConfigSpec.getDeviceChange().add(deviceConfigSpec);<NEW_LINE>workerVmMo.configureVm(vmConfigSpec);<NEW_LINE>// Write OVF descriptor file<NEW_LINE>OvfCreateDescriptorParams ovfDescParams = new OvfCreateDescriptorParams();<NEW_LINE>String deviceId = File.separator + workerVmMo.getMor().getValue() + File.separator + "VirtualIDEController0:0";<NEW_LINE>OvfFile ovfFile = new OvfFile();<NEW_LINE>ovfFile.setPath(diskFileName);<NEW_LINE>ovfFile.setDeviceId(deviceId);<NEW_LINE>ovfFile.setSize(fileSize);<NEW_LINE>ovfFile.setCapacity(diskCapacity);<NEW_LINE>ovfDescParams.getOvfFiles().add(ovfFile);<NEW_LINE>OvfCreateDescriptorResult ovfCreateDescriptorResult = context.getService().createDescriptor(morOvf, workerVmMo.getMor(), ovfDescParams);<NEW_LINE>String ovfPath = templatePath + File.separator + ovfName + ".ovf";<NEW_LINE>try {<NEW_LINE>FileWriter out = new FileWriter(ovfPath);<NEW_LINE>out.write(ovfCreateDescriptorResult.getOvfDescriptor());<NEW_LINE>out.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>workerVmMo.detachAllDisksAndDestroy();<NEW_LINE>}<NEW_LINE>} | VmwareContext context = host.getContext(); |
734,764 | public void processMessage(final WebSocketMessage webSocketData) {<NEW_LINE>setDoTransactionNotifications(true);<NEW_LINE>final String keyString = webSocketData.getNodeDataStringValue("key");<NEW_LINE>if (keyString == null) {<NEW_LINE>logger.error("Unable to remove given object from collection: key is null");<NEW_LINE>getWebSocket().send(MessageBuilder.status().code(400).build(), true);<NEW_LINE>}<NEW_LINE>final String idToRemove = webSocketData.getNodeDataStringValue("idToRemove");<NEW_LINE>if (idToRemove == null) {<NEW_LINE>logger.error("Unable to remove given object from collection: idToRemove is null");<NEW_LINE>getWebSocket().send(MessageBuilder.status().code(400).build(), true);<NEW_LINE>}<NEW_LINE>GraphObject obj = getNode(webSocketData.getId());<NEW_LINE>if (obj != null) {<NEW_LINE>if (!((AbstractNode) obj).isGranted(Permission.write, getWebSocket().getSecurityContext())) {<NEW_LINE>getWebSocket().send(MessageBuilder.status().message("No write permission").code(400).build(), true);<NEW_LINE>logger.warn("No write permission for {} on {}", new Object[] { getWebSocket().getCurrentUser().toString(), obj.toString() });<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (obj == null) {<NEW_LINE>// No node? Try to find relationship<NEW_LINE>obj = getRelationship(webSocketData.getId());<NEW_LINE>}<NEW_LINE>GraphObject objToRemove = getNode(idToRemove);<NEW_LINE>if (obj != null && objToRemove != null) {<NEW_LINE>try {<NEW_LINE>PropertyKey key = StructrApp.key(obj.getClass(), keyString);<NEW_LINE>if (key != null) {<NEW_LINE>List collection = Iterables.toList((Iterable) obj.getProperty(key));<NEW_LINE>collection.remove(objToRemove);<NEW_LINE>obj.setProperties(obj.getSecurityContext(), new PropertyMap(key, collection));<NEW_LINE>if (obj instanceof NodeInterface) {<NEW_LINE>TransactionCommand.registerNodeCallback((NodeInterface) obj, callback);<NEW_LINE>} else if (obj instanceof RelationshipInterface) {<NEW_LINE>TransactionCommand.registerRelCallback<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (FrameworkException ex) {<NEW_LINE>logger.error("Unable to set properties: {}", ((FrameworkException) ex).toString());<NEW_LINE>getWebSocket().send(MessageBuilder.status().code(400).build(), true);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.warn("Graph object with uuid {} not found.", webSocketData.getId());<NEW_LINE>getWebSocket().send(MessageBuilder.status().code(404).build(), true);<NEW_LINE>}<NEW_LINE>} | ((RelationshipInterface) obj, callback); |
1,425,481 | public void startUpdateThread() {<NEW_LINE>ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();<NEW_LINE>Runnable periodicTask = () -> {<NEW_LINE>if (GeyserImpl.getInstance() != null) {<NEW_LINE>// Update player table<NEW_LINE>playerTableModel.getDataVector().removeAllElements();<NEW_LINE>for (GeyserSession player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) {<NEW_LINE>Vector<String> <MASK><NEW_LINE>row.add(player.getSocketAddress().getHostName());<NEW_LINE>row.add(player.getPlayerEntity().getUsername());<NEW_LINE>playerTableModel.addRow(row);<NEW_LINE>}<NEW_LINE>playerTableModel.fireTableDataChanged();<NEW_LINE>}<NEW_LINE>// Update ram graph<NEW_LINE>final long freeMemory = Runtime.getRuntime().freeMemory();<NEW_LINE>final long totalMemory = Runtime.getRuntime().totalMemory();<NEW_LINE>final int freePercent = (int) (freeMemory * 100.0 / totalMemory + 0.5);<NEW_LINE>ramValues.add(100 - freePercent);<NEW_LINE>ramGraph.setXLabel(GeyserLocale.getLocaleStringLog("geyser.gui.graph.usage", String.format("%,d", (totalMemory - freeMemory) / MEGABYTE), freePercent));<NEW_LINE>// Trim the list<NEW_LINE>int k = ramValues.size();<NEW_LINE>if (k > 10)<NEW_LINE>ramValues.subList(0, k - 10).clear();<NEW_LINE>// Update the graph<NEW_LINE>ramGraph.setValues(ramValues);<NEW_LINE>};<NEW_LINE>// SwingUtilities.invokeLater is called so we don't run into threading issues with the GUI<NEW_LINE>executor.scheduleAtFixedRate(() -> SwingUtilities.invokeLater(periodicTask), 0, 1, TimeUnit.SECONDS);<NEW_LINE>} | row = new Vector<>(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.