idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
829,149 | private static org.netbeans.modules.html.editor.lib.api.elements.Node findNode(org.netbeans.modules.web.webkit.debugging.api.dom.Node node, org.netbeans.modules.web.webkit.debugging.api.dom.Node domParent, org.netbeans.modules.html.editor.lib.api.elements.Node sourceParent) {<NEW_LINE>List<org.netbeans.modules.web.webkit.debugging.api.dom.Node> parentChain = new LinkedList<org.netbeans.modules.web.webkit.debugging.api.dom.Node>();<NEW_LINE>org.netbeans.modules.web.webkit.debugging.api.dom.Node parent = node;<NEW_LINE>while (parent != domParent) {<NEW_LINE><MASK><NEW_LINE>parent = parent.getParent();<NEW_LINE>}<NEW_LINE>parentChain.add(0, parent);<NEW_LINE>return findNode(parentChain, sourceParent);<NEW_LINE>} | parentChain.add(0, parent); |
1,160,434 | public void updateFactLineFromDimension(final I_Fact_Acct fa, final AccountDimension dim) {<NEW_LINE>if (dim.getAcctSchemaId() != null) {<NEW_LINE>fa.setC_AcctSchema_ID(dim.getAcctSchemaId().getRepoId());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.Client)) {<NEW_LINE>// fa.setAD_Client_ID(dim.getAD_Client_ID());<NEW_LINE>Check.assume(fa.getAD_Client_ID() == dim.getAD_Client_ID(), "Fact_Acct and dimension shall have the same AD_Client_ID");<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.Organization)) {<NEW_LINE>fa.setAD_Org_ID(dim.getAD_Org_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.Account)) {<NEW_LINE>fa.setAccount_ID(dim.getC_ElementValue_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.SubAccount)) {<NEW_LINE>fa.setC_SubAcct_ID(dim.getC_SubAcct_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.Product)) {<NEW_LINE>fa.setM_Product_ID(dim.getM_Product_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.BPartner)) {<NEW_LINE>fa.setC_BPartner_ID(dim.getC_BPartner_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.OrgTrx)) {<NEW_LINE>fa.setAD_OrgTrx_ID(dim.getAD_OrgTrx_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.LocationFrom)) {<NEW_LINE>fa.<MASK><NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.LocationTo)) {<NEW_LINE>fa.setC_LocTo_ID(dim.getC_LocTo_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.SalesRegion)) {<NEW_LINE>fa.setC_SalesRegion_ID(dim.getC_SalesRegion_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.Project)) {<NEW_LINE>fa.setC_Project_ID(dim.getC_Project_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.Campaign)) {<NEW_LINE>fa.setC_Campaign_ID(dim.getC_Campaign_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.Activity)) {<NEW_LINE>fa.setC_Activity_ID(dim.getC_Activity_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserList1)) {<NEW_LINE>fa.setUser1_ID(dim.getUser1_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserList2)) {<NEW_LINE>fa.setUser2_ID(dim.getUser2_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserElement1)) {<NEW_LINE>fa.setUserElement1_ID(dim.getUserElement1_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserElement2)) {<NEW_LINE>fa.setUserElement2_ID(dim.getUserElement2_ID());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserElementString1)) {<NEW_LINE>fa.setUserElementString1(dim.getUserElementString1());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserElementString2)) {<NEW_LINE>fa.setUserElementString2(dim.getUserElementString2());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserElementString3)) {<NEW_LINE>fa.setUserElementString3(dim.getUserElementString3());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserElementString4)) {<NEW_LINE>fa.setUserElementString4(dim.getUserElementString4());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserElementString5)) {<NEW_LINE>fa.setUserElementString5(dim.getUserElementString5());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserElementString6)) {<NEW_LINE>fa.setUserElementString6(dim.getUserElementString6());<NEW_LINE>}<NEW_LINE>if (dim.isSegmentValueSet(AcctSegmentType.UserElementString7)) {<NEW_LINE>fa.setUserElementString7(dim.getUserElementString7());<NEW_LINE>}<NEW_LINE>} | setC_LocFrom_ID(dim.getC_LocFrom_ID()); |
1,731,370 | public static Object typeToStream(Object iFieldValue, OType iType, final ODatabaseObject db, final ODocument iRecord) {<NEW_LINE>if (iFieldValue == null)<NEW_LINE>return null;<NEW_LINE>if (iFieldValue instanceof Proxy)<NEW_LINE>return getDocument((Proxy) iFieldValue);<NEW_LINE>if (!OType.isSimpleType(iFieldValue) || iFieldValue.getClass().isArray()) {<NEW_LINE>Class<?> fieldClass = iFieldValue.getClass();<NEW_LINE>if (fieldClass.isArray()) {<NEW_LINE>if (OType.BINARY.equals(iType))<NEW_LINE>return iFieldValue;<NEW_LINE>// ARRAY<NEW_LINE>final int arrayLength = Array.getLength(iFieldValue);<NEW_LINE>final List<Object> arrayList = new ArrayList<Object>();<NEW_LINE>for (int i = 0; i < arrayLength; i++) arrayList.add(Array.get(iFieldValue, i));<NEW_LINE>iFieldValue = multiValueToStream(arrayList, iType, db, iRecord);<NEW_LINE>} else if (Collection.class.isAssignableFrom(fieldClass)) {<NEW_LINE>// COLLECTION (LIST OR SET)<NEW_LINE>iFieldValue = multiValueToStream(<MASK><NEW_LINE>} else if (Map.class.isAssignableFrom(fieldClass)) {<NEW_LINE>// MAP<NEW_LINE>iFieldValue = multiValueToStream(iFieldValue, iType, db, iRecord);<NEW_LINE>} else if (fieldClass.isEnum()) {<NEW_LINE>// ENUM<NEW_LINE>iFieldValue = ((Enum<?>) iFieldValue).name();<NEW_LINE>} else {<NEW_LINE>// LINK OR EMBEDDED<NEW_LINE>fieldClass = db.getEntityManager().getEntityClass(fieldClass.getSimpleName());<NEW_LINE>if (fieldClass != null) {<NEW_LINE>// RECOGNIZED TYPE, SERIALIZE IT<NEW_LINE>iFieldValue = getDocument((Proxy) serializeObject(iFieldValue, db));<NEW_LINE>} else {<NEW_LINE>final Object result = serializeFieldValue(null, iFieldValue);<NEW_LINE>if (iFieldValue == result && !ORecordAbstract.class.isAssignableFrom(result.getClass()))<NEW_LINE>throw new OSerializationException("Linked type [" + iFieldValue.getClass() + ":" + iFieldValue + "] cannot be serialized because is not part of registered entities. To fix this error register this class");<NEW_LINE>iFieldValue = result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return iFieldValue;<NEW_LINE>} | iFieldValue, iType, db, iRecord); |
503,780 | // Virtual machine image specific fluent methods<NEW_LINE>//<NEW_LINE>@Override<NEW_LINE>public VirtualMachineImpl withStoredWindowsImage(String imageUrl) {<NEW_LINE>VirtualHardDisk userImageVhd = new VirtualHardDisk();<NEW_LINE>userImageVhd.withUri(imageUrl);<NEW_LINE>this.innerModel().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE);<NEW_LINE>this.innerModel().storageProfile().<MASK><NEW_LINE>// For platform image osType will be null, azure will pick it from the image metadata.<NEW_LINE>this.innerModel().storageProfile().osDisk().withOsType(OperatingSystemTypes.WINDOWS);<NEW_LINE>this.innerModel().osProfile().withWindowsConfiguration(new WindowsConfiguration());<NEW_LINE>// sets defaults for "Stored(User)Image" or "VM(Platform)Image"<NEW_LINE>this.innerModel().osProfile().windowsConfiguration().withProvisionVMAgent(true);<NEW_LINE>this.innerModel().osProfile().windowsConfiguration().withEnableAutomaticUpdates(true);<NEW_LINE>return this;<NEW_LINE>} | osDisk().withImage(userImageVhd); |
1,672,096 | public WorkspaceResource listResource(String groupId, String type) {<NEW_LINE>Group group = groupMapper.selectByPrimaryKey(groupId);<NEW_LINE>String workspaceId = group.getScopeId();<NEW_LINE>WorkspaceResource resource = new WorkspaceResource();<NEW_LINE>if (StringUtils.equals(UserGroupType.WORKSPACE, type)) {<NEW_LINE>WorkspaceExample workspaceExample = new WorkspaceExample();<NEW_LINE>WorkspaceExample.Criteria criteria = workspaceExample.createCriteria();<NEW_LINE>if (!StringUtils.equals(workspaceId, "global")) {<NEW_LINE>criteria.andIdEqualTo(workspaceId);<NEW_LINE>}<NEW_LINE>List<Workspace> workspaces = workspaceMapper.selectByExample(workspaceExample);<NEW_LINE>resource.setWorkspaces(workspaces);<NEW_LINE>}<NEW_LINE>if (StringUtils.equals(UserGroupType.PROJECT, type)) {<NEW_LINE>ProjectExample projectExample = new ProjectExample();<NEW_LINE>ProjectExample.<MASK><NEW_LINE>WorkspaceExample workspaceExample = new WorkspaceExample();<NEW_LINE>WorkspaceExample.Criteria criteria = workspaceExample.createCriteria();<NEW_LINE>if (!StringUtils.equals(workspaceId, "global")) {<NEW_LINE>criteria.andIdEqualTo(workspaceId);<NEW_LINE>List<Workspace> workspaces = workspaceMapper.selectByExample(workspaceExample);<NEW_LINE>List<String> list = workspaces.stream().map(Workspace::getId).collect(Collectors.toList());<NEW_LINE>pc.andWorkspaceIdIn(list);<NEW_LINE>}<NEW_LINE>List<Project> projects = projectMapper.selectByExample(projectExample);<NEW_LINE>resource.setProjects(projects);<NEW_LINE>}<NEW_LINE>return resource;<NEW_LINE>} | Criteria pc = projectExample.createCriteria(); |
304,478 | protected RecordSetInner prepareForUpdate(RecordSetInner resource) {<NEW_LINE>if (resource.soaRecord() == null) {<NEW_LINE>resource.withSoaRecord(new SoaRecord());<NEW_LINE>}<NEW_LINE>if (innerModel().soaRecord().email() != null) {<NEW_LINE>resource.soaRecord().withEmail(innerModel().soaRecord().email());<NEW_LINE>}<NEW_LINE>if (innerModel().soaRecord().expireTime() != null) {<NEW_LINE>resource.soaRecord().withExpireTime(innerModel().soaRecord().expireTime());<NEW_LINE>}<NEW_LINE>if (innerModel().soaRecord().minimumTtl() != null) {<NEW_LINE>resource.soaRecord().withMinimumTtl(innerModel().<MASK><NEW_LINE>}<NEW_LINE>if (innerModel().soaRecord().refreshTime() != null) {<NEW_LINE>resource.soaRecord().withRefreshTime(innerModel().soaRecord().refreshTime());<NEW_LINE>}<NEW_LINE>if (innerModel().soaRecord().retryTime() != null) {<NEW_LINE>resource.soaRecord().withRetryTime(innerModel().soaRecord().retryTime());<NEW_LINE>}<NEW_LINE>if (innerModel().soaRecord().serialNumber() != null) {<NEW_LINE>resource.soaRecord().withSerialNumber(innerModel().soaRecord().serialNumber());<NEW_LINE>}<NEW_LINE>innerModel().withSoaRecord(new SoaRecord());<NEW_LINE>return resource;<NEW_LINE>} | soaRecord().minimumTtl()); |
793,970 | public void encrypt(HybridEncryptRequest request, StreamObserver<HybridEncryptResponse> responseObserver) {<NEW_LINE>HybridEncryptResponse response;<NEW_LINE>try {<NEW_LINE>KeysetHandle publicKeysetHandle = CleartextKeysetHandle.read(BinaryKeysetReader.withBytes(request.getPublicKeyset().toByteArray()));<NEW_LINE>HybridEncrypt hybridEncrypt = publicKeysetHandle.getPrimitive(HybridEncrypt.class);<NEW_LINE>byte[] ciphertext = hybridEncrypt.encrypt(request.getPlaintext().toByteArray(), request.<MASK><NEW_LINE>response = HybridEncryptResponse.newBuilder().setCiphertext(ByteString.copyFrom(ciphertext)).build();<NEW_LINE>} catch (GeneralSecurityException | InvalidProtocolBufferException e) {<NEW_LINE>response = HybridEncryptResponse.newBuilder().setErr(e.toString()).build();<NEW_LINE>} catch (IOException e) {<NEW_LINE>responseObserver.onError(Status.UNKNOWN.withDescription(e.getMessage()).asException());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>responseObserver.onNext(response);<NEW_LINE>responseObserver.onCompleted();<NEW_LINE>} | getContextInfo().toByteArray()); |
1,039,686 | private int[] createCircularMask(int shift, double radius, int[] offset) {<NEW_LINE>// if (radius<=2.0) {<NEW_LINE>// this.width= ((int)(radius+shift+0.5))*2 ;<NEW_LINE>// offset= SWGRAD;<NEW_LINE>// }<NEW_LINE>// else<NEW_LINE>this.width = (((int) (radius + shift + 0.5)) * 2) + 1;<NEW_LINE>// this.width= ((int)(radius+shift))*2 + 1;<NEW_LINE>this.height = width;<NEW_LINE>// IJ.log("w="+width);<NEW_LINE>int[] mask = new int[this.width * this.width];<NEW_LINE>double r <MASK><NEW_LINE>// if ((radius==1.5) && (r==3)) r=3.5;<NEW_LINE>double r2 = (radius * radius) + 1;<NEW_LINE>// IJ.log("radius "+radius+" r "+r +" r2 "+r2);<NEW_LINE>int index = 0;<NEW_LINE>for (double x = -r; x <= r; x++) {<NEW_LINE>for (double y = -r; y <= r; y++) {<NEW_LINE>// int index= (int)(r+x+width*(r+y));<NEW_LINE>// if (x*x+y*y<r2){<NEW_LINE>if ((((x - offset[0]) * (x - offset[0])) + ((y - offset[1]) * (y - offset[1]))) < r2) {<NEW_LINE>mask[index] = 255;<NEW_LINE>}<NEW_LINE>index++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// return mask;<NEW_LINE>return mask;<NEW_LINE>} | = (width / 2.0) - 0.5; |
542,451 | public boolean apply(Game game, Ability source) {<NEW_LINE>UUID opponentId = (UUID) this.getValue("PsychicSurgeryOpponent");<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>Player opponent = game.getPlayer(opponentId);<NEW_LINE>if (controller != null && opponent != null) {<NEW_LINE>Cards cards = new CardsImpl(opponent.getLibrary().getTopCards(game, 2));<NEW_LINE>controller.lookAtCards(<MASK><NEW_LINE>if (!cards.isEmpty() && controller.chooseUse(Outcome.Exile, "Exile a card?", source, game)) {<NEW_LINE>TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to exile"));<NEW_LINE>if (controller.choose(Outcome.Exile, cards, target, game)) {<NEW_LINE>Card card = cards.get(target.getFirstTarget(), game);<NEW_LINE>if (card != null) {<NEW_LINE>controller.moveCards(card, Zone.EXILED, source, game);<NEW_LINE>cards.remove(card);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>controller.putCardsOnTopOfLibrary(cards, game, source, true);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | source, null, cards, game); |
1,413,456 | private Mono<Response<RedisAccessKeysInner>> regenerateKeyWithResponseAsync(String resourceGroupName, String name, RedisRegenerateKeyParameters parameters, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (name == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.regenerateKey(this.client.getEndpoint(), resourceGroupName, name, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); |
1,418,343 | Mono<Response<QueueProperties>> updateQueueWithResponse(QueueProperties queue, Context context) {<NEW_LINE>if (queue == null) {<NEW_LINE>return monoError(LOGGER, new NullPointerException("'queue' cannot be null"));<NEW_LINE>} else if (context == null) {<NEW_LINE>return monoError(LOGGER, new NullPointerException("'context' cannot be null."));<NEW_LINE>}<NEW_LINE>final Context contextWithHeaders = context.addData(AZ_TRACING_NAMESPACE_KEY, AZ_TRACING_NAMESPACE_VALUE).addData(AZURE_REQUEST_HTTP_HEADERS_KEY, new HttpHeaders());<NEW_LINE>final String forwardToEntity = queue.getForwardTo();<NEW_LINE>if (!CoreUtils.isNullOrEmpty(forwardToEntity)) {<NEW_LINE>addSupplementaryAuthHeader(SERVICE_BUS_SUPPLEMENTARY_AUTHORIZATION_HEADER_NAME, forwardToEntity, contextWithHeaders);<NEW_LINE>queue.setForwardTo(getAbsoluteUrlFromEntity(forwardToEntity));<NEW_LINE>}<NEW_LINE>final String forwardDlqToEntity = queue.getForwardDeadLetteredMessagesTo();<NEW_LINE>if (!CoreUtils.isNullOrEmpty(forwardDlqToEntity)) {<NEW_LINE>addSupplementaryAuthHeader(SERVICE_BUS_DLQ_SUPPLEMENTARY_AUTHORIZATION_HEADER_NAME, forwardDlqToEntity, contextWithHeaders);<NEW_LINE>queue.setForwardDeadLetteredMessagesTo(getAbsoluteUrlFromEntity(forwardDlqToEntity));<NEW_LINE>}<NEW_LINE>final QueueDescription queueDescription = EntityHelper.toImplementation(queue);<NEW_LINE>final CreateQueueBodyContent content = new CreateQueueBodyContent().setType(CONTENT_TYPE).setQueueDescription(queueDescription);<NEW_LINE>final CreateQueueBody createEntity = new CreateQueueBody().setContent(content);<NEW_LINE>try {<NEW_LINE>// If-Match == "*" to unconditionally update. This is in line with the existing client library behaviour.<NEW_LINE>return entityClient.putWithResponseAsync(queue.getName(), createEntity, "*", contextWithHeaders).onErrorMap(ServiceBusAdministrationAsyncClient::mapException).map<MASK><NEW_LINE>} catch (RuntimeException ex) {<NEW_LINE>return monoError(LOGGER, ex);<NEW_LINE>}<NEW_LINE>} | (response -> deserializeQueue(response)); |
1,085,702 | public void save(final OutputStream os, final Object obj) {<NEW_LINE>final EncogWriteHelper out = new EncogWriteHelper(os);<NEW_LINE>final PrgPopulation pop = (PrgPopulation) obj;<NEW_LINE>out.addSection("BASIC");<NEW_LINE>out.addSubSection("PARAMS");<NEW_LINE>out.addProperties(pop.getProperties());<NEW_LINE>out.addSubSection("EPL-OPCODES");<NEW_LINE>for (final ProgramExtensionTemplate temp : pop.getContext().getFunctions().getOpCodes()) {<NEW_LINE>out.addColumn(temp.getName());<NEW_LINE>out.addColumn(temp.getChildNodeCount());<NEW_LINE>out.writeLine();<NEW_LINE>}<NEW_LINE>out.addSubSection("EPL-SYMBOLIC");<NEW_LINE>out.addColumn("name");<NEW_LINE>out.addColumn("type");<NEW_LINE>out.addColumn("enum");<NEW_LINE>out.addColumn("enum_type");<NEW_LINE>out.addColumn("enum_count");<NEW_LINE>out.writeLine();<NEW_LINE>// write the first line, the result<NEW_LINE>out.addColumn("");<NEW_LINE>out.addColumn(getType(pop.getContext().getResult()));<NEW_LINE>out.addColumn(pop.getContext().getResult().getEnumType());<NEW_LINE>out.addColumn(pop.getContext().getResult().getEnumValueCount());<NEW_LINE>out.writeLine();<NEW_LINE>// write the next lines, the variables<NEW_LINE>for (final VariableMapping mapping : pop.getContext().getDefinedVariables()) {<NEW_LINE>out.addColumn(mapping.getName());<NEW_LINE>out.addColumn(getType(mapping));<NEW_LINE>out.<MASK><NEW_LINE>out.addColumn(mapping.getEnumValueCount());<NEW_LINE>out.writeLine();<NEW_LINE>}<NEW_LINE>out.addSubSection("EPL-POPULATION");<NEW_LINE>for (final Species species : pop.getSpecies()) {<NEW_LINE>if (species.getMembers().size() > 0) {<NEW_LINE>out.addColumn("s");<NEW_LINE>out.addColumn(species.getAge());<NEW_LINE>out.addColumn(species.getBestScore());<NEW_LINE>out.addColumn(species.getGensNoImprovement());<NEW_LINE>out.writeLine();<NEW_LINE>for (final Genome genome : species.getMembers()) {<NEW_LINE>final EncogProgram prg = (EncogProgram) genome;<NEW_LINE>out.addColumn("p");<NEW_LINE>if (Double.isInfinite(prg.getScore()) || Double.isNaN(prg.getScore())) {<NEW_LINE>out.addColumn("NaN");<NEW_LINE>out.addColumn("NaN");<NEW_LINE>} else {<NEW_LINE>out.addColumn(prg.getScore());<NEW_LINE>out.addColumn(prg.getAdjustedScore());<NEW_LINE>}<NEW_LINE>out.addColumn(prg.generateEPL());<NEW_LINE>out.writeLine();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.flush();<NEW_LINE>} | addColumn(mapping.getEnumType()); |
21,072 | public void generatePlacementInfoPB(CatalogEntityInfo.PlacementInfoPB.Builder placementInfoPB, Cluster cluster) {<NEW_LINE>PlacementInfo placementInfo = cluster.placementInfo;<NEW_LINE>for (PlacementCloud placementCloud : placementInfo.cloudList) {<NEW_LINE>Provider cloud = Provider.<MASK><NEW_LINE>for (PlacementRegion placementRegion : placementCloud.regionList) {<NEW_LINE>Region region = Region.get(placementRegion.uuid);<NEW_LINE>for (PlacementAZ placementAz : placementRegion.azList) {<NEW_LINE>AvailabilityZone az = AvailabilityZone.find.byId(placementAz.uuid);<NEW_LINE>// Create the cloud info object.<NEW_LINE>CloudInfoPB.Builder ccb = CloudInfoPB.newBuilder();<NEW_LINE>ccb.setPlacementCloud(placementCloud.code).setPlacementRegion(region.code).setPlacementZone(az.code);<NEW_LINE>CatalogEntityInfo.PlacementBlockPB.Builder pbb = CatalogEntityInfo.PlacementBlockPB.newBuilder();<NEW_LINE>// Set the cloud info.<NEW_LINE>pbb.setCloudInfo(ccb);<NEW_LINE>// Set the minimum number of replicas in this PlacementAZ.<NEW_LINE>pbb.setMinNumReplicas(placementAz.replicationFactor);<NEW_LINE>placementInfoPB.addPlacementBlocks(pbb);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>placementInfoPB.setNumReplicas(cluster.userIntent.replicationFactor);<NEW_LINE>placementInfoPB.setPlacementUuid(ByteString.copyFromUtf8(cluster.uuid.toString()));<NEW_LINE>placementInfoPB.build();<NEW_LINE>} | find.byId(placementCloud.uuid); |
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 <MASK><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).getKernel().add(ni);<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>} | state = states.get(curState); |
394,751 | protected void initToolbar(Toolbar toolbar, Commands commands) {<NEW_LINE>urlBox_ = new Label("");<NEW_LINE>Style style = urlBox_<MASK><NEW_LINE>style.setColor("#606060");<NEW_LINE>urlBox_.addStyleName(ThemeStyles.INSTANCE.selectableText());<NEW_LINE>urlBox_.getElement().getStyle().setMarginRight(7, Unit.PX);<NEW_LINE>toolbar.addLeftWidget(urlBox_);<NEW_LINE>toolbar.addLeftSeparator();<NEW_LINE>ToolbarButton popoutButton = commands.viewerPopout().createToolbarButton();<NEW_LINE>popoutButton.setText(constants_.openInBrowserButtonText());<NEW_LINE>toolbar.addLeftWidget(popoutButton);<NEW_LINE>toolbar.addLeftSeparator();<NEW_LINE>refreshButton_ = commands.reloadShinyApp().createToolbarButton();<NEW_LINE>refreshButton_.setLeftImage(commands.viewerRefresh().getImageResource());<NEW_LINE>refreshButton_.getElement().getStyle().setMarginTop(1, Unit.PX);<NEW_LINE>toolbar.addLeftWidget(refreshButton_);<NEW_LINE>publishButton_ = new RSConnectPublishButton(RSConnectPublishButton.HOST_SHINY_APP, RSConnect.CONTENT_TYPE_NONE, true, null);<NEW_LINE>toolbar.addRightWidget(publishButton_);<NEW_LINE>} | .getElement().getStyle(); |
131,448 | public Answer execute(final GetStorageStatsCommand command, final CitrixResourceBase citrixResourceBase) {<NEW_LINE>final Connection conn = citrixResourceBase.getConnection();<NEW_LINE>try {<NEW_LINE>final Set<SR> srs = SR.getByNameLabel(conn, command.getStorageId());<NEW_LINE>if (srs.size() != 1) {<NEW_LINE>final String msg = "There are " + srs.size() + " storageid: " + command.getStorageId();<NEW_LINE>s_logger.warn(msg);<NEW_LINE>return new GetStorageStatsAnswer(command, msg);<NEW_LINE>}<NEW_LINE>final SR sr = srs.iterator().next();<NEW_LINE>sr.scan(conn);<NEW_LINE>final long capacity = sr.getPhysicalSize(conn);<NEW_LINE>final long used = sr.getPhysicalUtilisation(conn);<NEW_LINE>return new GetStorageStatsAnswer(command, capacity, used);<NEW_LINE>} catch (final XenAPIException e) {<NEW_LINE>final String msg = "GetStorageStats Exception:" + e.toString() + "host:" + citrixResourceBase.getHost().getUuid() + "storageid: " + command.getStorageId();<NEW_LINE>s_logger.warn(msg);<NEW_LINE><MASK><NEW_LINE>} catch (final XmlRpcException e) {<NEW_LINE>final String msg = "GetStorageStats Exception:" + e.getMessage() + "host:" + citrixResourceBase.getHost().getUuid() + "storageid: " + command.getStorageId();<NEW_LINE>s_logger.warn(msg);<NEW_LINE>return new GetStorageStatsAnswer(command, msg);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>final String msg = "GetStorageStats Exception:" + e.getMessage() + "host:" + citrixResourceBase.getHost().getUuid() + "storageid: " + command.getStorageId();<NEW_LINE>s_logger.warn(msg);<NEW_LINE>return new GetStorageStatsAnswer(command, msg);<NEW_LINE>}<NEW_LINE>} | return new GetStorageStatsAnswer(command, msg); |
94,701 | private void displayCancellingProgressMessages() {<NEW_LINE>if (usingNetBeansGUI) {<NEW_LINE>SwingUtilities.invokeLater(() -> {<NEW_LINE>if (dataSourceIngestProgressBar != null) {<NEW_LINE>dataSourceIngestProgressBar.setDisplayName(NbBundle.getMessage(getClass(), "IngestJob.progress.dataSourceIngest.initialDisplayName", ingestJob.getDataSource().getName()));<NEW_LINE>dataSourceIngestProgressBar.progress(NbBundle.getMessage<MASK><NEW_LINE>}<NEW_LINE>if (fileIngestProgressBar != null) {<NEW_LINE>fileIngestProgressBar.setDisplayName(NbBundle.getMessage(getClass(), "IngestJob.progress.fileIngest.displayName", ingestJob.getDataSource().getName()));<NEW_LINE>fileIngestProgressBar.progress(NbBundle.getMessage(getClass(), "IngestJob.progress.cancelling"));<NEW_LINE>}<NEW_LINE>if (artifactIngestProgressBar != null) {<NEW_LINE>artifactIngestProgressBar.setDisplayName(NbBundle.getMessage(getClass(), "IngestJob.progress.dataArtifactIngest.displayName", ingestJob.getDataSource().getName()));<NEW_LINE>artifactIngestProgressBar.progress(NbBundle.getMessage(getClass(), "IngestJob.progress.cancelling"));<NEW_LINE>}<NEW_LINE>if (resultIngestProgressBar != null) {<NEW_LINE>resultIngestProgressBar.setDisplayName(Bundle.IngestJob_progress_analysisResultIngest_displayName(ingestJob.getDataSource().getName()));<NEW_LINE>resultIngestProgressBar.progress(NbBundle.getMessage(getClass(), "IngestJob.progress.cancelling"));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | (getClass(), "IngestJob.progress.cancelling")); |
531,253 | // MRI: str_null_check without trailing null check (JVM arrays do not null terminate)<NEW_LINE>public static RubyString strNullCheck(IRubyObject ptr) {<NEW_LINE>final RubyString s = ptr.convertToString();<NEW_LINE>ByteList sByteList = s.getByteList();<NEW_LINE>byte[] sBytes = sByteList.unsafeBytes();<NEW_LINE>int beg = sByteList.begin();<NEW_LINE>int len = sByteList.length();<NEW_LINE>final <MASK><NEW_LINE>final int minlen = enc.minLength();<NEW_LINE>if (minlen > 1) {<NEW_LINE>if (strNullChar(sBytes, beg, len, minlen, enc) != -1) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return strFillTerm(s, sBytes, beg, len, minlen);<NEW_LINE>}<NEW_LINE>if (memchr(sBytes, beg, '\0', len) != -1) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return s;<NEW_LINE>} | Encoding enc = s.getEncoding(); |
1,201,822 | public Result process(CvPipeline pipeline) throws Exception {<NEW_LINE>Mat mat = pipeline.getWorkingImage();<NEW_LINE>List<Point> <MASK><NEW_LINE>byte[] rowData = new byte[mat.cols()];<NEW_LINE>for (int row = 0, rows = mat.rows(); row < rows; row++) {<NEW_LINE>mat.get(row, 0, rowData);<NEW_LINE>for (int col = 0, cols = mat.cols(); col < cols; col++) {<NEW_LINE>int pixel = ((int) rowData[col]) & 0xff;<NEW_LINE>if (pixel >= thresholdMin && pixel <= thresholdMax) {<NEW_LINE>points.add(new Point(col, row));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (points.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>MatOfPoint2f pointsMat = new MatOfPoint2f(points.toArray(new Point[] {}));<NEW_LINE>RotatedRect r = Imgproc.minAreaRect(pointsMat);<NEW_LINE>pointsMat.release();<NEW_LINE>return new Result(null, r);<NEW_LINE>} | points = new ArrayList<>(); |
346,591 | private boolean remove(double x, double y, T item) {<NEW_LINE>if (this.mChildren != null) {<NEW_LINE>if (y < mBounds.midY) {<NEW_LINE>if (x < mBounds.midX) {<NEW_LINE>// top left<NEW_LINE>return mChildren.get(0).remove(x, y, item);<NEW_LINE>} else {<NEW_LINE>// top right<NEW_LINE>return mChildren.get(1).remove(x, y, item);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (x < mBounds.midX) {<NEW_LINE>// bottom left<NEW_LINE>return mChildren.get(2).<MASK><NEW_LINE>} else {<NEW_LINE>return mChildren.get(3).remove(x, y, item);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (mItems == null) {<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>return mItems.remove(item);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | remove(x, y, item); |
1,252,393 | private void delegateToMethod(MethodHolder callingMethod, MethodHolder delegateMethod) {<NEW_LINE>CodeGenerator.generateMethodSignature(codeWriter, context.getNames(), callingMethod.getReference(), callingMethod.hasModifier(ElementModifier.STATIC), true);<NEW_LINE>codeWriter.println(" {").indent();<NEW_LINE>if (callingMethod.getResultType() != ValueType.VOID) {<NEW_LINE>codeWriter.print("return ");<NEW_LINE>}<NEW_LINE>codeWriter.print(context.getNames().forMethod(delegateMethod.getReference())).print("(");<NEW_LINE>boolean isStatic = callingMethod.hasModifier(ElementModifier.STATIC);<NEW_LINE>int start = 0;<NEW_LINE>if (!isStatic) {<NEW_LINE>codeWriter.print("teavm_this_");<NEW_LINE>} else {<NEW_LINE>if (callingMethod.parameterCount() > 0) {<NEW_LINE>codeWriter.print("teavm_local_1");<NEW_LINE>}<NEW_LINE>start++;<NEW_LINE>}<NEW_LINE>for (int i = start; i < callingMethod.parameterCount(); ++i) {<NEW_LINE>codeWriter.print(", ").print("teavm_local_").print(String.valueOf(i + 1));<NEW_LINE>}<NEW_LINE>codeWriter.println(");");<NEW_LINE>codeWriter.<MASK><NEW_LINE>} | outdent().println("}"); |
1,481,928 | public Request<ListCallAnalyticsCategoriesRequest> marshall(ListCallAnalyticsCategoriesRequest listCallAnalyticsCategoriesRequest) {<NEW_LINE>if (listCallAnalyticsCategoriesRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(ListCallAnalyticsCategoriesRequest)");<NEW_LINE>}<NEW_LINE>Request<ListCallAnalyticsCategoriesRequest> request = new DefaultRequest<MASK><NEW_LINE>String target = "Transcribe.ListCallAnalyticsCategories";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (listCallAnalyticsCategoriesRequest.getNextToken() != null) {<NEW_LINE>String nextToken = listCallAnalyticsCategoriesRequest.getNextToken();<NEW_LINE>jsonWriter.name("NextToken");<NEW_LINE>jsonWriter.value(nextToken);<NEW_LINE>}<NEW_LINE>if (listCallAnalyticsCategoriesRequest.getMaxResults() != null) {<NEW_LINE>Integer maxResults = listCallAnalyticsCategoriesRequest.getMaxResults();<NEW_LINE>jsonWriter.name("MaxResults");<NEW_LINE>jsonWriter.value(maxResults);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | <ListCallAnalyticsCategoriesRequest>(listCallAnalyticsCategoriesRequest, "AmazonTranscribe"); |
1,480,035 | private List<PropertyElement> processLambdas(Index index, JSScope globals, IParseNode node, URI location, IProgressMonitor monitor) {<NEW_LINE>List<PropertyElement> result = Collections.emptyList();<NEW_LINE>try {<NEW_LINE>Object queryResult = (LAMBDAS_IN_SCOPE != null) ? LAMBDAS_IN_SCOPE.evaluate(node) : null;<NEW_LINE>if (queryResult != null) {<NEW_LINE>List<JSFunctionNode> functions = (List<JSFunctionNode>) queryResult;<NEW_LINE>if (!functions.isEmpty()) {<NEW_LINE>SubMonitor sub = SubMonitor.convert(monitor, <MASK><NEW_LINE>result = new ArrayList<PropertyElement>(functions.size());<NEW_LINE>for (JSFunctionNode function : functions) {<NEW_LINE>// grab the correct scope for this function's body<NEW_LINE>JSScope scope = globals.getScopeAtOffset(function.getBody().getStartingOffset());<NEW_LINE>sub.worked(1);<NEW_LINE>JSSymbolTypeInferrer infer = new JSSymbolTypeInferrer(scope, index, location, queryHelper);<NEW_LINE>// add all properties off of "window" to our list<NEW_LINE>result.addAll(processWindowAssignments(scope, infer, sub.newChild(5)));<NEW_LINE>// handle any nested lambdas in this function<NEW_LINE>result.addAll(processLambdas(index, globals, function, location, sub.newChild(5)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (JaxenException e) {<NEW_LINE>IdeLog.logError(JSCorePlugin.getDefault(), e);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | functions.size() * 11); |
1,286,167 | public String prepareReceiveMediaFrom(Participant sender) {<NEW_LINE>final String senderName = sender.getParticipantPublicId();<NEW_LINE>log.info("PARTICIPANT {}: Request to prepare receive media from {} in room {}", this.getParticipantPublicId(), senderName, this.session.getSessionId());<NEW_LINE>if (senderName.equals(this.getParticipantPublicId())) {<NEW_LINE>log.warn("PARTICIPANT {}: trying to configure loopback by subscribing", this.getParticipantPublicId());<NEW_LINE>throw new OpenViduException(Code.USER_NOT_STREAMING_ERROR_CODE, "Can loopback only when publishing media");<NEW_LINE>}<NEW_LINE>KurentoParticipant kSender = (KurentoParticipant) sender;<NEW_LINE>if (kSender.streaming && kSender.getPublisher() != null) {<NEW_LINE>final Lock closingReadLock = kSender.getPublisher<MASK><NEW_LINE>if (closingReadLock.tryLock()) {<NEW_LINE>try {<NEW_LINE>SubscriberEndpoint subscriber = initializeSubscriberEndpoint(kSender);<NEW_LINE>try {<NEW_LINE>String sdpOffer = subscriber.prepareSubscription(kSender.getPublisher());<NEW_LINE>log.trace("PARTICIPANT {}: Subscribing SdpOffer is {}", this.getParticipantPublicId(), sdpOffer);<NEW_LINE>log.info("PARTICIPANT {}: offer prepared to receive media from {} in room {}", this.getParticipantPublicId(), senderName, this.session.getSessionId());<NEW_LINE>return sdpOffer;<NEW_LINE>} catch (KurentoServerException e) {<NEW_LINE>log.error("Exception preparing subscriber endpoint for user {}: {}", this.getParticipantPublicId(), e.getMessage());<NEW_LINE>this.subscribers.remove(senderName);<NEW_LINE>releaseSubscriberEndpoint(senderName, (KurentoParticipant) sender, subscriber, null, false);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>closingReadLock.unlock();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.error("PublisherEndpoint of participant {} of session {} is closed. Participant {} couldn't subscribe to it ", senderName, sender.getSessionId(), this.participantPublicId);<NEW_LINE>throw new OpenViduException(Code.MEDIA_ENDPOINT_ERROR_CODE, "Unable to create subscriber endpoint. Publisher endpoint of participant " + senderName + "is closed");<NEW_LINE>} | ().closingLock.readLock(); |
1,775,701 | public org.python.Object expandtabs(org.python.Object tabsize) {<NEW_LINE>int tabsize_int = 8;<NEW_LINE>if (tabsize != null) {<NEW_LINE>tabsize_int = (int) ((org.python.types.Int) tabsize).value;<NEW_LINE>}<NEW_LINE>if (this.value == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>java.lang.StringBuilder buf = new java.lang.StringBuilder();<NEW_LINE>int col = 0;<NEW_LINE>for (int i = 0; i < this.value.length(); i++) {<NEW_LINE>char c = this.value.charAt(i);<NEW_LINE>switch(c) {<NEW_LINE>case '\n':<NEW_LINE>col = 0;<NEW_LINE>buf.append(c);<NEW_LINE>break;<NEW_LINE>case '\t':<NEW_LINE>buf.append(this.spaces(tabsize_int - col % tabsize_int));<NEW_LINE>col += tabsize_int - col % tabsize_int;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>col++;<NEW_LINE>buf.append(c);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new org.python.types.<MASK><NEW_LINE>} | Str(buf.toString()); |
650,416 | private static void pointLookup(int block, int index, PointPrecomp p) {<NEW_LINE>// assert 0 <= block && block < PRECOMP_BLOCKS;<NEW_LINE>// assert 0 <= index && index < PRECOMP_POINTS;<NEW_LINE>int off = block * PRECOMP_POINTS * 3 * F.SIZE;<NEW_LINE>for (int i = 0; i < PRECOMP_POINTS; ++i) {<NEW_LINE>int cond = ((i ^ <MASK><NEW_LINE>F.cmov(cond, precompBase, off, p.ypx_h, 0);<NEW_LINE>off += F.SIZE;<NEW_LINE>F.cmov(cond, precompBase, off, p.ymx_h, 0);<NEW_LINE>off += F.SIZE;<NEW_LINE>F.cmov(cond, precompBase, off, p.xyd, 0);<NEW_LINE>off += F.SIZE;<NEW_LINE>}<NEW_LINE>} | index) - 1) >> 31; |
1,191,658 | public static TreePathHandle create(Element element, CompilationInfo info) throws IllegalArgumentException {<NEW_LINE>URL u = null;<NEW_LINE>String qualName = null;<NEW_LINE>Symbol.ClassSymbol clsSym;<NEW_LINE>if (element instanceof Symbol.ClassSymbol) {<NEW_LINE>clsSym = (Symbol.ClassSymbol) element;<NEW_LINE>} else {<NEW_LINE>clsSym = (Symbol.ClassSymbol) SourceUtils.getEnclosingTypeElement(element);<NEW_LINE>}<NEW_LINE>if (clsSym != null && (clsSym.classfile != null || clsSym.sourcefile != null)) {<NEW_LINE>try {<NEW_LINE>if (clsSym.sourcefile != null && clsSym.sourcefile.getKind() == JavaFileObject.Kind.SOURCE && clsSym.sourcefile.toUri().isAbsolute()) {<NEW_LINE>u = clsSym.sourcefile<MASK><NEW_LINE>} else if (clsSym.classfile != null) {<NEW_LINE>u = clsSym.classfile.toUri().toURL();<NEW_LINE>}<NEW_LINE>} catch (MalformedURLException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>qualName = clsSym.getEnclosingElement().getQualifiedName().toString();<NEW_LINE>}<NEW_LINE>return new TreePathHandle(new ElementDelegate(ElementHandle.create(element), u, qualName, info.getClasspathInfo()));<NEW_LINE>} | .toUri().toURL(); |
610,594 | public Map<String, Object> toMap(final String filter) {<NEW_LINE>final Map<String, Object> map = new HashMap<>();<NEW_LINE>final String prefix = filter.substring(0<MASK><NEW_LINE>if ("dos".equals(prefix)) {<NEW_LINE>map.put("hidden", isHidden());<NEW_LINE>map.put("archive", isArchive());<NEW_LINE>map.put("system", isSystem());<NEW_LINE>map.put("readonly", isReadOnly());<NEW_LINE>}<NEW_LINE>if (!"owner".equals(prefix)) {<NEW_LINE>map.put("lastModifiedTime", lastModifiedTime());<NEW_LINE>map.put("lastAccessTime", lastAccessTime());<NEW_LINE>map.put("creationTime", creationTime());<NEW_LINE>map.put("size", size());<NEW_LINE>map.put("isRegularFile", isRegularFile());<NEW_LINE>map.put("isDirectory", isDirectory());<NEW_LINE>map.put("isSymbolicLink", isSymbolicLink());<NEW_LINE>map.put("isOther", isOther());<NEW_LINE>map.put("fileKey", fileKey());<NEW_LINE>}<NEW_LINE>// POSIX properties<NEW_LINE>if ("posix".equals(prefix)) {<NEW_LINE>map.put("permissions", permissions());<NEW_LINE>map.put("group", group().getName());<NEW_LINE>map.put("owner", owner().getName());<NEW_LINE>}<NEW_LINE>if ("owner".equals(prefix)) {<NEW_LINE>map.put("owner", owner().getName());<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | , filter.indexOf(":")); |
959,618 | private void insert(String data) throws IoTDBConnectionException, StatementExecutionException {<NEW_LINE>String[] dataArray = data.split(",");<NEW_LINE>String device = dataArray[0];<NEW_LINE>long time = Long.parseLong(dataArray[1]);<NEW_LINE>List<String> measurements = Arrays.asList(dataArray[2].split(":"));<NEW_LINE>List<TSDataType> types = new ArrayList<>();<NEW_LINE>for (String type : dataArray[3].split(":")) {<NEW_LINE>types.add(TSDataType.valueOf(type));<NEW_LINE>}<NEW_LINE>List<Object> <MASK><NEW_LINE>String[] valuesStr = dataArray[4].split(":");<NEW_LINE>for (int i = 0; i < valuesStr.length; i++) {<NEW_LINE>switch(types.get(i)) {<NEW_LINE>case INT64:<NEW_LINE>values.add(Long.parseLong(valuesStr[i]));<NEW_LINE>break;<NEW_LINE>case DOUBLE:<NEW_LINE>values.add(Double.parseDouble(valuesStr[i]));<NEW_LINE>break;<NEW_LINE>case INT32:<NEW_LINE>values.add(Integer.parseInt(valuesStr[i]));<NEW_LINE>break;<NEW_LINE>case TEXT:<NEW_LINE>values.add(valuesStr[i]);<NEW_LINE>break;<NEW_LINE>case FLOAT:<NEW_LINE>values.add(Float.parseFloat(valuesStr[i]));<NEW_LINE>break;<NEW_LINE>case BOOLEAN:<NEW_LINE>values.add(Boolean.parseBoolean(valuesStr[i]));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>session.insertRecord(device, time, measurements, types, values);<NEW_LINE>} | values = new ArrayList<>(); |
953,151 | private BindableValue bindableValueFor(JsonToken token) {<NEW_LINE>if (!JsonTokenType.STRING.equals(token.getType()) && !JsonTokenType.UNQUOTED_STRING.equals(token.getType()) && !JsonTokenType.REGULAR_EXPRESSION.equals(token.getType())) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>boolean isRegularExpression = token.getType().equals(JsonTokenType.REGULAR_EXPRESSION);<NEW_LINE>BindableValue bindableValue = new BindableValue();<NEW_LINE>String tokenValue = isRegularExpression ? token.getValue(BsonRegularExpression.class).getPattern() : String.class.cast(token.getValue());<NEW_LINE>Matcher <MASK><NEW_LINE>if (token.getType().equals(JsonTokenType.UNQUOTED_STRING)) {<NEW_LINE>Matcher regexMatcher = EXPRESSION_BINDING_PATTERN.matcher(tokenValue);<NEW_LINE>if (regexMatcher.find()) {<NEW_LINE>String binding = regexMatcher.group();<NEW_LINE>String expression = binding.substring(3, binding.length() - 1);<NEW_LINE>Matcher inSpelMatcher = PARAMETER_BINDING_PATTERN.matcher(expression);<NEW_LINE>while (inSpelMatcher.find()) {<NEW_LINE>int index = computeParameterIndex(inSpelMatcher.group());<NEW_LINE>expression = expression.replace(inSpelMatcher.group(), getBindableValueForIndex(index).toString());<NEW_LINE>}<NEW_LINE>Object value = evaluateExpression(expression);<NEW_LINE>bindableValue.setValue(value);<NEW_LINE>bindableValue.setType(bsonTypeForValue(value));<NEW_LINE>return bindableValue;<NEW_LINE>}<NEW_LINE>if (matcher.find()) {<NEW_LINE>int index = computeParameterIndex(matcher.group());<NEW_LINE>bindableValue.setValue(getBindableValueForIndex(index));<NEW_LINE>bindableValue.setType(bsonTypeForValue(getBindableValueForIndex(index)));<NEW_LINE>return bindableValue;<NEW_LINE>}<NEW_LINE>bindableValue.setValue(tokenValue);<NEW_LINE>bindableValue.setType(BsonType.STRING);<NEW_LINE>return bindableValue;<NEW_LINE>}<NEW_LINE>String computedValue = tokenValue;<NEW_LINE>Matcher regexMatcher = EXPRESSION_BINDING_PATTERN.matcher(computedValue);<NEW_LINE>while (regexMatcher.find()) {<NEW_LINE>String binding = regexMatcher.group();<NEW_LINE>String expression = binding.substring(3, binding.length() - 1);<NEW_LINE>Matcher inSpelMatcher = PARAMETER_BINDING_PATTERN.matcher(expression);<NEW_LINE>while (inSpelMatcher.find()) {<NEW_LINE>int index = computeParameterIndex(inSpelMatcher.group());<NEW_LINE>expression = expression.replace(inSpelMatcher.group(), getBindableValueForIndex(index).toString());<NEW_LINE>}<NEW_LINE>computedValue = computedValue.replace(binding, nullSafeToString(evaluateExpression(expression)));<NEW_LINE>bindableValue.setValue(computedValue);<NEW_LINE>bindableValue.setType(BsonType.STRING);<NEW_LINE>return bindableValue;<NEW_LINE>}<NEW_LINE>while (matcher.find()) {<NEW_LINE>String group = matcher.group();<NEW_LINE>int index = computeParameterIndex(group);<NEW_LINE>computedValue = computedValue.replace(group, nullSafeToString(getBindableValueForIndex(index)));<NEW_LINE>}<NEW_LINE>if (isRegularExpression) {<NEW_LINE>bindableValue.setValue(new BsonRegularExpression(computedValue));<NEW_LINE>bindableValue.setType(BsonType.REGULAR_EXPRESSION);<NEW_LINE>} else {<NEW_LINE>bindableValue.setValue(computedValue);<NEW_LINE>bindableValue.setType(BsonType.STRING);<NEW_LINE>}<NEW_LINE>return bindableValue;<NEW_LINE>} | matcher = PARAMETER_BINDING_PATTERN.matcher(tokenValue); |
1,799,941 | public static void printMountInfo(Map<String, MountPointInfo> mountTable) {<NEW_LINE>for (Map.Entry<String, MountPointInfo> entry : mountTable.entrySet()) {<NEW_LINE>String mMountPoint = entry.getKey();<NEW_LINE>MountPointInfo mountPointInfo = entry.getValue();<NEW_LINE>long capacityBytes = mountPointInfo.getUfsCapacityBytes();<NEW_LINE>long usedBytes = mountPointInfo.getUfsUsedBytes();<NEW_LINE>String usedPercentageInfo = "";<NEW_LINE>if (capacityBytes > 0) {<NEW_LINE>int usedPercentage = (int<MASK><NEW_LINE>usedPercentageInfo = String.format("(%s%%)", usedPercentage);<NEW_LINE>}<NEW_LINE>String leftAlignFormat = getAlignFormat(mountTable);<NEW_LINE>System.out.format(leftAlignFormat, mountPointInfo.getUfsUri(), mMountPoint, mountPointInfo.getUfsType(), FormatUtils.getSizeFromBytes(capacityBytes), FormatUtils.getSizeFromBytes(usedBytes) + usedPercentageInfo, mountPointInfo.getReadOnly() ? "" : "not ", mountPointInfo.getShared() ? "" : "not ");<NEW_LINE>System.out.println("properties=" + mountPointInfo.getProperties() + ")");<NEW_LINE>}<NEW_LINE>} | ) (100.0 * usedBytes / capacityBytes); |
1,220,653 | private Mono<Response<Void>> simulateEvictionWithResponseAsync(String resourceGroupName, String vmName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (vmName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2021-11-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.simulateEviction(this.client.getEndpoint(), resourceGroupName, vmName, apiVersion, this.client.getSubscriptionId(), accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); |
785,226 | private static DeserializedAst deserialize(AbstractCompiler compiler, SourceFile syntheticExterns, ImmutableMap<String, SourceFile> scriptSourceFiles, Optional<ColorPool.Builder> colorPool, InputStream typedAstStream, Mode mode, boolean includeTypeInformation) {<NEW_LINE>checkArgument(colorPool.isPresent() == (mode.equals(Mode.<MASK><NEW_LINE>List<TypedAst> typedAstProtos = deserializeTypedAsts(typedAstStream);<NEW_LINE>TypedAstDeserializer deserializer = new TypedAstDeserializer(syntheticExterns, colorPool, mode, includeTypeInformation);<NEW_LINE>deserializer.filePoolBuilder.put(syntheticExterns.getName(), syntheticExterns);<NEW_LINE>deserializer.filePoolBuilder.putAll(scriptSourceFiles);<NEW_LINE>if (!mode.equals(Mode.RUNTIME_LIBRARY_ONLY)) {<NEW_LINE>// skip this step if deserializing the runtime libraries to avoid an infinite loop<NEW_LINE>// runtime library initialization needs an unbuilt ColorPool.Builder<NEW_LINE>compiler.initRuntimeLibraryTypedAsts(deserializer.colorPoolBuilder);<NEW_LINE>}<NEW_LINE>for (TypedAst typedAstProto : typedAstProtos) {<NEW_LINE>deserializer.deserializeSingleTypedAst(typedAstProto);<NEW_LINE>}<NEW_LINE>deserializer.typedAstFilesystem.put(syntheticExterns, () -> {<NEW_LINE>Node script = IR.script();<NEW_LINE>script.setStaticSourceFile(syntheticExterns);<NEW_LINE>for (ScriptNodeDeserializer d : deserializer.syntheticExternsDeserializers) {<NEW_LINE>script.addChildrenToBack(d.deserializeNew().removeChildren());<NEW_LINE>}<NEW_LINE>return script;<NEW_LINE>});<NEW_LINE>return deserializer.toDeserializedAst();<NEW_LINE>} | RUNTIME_LIBRARY_ONLY) && includeTypeInformation), "ColorPool.Builder required iff deserializing runtime libraries & including types"); |
815,765 | public String readMemory(String address, long offset, int length) {<NEW_LINE>MIRecord memory;<NEW_LINE>String offsetArg;<NEW_LINE>if (offset != 0) {<NEW_LINE>offsetArg = "-o " + offset + " ";<NEW_LINE>} else {<NEW_LINE>offsetArg = "";<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>memory = sendAndGet("-data-read-memory-bytes " + <MASK><NEW_LINE>} catch (InterruptedException ex) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>MIValue memoryValue = memory.results().valueOf("memory");<NEW_LINE>if (memoryValue instanceof MITList) {<NEW_LINE>MITList memoryList = (MITList) memoryValue;<NEW_LINE>if (!memoryList.isEmpty()) {<NEW_LINE>MITListItem row = memoryList.get(0);<NEW_LINE>if (row instanceof MITList) {<NEW_LINE>String contents = ((MITList) row).getConstValue("contents");<NEW_LINE>return contents;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | offsetArg + address + " " + length); |
996,483 | final Optional<ServerInterceptor> rateMeteringInterceptor() {<NEW_LINE>return getCustomRateMeteringInterceptor(coreApi.getConfig().appDataDir, this.getClass()).or(() -> Optional.of(CallRateMeteringInterceptor.valueOf(new HashMap<>() {<NEW_LINE><NEW_LINE>{<NEW_LINE>put(getGetOfferCategoryMethod().getFullMethodName(), new GrpcCallRateMeter(1, SECONDS));<NEW_LINE>put(getGetOfferMethod().getFullMethodName(), <MASK><NEW_LINE>put(getGetMyOfferMethod().getFullMethodName(), new GrpcCallRateMeter(1, SECONDS));<NEW_LINE>put(getGetOffersMethod().getFullMethodName(), new GrpcCallRateMeter(1, SECONDS));<NEW_LINE>put(getGetMyOffersMethod().getFullMethodName(), new GrpcCallRateMeter(1, SECONDS));<NEW_LINE>put(getCreateOfferMethod().getFullMethodName(), new GrpcCallRateMeter(1, MINUTES));<NEW_LINE>put(getEditOfferMethod().getFullMethodName(), new GrpcCallRateMeter(1, MINUTES));<NEW_LINE>put(getCancelOfferMethod().getFullMethodName(), new GrpcCallRateMeter(1, MINUTES));<NEW_LINE>}<NEW_LINE>})));<NEW_LINE>} | new GrpcCallRateMeter(1, SECONDS)); |
610,892 | protected void exec() throws Exception {<NEW_LINE>super.verifyArtifacts();<NEW_LINE>// Define the distribution file paths<NEW_LINE>Path api = getRelativeFile("dist/" + formatVersion(ARTIFACT_API));<NEW_LINE>Path standalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE));<NEW_LINE>Path unoptimized = getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED));<NEW_LINE>Path forgeApi = getRelativeFile<MASK><NEW_LINE>Path forgeStandalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_STANDALONE));<NEW_LINE>// NIO will not automatically create directories<NEW_LINE>Path dir = getRelativeFile("dist/");<NEW_LINE>if (!Files.exists(dir)) {<NEW_LINE>Files.createDirectory(dir);<NEW_LINE>}<NEW_LINE>// Copy build jars to dist/<NEW_LINE>Files.copy(this.artifactApiPath, api, REPLACE_EXISTING);<NEW_LINE>Files.copy(this.artifactStandalonePath, standalone, REPLACE_EXISTING);<NEW_LINE>Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING);<NEW_LINE>Files.copy(this.artifactForgeApiPath, forgeApi, REPLACE_EXISTING);<NEW_LINE>Files.copy(this.artifactForgeStandalonePath, forgeStandalone, REPLACE_EXISTING);<NEW_LINE>// Calculate all checksums and format them like "shasum"<NEW_LINE>List<String> shasum = Stream.of(api, forgeApi, standalone, forgeStandalone, unoptimized).map(path -> sha1(path) + " " + path.getFileName().toString()).collect(Collectors.toList());<NEW_LINE>shasum.forEach(System.out::println);<NEW_LINE>// Write the checksums to a file<NEW_LINE>Files.write(getRelativeFile("dist/checksums.txt"), shasum);<NEW_LINE>} | ("dist/" + formatVersion(ARTIFACT_FORGE_API)); |
498,943 | private static ExplosionEvent.Detonate createAndPostExplosionEventDetonate(CauseStackManager.StackFrame frame, ForgeToSpongeEventData eventData) {<NEW_LINE>ExplosionEvent.Detonate spongeEvent;<NEW_LINE>final net.minecraftforge.event.world.ExplosionEvent.Detonate forgeEvent = (net.minecraftforge.event.world.ExplosionEvent.Detonate) eventData.getForgeEvent();<NEW_LINE>final List<Location<World>> blockPositions = new ArrayList<>(forgeEvent.getAffectedBlocks().size());<NEW_LINE>final List<org.spongepowered.api.entity.Entity> entities = new ArrayList<>(forgeEvent.getAffectedEntities().size());<NEW_LINE>for (BlockPos pos : forgeEvent.getAffectedBlocks()) {<NEW_LINE>blockPositions.add(new Location<>((World) forgeEvent.getWorld(), pos.getX(), pos.getY(), pos.getZ()));<NEW_LINE>}<NEW_LINE>for (Entity entity : forgeEvent.getAffectedEntities()) {<NEW_LINE>entities.add((org.spongepowered.<MASK><NEW_LINE>}<NEW_LINE>spongeEvent = SpongeEventFactory.createExplosionEventDetonate(frame.getCurrentCause(), blockPositions, entities, (org.spongepowered.api.world.explosion.Explosion) forgeEvent.getExplosion(), (World) forgeEvent.getWorld());<NEW_LINE>eventData.setSpongeEvent(spongeEvent);<NEW_LINE>eventManager.postEvent(eventData);<NEW_LINE>if (spongeEvent.isCancelled()) {<NEW_LINE>forgeEvent.getAffectedBlocks().clear();<NEW_LINE>forgeEvent.getAffectedEntities().clear();<NEW_LINE>return spongeEvent;<NEW_LINE>}<NEW_LINE>if (forgeEvent.getAffectedBlocks().size() != spongeEvent.getAffectedLocations().size()) {<NEW_LINE>forgeEvent.getAffectedBlocks().clear();<NEW_LINE>for (Location<World> location : spongeEvent.getAffectedLocations()) {<NEW_LINE>forgeEvent.getAffectedBlocks().add(VecHelper.toBlockPos(location));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (forgeEvent.getAffectedEntities().size() != spongeEvent.getEntities().size()) {<NEW_LINE>forgeEvent.getAffectedEntities().clear();<NEW_LINE>for (org.spongepowered.api.entity.Entity entity : spongeEvent.getEntities()) {<NEW_LINE>forgeEvent.getAffectedEntities().add((Entity) entity);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return spongeEvent;<NEW_LINE>} | api.entity.Entity) entity); |
267,891 | public GetFindingsReportAccountSummaryResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetFindingsReportAccountSummaryResult getFindingsReportAccountSummaryResult = new GetFindingsReportAccountSummaryResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><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 getFindingsReportAccountSummaryResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getFindingsReportAccountSummaryResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("reportSummaries", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getFindingsReportAccountSummaryResult.setReportSummaries(new ListUnmarshaller<FindingsReportSummary>(FindingsReportSummaryJsonUnmarshaller.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 getFindingsReportAccountSummaryResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,217,967 | private void process(final byte[] nonce, ByteBuffer output, ByteBuffer input) throws GeneralSecurityException {<NEW_LINE>if (nonce.length != nonceSizeInBytes()) {<NEW_LINE>throw new GeneralSecurityException("The nonce length (in bytes) must be " + nonceSizeInBytes());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>int numBlocks = (length / ChaCha20Util.BLOCK_SIZE_IN_BYTES) + 1;<NEW_LINE>for (int i = 0; i < numBlocks; i++) {<NEW_LINE>ByteBuffer keyStreamBlock = chacha20Block(nonce, i + initialCounter);<NEW_LINE>if (i == numBlocks - 1) {<NEW_LINE>// last block<NEW_LINE>Bytes.xor(output, input, keyStreamBlock, length % ChaCha20Util.BLOCK_SIZE_IN_BYTES);<NEW_LINE>} else {<NEW_LINE>Bytes.xor(output, input, keyStreamBlock, ChaCha20Util.BLOCK_SIZE_IN_BYTES);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int length = input.remaining(); |
1,098,661 | public void generateSyntheticFinalFieldInitialization(CodeStream codeStream) {<NEW_LINE>if (this.synthetics == null || this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)<NEW_LINE>return;<NEW_LINE>Collection<FieldBinding> syntheticFields = this.synthetics[SourceTypeBinding.FIELD_EMUL].values();<NEW_LINE>for (FieldBinding field : syntheticFields) {<NEW_LINE>if (CharOperation.prefixEquals(TypeConstants.SYNTHETIC_SWITCH_ENUM_TABLE, field.name) && field.isFinal()) {<NEW_LINE>MethodBinding[] accessors = (MethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(new String(field.name));<NEW_LINE>if (// not a field for switch enum<NEW_LINE>accessors == null || accessors[0] == null)<NEW_LINE>continue;<NEW_LINE>codeStream.invoke(Opcodes.OPC_invokestatic, accessors[0], null);<NEW_LINE>codeStream.fieldAccess(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Opcodes.OPC_putstatic, field, null); |
486,312 | private ByteBuf deserialize(ImmutableList<Cookie> sessionCookies) throws Exception {<NEW_LINE>if (sessionCookies.isEmpty()) {<NEW_LINE>return Unpooled.EMPTY_BUFFER;<NEW_LINE>}<NEW_LINE>StringBuilder sessionCookie = new StringBuilder();<NEW_LINE>for (Cookie cookie : sessionCookies) {<NEW_LINE>sessionCookie.append(cookie.value());<NEW_LINE>}<NEW_LINE>String[] parts = sessionCookie.<MASK><NEW_LINE>if (parts.length != 2) {<NEW_LINE>return Unpooled.buffer(0, 0);<NEW_LINE>}<NEW_LINE>ByteBuf payload = null;<NEW_LINE>ByteBuf digest = null;<NEW_LINE>ByteBuf expectedDigest = null;<NEW_LINE>ByteBuf decryptedPayload = null;<NEW_LINE>try {<NEW_LINE>payload = fromBase64(bufferAllocator, parts[0]);<NEW_LINE>digest = fromBase64(bufferAllocator, parts[1]);<NEW_LINE>expectedDigest = signer.sign(payload, bufferAllocator);<NEW_LINE>if (ByteBufUtil.equals(digest, expectedDigest)) {<NEW_LINE>decryptedPayload = crypto.decrypt(payload.resetReaderIndex(), bufferAllocator);<NEW_LINE>} else {<NEW_LINE>decryptedPayload = Unpooled.buffer(0, 0);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (payload != null) {<NEW_LINE>payload.touch().release();<NEW_LINE>}<NEW_LINE>if (digest != null) {<NEW_LINE>digest.release();<NEW_LINE>}<NEW_LINE>if (expectedDigest != null) {<NEW_LINE>expectedDigest.release();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return decryptedPayload.touch();<NEW_LINE>} | toString().split(SESSION_SEPARATOR); |
1,717,556 | private PackageLookupValue computeExternalPackageLookupValue(SkyKey skyKey, Environment env, PackageIdentifier packageIdentifier) throws PackageLookupFunctionException, InterruptedException {<NEW_LINE>PackageIdentifier id = (PackageIdentifier) skyKey.argument();<NEW_LINE>SkyKey repositoryKey = RepositoryDirectoryValue.key(id.getRepository());<NEW_LINE>RepositoryDirectoryValue repositoryValue;<NEW_LINE>try {<NEW_LINE>repositoryValue = (RepositoryDirectoryValue) env.getValueOrThrow(repositoryKey, NoSuchPackageException.class, IOException.class, EvalException.class, AlreadyReportedException.class);<NEW_LINE>if (repositoryValue == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} catch (NoSuchPackageException e) {<NEW_LINE>throw new PackageLookupFunctionException(new BuildFileNotFoundException(id, e.getMessage<MASK><NEW_LINE>} catch (IOException | EvalException | AlreadyReportedException e) {<NEW_LINE>throw new PackageLookupFunctionException(new RepositoryFetchException(id, e.getMessage()), Transience.PERSISTENT);<NEW_LINE>}<NEW_LINE>if (!repositoryValue.repositoryExists()) {<NEW_LINE>return new PackageLookupValue.NoRepositoryPackageLookupValue(id.getRepository().getName(), repositoryValue.getErrorMsg());<NEW_LINE>}<NEW_LINE>// Check .bazelignore file after fetching the external repository.<NEW_LINE>IgnoredPackagePrefixesValue ignoredPatternsValue = (IgnoredPackagePrefixesValue) env.getValue(IgnoredPackagePrefixesValue.key(id.getRepository()));<NEW_LINE>if (ignoredPatternsValue == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (isPackageIgnored(id, ignoredPatternsValue)) {<NEW_LINE>return PackageLookupValue.DELETED_PACKAGE_VALUE;<NEW_LINE>}<NEW_LINE>// This checks for the build file names in the correct precedence order.<NEW_LINE>for (BuildFileName buildFileName : buildFilesByPriority) {<NEW_LINE>PathFragment buildFileFragment = id.getPackageFragment().getRelative(buildFileName.getFilenameFragment());<NEW_LINE>RootedPath buildFileRootedPath = RootedPath.toRootedPath(Root.fromPath(repositoryValue.getPath()), buildFileFragment);<NEW_LINE>FileValue fileValue = getFileValue(buildFileRootedPath, env, packageIdentifier);<NEW_LINE>if (fileValue == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (fileValue.isFile()) {<NEW_LINE>return PackageLookupValue.success(repositoryValue, Root.fromPath(repositoryValue.getPath()), buildFileName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return PackageLookupValue.NO_BUILD_FILE_VALUE;<NEW_LINE>} | ()), Transience.PERSISTENT); |
761,605 | private Mono<PagedResponse<UsageInner>> listSinglePageAsync(String location, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (location == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>final String apiVersion = "2021-11-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.list(this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), accept, context).map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null));<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); |
720,785 | public void save(RowBasedPartition part, MatrixPartitionMeta partMeta, PSMatrixSaveContext saveContext, DataOutputStream output) throws IOException {<NEW_LINE>List<Integer> rowIds = saveContext.getRowIndexes();<NEW_LINE>ServerRowsStorage rows = part.getRowsStorage();<NEW_LINE>if (rowIds == null || rowIds.isEmpty()) {<NEW_LINE>int rowStart = part.getPartitionKey().getStartRow();<NEW_LINE>int rowEnd = part.getPartitionKey().getEndRow();<NEW_LINE>rowIds = new ArrayList<>(rowEnd - rowStart);<NEW_LINE>for (int i = rowStart; i < rowEnd; i++) {<NEW_LINE>rowIds.add(i);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>rowIds = filter(part, rowIds);<NEW_LINE>}<NEW_LINE>FSDataOutputStream dataOutputStream = new FSDataOutputStream(output, null, partMeta != null ? partMeta.getOffset() : 0);<NEW_LINE>partMeta.setSaveRowNum(rowIds.size());<NEW_LINE>for (int rowId : rowIds) {<NEW_LINE>ServerRow row = rows.getRow(rowId);<NEW_LINE>RowPartitionMeta rowMeta = new RowPartitionMeta(rowId, 0, 0);<NEW_LINE>if (row != null) {<NEW_LINE>rowMeta.setElementNum(row.size());<NEW_LINE>rowMeta.setOffset(dataOutputStream.getPos());<NEW_LINE>if (row.isDense()) {<NEW_LINE>rowMeta.setSaveType(<MASK><NEW_LINE>} else {<NEW_LINE>rowMeta.setSaveType(SaveType.SPARSE.getTypeId());<NEW_LINE>}<NEW_LINE>save(rows.getRow(rowId), saveContext, partMeta, output);<NEW_LINE>} else {<NEW_LINE>rowMeta.setElementNum(0);<NEW_LINE>rowMeta.setOffset(dataOutputStream.getPos());<NEW_LINE>}<NEW_LINE>partMeta.setRowMeta(rowMeta);<NEW_LINE>}<NEW_LINE>} | SaveType.DENSE.getTypeId()); |
141,353 | private CommonResponse handleStaticResource(String path, CommonRequest request) throws IOException {<NEW_LINE>URL url = getSecureUrlForPath(RESOURCE_BASE + path);<NEW_LINE>if (url == null) {<NEW_LINE>// log at debug only since this is typically just exploit bot spam<NEW_LINE>logger.debug("unexpected path: {}", path);<NEW_LINE>return new CommonResponse(NOT_FOUND);<NEW_LINE>}<NEW_LINE>Date expires = getExpiresForPath(path);<NEW_LINE>if (request.getHeader(HttpHeaderNames.IF_MODIFIED_SINCE) != null && expires == null) {<NEW_LINE>// all static resources without explicit expires are versioned and can be safely<NEW_LINE>// cached forever<NEW_LINE>return new CommonResponse(NOT_MODIFIED);<NEW_LINE>}<NEW_LINE>int extensionStartIndex = path.lastIndexOf('.');<NEW_LINE>checkState(extensionStartIndex != -1, "found path under %s with no extension: %s", RESOURCE_BASE, path);<NEW_LINE>String extension = path.substring(extensionStartIndex + 1);<NEW_LINE>MediaType mediaType = mediaTypes.get(extension);<NEW_LINE>checkNotNull(<MASK><NEW_LINE>CommonResponse response = new CommonResponse(OK, mediaType, url);<NEW_LINE>if (expires != null) {<NEW_LINE>response.setHeader(HttpHeaderNames.EXPIRES, expires);<NEW_LINE>response.setHeader(HttpHeaderNames.CACHE_CONTROL, "public, max-age=" + expires.getTime());<NEW_LINE>} else {<NEW_LINE>response.setHeader(HttpHeaderNames.LAST_MODIFIED, new Date(0));<NEW_LINE>response.setHeader(HttpHeaderNames.EXPIRES, new Date(clock.currentTimeMillis() + TEN_YEARS));<NEW_LINE>response.setHeader(HttpHeaderNames.CACHE_CONTROL, "public, max-age=" + TEN_YEARS + ", immutable");<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | mediaType, "found extension under %s with no media type: %s", RESOURCE_BASE, extension); |
218,075 | public DBClusterRole unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>DBClusterRole dBClusterRole = new DBClusterRole();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE><MASK><NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return dBClusterRole;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("RoleArn", targetDepth)) {<NEW_LINE>dBClusterRole.setRoleArn(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("Status", targetDepth)) {<NEW_LINE>dBClusterRole.setStatus(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return dBClusterRole;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | XMLEvent xmlEvent = context.nextEvent(); |
184,773 | public Map<String, Object> assignUserAccess(Map<String, String> params) throws Exception {<NEW_LINE>final WebContext ctx = WebContextFactory.get();<NEW_LINE>final HttpServletRequest request = ctx.getHttpServletRequest();<NEW_LINE>final HttpServletResponse response = ctx.getHttpServletResponse();<NEW_LINE>final UserAPI uApi = APILocator.getUserAPI();<NEW_LINE>final String access = params.getOrDefault("access", "nope");<NEW_LINE>final User loggedInUser = new WebResource.InitBuilder(request, response).requiredBackendUser(true).requiredAnonAccess(AnonymousAccess.NONE).requiredPortlet("users").init().getUser();<NEW_LINE>final User userToModify = uApi.loadUserById(params.get("userid"), loggedInUser, false);<NEW_LINE>final boolean granted = Try.of(() -> Boolean.valueOf(params.getOrDefault("granted", "false"))).getOrElse(false);<NEW_LINE>if (access.indexOf("userActive") == 0) {<NEW_LINE>userToModify.setActive(granted);<NEW_LINE>uApi.<MASK><NEW_LINE>return ImmutableMap.of("granted", granted, "role", "active", "user", userToModify.toMap());<NEW_LINE>}<NEW_LINE>final Role role = access.toLowerCase().indexOf("admin") == 0 && APILocator.getRoleAPI().doesUserHaveRole(loggedInUser, APILocator.getRoleAPI().loadCMSAdminRole()) ? APILocator.getRoleAPI().loadCMSAdminRole() : access.toLowerCase().indexOf("backend") == 0 ? APILocator.getRoleAPI().loadBackEndUserRole() : access.toLowerCase().indexOf("frontend") == 0 ? APILocator.getRoleAPI().loadFrontEndUserRole() : null;<NEW_LINE>if (role == null) {<NEW_LINE>return ImmutableMap.of();<NEW_LINE>}<NEW_LINE>if (granted) {<NEW_LINE>APILocator.getRoleAPI().addRoleToUser(role, userToModify);<NEW_LINE>} else {<NEW_LINE>APILocator.getRoleAPI().removeRoleFromUser(role, userToModify);<NEW_LINE>}<NEW_LINE>return ImmutableMap.of("granted", granted, "role", role.toMap(), "user", userToModify.toMap());<NEW_LINE>} | save(userToModify, loggedInUser, false); |
352,066 | public static ClientMessage encodeRequest(java.lang.String name, com.hazelcast.internal.serialization.Data key, com.hazelcast.internal.serialization.Data value, long threadId, long ttl, long maxIdle) {<NEW_LINE>ClientMessage clientMessage = ClientMessage.createForEncode();<NEW_LINE>clientMessage.setRetryable(false);<NEW_LINE>clientMessage.setOperationName("Map.PutWithMaxIdle");<NEW_LINE>ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);<NEW_LINE>encodeInt(<MASK><NEW_LINE>encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);<NEW_LINE>encodeLong(initialFrame.content, REQUEST_THREAD_ID_FIELD_OFFSET, threadId);<NEW_LINE>encodeLong(initialFrame.content, REQUEST_TTL_FIELD_OFFSET, ttl);<NEW_LINE>encodeLong(initialFrame.content, REQUEST_MAX_IDLE_FIELD_OFFSET, maxIdle);<NEW_LINE>clientMessage.add(initialFrame);<NEW_LINE>StringCodec.encode(clientMessage, name);<NEW_LINE>DataCodec.encode(clientMessage, key);<NEW_LINE>DataCodec.encode(clientMessage, value);<NEW_LINE>return clientMessage;<NEW_LINE>} | initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE); |
1,609,940 | public Document toDocument(AggregationOperationContext context) {<NEW_LINE>Document graphLookup = new Document();<NEW_LINE>graphLookup.put("from", from);<NEW_LINE>List<Object> mappedStartWith = new ArrayList<Object>(startWith.size());<NEW_LINE>for (Object startWithElement : startWith) {<NEW_LINE>if (startWithElement instanceof AggregationExpression) {<NEW_LINE>mappedStartWith.add(((AggregationExpression) startWithElement).toDocument(context));<NEW_LINE>} else if (startWithElement instanceof Field) {<NEW_LINE>mappedStartWith.add(context.getReference((Field) startWithElement).toString());<NEW_LINE>} else {<NEW_LINE>mappedStartWith.add(startWithElement);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>graphLookup.put("startWith", mappedStartWith.size() == 1 ? mappedStartWith.iterator().next() : mappedStartWith);<NEW_LINE>graphLookup.put(<MASK><NEW_LINE>graphLookup.put("connectToField", connectTo.getTarget());<NEW_LINE>graphLookup.put("as", as.getName());<NEW_LINE>if (maxDepth != null) {<NEW_LINE>graphLookup.put("maxDepth", maxDepth);<NEW_LINE>}<NEW_LINE>if (depthField != null) {<NEW_LINE>graphLookup.put("depthField", depthField.getTarget());<NEW_LINE>}<NEW_LINE>if (restrictSearchWithMatch != null) {<NEW_LINE>graphLookup.put("restrictSearchWithMatch", context.getMappedObject(restrictSearchWithMatch.getCriteriaObject()));<NEW_LINE>}<NEW_LINE>return new Document(getOperator(), graphLookup);<NEW_LINE>} | "connectFromField", connectFrom.getTarget()); |
615,646 | public HiveMQExtensionEvent loadEmbeddedExtension(@NotNull final EmbeddedExtension embeddedExtension) {<NEW_LINE>final HiveMQEmbeddedExtensionImpl extension = new HiveMQEmbeddedExtensionImpl(embeddedExtension.getId(), embeddedExtension.getVersion(), embeddedExtension.getName(), embeddedExtension.getAuthor(), embeddedExtension.getPriority(), embeddedExtension.getStartPriority(), embeddedExtension.getExtensionMain(), true);<NEW_LINE>final HiveMQExtensionEvent hiveMQExtensionEvent = new HiveMQExtensionEvent(HiveMQExtensionEvent.Change.ENABLE, embeddedExtension.getId(), embeddedExtension.getStartPriority(), extension.getExtensionFolderPath(), true);<NEW_LINE>hiveMQExtensions.addHiveMQExtension(extension);<NEW_LINE>final ClassLoader extensionClassloader = extension.getExtensionClassloader();<NEW_LINE>if (extensionClassloader == null) {<NEW_LINE>throw new IllegalStateException("The extensions class loader must not be null at loading stage");<NEW_LINE>}<NEW_LINE>// need wrapper to load static context and classes.<NEW_LINE>final IsolatedExtensionClassloader isolatedExtensionClassloader = new IsolatedExtensionClassloader(extensionClassloader, HiveMQServer.class.getClassLoader());<NEW_LINE>isolatedExtensionClassloader.loadClassesWithStaticContext();<NEW_LINE>try {<NEW_LINE>staticInitializer.initialize(embeddedExtension.getId(), extensionClassloader);<NEW_LINE>} catch (final ExtensionLoadingException e) {<NEW_LINE>log.warn("Embedded extension with id \"{}\" cannot be started, the extension will be disabled. reason: {}", embeddedExtension.getId(<MASK><NEW_LINE>log.debug("Original exception", e);<NEW_LINE>Exceptions.rethrowError(e);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return hiveMQExtensionEvent;<NEW_LINE>} | ), e.getMessage()); |
924,833 | void validateTemplateInjectionPoints(TemplateFilePathsBuildItem filePaths, List<TemplatePathBuildItem> templatePaths, ValidationPhaseBuildItem validationPhase, BuildProducer<ValidationErrorBuildItem> validationErrors) {<NEW_LINE>for (InjectionPointInfo injectionPoint : validationPhase.getContext().getInjectionPoints()) {<NEW_LINE>if (injectionPoint.getRequiredType().name().equals(Names.TEMPLATE)) {<NEW_LINE>AnnotationInstance location = injectionPoint.getRequiredQualifier(Names.LOCATION);<NEW_LINE>String name;<NEW_LINE>if (location != null) {<NEW_LINE>name = location<MASK><NEW_LINE>} else if (injectionPoint.hasDefaultedQualifier()) {<NEW_LINE>name = getName(injectionPoint);<NEW_LINE>} else {<NEW_LINE>name = null;<NEW_LINE>}<NEW_LINE>if (name != null) {<NEW_LINE>// For "@Inject Template items" we try to match "items"<NEW_LINE>// For "@Location("github/pulls") Template pulls" we try to match "github/pulls"<NEW_LINE>// For "@Location("foo/bar/baz.txt") Template baz" we try to match "foo/bar/baz.txt"<NEW_LINE>if (!filePaths.contains(name)) {<NEW_LINE>validationErrors.produce(new ValidationErrorBuildItem(new TemplateException(String.format("No template found for path [%s] defined at %s\n\t- available templates: %s", name, injectionPoint.getTargetInfo(), templatePaths.stream().map(TemplatePathBuildItem::getPath).collect(Collectors.toList())))));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .value().asString(); |
1,596,762 | private static String resolveSpecialTypes(String paramInfo, final BaseFunctionElement element, TypeNameResolver typeNameResolver, final ParameterElement param) {<NEW_LINE>String parameterInfo = paramInfo;<NEW_LINE>if (// NOI18N<NEW_LINE>parameterInfo.startsWith(Type.SELF + " ") && element instanceof TypeMemberElement) {<NEW_LINE>// #267563<NEW_LINE>parameterInfo = typeNameResolver.resolve(((TypeMemberElement) element).getType().getFullyQualifiedName()).toString() + parameterInfo.substring(Type.SELF.length());<NEW_LINE>}<NEW_LINE>if (// NOI18N<NEW_LINE>parameterInfo.startsWith(Type.PARENT + " ") && element instanceof TypeMemberElement) {<NEW_LINE>TypeElement typeElement = ((TypeMemberElement) element).getType();<NEW_LINE>if (typeElement instanceof ClassElement) {<NEW_LINE>QualifiedName superClassName = ((ClassElement) typeElement).getSuperClassName();<NEW_LINE>if (superClassName != null) {<NEW_LINE>parameterInfo = typeNameResolver.resolve(superClassName).toString() + parameterInfo.substring(Type.PARENT.length());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (param.isUnionType() && element instanceof TypeMemberElement) {<NEW_LINE>parameterInfo = <MASK><NEW_LINE>}<NEW_LINE>return parameterInfo;<NEW_LINE>} | resolveSpecialTypesInUnionType(parameterInfo, element, typeNameResolver); |
1,002,095 | private void findTablesByMask(JDBCSession session, GenericCatalog catalog, GenericSchema schema, String tableNameMask, int maxResults, List<DBSObjectReference> objects) throws SQLException, DBException {<NEW_LINE>final GenericMetaObject tableObject = getDataSource().getMetaObject(GenericConstants.OBJECT_TABLE);<NEW_LINE>final DBRProgressMonitor monitor = session.getProgressMonitor();<NEW_LINE>try (JDBCResultSet dbResult = session.getMetaData().getTables(catalog == null ? null : catalog.getName(), schema == null ? null : schema.getName(), tableNameMask, null)) {<NEW_LINE>while (dbResult.next()) {<NEW_LINE>if (monitor.isCanceled()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>String catalogName = GenericUtils.safeGetStringTrimmed(tableObject, dbResult, JDBCConstants.TABLE_CAT);<NEW_LINE>String schemaName = GenericUtils.safeGetStringTrimmed(tableObject, dbResult, JDBCConstants.TABLE_SCHEM);<NEW_LINE>String tableName = GenericUtils.safeGetStringTrimmed(tableObject, dbResult, JDBCConstants.TABLE_NAME);<NEW_LINE>if (CommonUtils.isEmpty(tableName)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>objects.add(new TableReference(findContainer(session.getProgressMonitor(), catalog, schema, catalogName, schemaName), tableName, GenericUtils.safeGetString(tableObject, <MASK><NEW_LINE>if (objects.size() >= maxResults) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | dbResult, JDBCConstants.REMARKS))); |
626,279 | public com.amazonaws.services.dataexchange.model.InternalServerException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.dataexchange.model.InternalServerException internalServerException = new com.amazonaws.services.<MASK><NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<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>} 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 internalServerException;<NEW_LINE>} | dataexchange.model.InternalServerException(null); |
1,231,686 | public final // JPA2.g:506:1: boolean_literal : ( 'true' | 'false' );<NEW_LINE>JPA2Parser.boolean_literal_return boolean_literal() throws RecognitionException {<NEW_LINE>JPA2Parser.boolean_literal_return <MASK><NEW_LINE>retval.start = input.LT(1);<NEW_LINE>Object root_0 = null;<NEW_LINE>Token set592 = null;<NEW_LINE>Object set592_tree = null;<NEW_LINE>try {<NEW_LINE>// JPA2.g:507:5: ( 'true' | 'false' )<NEW_LINE>// JPA2.g:<NEW_LINE>{<NEW_LINE>root_0 = (Object) adaptor.nil();<NEW_LINE>set592 = input.LT(1);<NEW_LINE>if ((input.LA(1) >= 145 && input.LA(1) <= 146)) {<NEW_LINE>input.consume();<NEW_LINE>if (state.backtracking == 0)<NEW_LINE>adaptor.addChild(root_0, (Object) adaptor.create(set592));<NEW_LINE>state.errorRecovery = false;<NEW_LINE>state.failed = false;<NEW_LINE>} else {<NEW_LINE>if (state.backtracking > 0) {<NEW_LINE>state.failed = true;<NEW_LINE>return retval;<NEW_LINE>}<NEW_LINE>MismatchedSetException mse = new MismatchedSetException(null, input);<NEW_LINE>throw mse;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>retval.stop = input.LT(-1);<NEW_LINE>if (state.backtracking == 0) {<NEW_LINE>retval.tree = (Object) adaptor.rulePostProcessing(root_0);<NEW_LINE>adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>reportError(re);<NEW_LINE>recover(input, re);<NEW_LINE>retval.tree = (Object) adaptor.errorNode(input, retval.start, input.LT(-1), re);<NEW_LINE>} finally {<NEW_LINE>// do for sure before leaving<NEW_LINE>}<NEW_LINE>return retval;<NEW_LINE>} | retval = new JPA2Parser.boolean_literal_return(); |
1,234,271 | TableView<Pair<String, String>> createTable(final Set<Pair<String, String>> props) {<NEW_LINE>final TableView<Pair<String, String>> table = new TableView<>();<NEW_LINE>final TableColumn<Pair<String, String>, String> colName = new TableColumn<>("Name");<NEW_LINE>final TableColumn<Pair<String, String>, String> colValue = new TableColumn<>("Value");<NEW_LINE>// To fill the cells using the input pair of values (property name, value)<NEW_LINE>colName.setCellValueFactory(p -> new ReadOnlyObjectWrapper<>(p.getValue().getKey()));<NEW_LINE>colValue.setCellValueFactory(p -> new ReadOnlyObjectWrapper<>(p.getValue().getValue()));<NEW_LINE>table.getColumns().addAll(List.of(colName, colValue));<NEW_LINE>// Balancing the width of each column<NEW_LINE>table.getColumns().forEach(col -> col.prefWidthProperty().bind(table.widthProperty().divide(table.getColumns().size())));<NEW_LINE>table.getItems().addAll(props);<NEW_LINE>// Workaround to resize the table view according to its content<NEW_LINE>table.setMinHeight(props.size() * 30 + 40);<NEW_LINE>table.setMaxHeight(table.getMinHeight());<NEW_LINE>table.setPrefHeight(table.getMinHeight());<NEW_LINE>// Be able to copy the selected row<NEW_LINE>final KeyCodeCombination keyCodeCopy = new KeyCodeCombination(KeyCode.C, KeyCombination.CONTROL_ANY);<NEW_LINE>table.setOnKeyPressed(event -> {<NEW_LINE>if (keyCodeCopy.match(event) && table.getSelectionModel().getSelectedItem() != null) {<NEW_LINE>final Pair<String, String> item = table.getSelectionModel().getSelectedItem();<NEW_LINE><MASK><NEW_LINE>clipboardContent.putString(item.getKey() + ": " + item.getValue());<NEW_LINE>Clipboard.getSystemClipboard().setContent(clipboardContent);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return table;<NEW_LINE>} | final ClipboardContent clipboardContent = new ClipboardContent(); |
1,474,728 | public List<JoinResponseTimeBo> decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) {<NEW_LINE>final String id = decodingContext.getApplicationId();<NEW_LINE>final long baseTimestamp = decodingContext.getBaseTimestamp();<NEW_LINE>final <MASK><NEW_LINE>final long initialTimestamp = baseTimestamp + timestampDelta;<NEW_LINE>int numValues = valueBuffer.readVInt();<NEW_LINE>List<Long> timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);<NEW_LINE>final byte[] header = valueBuffer.readPrefixedBytes();<NEW_LINE>AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);<NEW_LINE>JoinLongFieldEncodingStrategy responseTimeEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());<NEW_LINE>final List<JoinLongFieldBo> responseTimeList = this.codec.decodeValues(valueBuffer, responseTimeEncodingStrategy, numValues);<NEW_LINE>List<JoinResponseTimeBo> joinResponseTimeBoList = new ArrayList<>();<NEW_LINE>for (int i = 0; i < numValues; i++) {<NEW_LINE>JoinResponseTimeBo joinResponseTimeBo = new JoinResponseTimeBo();<NEW_LINE>joinResponseTimeBo.setId(id);<NEW_LINE>joinResponseTimeBo.setTimestamp(timestampList.get(i));<NEW_LINE>joinResponseTimeBo.setResponseTimeJoinValue(responseTimeList.get(i));<NEW_LINE>joinResponseTimeBoList.add(joinResponseTimeBo);<NEW_LINE>}<NEW_LINE>return joinResponseTimeBoList;<NEW_LINE>} | long timestampDelta = decodingContext.getTimestampDelta(); |
294,011 | static // [START securitycenter_add_finding_security_marks]<NEW_LINE>SecurityMarks addToFinding(FindingName findingName) {<NEW_LINE>// FindingName findingName = FindingName.of(/*organization=*/"123234324",<NEW_LINE>// /*source=*/"423432321", /*findingId=*/"samplefindingid2");<NEW_LINE>try (SecurityCenterClient client = SecurityCenterClient.create()) {<NEW_LINE>// Start setting up a request to add security marks for a finding.<NEW_LINE>ImmutableMap markMap = ImmutableMap.of("key_a", "value_a", "key_b", "value_b");<NEW_LINE>// Add security marks and field mask for security marks.<NEW_LINE>SecurityMarks securityMarks = SecurityMarks.newBuilder().setName(findingName + "/securityMarks").putAllMarks(markMap).build();<NEW_LINE>FieldMask updateMask = FieldMask.newBuilder().addPaths("marks.key_a").addPaths("marks.key_b").build();<NEW_LINE>UpdateSecurityMarksRequest request = UpdateSecurityMarksRequest.newBuilder().setSecurityMarks(securityMarks).setUpdateMask(updateMask).build();<NEW_LINE>// Call the API.<NEW_LINE>SecurityMarks response = client.updateSecurityMarks(request);<NEW_LINE>System.out.println("Security Marks:");<NEW_LINE>System.out.println(response);<NEW_LINE>return response;<NEW_LINE>} catch (IOException e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new RuntimeException("Couldn't create client.", e); |
1,704,354 | private void translateTab(int scrollY, boolean animated) {<NEW_LINE>int flexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);<NEW_LINE>int tabHeight = getResources().<MASK><NEW_LINE>View imageView = findViewById(R.id.image);<NEW_LINE>View overlayView = findViewById(R.id.overlay);<NEW_LINE>TextView titleView = (TextView) findViewById(R.id.title);<NEW_LINE>// Translate overlay and image<NEW_LINE>float flexibleRange = flexibleSpaceImageHeight - getActionBarSize();<NEW_LINE>int minOverlayTransitionY = tabHeight - overlayView.getHeight();<NEW_LINE>ViewHelper.setTranslationY(overlayView, ScrollUtils.getFloat(-scrollY, minOverlayTransitionY, 0));<NEW_LINE>ViewHelper.setTranslationY(imageView, ScrollUtils.getFloat(-scrollY / 2, minOverlayTransitionY, 0));<NEW_LINE>// Change alpha of overlay<NEW_LINE>ViewHelper.setAlpha(overlayView, ScrollUtils.getFloat((float) scrollY / flexibleRange, 0, 1));<NEW_LINE>// Scale title text<NEW_LINE>float scale = 1 + ScrollUtils.getFloat((flexibleRange - scrollY - tabHeight) / flexibleRange, 0, MAX_TEXT_SCALE_DELTA);<NEW_LINE>setPivotXToTitle(titleView);<NEW_LINE>ViewHelper.setPivotY(titleView, 0);<NEW_LINE>ViewHelper.setScaleX(titleView, scale);<NEW_LINE>ViewHelper.setScaleY(titleView, scale);<NEW_LINE>// Translate title text<NEW_LINE>int maxTitleTranslationY = flexibleSpaceImageHeight - tabHeight - getActionBarSize();<NEW_LINE>int titleTranslationY = maxTitleTranslationY - scrollY;<NEW_LINE>ViewHelper.setTranslationY(titleView, titleTranslationY);<NEW_LINE>// If tabs are moving, cancel it to start a new animation.<NEW_LINE>ViewPropertyAnimator.animate(mSlidingTabLayout).cancel();<NEW_LINE>// Tabs will move between the top of the screen to the bottom of the image.<NEW_LINE>float translationY = ScrollUtils.getFloat(-scrollY + mFlexibleSpaceHeight - mTabHeight, 0, mFlexibleSpaceHeight - mTabHeight);<NEW_LINE>if (animated) {<NEW_LINE>// Animation will be invoked only when the current tab is changed.<NEW_LINE>ViewPropertyAnimator.animate(mSlidingTabLayout).translationY(translationY).setDuration(200).start();<NEW_LINE>} else {<NEW_LINE>// When Fragments' scroll, translate tabs immediately (without animation).<NEW_LINE>ViewHelper.setTranslationY(mSlidingTabLayout, translationY);<NEW_LINE>}<NEW_LINE>} | getDimensionPixelSize(R.dimen.tab_height); |
266,690 | private String uploadFile(String sourceFile, String destinationUrl) throws IOException, URISyntaxException {<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_DEBUG, "Start"));<NEW_LINE>String result = ERROR;<NEW_LINE>httpClient = createHttpsClient();<NEW_LINE>HttpParams params = httpClient.getParams();<NEW_LINE>if (isUrlDirect(destinationUrl) == false) {<NEW_LINE>setProxy();<NEW_LINE>String proxyHost = System.getProperty("http.proxyHost");<NEW_LINE>String proxyPort = System.getProperty("http.proxyPort");<NEW_LINE>if ((proxyHost != null) && (proxyPort != null)) {<NEW_LINE>try {<NEW_LINE>HttpHost proxy = new HttpHost(proxyHost, Integer.parseInt(proxyPort));<NEW_LINE>httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_ERROR, e.getMessage()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);<NEW_LINE>HttpConnectionParams.setConnectionTimeout(params, HTTP_TIMEOUT);<NEW_LINE>HttpConnectionParams.setSoTimeout(params, HTTP_TIMEOUT);<NEW_LINE>URL url = new URL(fixUrl(destinationUrl));<NEW_LINE>HttpPost httpPost = new <MASK><NEW_LINE>File sourceFileObject = new File(sourceFile);<NEW_LINE>if (sourceFileObject.exists() == false)<NEW_LINE>throw (new IOException("source file not found"));<NEW_LINE>FileBody fileContent = new FileBody(new File(sourceFile));<NEW_LINE>MultipartEntity reqEntity = new MultipartEntity();<NEW_LINE>// Insert Authorization header if required<NEW_LINE>if (m_username.length() > 0) {<NEW_LINE>byte[] encodedPasswordBuffer = (m_username + ":" + m_password).getBytes();<NEW_LINE>Base64 encoder = new Base64();<NEW_LINE>String encodedPassword = encoder.encodeToString(encodedPasswordBuffer);<NEW_LINE>encodedPassword = encodedPassword.substring(0, encodedPassword.length() - 2);<NEW_LINE>httpPost.setHeader("Authorization", "Basic " + encodedPassword);<NEW_LINE>}<NEW_LINE>reqEntity.addPart("SpbImagerFile", fileContent);<NEW_LINE>httpPost.setHeader("Cache-Control", "no-cache");<NEW_LINE>httpPost.setHeader("User-Agent", "Symbol RhoElements");<NEW_LINE>httpPost.getParams().setBooleanParameter("http.protocol.expect-continue", false);<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_INFO, "executing request " + httpPost.getRequestLine()));<NEW_LINE>httpPost.setEntity(reqEntity);<NEW_LINE>result = httpClient.execute(httpPost, new CustomHttpResponse());<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_DEBUG, "End"));<NEW_LINE>return result;<NEW_LINE>} | HttpPost(url.toURI()); |
832,018 | public Object calculate(Context ctx) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>if (param == null || param.isLeaf()) {<NEW_LINE>throw new RQException("FCoups:" + mm.getMessage("function.missingParam"));<NEW_LINE>}<NEW_LINE>Object[] result = new Object[2];<NEW_LINE>for (int i = 0; i < 2; i++) {<NEW_LINE>IParam sub = param.getSub(i);<NEW_LINE>if (sub != null) {<NEW_LINE>result[i] = sub.getLeafExpression().calculate(ctx);<NEW_LINE>if (result[i] == null) {<NEW_LINE>throw new RQException("The " + i + "th param of Fcoups:" + mm.getMessage("function.paramValNull"));<NEW_LINE>}<NEW_LINE>if (!(result[i] instanceof Date)) {<NEW_LINE>throw new RQException("The " + i + "th param of Fcoups:" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Date settlement = (Date) result[0];<NEW_LINE>Date maturity = (Date) result[1];<NEW_LINE>if (Variant.compare(settlement, maturity) == 1) {<NEW_LINE>throw new RQException("The maturity of FCoups should be later than settlement");<NEW_LINE>}<NEW_LINE>double frequency = 1;<NEW_LINE>int basis = 0;<NEW_LINE>if (option != null && option.indexOf("2") >= 0)<NEW_LINE>frequency = 2;<NEW_LINE>else if (option != null && option.indexOf("4") >= 0)<NEW_LINE>frequency = 4;<NEW_LINE>else<NEW_LINE>frequency = 1;<NEW_LINE>if (option != null && option.indexOf("1") >= 0)<NEW_LINE>basis = 1;<NEW_LINE>else if (option != null && option.indexOf("0") >= 0)<NEW_LINE>basis = 2;<NEW_LINE>else if (option != null && option.indexOf("5") >= 0)<NEW_LINE>basis = 3;<NEW_LINE>else if (option != null && option.indexOf("e") >= 0)<NEW_LINE>basis = 4;<NEW_LINE>else<NEW_LINE>basis = 0;<NEW_LINE>if (option == null || (option.indexOf("d") < 0 && option.indexOf("b") < 0 && option.indexOf("n") < 0)) {<NEW_LINE>return coupnum(<MASK><NEW_LINE>}<NEW_LINE>return coupdays(maturity, settlement, frequency, basis);<NEW_LINE>} | maturity, settlement, frequency, basis); |
1,158,044 | public List<Fact> createFacts(final AcctSchema as) {<NEW_LINE>setC_Currency_ID(as.getCurrencyId());<NEW_LINE>final ArrayList<Fact> <MASK><NEW_LINE>final CostCollectorType costCollectorType = getCostCollectorType();<NEW_LINE>if (CostCollectorType.MaterialReceipt.equals(costCollectorType)) {<NEW_LINE>facts.addAll(createFacts_MaterialReceipt(as));<NEW_LINE>} else if (CostCollectorType.ComponentIssue.equals(costCollectorType)) {<NEW_LINE>facts.addAll(createFacts_ComponentIssue(as));<NEW_LINE>} else if (CostCollectorType.MethodChangeVariance.equals(costCollectorType)) {<NEW_LINE>facts.addAll(createFacts_Variance(as, ProductAcctType.MethodChangeVariance));<NEW_LINE>} else if (CostCollectorType.UsageVariance.equals(costCollectorType)) {<NEW_LINE>facts.addAll(createFacts_Variance(as, ProductAcctType.UsageVariance));<NEW_LINE>} else if (CostCollectorType.RateVariance.equals(costCollectorType)) {<NEW_LINE>facts.addAll(createFacts_Variance(as, ProductAcctType.RateVariance));<NEW_LINE>} else if (CostCollectorType.MixVariance.equals(costCollectorType)) {<NEW_LINE>facts.addAll(createFacts_Variance(as, ProductAcctType.MixVariance));<NEW_LINE>} else if (CostCollectorType.ActivityControl.equals(costCollectorType)) {<NEW_LINE>facts.addAll(createFacts_ActivityControl(as));<NEW_LINE>} else {<NEW_LINE>throw newPostingException().setDetailMessage("Unknown costCollectorType: " + costCollectorType);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>return facts;<NEW_LINE>} | facts = new ArrayList<>(); |
71,451 | public List<CompletableFuture<Long>> executeBulk(TransactionContext txnCtx) {<NEW_LINE>Iterable<NodeOperation> nodeOperations = nodeOperationTrees.stream().flatMap(opTree -> opTree.nodeOperations().stream())::iterator;<NEW_LINE>Map<String, Collection<NodeOperation>> operationByServer = NodeOperationGrouper.groupByServer(nodeOperations);<NEW_LINE>List<ExecutionPhase> handlerPhases = new ArrayList<>(nodeOperationTrees.size());<NEW_LINE>List<RowConsumer> handlerConsumers = new ArrayList<<MASK><NEW_LINE>List<CompletableFuture<Long>> results = new ArrayList<>(nodeOperationTrees.size());<NEW_LINE>for (NodeOperationTree nodeOperationTree : nodeOperationTrees) {<NEW_LINE>CollectingRowConsumer<?, Long> consumer = new CollectingRowConsumer<>(Collectors.collectingAndThen(Collectors.summingLong(r -> ((long) r.get(0))), sum -> sum));<NEW_LINE>handlerConsumers.add(consumer);<NEW_LINE>results.add(consumer.completionFuture());<NEW_LINE>handlerPhases.add(nodeOperationTree.leaf());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>setupTasks(txnCtx, operationByServer, handlerPhases, handlerConsumers);<NEW_LINE>} catch (Throwable throwable) {<NEW_LINE>return Collections.singletonList(CompletableFuture.failedFuture(throwable));<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | >(nodeOperationTrees.size()); |
609,360 | private void generateNormalVirtualCall(MethodReference reference, List<? extends Expr> arguments) {<NEW_LINE>VirtualTable vtable = context.getVirtualTableProvider().lookup(reference.getClassName());<NEW_LINE>String vtableClass = null;<NEW_LINE>if (vtable != null) {<NEW_LINE>VirtualTable containingVt = vtable.findMethodContainer(reference.getDescriptor());<NEW_LINE>if (containingVt != null) {<NEW_LINE>vtableClass = containingVt.getClassName();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (vtableClass == null) {<NEW_LINE>generateNoMethodCall(reference, arguments);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Expr <MASK><NEW_LINE>boolean closingParenthesis = false;<NEW_LINE>String receiver;<NEW_LINE>if (receiverArg instanceof VariableExpr) {<NEW_LINE>receiver = getVariableName(((VariableExpr) receiverArg).getIndex());<NEW_LINE>} else {<NEW_LINE>receiver = allocTemporaryVariable(CVariableType.PTR);<NEW_LINE>writer.print("((").print(receiver).print(" = ");<NEW_LINE>visitReference(receiverArg);<NEW_LINE>writer.print("), ");<NEW_LINE>closingParenthesis = true;<NEW_LINE>}<NEW_LINE>includes.includeClass(vtableClass);<NEW_LINE>writer.print("TEAVM_METHOD(").print(receiver).print(", ").print(names.forClassClass(vtableClass)).print(", ").print(names.forVirtualMethod(reference.getDescriptor())).print(")(").print(receiver);<NEW_LINE>for (int i = 1; i < arguments.size(); ++i) {<NEW_LINE>writer.print(", ");<NEW_LINE>arguments.get(i).acceptVisitor(this);<NEW_LINE>}<NEW_LINE>writer.print(")");<NEW_LINE>if (closingParenthesis) {<NEW_LINE>writer.print(")");<NEW_LINE>freeTemporaryVariable(CVariableType.PTR);<NEW_LINE>}<NEW_LINE>} | receiverArg = arguments.get(0); |
1,131,213 | protected Query doToQuery(SearchExecutionContext searchExecutionContext) throws IOException {<NEW_LINE>// TODO: should we be passing activeFeatures here?<NEW_LINE>LtrQueryContext context = new LtrQueryContext(searchExecutionContext);<NEW_LINE>if (StoredFeature.TYPE.equals(element.type())) {<NEW_LINE>Feature feature = ((StoredFeature) element).optimize();<NEW_LINE>if (feature instanceof PrecompiledExpressionFeature) {<NEW_LINE>// Derived features cannot be tested alone<NEW_LINE>return new MatchAllDocsQuery();<NEW_LINE>}<NEW_LINE>// TODO: support activeFeatures in Validating queries<NEW_LINE>return feature.doToQuery(context, null, validation.getParams());<NEW_LINE>} else if (StoredFeatureSet.TYPE.equals(element.type())) {<NEW_LINE>FeatureSet set = ((StoredFeatureSet) element).optimize();<NEW_LINE>LinearRanker ranker = new LinearRanker(new float[set.size()]);<NEW_LINE>CompiledLtrModel model = new CompiledLtrModel("validation", set, ranker);<NEW_LINE>return RankerQuery.build(model, context, validation.getParams(), false);<NEW_LINE>} else if (StoredLtrModel.TYPE.equals(element.type())) {<NEW_LINE>CompiledLtrModel model = ((StoredLtrModel<MASK><NEW_LINE>return RankerQuery.build(model, context, validation.getParams(), false);<NEW_LINE>} else {<NEW_LINE>throw new QueryShardException(searchExecutionContext, "Unknown element type [" + element.type() + "]");<NEW_LINE>}<NEW_LINE>} | ) element).compile(factory); |
1,046,244 | private void classNameChanged(ActionEvent ac) {<NEW_LINE>final String s = source.getText().trim();<NEW_LINE>if (s.equals(oldText)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (loaderSelect.getSelectedItem() == LoaderPolicy.SYSTEM) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>class UT extends UserTask implements ClasspathInfo.Provider {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ClasspathInfo getClasspathInfo() {<NEW_LINE>return JShellOptions2.this.getClasspathInfo();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(ResultIterator resultIterator) throws Exception {<NEW_LINE>CompilationInfo cc = CompilationInfo.get(resultIterator.getParserResult());<NEW_LINE>TypeElement tel = cc.getElements().getTypeElement(s);<NEW_LINE>if (tel != null) {<NEW_LINE>targetClass = ElementHandle.create(tel);<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>targetClass = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>ParserManager.parse<MASK><NEW_LINE>} catch (ParseException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>this.message = null;<NEW_LINE>if (targetClass == null) {<NEW_LINE>this.message = Bundle.ERR_ClassNameInvalid();<NEW_LINE>} else {<NEW_LINE>changedOptions.put(PropertyNames.JSHELL_CLASSNAME, s);<NEW_LINE>}<NEW_LINE>updateMembers();<NEW_LINE>oldText = s;<NEW_LINE>if (disableUpdates) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>storeChanges();<NEW_LINE>} | ("text/x-java", new UT()); |
83,958 | private PreparedStatement createQueryStatement(Connection conn, OracleTriggerMonitoredSourceInfo source, long sinceScn, int currentFetchSize, boolean useChunking) throws SQLException {<NEW_LINE><MASK><NEW_LINE>String eventQuery = null;<NEW_LINE>ChunkingType type = _chunkingType;<NEW_LINE>if (!useChunking || (!type.isChunkingEnabled())) {<NEW_LINE>eventQuery = _eventQueriesBySource.get(source.getSourceId());<NEW_LINE>} else {<NEW_LINE>if (type == ChunkingType.SCN_CHUNKING)<NEW_LINE>eventQuery = _eventChunkedScnQueriesBySource.get(source.getSourceId());<NEW_LINE>else<NEW_LINE>eventQuery = _eventChunkedTxnQueriesBySource.get(source.getSourceId());<NEW_LINE>}<NEW_LINE>if (debugEnabled)<NEW_LINE>_log.debug("source[" + source.getEventView() + "]: " + eventQuery + "; skipInfinityScn=" + source.isSkipInfinityScn() + " ; sinceScn=" + sinceScn);<NEW_LINE>PreparedStatement pStmt = conn.prepareStatement(eventQuery);<NEW_LINE>if (!useChunking || (!type.isChunkingEnabled())) {<NEW_LINE>pStmt.setFetchSize(currentFetchSize);<NEW_LINE>pStmt.setLong(1, sinceScn);<NEW_LINE>if (!source.isSkipInfinityScn())<NEW_LINE>pStmt.setLong(2, sinceScn);<NEW_LINE>} else {<NEW_LINE>int i = 1;<NEW_LINE>pStmt.setLong(i++, sinceScn);<NEW_LINE>pStmt.setLong(i++, sinceScn);<NEW_LINE>if (ChunkingType.TXN_CHUNKING == type) {<NEW_LINE>pStmt.setLong(i++, _txnsPerChunk);<NEW_LINE>} else {<NEW_LINE>long untilScn = sinceScn + _scnChunkSize;<NEW_LINE>_log.info("SCN chunking mode, next target SCN is: " + untilScn);<NEW_LINE>pStmt.setLong(i++, untilScn);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return pStmt;<NEW_LINE>} | boolean debugEnabled = _log.isDebugEnabled(); |
1,779,699 | public static ErrorDescription apply(HintContext hc) {<NEW_LINE>if (hc.isCanceled()) {<NEW_LINE>// NOI18N<NEW_LINE>// we pass only if it is an annotation<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final JPAProblemContext ctx = ModelUtils.getOrCreateCachedContext(hc);<NEW_LINE>if (ctx == null || hc.isCanceled()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TypeElement subject = ctx.getJavaClass();<NEW_LINE>AnnotationMirror isENtityMapped = getFirstAnnotationFromGivenSet(subject, Arrays.asList(JPAAnnotations<MASK><NEW_LINE>if (isENtityMapped != null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>AnnotationMirror firstOffendingAnotation = getFirstAnnotationFromGivenSet(subject, Arrays.asList(JPAAnnotations.NAMED_QUERY, JPAAnnotations.NAMED_NATIVE_QUERY, JPAAnnotations.NAMED_QUERIES, JPAAnnotations.NAMED_NATIVE_QUERIES));<NEW_LINE>if (firstOffendingAnotation != null) {<NEW_LINE>TreePath par = hc.getPath();<NEW_LINE>while (par != null && par.getParentPath() != null && par.getLeaf().getKind() != Tree.Kind.CLASS) {<NEW_LINE>par = par.getParentPath();<NEW_LINE>}<NEW_LINE>Utilities.TextSpan underlineSpan = Utilities.getUnderlineSpan(ctx.getCompilationInfo(), par.getLeaf());<NEW_LINE>return ErrorDescriptionFactory.forSpan(hc, underlineSpan.getStartOffset(), underlineSpan.getEndOffset(), NbBundle.getMessage(QueriesProperlyDefined.class, "MSG_QueriesProperlyDefined"));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | .ENTITY, JPAAnnotations.MAPPED_SUPERCLASS)); |
1,141,524 | // @Override<NEW_LINE>public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException {<NEW_LINE>System.out.println("Updating configuration properties:" + properties);<NEW_LINE>String id = (String) properties.get("id");<NEW_LINE>_properties = cloneDictionary(properties);<NEW_LINE>System.out.println("pid:" + pid + " id:" + id);<NEW_LINE>if (_context != null) {<NEW_LINE>System.out.println("register User Identity Resolver service upon pid:" + pid);<NEW_LINE>Dictionary<String, <MASK><NEW_LINE>String vendor = (String) serviceProps.get("service.vendor");<NEW_LINE>if (vendor == null || vendor.isEmpty()) {<NEW_LINE>vendor = "IBM";<NEW_LINE>}<NEW_LINE>serviceProps.put("service.vendor", vendor);<NEW_LINE>// Lets registered the service<NEW_LINE>UserCredentialResolver idService = new OAuth20TokenMappingResolver(serviceProps);<NEW_LINE>ServiceRegistration<UserCredentialResolver> sr = _context.registerService(UserCredentialResolver.class, idService, serviceProps);<NEW_LINE>userIdentityResolverRef.put(pid, sr);<NEW_LINE>}<NEW_LINE>} | Object> serviceProps = cloneDictionary(properties); |
1,099,896 | private HoldingContainer visitBooleanOr(BooleanOperator op, ClassGenerator<?> generator) {<NEW_LINE>HoldingContainer out = generator.declare(op.getMajorType());<NEW_LINE>JLabel label = generator.getEvalBlockLabel("OrOP");<NEW_LINE>JBlock eval = generator.createInnerEvalBlock();<NEW_LINE>// enter into nested block.<NEW_LINE>generator.nestEvalBlock(eval);<NEW_LINE>HoldingContainer arg = null;<NEW_LINE>JExpression e = null;<NEW_LINE>// value of boolean "or" when one side is null<NEW_LINE>// p q p and q<NEW_LINE>// true null true<NEW_LINE>// false null null<NEW_LINE>// null true true<NEW_LINE>// null false null<NEW_LINE>// null null null<NEW_LINE>for (LogicalExpression expr : op.args()) {<NEW_LINE>arg = expr.accept(this, generator);<NEW_LINE>JBlock earlyExit = null;<NEW_LINE>if (arg.isOptional()) {<NEW_LINE>earlyExit = eval._if(arg.getIsSet().eq(JExpr.lit(1)).cand(arg.getValue().eq(JExpr.lit(1))))._then();<NEW_LINE>if (e == null) {<NEW_LINE>e = arg.getIsSet();<NEW_LINE>} else {<NEW_LINE>e = e.mul(arg.getIsSet());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>earlyExit = eval._if(arg.getValue().eq(JExpr.lit(1)))._then();<NEW_LINE>}<NEW_LINE>if (out.isOptional()) {<NEW_LINE>earlyExit.assign(out.getIsSet(), JExpr.lit(1));<NEW_LINE>}<NEW_LINE>earlyExit.assign(out.getValue(), JExpr.lit(1));<NEW_LINE>earlyExit._break(label);<NEW_LINE>}<NEW_LINE>if (out.isOptional()) {<NEW_LINE>assert (e != null);<NEW_LINE>JConditional notSetJC = eval._if(e.eq(JExpr.lit(0)));<NEW_LINE>notSetJC._then().assign(out.getIsSet(), JExpr.lit(0));<NEW_LINE>JBlock setBlock = notSetJC._else().block();<NEW_LINE>setBlock.assign(out.getIsSet(), JExpr.lit(1));<NEW_LINE>setBlock.assign(out.getValue(), JExpr.lit(0));<NEW_LINE>} else {<NEW_LINE>assert (e == null);<NEW_LINE>eval.assign(out.getValue()<MASK><NEW_LINE>}<NEW_LINE>// exit from nested block.<NEW_LINE>generator.unNestEvalBlock();<NEW_LINE>return out;<NEW_LINE>} | , JExpr.lit(0)); |
1,140,428 | public Request<SetIdentityDkimEnabledRequest> marshall(SetIdentityDkimEnabledRequest setIdentityDkimEnabledRequest) {<NEW_LINE>if (setIdentityDkimEnabledRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(SetIdentityDkimEnabledRequest)");<NEW_LINE>}<NEW_LINE>Request<SetIdentityDkimEnabledRequest> request = new DefaultRequest<MASK><NEW_LINE>request.addParameter("Action", "SetIdentityDkimEnabled");<NEW_LINE>request.addParameter("Version", "2010-12-01");<NEW_LINE>String prefix;<NEW_LINE>if (setIdentityDkimEnabledRequest.getIdentity() != null) {<NEW_LINE>prefix = "Identity";<NEW_LINE>String identity = setIdentityDkimEnabledRequest.getIdentity();<NEW_LINE>request.addParameter(prefix, StringUtils.fromString(identity));<NEW_LINE>}<NEW_LINE>if (setIdentityDkimEnabledRequest.getDkimEnabled() != null) {<NEW_LINE>prefix = "DkimEnabled";<NEW_LINE>Boolean dkimEnabled = setIdentityDkimEnabledRequest.getDkimEnabled();<NEW_LINE>request.addParameter(prefix, StringUtils.fromBoolean(dkimEnabled));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | <SetIdentityDkimEnabledRequest>(setIdentityDkimEnabledRequest, "AmazonSimpleEmailService"); |
330,540 | public void show(final String date) {<NEW_LINE>dialog = setDialogLayout();<NEW_LINE>UIUtil.setDialogDefaultFunctions(dialog);<NEW_LINE>ExUtil.asyncRun(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>ObjectPack objectPack = null;<NEW_LINE>TcpProxy proxy = TcpProxy.getTcpProxy(serverId);<NEW_LINE>try {<NEW_LINE>MapPack param = new MapPack();<NEW_LINE>param.put("date", date);<NEW_LINE>param.put("objHash", objHash);<NEW_LINE>objectPack = (ObjectPack) proxy.getSingle(RequestCmd.OBJECT_INFO, param);<NEW_LINE>CounterEngine counterEngine = ServerManager.getInstance().<MASK><NEW_LINE>String code = counterEngine.getMasterCounter(objectPack.objType);<NEW_LINE>objectPack.tags.put("main counter", code);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>ConsoleProxy.errorSafe(t.toString());<NEW_LINE>} finally {<NEW_LINE>TcpProxy.putTcpProxy(proxy);<NEW_LINE>}<NEW_LINE>ObjectPropertiesDialog.this.objectPack = objectPack;<NEW_LINE>ExUtil.exec(propertyTableViewer.getTable(), new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>makeTableContents();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | getServer(serverId).getCounterEngine(); |
248,437 | private boolean returnsNormalizedAbstractValueType(ExecutableElement validationMethodCandidate) {<NEW_LINE>Optional<DeclaringType<MASK><NEW_LINE>if (!declaringType.isPresent()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>TypeStringProvider provider = new TypeStringProvider(reporter, validationMethodCandidate, resolveReturnType(validationMethodCandidate), new ImportsTypeStringResolver(declaringType.orNull(), declaringType.orNull()), protoclass.constitution().generics().vars(), null);<NEW_LINE>provider.process();<NEW_LINE>String returnTypeName = provider.returnTypeName();<NEW_LINE>boolean isCompatibleReturnType = protoclass.constitution().typeAbstract().toString().equals(returnTypeName) || protoclass.constitution().typeImmutable().toString().equals(returnTypeName);<NEW_LINE>if (!isCompatibleReturnType) {<NEW_LINE>report(validationMethodCandidate).error("Method '%s' annotated with @%s should have compatible return type to" + " be used as normalization method. It should return abstract value type itself" + " or immutable generated type (i.e. %s or %s)", validationMethodCandidate.getSimpleName(), CheckMirror.simpleName(), protoclass.constitution().typeAbstract(), protoclass.constitution().typeImmutable());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | > declaringType = protoclass.declaringType(); |
1,774,778 | public static FromChannelCredentialsResult from(ChannelCredentials creds) {<NEW_LINE>if (creds instanceof TlsChannelCredentials) {<NEW_LINE>TlsChannelCredentials tlsCreds = (TlsChannelCredentials) creds;<NEW_LINE>Set<TlsChannelCredentials.Feature> incomprehensible = tlsCreds.incomprehensible(understoodTlsFeatures);<NEW_LINE>if (!incomprehensible.isEmpty()) {<NEW_LINE>return FromChannelCredentialsResult.error("TLS features not understood: " + incomprehensible);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (tlsCreds.getKeyManagers() != null) {<NEW_LINE>builder.keyManager(new FixedKeyManagerFactory(tlsCreds.getKeyManagers()));<NEW_LINE>} else if (tlsCreds.getPrivateKey() != null) {<NEW_LINE>builder.keyManager(new ByteArrayInputStream(tlsCreds.getCertificateChain()), new ByteArrayInputStream(tlsCreds.getPrivateKey()), tlsCreds.getPrivateKeyPassword());<NEW_LINE>}<NEW_LINE>if (tlsCreds.getTrustManagers() != null) {<NEW_LINE>builder.trustManager(new FixedTrustManagerFactory(tlsCreds.getTrustManagers()));<NEW_LINE>} else if (tlsCreds.getRootCertificates() != null) {<NEW_LINE>builder.trustManager(new ByteArrayInputStream(tlsCreds.getRootCertificates()));<NEW_LINE>}<NEW_LINE>// else use system default<NEW_LINE>try {<NEW_LINE>return FromChannelCredentialsResult.negotiator(tlsClientFactory(builder.build()));<NEW_LINE>} catch (SSLException ex) {<NEW_LINE>log.log(Level.FINE, "Exception building SslContext", ex);<NEW_LINE>return FromChannelCredentialsResult.error("Unable to create SslContext: " + ex.getMessage());<NEW_LINE>}<NEW_LINE>} else if (creds instanceof InsecureChannelCredentials) {<NEW_LINE>return FromChannelCredentialsResult.negotiator(plaintextClientFactory());<NEW_LINE>} else if (creds instanceof CompositeChannelCredentials) {<NEW_LINE>CompositeChannelCredentials compCreds = (CompositeChannelCredentials) creds;<NEW_LINE>return from(compCreds.getChannelCredentials()).withCallCredentials(compCreds.getCallCredentials());<NEW_LINE>} else if (creds instanceof NettyChannelCredentials) {<NEW_LINE>NettyChannelCredentials nettyCreds = (NettyChannelCredentials) creds;<NEW_LINE>return FromChannelCredentialsResult.negotiator(nettyCreds.getNegotiator());<NEW_LINE>} else if (creds instanceof ChoiceChannelCredentials) {<NEW_LINE>ChoiceChannelCredentials choiceCreds = (ChoiceChannelCredentials) creds;<NEW_LINE>StringBuilder error = new StringBuilder();<NEW_LINE>for (ChannelCredentials innerCreds : choiceCreds.getCredentialsList()) {<NEW_LINE>FromChannelCredentialsResult result = from(innerCreds);<NEW_LINE>if (result.error == null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>error.append(", ");<NEW_LINE>error.append(result.error);<NEW_LINE>}<NEW_LINE>return FromChannelCredentialsResult.error(error.substring(2));<NEW_LINE>} else {<NEW_LINE>return FromChannelCredentialsResult.error("Unsupported credential type: " + creds.getClass().getName());<NEW_LINE>}<NEW_LINE>} | SslContextBuilder builder = GrpcSslContexts.forClient(); |
1,714,781 | public void write(org.apache.thrift.protocol.TProtocol prot, UpdateErrors struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;<NEW_LINE>java.util.BitSet optionals = new java.util.BitSet();<NEW_LINE>if (struct.isSetFailedExtents()) {<NEW_LINE>optionals.set(0);<NEW_LINE>}<NEW_LINE>if (struct.isSetViolationSummaries()) {<NEW_LINE>optionals.set(1);<NEW_LINE>}<NEW_LINE>if (struct.isSetAuthorizationFailures()) {<NEW_LINE>optionals.set(2);<NEW_LINE>}<NEW_LINE>oprot.writeBitSet(optionals, 3);<NEW_LINE>if (struct.isSetFailedExtents()) {<NEW_LINE>{<NEW_LINE>oprot.writeI32(struct.failedExtents.size());<NEW_LINE>for (java.util.Map.Entry<TKeyExtent, java.lang.Long> _iter72 : struct.failedExtents.entrySet()) {<NEW_LINE>_iter72.<MASK><NEW_LINE>oprot.writeI64(_iter72.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (struct.isSetViolationSummaries()) {<NEW_LINE>{<NEW_LINE>oprot.writeI32(struct.violationSummaries.size());<NEW_LINE>for (TConstraintViolationSummary _iter73 : struct.violationSummaries) {<NEW_LINE>_iter73.write(oprot);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (struct.isSetAuthorizationFailures()) {<NEW_LINE>{<NEW_LINE>oprot.writeI32(struct.authorizationFailures.size());<NEW_LINE>for (java.util.Map.Entry<TKeyExtent, org.apache.accumulo.core.clientImpl.thrift.SecurityErrorCode> _iter74 : struct.authorizationFailures.entrySet()) {<NEW_LINE>_iter74.getKey().write(oprot);<NEW_LINE>oprot.writeI32(_iter74.getValue().getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getKey().write(oprot); |
517,776 | protected String toJson() {<NEW_LINE>JsonObject json = new JsonObject();<NEW_LINE>json.addProperty("sessionId", this.sessionId);<NEW_LINE>json.addProperty("createdAt", this.createdAt);<NEW_LINE>json.addProperty("recording", this.recording);<NEW_LINE>// Add keys from SessionProperties<NEW_LINE>JsonObject sessionPropertiesJson <MASK><NEW_LINE>for (Map.Entry<String, JsonElement> entry : sessionPropertiesJson.entrySet()) {<NEW_LINE>json.add(entry.getKey(), entry.getValue().deepCopy());<NEW_LINE>}<NEW_LINE>// Add "connections" object<NEW_LINE>JsonObject connections = new JsonObject();<NEW_LINE>connections.addProperty("numberOfElements", this.getConnections().size());<NEW_LINE>JsonArray jsonArrayConnections = new JsonArray();<NEW_LINE>this.getConnections().forEach(con -> {<NEW_LINE>jsonArrayConnections.add(con.toJson());<NEW_LINE>});<NEW_LINE>connections.add("content", jsonArrayConnections);<NEW_LINE>json.add("connections", connections);<NEW_LINE>return json.toString();<NEW_LINE>} | = this.properties.toJson(); |
1,839,097 | static String addLineNumbers(final String javaSource) {<NEW_LINE>final StringBuilder sb = new StringBuilder(javaSource);<NEW_LINE>sb.insert(0, "<a name=1 href=#1>1</a> ");<NEW_LINE>int line = 2;<NEW_LINE>int index = sb.indexOf(BR);<NEW_LINE>while (index != -1) {<NEW_LINE>final int offset <MASK><NEW_LINE>final String strLine = Integer.toString(line);<NEW_LINE>sb.insert(offset, "</a> ");<NEW_LINE>sb.insert(offset, strLine);<NEW_LINE>sb.insert(offset, '>');<NEW_LINE>sb.insert(offset, strLine);<NEW_LINE>sb.insert(offset, " href=#");<NEW_LINE>sb.insert(offset, strLine);<NEW_LINE>sb.insert(offset, "<a name=");<NEW_LINE>index = sb.indexOf(BR, index + 1);<NEW_LINE>line++;<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | = index + BR.length(); |
1,589,559 | protected void addStandardClassSources(String moduleUri, ClassLoader rootClassLoader, ClassSource_Aggregate classSource) throws ClassSource_Exception {<NEW_LINE>String useApplicationLibPath = getApplicationLibraryPath();<NEW_LINE>List<String> applicationLibJarPaths;<NEW_LINE>if (useApplicationLibPath != null) {<NEW_LINE>applicationLibJarPaths = selectJars(useApplicationLibPath);<NEW_LINE>} else {<NEW_LINE>applicationLibJarPaths = getApplicationLibraryJarPaths();<NEW_LINE>}<NEW_LINE>if (applicationLibJarPaths != null) {<NEW_LINE>for (String nextJarPath : applicationLibJarPaths) {<NEW_LINE>// throws ClassSource_Exception<NEW_LINE>getFactory().addJarClassSource(classSource, nextJarPath, nextJarPath, ScanPolicy.EXTERNAL);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<MASK><NEW_LINE>if (manifestJarPaths != null) {<NEW_LINE>for (String nextManifestJarPath : manifestJarPaths) {<NEW_LINE>// throws ClassSource_Exception<NEW_LINE>getFactory().addJarClassSource(classSource, nextManifestJarPath, nextManifestJarPath, ScanPolicy.EXTERNAL);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (rootClassLoader != null) {<NEW_LINE>getFactory().addClassLoaderClassSource(classSource, "classloader", rootClassLoader);<NEW_LINE>}<NEW_LINE>} | <String> manifestJarPaths = getManifestJarPaths(); |
1,039,056 | public void checkEmptyPeriod(Timesheet timesheet) throws AxelorException {<NEW_LINE>LeaveService leaveService = Beans.get(LeaveService.class);<NEW_LINE>PublicHolidayHrService publicHolidayHrService = Beans.get(PublicHolidayHrService.class);<NEW_LINE>User user = timesheet.getUser();<NEW_LINE>Employee employee = user.getEmployee();<NEW_LINE>if (employee == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (employee.getPublicHolidayEventsPlanning() == null) {<NEW_LINE>throw new AxelorException(timesheet, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.TIMESHEET_EMPLOYEE_PUBLIC_HOLIDAY_EVENTS_PLANNING), user.getName());<NEW_LINE>}<NEW_LINE>WeeklyPlanning planning = employee.getWeeklyPlanning();<NEW_LINE>if (planning == null) {<NEW_LINE>throw new AxelorException(timesheet, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.TIMESHEET_EMPLOYEE_DAY_PLANNING<MASK><NEW_LINE>}<NEW_LINE>List<DayPlanning> dayPlanningList = planning.getWeekDays();<NEW_LINE>Map<Integer, String> correspMap = getCorresMap();<NEW_LINE>List<TimesheetLine> timesheetLines = timesheet.getTimesheetLineList();<NEW_LINE>timesheetLines.sort(Comparator.comparing(TimesheetLine::getDate));<NEW_LINE>for (int i = 0; i < timesheetLines.size(); i++) {<NEW_LINE>if (i + 1 < timesheetLines.size()) {<NEW_LINE>LocalDate date1 = timesheetLines.get(i).getDate();<NEW_LINE>LocalDate date2 = timesheetLines.get(i + 1).getDate();<NEW_LINE>LocalDate missingDay = date1.plusDays(1);<NEW_LINE>while (ChronoUnit.DAYS.between(date1, date2) > 1) {<NEW_LINE>if (isWorkedDay(missingDay, correspMap, dayPlanningList) && !leaveService.isLeaveDay(user, missingDay) && !publicHolidayHrService.checkPublicHolidayDay(missingDay, employee)) {<NEW_LINE>throw new AxelorException(TraceBackRepository.CATEGORY_MISSING_FIELD, "Line for %s is missing.", missingDay);<NEW_LINE>}<NEW_LINE>date1 = missingDay;<NEW_LINE>missingDay = missingDay.plusDays(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), user.getName()); |
373,860 | public void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap) {<NEW_LINE>Preconditions.checkArgument(arguments.size() == 3 || arguments.size() == 2, "Transform function %s requires 2 or 3 arguments", getName());<NEW_LINE>if (arguments.size() == 3) {<NEW_LINE>TransformFunction transformFunction = arguments.get(0);<NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().isSingleValue(), "First argument must be single-valued for transform function: %s", getName());<NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType().getStoredType().isNumeric() || transformFunction instanceof LiteralTransformFunction, "The first argument must be numeric");<NEW_LINE>_firstArgument = transformFunction;<NEW_LINE><MASK><NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().isSingleValue(), "Second argument must be single-valued for transform function: %s", getName());<NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType().getStoredType().isNumeric() || transformFunction instanceof LiteralTransformFunction, "The second argument must be numeric");<NEW_LINE>_secondArgument = transformFunction;<NEW_LINE>transformFunction = arguments.get(2);<NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().isSingleValue(), "Third argument must be single-valued for transform function: %s", getName());<NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType().getStoredType().isNumeric() || transformFunction instanceof LiteralTransformFunction, "The third argument must be numeric");<NEW_LINE>_thirdArgument = transformFunction;<NEW_LINE>} else {<NEW_LINE>TransformFunction transformFunction = arguments.get(0);<NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().isSingleValue(), "First argument must be single-valued for transform function: %s", getName());<NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType() == FieldSpec.DataType.BYTES, "The first argument must be bytes");<NEW_LINE>_firstArgument = transformFunction;<NEW_LINE>transformFunction = arguments.get(1);<NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().isSingleValue(), "Second argument must be single-valued for transform function: %s", getName());<NEW_LINE>Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType().getStoredType().isNumeric() || transformFunction instanceof LiteralTransformFunction, "The second argument must be numeric");<NEW_LINE>_secondArgument = transformFunction;<NEW_LINE>}<NEW_LINE>} | transformFunction = arguments.get(1); |
1,311,817 | private void drawDocumentBox(Point[] points, Size stdSize) {<NEW_LINE>Path path = new Path();<NEW_LINE>HUDCanvasView hud = mMainActivity.getHUD();<NEW_LINE>// ATTENTION: axis are swapped<NEW_LINE>float previewWidth = (float) stdSize.height;<NEW_LINE>float <MASK><NEW_LINE>path.moveTo(previewWidth - (float) points[0].y, (float) points[0].x);<NEW_LINE>path.lineTo(previewWidth - (float) points[1].y, (float) points[1].x);<NEW_LINE>path.lineTo(previewWidth - (float) points[2].y, (float) points[2].x);<NEW_LINE>path.lineTo(previewWidth - (float) points[3].y, (float) points[3].x);<NEW_LINE>path.close();<NEW_LINE>PathShape newBox = new PathShape(path, previewWidth, previewHeight);<NEW_LINE>Paint paint = new Paint();<NEW_LINE>paint.setColor(Color.argb(64, 0, 255, 0));<NEW_LINE>Paint border = new Paint();<NEW_LINE>border.setColor(Color.rgb(0, 255, 0));<NEW_LINE>border.setStrokeWidth(5);<NEW_LINE>hud.clear();<NEW_LINE>hud.addShape(newBox, paint, border);<NEW_LINE>mMainActivity.invalidateHUD();<NEW_LINE>} | previewHeight = (float) stdSize.width; |
725,520 | @ApiOperation("Removes a token for a user")<NEW_LINE>@AuditEvent(type = AuditEventTypes.USER_ACCESS_TOKEN_DELETE)<NEW_LINE>public void revokeToken(@ApiParam(name = "userId", required = true) @PathParam("userId") String userId, @ApiParam(name = "idOrToken", required = true) @PathParam("idOrToken") String idOrToken) {<NEW_LINE>final User user = loadUserById(userId);<NEW_LINE>final <MASK><NEW_LINE>if (!isPermitted(USERS_TOKENREMOVE, username)) {<NEW_LINE>throw new ForbiddenException("Not allowed to remove tokens for user " + username);<NEW_LINE>}<NEW_LINE>// The endpoint supports both, deletion by token ID and deletion by using the token value itself.<NEW_LINE>// The latter should not be used anymore because the plain text token will be part of the URL and URLs<NEW_LINE>// will most probably be logged. We keep the old behavior for backwards compatibility.<NEW_LINE>// TODO: Remove support for old behavior in 4.0<NEW_LINE>final AccessToken accessToken = Optional.ofNullable(accessTokenService.loadById(idOrToken)).orElse(accessTokenService.load(idOrToken));<NEW_LINE>if (accessToken != null) {<NEW_LINE>accessTokenService.destroy(accessToken);<NEW_LINE>} else {<NEW_LINE>throw new NotFoundException("Couldn't find access token for user " + username);<NEW_LINE>}<NEW_LINE>} | String username = user.getName(); |
56,730 | protected PluginWrapper loadPluginFromPath(Path pluginPath) {<NEW_LINE>// Test for plugin path duplication<NEW_LINE>String pluginId = idForPath(pluginPath);<NEW_LINE>if (pluginId != null) {<NEW_LINE>throw new PluginAlreadyLoadedException(pluginId, pluginPath);<NEW_LINE>}<NEW_LINE>// Retrieve and validate the plugin descriptor<NEW_LINE>PluginDescriptorFinder pluginDescriptorFinder = getPluginDescriptorFinder();<NEW_LINE>log.debug("Use '{}' to find plugins descriptors", pluginDescriptorFinder);<NEW_LINE>log.debug("Finding plugin descriptor for plugin '{}'", pluginPath);<NEW_LINE>PluginDescriptor pluginDescriptor = pluginDescriptorFinder.find(pluginPath);<NEW_LINE>validatePluginDescriptor(pluginDescriptor);<NEW_LINE>// Check there are no loaded plugins with the retrieved id<NEW_LINE>pluginId = pluginDescriptor.getPluginId();<NEW_LINE>if (plugins.containsKey(pluginId)) {<NEW_LINE>PluginWrapper loadedPlugin = getPlugin(pluginId);<NEW_LINE>throw new PluginRuntimeException("There is an already loaded plugin ({}) " + "with the same id ({}) as the plugin at path '{}'. Simultaneous loading " + "of plugins with the same PluginId is not currently supported.\n" + "As a workaround you may include PluginVersion and PluginProvider " + "in PluginId.", loadedPlugin, pluginId, pluginPath);<NEW_LINE>}<NEW_LINE>log.debug("Found descriptor {}", pluginDescriptor);<NEW_LINE>String pluginClassName = pluginDescriptor.getPluginClass();<NEW_LINE>log.debug("Class '{}' for plugin '{}'", pluginClassName, pluginPath);<NEW_LINE>// load plugin<NEW_LINE>log.debug("Loading plugin '{}'", pluginPath);<NEW_LINE>ClassLoader pluginClassLoader = getPluginLoader().loadPlugin(pluginPath, pluginDescriptor);<NEW_LINE>log.debug("Loaded plugin '{}' with class loader '{}'", pluginPath, pluginClassLoader);<NEW_LINE>PluginWrapper pluginWrapper = createPluginWrapper(pluginDescriptor, pluginPath, pluginClassLoader);<NEW_LINE>// test for disabled plugin<NEW_LINE>if (isPluginDisabled(pluginDescriptor.getPluginId())) {<NEW_LINE>log.info("Plugin '{}' is disabled", pluginPath);<NEW_LINE>pluginWrapper.setPluginState(PluginState.DISABLED);<NEW_LINE>}<NEW_LINE>// validate the plugin<NEW_LINE>if (!isPluginValid(pluginWrapper)) {<NEW_LINE>log.warn("Plugin '{}' is invalid and it will be disabled", pluginPath);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>log.debug("Created wrapper '{}' for plugin '{}'", pluginWrapper, pluginPath);<NEW_LINE>pluginId = pluginDescriptor.getPluginId();<NEW_LINE>// add plugin to the list with plugins<NEW_LINE>plugins.put(pluginId, pluginWrapper);<NEW_LINE>getUnresolvedPlugins().add(pluginWrapper);<NEW_LINE>// add plugin class loader to the list with class loaders<NEW_LINE>getPluginClassLoaders().put(pluginId, pluginClassLoader);<NEW_LINE>return pluginWrapper;<NEW_LINE>} | pluginWrapper.setPluginState(PluginState.DISABLED); |
1,521,326 | private static JCExpression cloneType0(JavacTreeMaker maker, JCTree in) {<NEW_LINE>if (in == null)<NEW_LINE>return null;<NEW_LINE>if (in instanceof JCPrimitiveTypeTree) {<NEW_LINE>return maker.TypeIdent(TypeTag.typeTag(in));<NEW_LINE>}<NEW_LINE>if (in instanceof JCIdent) {<NEW_LINE>return maker.Ident((<MASK><NEW_LINE>}<NEW_LINE>if (in instanceof JCFieldAccess) {<NEW_LINE>JCFieldAccess fa = (JCFieldAccess) in;<NEW_LINE>return maker.Select(cloneType0(maker, fa.selected), fa.name);<NEW_LINE>}<NEW_LINE>if (in instanceof JCArrayTypeTree) {<NEW_LINE>JCArrayTypeTree att = (JCArrayTypeTree) in;<NEW_LINE>return maker.TypeArray(cloneType0(maker, att.elemtype));<NEW_LINE>}<NEW_LINE>if (in instanceof JCTypeApply) {<NEW_LINE>JCTypeApply ta = (JCTypeApply) in;<NEW_LINE>ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>();<NEW_LINE>for (JCExpression typeArg : ta.arguments) {<NEW_LINE>lb.append(cloneType0(maker, typeArg));<NEW_LINE>}<NEW_LINE>return maker.TypeApply(cloneType0(maker, ta.clazz), lb.toList());<NEW_LINE>}<NEW_LINE>if (in instanceof JCWildcard) {<NEW_LINE>JCWildcard w = (JCWildcard) in;<NEW_LINE>JCExpression newInner = cloneType0(maker, w.inner);<NEW_LINE>TypeBoundKind newKind;<NEW_LINE>switch(w.getKind()) {<NEW_LINE>case SUPER_WILDCARD:<NEW_LINE>newKind = maker.TypeBoundKind(BoundKind.SUPER);<NEW_LINE>break;<NEW_LINE>case EXTENDS_WILDCARD:<NEW_LINE>newKind = maker.TypeBoundKind(BoundKind.EXTENDS);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>case UNBOUNDED_WILDCARD:<NEW_LINE>newKind = maker.TypeBoundKind(BoundKind.UNBOUND);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return maker.Wildcard(newKind, newInner);<NEW_LINE>}<NEW_LINE>if (JCAnnotatedTypeReflect.is(in)) {<NEW_LINE>JCExpression underlyingType = cloneType0(maker, JCAnnotatedTypeReflect.getUnderlyingType(in));<NEW_LINE>List<JCAnnotation> anns = copyAnnotations(JCAnnotatedTypeReflect.getAnnotations(in));<NEW_LINE>return JCAnnotatedTypeReflect.create(anns, underlyingType);<NEW_LINE>}<NEW_LINE>// This is somewhat unsafe, but it's better than outright throwing an exception here. Returning null will just cause an exception down the pipeline.<NEW_LINE>return (JCExpression) in;<NEW_LINE>} | (JCIdent) in).name); |
313,654 | protected void openInt(UsbDeviceConnection connection) throws IOException {<NEW_LINE>if (!connection.claimInterface(mDevice.getInterface(mPortNumber), true)) {<NEW_LINE>throw new IOException("Could not claim interface " + mPortNumber);<NEW_LINE>}<NEW_LINE>if (mDevice.getInterface(mPortNumber).getEndpointCount() < 2) {<NEW_LINE>throw new IOException("Not enough endpoints");<NEW_LINE>}<NEW_LINE>mReadEndpoint = mDevice.getInterface<MASK><NEW_LINE>mWriteEndpoint = mDevice.getInterface(mPortNumber).getEndpoint(1);<NEW_LINE>int result = mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, RESET_REQUEST, RESET_ALL, mPortNumber + 1, null, 0, USB_WRITE_TIMEOUT_MILLIS);<NEW_LINE>if (result != 0) {<NEW_LINE>throw new IOException("Reset failed: result=" + result);<NEW_LINE>}<NEW_LINE>result = mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, MODEM_CONTROL_REQUEST, (dtr ? MODEM_CONTROL_DTR_ENABLE : MODEM_CONTROL_DTR_DISABLE) | (rts ? MODEM_CONTROL_RTS_ENABLE : MODEM_CONTROL_RTS_DISABLE), mPortNumber + 1, null, 0, USB_WRITE_TIMEOUT_MILLIS);<NEW_LINE>if (result != 0) {<NEW_LINE>throw new IOException("Init RTS,DTR failed: result=" + result);<NEW_LINE>}<NEW_LINE>// mDevice.getVersion() would require API 23<NEW_LINE>byte[] rawDescriptors = connection.getRawDescriptors();<NEW_LINE>if (rawDescriptors == null || rawDescriptors.length < 14) {<NEW_LINE>throw new IOException("Could not get device descriptors");<NEW_LINE>}<NEW_LINE>int deviceType = rawDescriptors[13];<NEW_LINE>// ...H devices<NEW_LINE>baudRateWithPort = // FT2232C<NEW_LINE>deviceType == 7 || deviceType == 8 || deviceType == 9 || mDevice.getInterfaceCount() > 1;<NEW_LINE>} | (mPortNumber).getEndpoint(0); |
727,785 | public FileHeader generateFileHeader(ZipParameters zipParameters, boolean isSplitZip, int currentDiskNumberStart, Charset charset, RawIO rawIO) throws ZipException {<NEW_LINE>FileHeader fileHeader = new FileHeader();<NEW_LINE><MASK><NEW_LINE>fileHeader.setVersionMadeBy(determineVersionMadeBy(zipParameters, rawIO));<NEW_LINE>fileHeader.setVersionNeededToExtract(determineVersionNeededToExtract(zipParameters).getCode());<NEW_LINE>if (zipParameters.isEncryptFiles() && zipParameters.getEncryptionMethod() == EncryptionMethod.AES) {<NEW_LINE>fileHeader.setCompressionMethod(CompressionMethod.AES_INTERNAL_ONLY);<NEW_LINE>fileHeader.setAesExtraDataRecord(generateAESExtraDataRecord(zipParameters));<NEW_LINE>fileHeader.setExtraFieldLength(fileHeader.getExtraFieldLength() + InternalZipConstants.AES_EXTRA_DATA_RECORD_SIZE);<NEW_LINE>} else {<NEW_LINE>fileHeader.setCompressionMethod(zipParameters.getCompressionMethod());<NEW_LINE>}<NEW_LINE>if (zipParameters.isEncryptFiles()) {<NEW_LINE>if (zipParameters.getEncryptionMethod() == null || zipParameters.getEncryptionMethod() == EncryptionMethod.NONE) {<NEW_LINE>throw new ZipException("Encryption method has to be set when encryptFiles flag is set in zip parameters");<NEW_LINE>}<NEW_LINE>fileHeader.setEncrypted(true);<NEW_LINE>fileHeader.setEncryptionMethod(zipParameters.getEncryptionMethod());<NEW_LINE>}<NEW_LINE>String fileName = validateAndGetFileName(zipParameters.getFileNameInZip());<NEW_LINE>fileHeader.setFileName(fileName);<NEW_LINE>fileHeader.setFileNameLength(determineFileNameLength(fileName, charset));<NEW_LINE>fileHeader.setDiskNumberStart(isSplitZip ? currentDiskNumberStart : 0);<NEW_LINE>if (zipParameters.getLastModifiedFileTime() > 0) {<NEW_LINE>fileHeader.setLastModifiedTime(Zip4jUtil.epochToExtendedDosTime(zipParameters.getLastModifiedFileTime()));<NEW_LINE>} else {<NEW_LINE>fileHeader.setLastModifiedTime(Zip4jUtil.epochToExtendedDosTime(System.currentTimeMillis()));<NEW_LINE>}<NEW_LINE>boolean isDirectory = isZipEntryDirectory(fileName);<NEW_LINE>fileHeader.setDirectory(isDirectory);<NEW_LINE>fileHeader.setExternalFileAttributes(FileUtils.getDefaultFileAttributes(isDirectory));<NEW_LINE>if (zipParameters.isWriteExtendedLocalFileHeader() && zipParameters.getEntrySize() == -1) {<NEW_LINE>fileHeader.setUncompressedSize(0);<NEW_LINE>} else {<NEW_LINE>fileHeader.setUncompressedSize(zipParameters.getEntrySize());<NEW_LINE>}<NEW_LINE>if (zipParameters.isEncryptFiles() && zipParameters.getEncryptionMethod() == EncryptionMethod.ZIP_STANDARD) {<NEW_LINE>fileHeader.setCrc(zipParameters.getEntryCRC());<NEW_LINE>}<NEW_LINE>fileHeader.setGeneralPurposeFlag(determineGeneralPurposeBitFlag(fileHeader.isEncrypted(), zipParameters, charset));<NEW_LINE>fileHeader.setDataDescriptorExists(zipParameters.isWriteExtendedLocalFileHeader());<NEW_LINE>fileHeader.setFileComment(zipParameters.getFileComment());<NEW_LINE>return fileHeader;<NEW_LINE>} | fileHeader.setSignature(HeaderSignature.CENTRAL_DIRECTORY); |
972,299 | public static void main(String[] args) {<NEW_LINE>final String USAGE = "\n" + "Usage: " + "CreateBrokerActiveMQ <engineType> <brokerName>\n\n" + "Where:\n" + " engineType - Required. RABBITMQ or ACTIVEMQ for broker's engine type.\n" + " brokerName - Optional. The name of the Amazon MQ for ActiveMQ broker.\n\n";<NEW_LINE>int argsLength = args.length;<NEW_LINE>String brokerName = "";<NEW_LINE>String engineType = "";<NEW_LINE>if (argsLength < 1 || argsLength > 2) {<NEW_LINE>System.out.println(USAGE);<NEW_LINE>System.exit(1);<NEW_LINE>} else {<NEW_LINE>engineType = args[0];<NEW_LINE>if (argsLength == 1) {<NEW_LINE>brokerName = engineType <MASK><NEW_LINE>} else {<NEW_LINE>brokerName = args[1];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Region region = Region.US_WEST_2;<NEW_LINE>MqClient mqClient = MqClient.builder().region(region).build();<NEW_LINE>String brokerId = createBroker(mqClient, engineType, brokerName);<NEW_LINE>System.out.println("The broker ID is: " + brokerId);<NEW_LINE>mqClient.close();<NEW_LINE>} | + "-" + System.currentTimeMillis(); |
1,160,044 | public com.amazonaws.services.eventbridge.model.ManagedRuleException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.eventbridge.model.ManagedRuleException managedRuleException = new com.amazonaws.services.eventbridge.model.ManagedRuleException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><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 null;<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>} 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 managedRuleException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
7,774 | protected String buildNonAjaxRequest(FacesContext context, UIComponent component, UIComponent form, String decodeParam, Map<String, List<String>> parameters, boolean submit) {<NEW_LINE>StringBuilder request = SharedStringBuilder.get(context, SB_BUILD_NON_AJAX_REQUEST);<NEW_LINE>String formId = form.getClientId(context);<NEW_LINE>Map<String, Object> params = new HashMap<>();<NEW_LINE>if (decodeParam != null) {<NEW_LINE>params.put(decodeParam, decodeParam);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < component.getChildCount(); i++) {<NEW_LINE>UIComponent child = component.getChildren().get(i);<NEW_LINE>if (child instanceof UIParameter) {<NEW_LINE>UIParameter param = (UIParameter) child;<NEW_LINE>params.put(param.getName(), param.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (parameters != null && !parameters.isEmpty()) {<NEW_LINE>parameters.forEach((k, v) -> params.put(k, v.get(0)));<NEW_LINE>}<NEW_LINE>// append params<NEW_LINE>if (!params.isEmpty()) {<NEW_LINE>request.append("PrimeFaces.addSubmitParam('").append(formId).append("',{");<NEW_LINE>request.append(params.entrySet().stream().map(e -> "'" + e.getKey() + "':'" + EscapeUtils.forJavaScript(String.valueOf(e.getValue())) + "'").collect(<MASK><NEW_LINE>request.append("})");<NEW_LINE>}<NEW_LINE>if (submit) {<NEW_LINE>Object target = component.getAttributes().get("target");<NEW_LINE>request.append(".submit('").append(formId).append("'");<NEW_LINE>if (target != null) {<NEW_LINE>request.append(",'").append(target).append("'");<NEW_LINE>}<NEW_LINE>request.append(");return false;");<NEW_LINE>}<NEW_LINE>if (!submit && !params.isEmpty()) {<NEW_LINE>request.append(";");<NEW_LINE>}<NEW_LINE>return request.toString();<NEW_LINE>} | Collectors.joining(","))); |
487,106 | public void onNext(final T element) {<NEW_LINE>if (subscription == null) {<NEW_LINE>// Technically this check is not needed, since we are expecting Publishers to conform to the spec<NEW_LINE>(new IllegalStateException("Publisher violated the Reactive Streams rule 1.09 signalling onNext prior to onSubscribe.")).printStackTrace(System.err);<NEW_LINE>} else {<NEW_LINE>// As per rule 2.13, we need to throw a `java.lang.NullPointerException` if the `element` is `null`<NEW_LINE>if (element == null)<NEW_LINE>throw null;<NEW_LINE>if (!done) {<NEW_LINE>// If we aren't already done<NEW_LINE>try {<NEW_LINE>if (whenNext(element)) {<NEW_LINE>try {<NEW_LINE>// Our Subscriber is unbuffered and modest, it requests one element at a time<NEW_LINE>subscription.request(1);<NEW_LINE>} catch (final Throwable t) {<NEW_LINE>// Subscription.request is not allowed to throw according to rule 3.16<NEW_LINE>(new IllegalStateException(subscription + " violated the Reactive Streams rule 3.16 by throwing an exception from request.", t)).printStackTrace(System.err);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>done();<NEW_LINE>}<NEW_LINE>} catch (final Throwable t) {<NEW_LINE>done();<NEW_LINE>try {<NEW_LINE>onError(t);<NEW_LINE>} catch (final Throwable t2) {<NEW_LINE>// Subscriber.onError is not allowed to throw an exception, according to rule 2.13<NEW_LINE>(new IllegalStateException(this + " violated the Reactive Streams rule 2.13 by throwing an exception from onError.", t2)<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).printStackTrace(System.err); |
806,187 | private long insert(GlobalId globalId, Session session) {<NEW_LINE>InsertBuilder insert = null;<NEW_LINE>if (globalId instanceof ValueObjectId) {<NEW_LINE>insert = session.insert("ValueObjectId");<NEW_LINE>ValueObjectId valueObjectId = (ValueObjectId) globalId;<NEW_LINE>long ownerFk = getOrInsertId(<MASK><NEW_LINE>insert.value(GLOBAL_ID_FRAGMENT, valueObjectId.getFragment()).value(GLOBAL_ID_OWNER_ID_FK, ownerFk);<NEW_LINE>} else if (globalId instanceof InstanceId) {<NEW_LINE>insert = session.insert("InstanceId").value(GLOBAL_ID_TYPE_NAME, globalId.getTypeName()).value(GLOBAL_ID_LOCAL_ID, jsonConverter.toJson(((InstanceId) globalId).getCdoId()));<NEW_LINE>} else if (globalId instanceof UnboundedValueObjectId) {<NEW_LINE>insert = session.insert("UnboundedValueObjectId").value(GLOBAL_ID_TYPE_NAME, globalId.getTypeName());<NEW_LINE>}<NEW_LINE>return insert.into(getGlobalIdTableNameWithSchema()).sequence(GLOBAL_ID_PK, getGlobalIdPkSeqName().nameWithSchema()).executeAndGetSequence();<NEW_LINE>} | valueObjectId.getOwnerId(), session); |
757,400 | private void handleDeletion(final CascadeAction action, final Completion completion) {<NEW_LINE>final List<ImageDeletionStruct> structs = imageFromAction(action);<NEW_LINE>if (structs == null) {<NEW_LINE>completion.success();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<ImageDeletionMsg> msgs = CollectionUtils.transformToList(structs, new Function<ImageDeletionMsg, ImageDeletionStruct>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ImageDeletionMsg call(ImageDeletionStruct arg) {<NEW_LINE>ImageDeletionMsg msg = new ImageDeletionMsg();<NEW_LINE>msg.setImageUuid(arg.getImage().getUuid());<NEW_LINE>if (!arg.getDeleteAll()) {<NEW_LINE>msg.setBackupStorageUuids(arg.getBackupStorageUuids());<NEW_LINE>}<NEW_LINE>ImageDeletionPolicy deletionPolicy = deletionPolicyFromAction(action);<NEW_LINE>msg.setDeletionPolicy(deletionPolicy == null ? <MASK><NEW_LINE>bus.makeTargetServiceIdByResourceUuid(msg, ImageConstant.SERVICE_ID, arg.getImage().getUuid());<NEW_LINE>msg.setForceDelete(action.isActionCode(CascadeConstant.DELETION_FORCE_DELETE_CODE));<NEW_LINE>return msg;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>bus.send(msgs, new CloudBusListCallBack(completion) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(List<MessageReply> replies) {<NEW_LINE>if (!action.isActionCode(CascadeConstant.DELETION_FORCE_DELETE_CODE)) {<NEW_LINE>for (MessageReply r : replies) {<NEW_LINE>if (!r.isSuccess()) {<NEW_LINE>completion.fail(r.getError());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>completion.success();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | null : deletionPolicy.toString()); |
1,216,968 | private void sendResultNotification(DestroyedActivityInfo activityInfo, ManualDumpData data) {<NEW_LINE>final Context context = getWatcher().getContext();<NEW_LINE>Intent targetIntent = new Intent();<NEW_LINE>targetIntent.setClassName(getWatcher().getContext(), mTargetActivity);<NEW_LINE>targetIntent.putExtra(<MASK><NEW_LINE>targetIntent.putExtra(SharePluginInfo.ISSUE_REF_KEY, activityInfo.mKey);<NEW_LINE>targetIntent.putExtra(SharePluginInfo.ISSUE_LEAK_PROCESS, MatrixUtil.getProcessName(context));<NEW_LINE>targetIntent.putExtra(SharePluginInfo.ISSUE_DUMP_DATA, data);<NEW_LINE>PendingIntent pIntent = PendingIntent.getActivity(context, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT);<NEW_LINE>String dumpingHeapTitle = context.getString(R.string.resource_canary_leak_tip);<NEW_LINE>ResourceConfig config = getWatcher().getResourcePlugin().getConfig();<NEW_LINE>String dumpingHeapContent = String.format(Locale.getDefault(), "[%s] has leaked for [%s]min!!!", activityInfo.mActivityName, TimeUnit.MILLISECONDS.toMinutes(config.getScanIntervalMillis() * config.getMaxRedetectTimes()));<NEW_LINE>Notification.Builder builder;<NEW_LINE>if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {<NEW_LINE>builder = new Notification.Builder(context, getNotificationChannelIdCompat(context));<NEW_LINE>} else {<NEW_LINE>builder = new Notification.Builder(context);<NEW_LINE>}<NEW_LINE>builder.setContentTitle(dumpingHeapTitle).setPriority(Notification.PRIORITY_DEFAULT).setStyle(new Notification.BigTextStyle().bigText(dumpingHeapContent)).setAutoCancel(true).setContentIntent(pIntent).setSmallIcon(R.drawable.ic_launcher).setWhen(System.currentTimeMillis());<NEW_LINE>Notification notification = builder.build();<NEW_LINE>mNotificationManager.notify(NOTIFICATION_ID + activityInfo.mKey.hashCode(), notification);<NEW_LINE>} | SharePluginInfo.ISSUE_ACTIVITY_NAME, activityInfo.mActivityName); |
1,438,945 | private void overlayValue(HeaderElement elem) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "Overlaying existing header: " + elem.getName());<NEW_LINE>}<NEW_LINE>int next_index = this.lastCRLFBufferIndex;<NEW_LINE>int next_pos = this.lastCRLFPosition;<NEW_LINE>if (null != elem.nextSequence && !elem.nextSequence.wasAdded()) {<NEW_LINE>next_index = elem.nextSequence.getLastCRLFBufferIndex();<NEW_LINE>next_pos = elem.nextSequence.getLastCRLFPosition();<NEW_LINE>}<NEW_LINE>WsByteBuffer buffer = this.parseBuffers[elem.getLastCRLFBufferIndex()];<NEW_LINE>buffer.position(elem.getLastCRLFPosition() + (elem.isLastCRLFaCR() ? 2 : 1));<NEW_LINE>if (next_index == elem.getLastCRLFBufferIndex()) {<NEW_LINE>// all in one buffer<NEW_LINE>buffer.put(elem.getKey().getMarshalledByteArray(foundCompactHeader()));<NEW_LINE>buffer.put(elem.asRawBytes(), elem.getOffset(), elem.getValueLength());<NEW_LINE>} else {<NEW_LINE>// header straddles buffers<NEW_LINE>int index = elem.getLastCRLFBufferIndex();<NEW_LINE>index = overlayBytes(elem.getKey().getMarshalledByteArray(foundCompactHeader()), 0, -1, index);<NEW_LINE>index = overlayBytes(elem.asRawBytes(), elem.getOffset(), elem.getValueLength(), index);<NEW_LINE>buffer = this.parseBuffers[index];<NEW_LINE>}<NEW_LINE>// pad trailing whitespace if we need it<NEW_LINE><MASK><NEW_LINE>if (start < next_pos) {<NEW_LINE>scribbleWhiteSpace(buffer, start, next_pos);<NEW_LINE>}<NEW_LINE>} | int start = buffer.position(); |
1,296,496 | public void removeDatabase(String userId, String databaseGUID, String externalSourceName, DeleteSemantic deleteSemantic) throws FunctionNotSupportedException, InvalidParameterException, PropertyServerException, UserNotAuthorizedException {<NEW_LINE>final String methodName = "removeDatabase";<NEW_LINE><MASK><NEW_LINE>invalidParameterHandler.validateUserId(userId, methodName);<NEW_LINE>invalidParameterHandler.validateGUID(databaseGUID, GUID_PROPERTY_NAME, methodName);<NEW_LINE>Optional<EntityDetail> databaseOptional = dataEngineCommonHandler.getEntityDetails(userId, databaseGUID, DATABASE_TYPE_NAME);<NEW_LINE>if (databaseOptional.isPresent()) {<NEW_LINE>EntityDetail databaseEntity = databaseOptional.get();<NEW_LINE>String databaseQualifiedName = databaseEntity.getProperties().getPropertyValue(QUALIFIED_NAME_PROPERTY_NAME).valueAsString();<NEW_LINE>String externalSourceGUID = registrationHandler.getExternalDataEngine(userId, externalSourceName);<NEW_LINE>relationalDataHandler.removeDatabase(userId, externalSourceGUID, externalSourceName, databaseGUID, databaseQualifiedName, methodName);<NEW_LINE>} else {<NEW_LINE>dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.ENTITY_NOT_DELETED, methodName, databaseGUID);<NEW_LINE>}<NEW_LINE>} | dataEngineCommonHandler.validateDeleteSemantic(deleteSemantic, methodName); |
1,174,099 | public ImmutableSortedMap<DocumentKey, Document> applyBundledDocuments(ImmutableSortedMap<DocumentKey, MutableDocument> documents, String bundleId) {<NEW_LINE>// Allocates a target to hold all document keys from the bundle, such that<NEW_LINE>// they will not get garbage collected right away.<NEW_LINE>TargetData umbrellaTargetData <MASK><NEW_LINE>return persistence.runTransaction("Apply bundle documents", () -> {<NEW_LINE>ImmutableSortedSet<DocumentKey> documentKeys = DocumentKey.emptyKeySet();<NEW_LINE>Map<DocumentKey, MutableDocument> documentMap = new HashMap<>();<NEW_LINE>for (Entry<DocumentKey, MutableDocument> entry : documents) {<NEW_LINE>DocumentKey documentKey = entry.getKey();<NEW_LINE>MutableDocument document = entry.getValue();<NEW_LINE>if (document.isFoundDocument()) {<NEW_LINE>documentKeys = documentKeys.insert(documentKey);<NEW_LINE>}<NEW_LINE>documentMap.put(documentKey, document);<NEW_LINE>}<NEW_LINE>targetCache.removeMatchingKeysForTargetId(umbrellaTargetData.getTargetId());<NEW_LINE>targetCache.addMatchingKeys(documentKeys, umbrellaTargetData.getTargetId());<NEW_LINE>DocumentChangeResult result = populateDocumentChanges(documentMap);<NEW_LINE>Map<DocumentKey, MutableDocument> changedDocs = result.changedDocuments;<NEW_LINE>return localDocuments.getLocalViewOfDocuments(changedDocs, result.existenceChangedKeys);<NEW_LINE>});<NEW_LINE>} | = allocateTarget(newUmbrellaTarget(bundleId)); |
1,850,982 | public void start(Member member, XposedBridge.AdditionalHookInfo hookInfo, ClassLoader appClassLoader) throws Exception {<NEW_LINE>Class<?> returnType;<NEW_LINE>boolean isStatic;<NEW_LINE>if (member instanceof Method) {<NEW_LINE>Method method = (Method) member;<NEW_LINE>isStatic = Modifier.isStatic(method.getModifiers());<NEW_LINE>returnType = method.getReturnType();<NEW_LINE>if (returnType.equals(Void.class) || returnType.equals(void.class) || returnType.isPrimitive()) {<NEW_LINE>mReturnTypeId = TypeId.get(returnType);<NEW_LINE>} else {<NEW_LINE>// all others fallback to plain Object for convenience<NEW_LINE>mReturnTypeId = TypeId.OBJECT;<NEW_LINE>}<NEW_LINE>mParameterTypeIds = getParameterTypeIds(method.getParameterTypes(), isStatic);<NEW_LINE>mActualParameterTypes = getParameterTypes(<MASK><NEW_LINE>} else if (member instanceof Constructor) {<NEW_LINE>Constructor constructor = (Constructor) member;<NEW_LINE>isStatic = false;<NEW_LINE>mReturnTypeId = TypeId.VOID;<NEW_LINE>mParameterTypeIds = getParameterTypeIds(constructor.getParameterTypes(), isStatic);<NEW_LINE>mActualParameterTypes = getParameterTypes(constructor.getParameterTypes(), isStatic);<NEW_LINE>} else if (member.getDeclaringClass().isInterface()) {<NEW_LINE>throw new IllegalArgumentException("Cannot hook interfaces: " + member.toString());<NEW_LINE>} else if (Modifier.isAbstract(member.getModifiers())) {<NEW_LINE>throw new IllegalArgumentException("Cannot hook abstract methods: " + member.toString());<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Only methods and constructors can be hooked: " + member.toString());<NEW_LINE>}<NEW_LINE>mMember = member;<NEW_LINE>mHookInfo = hookInfo;<NEW_LINE>if (appClassLoader == null || appClassLoader.getClass().getName().equals("java.lang.BootClassLoader")) {<NEW_LINE>mAppClassLoader = getClass().getClassLoader();<NEW_LINE>} else {<NEW_LINE>mAppClassLoader = appClassLoader;<NEW_LINE>mAppClassLoader = new ProxyClassLoader(mAppClassLoader, getClass().getClassLoader());<NEW_LINE>}<NEW_LINE>doMake(member.getDeclaringClass().getName());<NEW_LINE>} | method.getParameterTypes(), isStatic); |
189,809 | protected void fillCpuUsage(final ExecutorInfo stats) {<NEW_LINE>if (exists_Bash && exists_Cat && exists_LoadAvg) {<NEW_LINE>try {<NEW_LINE>final ArrayList<String> output = Utils.runProcess("/bin/bash", "-c", "/bin/cat /proc/loadavg");<NEW_LINE>// process the output from bash call.<NEW_LINE>if (output.size() > 0) {<NEW_LINE>final String[] splitedresult = output.get(0).split("\\s+");<NEW_LINE>double cpuUsage = 0.0;<NEW_LINE>try {<NEW_LINE>cpuUsage = Double<MASK><NEW_LINE>} catch (final NumberFormatException e) {<NEW_LINE>logger.error("yielding 0.0 for CPU usage as output is invalid -" + output.get(0));<NEW_LINE>}<NEW_LINE>logger.info("System load : " + cpuUsage);<NEW_LINE>stats.setCpuUpsage(cpuUsage);<NEW_LINE>}<NEW_LINE>} catch (final Exception ex) {<NEW_LINE>logger.error("failed fetch system load info " + "as exception is captured when fetching result from bash call. Ex -" + ex.getMessage());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.error("failed fetch system load info, one or more files from the following list are missing - " + "'/bin/bash'," + "'/bin/cat'," + "'/proc/loadavg'");<NEW_LINE>}<NEW_LINE>} | .parseDouble(splitedresult[0]); |
1,635,173 | public List<FilesListRecursiveItem> listRecursive(String path) throws IOException, InvalidTokenException {<NEW_LINE>String url;<NEW_LINE>try {<NEW_LINE>URIBuilder builder = getUriBuilder().setPath(CONTENT_API_PATH_PREFIX + "/mounts/primary/files/listrecursive").setParameter("path", path);<NEW_LINE>url = builder.build().toString();<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>throw new IllegalStateException("Could not produce url.", e);<NEW_LINE>}<NEW_LINE>Request.Builder requestBuilder = getRequestBuilder(url).get();<NEW_LINE>try (Response response = getResponse(requestBuilder)) {<NEW_LINE><MASK><NEW_LINE>if (code == 404) {<NEW_LINE>return ImmutableList.of();<NEW_LINE>}<NEW_LINE>ResponseBody body = response.body();<NEW_LINE>if (code < 200 || code > 299) {<NEW_LINE>throw new IOException("Got error code: " + code + " message: " + response.message() + " body: " + body.string());<NEW_LINE>}<NEW_LINE>try (final Reader bodyReader = new InputStreamReader(body.byteStream(), StandardCharsets.UTF_8);<NEW_LINE>final BufferedReader bufferedBodyReader = new BufferedReader(bodyReader)) {<NEW_LINE>String line;<NEW_LINE>List<FilesListRecursiveItem> items = new ArrayList<FilesListRecursiveItem>();<NEW_LINE>while ((line = bufferedBodyReader.readLine()) != null) {<NEW_LINE>items.add(objectMapper.readValue(line, FilesListRecursiveItem.class));<NEW_LINE>}<NEW_LINE>return items;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int code = response.code(); |
579,116 | public void prepare(OutlierResult or) {<NEW_LINE>meta = or.getOutlierMeta();<NEW_LINE>// Determine Minimum and Maximum.<NEW_LINE>DoubleMinMax mm = new DoubleMinMax();<NEW_LINE>DoubleRelation scores = or.getScores();<NEW_LINE>for (DBIDIter id = scores.iterDBIDs(); id.valid(); id.advance()) {<NEW_LINE>double score = scores.doubleValue(id);<NEW_LINE>if (!Double.isNaN(score) && !Double.isInfinite(score)) {<NEW_LINE>mm.put(score);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>max = mm.getMax();<NEW_LINE>mlogmax = -FastMath.log(mm.getMin() / max);<NEW_LINE>// with the prescaling, do Gamma Scaling.<NEW_LINE>MeanVariance mv = new MeanVariance();<NEW_LINE>for (DBIDIter id = scores.iterDBIDs(); id.valid(); id.advance()) {<NEW_LINE>double score = preScale(scores.doubleValue(id));<NEW_LINE>if (!Double.isNaN(score) && !Double.isInfinite(score)) {<NEW_LINE>mv.put(score);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final double mean = mv.getMean()<MASK><NEW_LINE>k = (mean * mean) / var;<NEW_LINE>theta = var / mean;<NEW_LINE>atmean = GammaDistribution.regularizedGammaP(k, mean / theta);<NEW_LINE>} | , var = mv.getSampleVariance(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.