idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,714,902 | public void Start() {<NEW_LINE>// Need to check if we have RECORD_AUDIO and WRITE_EXTERNAL permissions<NEW_LINE>String uri = FileUtil.resolveFileName(form, savedRecording, form.DefaultFileScope());<NEW_LINE>if (!havePermission) {<NEW_LINE>final SoundRecorder me = this;<NEW_LINE>final String[] neededPermissions;<NEW_LINE>if (FileUtil.needsPermission(form, uri)) {<NEW_LINE>neededPermissions = new String[] { RECORD_AUDIO, WRITE_EXTERNAL_STORAGE };<NEW_LINE>} else {<NEW_LINE>neededPermissions <MASK><NEW_LINE>}<NEW_LINE>form.runOnUiThread(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>form.askPermission(new BulkPermissionRequest(me, "Start", neededPermissions) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onGranted() {<NEW_LINE>me.havePermission = true;<NEW_LINE>me.Start();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (controller != null) {<NEW_LINE>Log.i(TAG, "Start() called, but already recording to " + controller.file);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Log.i(TAG, "Start() called");<NEW_LINE>if (FileUtil.isExternalStorageUri(form, uri) && !Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {<NEW_LINE>form.dispatchErrorOccurredEvent(this, "Start", ErrorMessages.ERROR_MEDIA_EXTERNAL_STORAGE_NOT_AVAILABLE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>controller = new RecordingController(savedRecording);<NEW_LINE>} catch (PermissionException e) {<NEW_LINE>form.dispatchPermissionDeniedEvent(this, "Start", e);<NEW_LINE>return;<NEW_LINE>} catch (Throwable t) {<NEW_LINE>form.dispatchErrorOccurredEvent(this, "Start", ErrorMessages.ERROR_SOUND_RECORDER_CANNOT_CREATE, t.getMessage());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>controller.start();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>// I'm commenting the next line out because stop can throw an error, and<NEW_LINE>// it's not clear to me how to handle that.<NEW_LINE>// controller.stop();<NEW_LINE>controller = null;<NEW_LINE>form.dispatchErrorOccurredEvent(this, "Start", ErrorMessages.ERROR_SOUND_RECORDER_CANNOT_CREATE, t.getMessage());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>StartedRecording();<NEW_LINE>} | = new String[] { RECORD_AUDIO }; |
1,219,300 | protected void computeOtsu2(int[] histogram, int length, int totalPixels) {<NEW_LINE>double dlength = length;<NEW_LINE>double sum = 0;<NEW_LINE>for (int i = 0; i < length; i++) sum += (i / dlength) * histogram[i];<NEW_LINE>double sumB = 0;<NEW_LINE>int wB = 0;<NEW_LINE>variance = 0;<NEW_LINE>threshold = 0;<NEW_LINE>double selectedMB = 0;<NEW_LINE>double selectedMF = 0;<NEW_LINE>int i;<NEW_LINE>for (i = 0; i < length; i++) {<NEW_LINE>// Weight Background<NEW_LINE>wB += histogram[i];<NEW_LINE>if (wB == 0)<NEW_LINE>continue;<NEW_LINE>// Weight Foreground<NEW_LINE>int wF = totalPixels - wB;<NEW_LINE>if (wF == 0)<NEW_LINE>break;<NEW_LINE>double f = i / dlength;<NEW_LINE>sumB += f * histogram[i];<NEW_LINE>// Mean Background<NEW_LINE>double mB = sumB / wB;<NEW_LINE>// Mean Foreground<NEW_LINE>double mF = (sum - sumB) / wF;<NEW_LINE>// Calculate Between Class Variance<NEW_LINE>double varBetween = (double) wB * (double) wF * (mB - mF) * (mB - mF);<NEW_LINE>// Check if new maximum found<NEW_LINE>if (varBetween > variance) {<NEW_LINE>variance = varBetween;<NEW_LINE>selectedMB = mB;<NEW_LINE>selectedMF = mF;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// select a threshold which maximizes the distance between the two distributions. In pathological<NEW_LINE>// cases there's a dead zone where all the values are equally good and it would select a value with a low index<NEW_LINE>// arbitrarily. Then if you scaled the threshold it would reject everything<NEW_LINE>threshold = length <MASK><NEW_LINE>} | * (selectedMB + selectedMF) / 2.0; |
1,850,344 | public Bias unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>Bias bias = new Bias();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return 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>if (context.testExpression("Report", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>bias.setReport(MetricsSourceJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("PreTrainingReport", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>bias.setPreTrainingReport(MetricsSourceJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("PostTrainingReport", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>bias.setPostTrainingReport(MetricsSourceJsonUnmarshaller.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 bias;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,411,731 | public Service convertFromSObject(SService input, Service result, DatabaseSession session) throws BimserverDatabaseException {<NEW_LINE>if (input == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>result.setName(input.getName());<NEW_LINE>result.setServiceName(input.getServiceName());<NEW_LINE>result.setServiceIdentifier(input.getServiceIdentifier());<NEW_LINE>result.setProviderName(input.getProviderName());<NEW_LINE>result.setUrl(input.getUrl());<NEW_LINE>result.setToken(input.getToken());<NEW_LINE>result.setNotificationProtocol(AccessMethod.values()[input.getNotificationProtocol().ordinal()]);<NEW_LINE>result.setDescription(input.getDescription());<NEW_LINE>result.setTrigger(Trigger.values()[input.getTrigger().ordinal()]);<NEW_LINE>result.setReadRevision(input.isReadRevision());<NEW_LINE>result.setProfileIdentifier(input.getProfileIdentifier());<NEW_LINE>result.<MASK><NEW_LINE>result.setProfileDescription(input.getProfileDescription());<NEW_LINE>result.setProfilePublic(input.isProfilePublic());<NEW_LINE>result.setReadExtendedData((ExtendedDataSchema) session.get(StorePackage.eINSTANCE.getExtendedDataSchema(), input.getReadExtendedDataId(), OldQuery.getDefault()));<NEW_LINE>result.setWriteRevision((Project) session.get(StorePackage.eINSTANCE.getProject(), input.getWriteRevisionId(), OldQuery.getDefault()));<NEW_LINE>result.setWriteExtendedData((ExtendedDataSchema) session.get(StorePackage.eINSTANCE.getExtendedDataSchema(), input.getWriteExtendedDataId(), OldQuery.getDefault()));<NEW_LINE>result.setProject((Project) session.get(StorePackage.eINSTANCE.getProject(), input.getProjectId(), OldQuery.getDefault()));<NEW_LINE>result.setUser((User) session.get(StorePackage.eINSTANCE.getUser(), input.getUserId(), OldQuery.getDefault()));<NEW_LINE>result.setInternalService((InternalServicePluginConfiguration) session.get(StorePackage.eINSTANCE.getInternalServicePluginConfiguration(), input.getInternalServiceId(), OldQuery.getDefault()));<NEW_LINE>List<ModelCheckerInstance> listmodelCheckers = result.getModelCheckers();<NEW_LINE>for (long oid : input.getModelCheckers()) {<NEW_LINE>listmodelCheckers.add((ModelCheckerInstance) session.get(StorePackage.eINSTANCE.getModelCheckerInstance(), oid, OldQuery.getDefault()));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | setProfileName(input.getProfileName()); |
1,525,694 | private static Optional<List<BingTile>> handleTrivialCases(Envelope envelope, int zoom) {<NEW_LINE>checkZoomLevel(zoom);<NEW_LINE>if (envelope.isEmpty()) {<NEW_LINE>return Optional.of(ImmutableList.of());<NEW_LINE>}<NEW_LINE>checkLatitude(envelope.getYMin(), LATITUDE_SPAN_OUT_OF_RANGE);<NEW_LINE>checkLatitude(envelope.getYMax(), LATITUDE_SPAN_OUT_OF_RANGE);<NEW_LINE>checkLongitude(envelope.getXMin(), LONGITUDE_SPAN_OUT_OF_RANGE);<NEW_LINE>checkLongitude(<MASK><NEW_LINE>if (zoom == 0) {<NEW_LINE>return Optional.of(ImmutableList.of(BingTile.fromCoordinates(0, 0, 0)));<NEW_LINE>}<NEW_LINE>if (envelope.getXMax() == envelope.getXMin() && envelope.getYMax() == envelope.getYMin()) {<NEW_LINE>return Optional.of(ImmutableList.of(latitudeLongitudeToTile(envelope.getYMax(), envelope.getXMax(), zoom)));<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>} | envelope.getXMax(), LONGITUDE_SPAN_OUT_OF_RANGE); |
1,479,687 | protected Subtitle decode(byte[] bytes, int length, boolean reset) throws SubtitleDecoderException {<NEW_LINE>// Webvtt in Mp4 samples have boxes inside of them, so we have to do a traditional box parsing:<NEW_LINE>// first 4 bytes size and then 4 bytes type.<NEW_LINE>sampleData.reset(bytes, length);<NEW_LINE>List<Cue> resultingCueList = new ArrayList<>();<NEW_LINE>while (sampleData.bytesLeft() > 0) {<NEW_LINE>if (sampleData.bytesLeft() < BOX_HEADER_SIZE) {<NEW_LINE>throw new SubtitleDecoderException("Incomplete Mp4Webvtt Top Level box header found.");<NEW_LINE>}<NEW_LINE>int boxSize = sampleData.readInt();<NEW_LINE>int boxType = sampleData.readInt();<NEW_LINE>if (boxType == TYPE_vttc) {<NEW_LINE>resultingCueList.add(parseVttCueBox<MASK><NEW_LINE>} else {<NEW_LINE>// Peers of the VTTCueBox are still not supported and are skipped.<NEW_LINE>sampleData.skipBytes(boxSize - BOX_HEADER_SIZE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new Mp4WebvttSubtitle(resultingCueList);<NEW_LINE>} | (sampleData, boxSize - BOX_HEADER_SIZE)); |
989,607 | public OriginGroup unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>OriginGroup originGroup = new OriginGroup();<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>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return originGroup;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("Id", targetDepth)) {<NEW_LINE>originGroup.setId(StringStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("FailoverCriteria", targetDepth)) {<NEW_LINE>originGroup.setFailoverCriteria(OriginGroupFailoverCriteriaStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("Members", targetDepth)) {<NEW_LINE>originGroup.setMembers(OriginGroupMembersStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return originGroup;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().unmarshall(context)); |
480,620 | private void createPreviewRequest() {<NEW_LINE>if (MyDebug.LOG)<NEW_LINE>Log.d(TAG, "createPreviewRequest");<NEW_LINE>if (camera == null) {<NEW_LINE>if (MyDebug.LOG)<NEW_LINE>Log.d(TAG, "camera not available!");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (MyDebug.LOG)<NEW_LINE>Log.d(TAG, "camera: " + camera);<NEW_LINE>try {<NEW_LINE>previewBuilder = camera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);<NEW_LINE>previewBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT, CaptureRequest.CONTROL_CAPTURE_INTENT_PREVIEW);<NEW_LINE>camera_settings.setupBuilder(previewBuilder, false);<NEW_LINE>if (MyDebug.LOG)<NEW_LINE><MASK><NEW_LINE>} catch (CameraAccessException e) {<NEW_LINE>// captureSession = null;<NEW_LINE>if (MyDebug.LOG) {<NEW_LINE>Log.e(TAG, "failed to create capture request");<NEW_LINE>Log.e(TAG, "reason: " + e.getReason());<NEW_LINE>Log.e(TAG, "message: " + e.getMessage());<NEW_LINE>}<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | Log.d(TAG, "successfully created preview request"); |
1,697,639 | public static // ifftSize can be greater than, equal to, or less than x.length.<NEW_LINE>ComplexArray ifft(ComplexArray x, int ifftSize) {<NEW_LINE>ComplexArray h = null;<NEW_LINE>int w;<NEW_LINE>if (x.real.length > ifftSize) {<NEW_LINE>ComplexArray h2 = ifft(x);<NEW_LINE>h = new ComplexArray(ifftSize);<NEW_LINE>for (w = 0; w < ifftSize; w++) {<NEW_LINE>h.real[w] = h2.real[w];<NEW_LINE>h.imag[w] = h2.imag[w];<NEW_LINE>}<NEW_LINE>} else if (x.real.length == ifftSize)<NEW_LINE>h = ifft(x);<NEW_LINE>else {<NEW_LINE>ComplexArray h2 = ifft(x);<NEW_LINE>h = new ComplexArray(ifftSize);<NEW_LINE>for (w = 0; w < h2.real.length; w++) {<NEW_LINE>h.real[w] = h2.real[w];<NEW_LINE>h.imag[w] = h2.imag[w];<NEW_LINE>}<NEW_LINE>for (w = h2.real.length; w < ifftSize; w++) {<NEW_LINE>h.real[w] = 0.0;<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return h;<NEW_LINE>} | h.imag[w] = 0.0; |
535,768 | public void fileCreated(int wd, String rootPath, final String name) {<NEW_LINE>if (name == null || name.endsWith(DOT_LOCK)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// a branch has been added<NEW_LINE>addBranch(new GitRevSpecifier(GitRef.refFromString(GitRef.REFS_HEADS + name)));<NEW_LINE>Job job = new // $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>GitRepoJob(// $NON-NLS-1$<NEW_LINE>self, "Checking if HEAD changed") {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected IStatus run(IProgressMonitor monitor) {<NEW_LINE>fireBranchAddedEvent(name);<NEW_LINE>// Check if our HEAD changed<NEW_LINE>String oldBranchName = currentBranch<MASK><NEW_LINE>if (oldBranchName.equals(name)) {<NEW_LINE>return Status.OK_STATUS;<NEW_LINE>}<NEW_LINE>_headRef = null;<NEW_LINE>readCurrentBranch();<NEW_LINE>fireBranchChangeEvent(oldBranchName, name);<NEW_LINE>return Status.OK_STATUS;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>job.schedule();<NEW_LINE>} | .simpleRef().shortName(); |
1,303,667 | public RestHighLevelClient initRestClient() {<NEW_LINE>// support es cluster with multi hosts<NEW_LINE>List<HttpHost> hosts = new ArrayList<>();<NEW_LINE>String[] hostArrays = host.split(",");<NEW_LINE>for (String host : hostArrays) {<NEW_LINE>if (StringUtils.isNotEmpty(host)) {<NEW_LINE>hosts.add(new HttpHost(host.trim<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>RestClientBuilder restClientBuilder = RestClient.builder(hosts.toArray(new HttpHost[0]));<NEW_LINE>// configurable auth<NEW_LINE>if (authEnable) {<NEW_LINE>final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();<NEW_LINE>credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));<NEW_LINE>restClientBuilder.setHttpClientConfigCallback(httpAsyncClientBuilder -> httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider));<NEW_LINE>}<NEW_LINE>restClientBuilder.setRequestConfigCallback(requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(connTimeout).setSocketTimeout(socketTimeout).setConnectionRequestTimeout(connectionRequestTimeout));<NEW_LINE>return new RestHighLevelClient(restClientBuilder);<NEW_LINE>} | (), port, "http")); |
1,639,247 | public <T> List<ExtensionWrapper<T>> find(Class<T> type) {<NEW_LINE>log.debug("Finding extensions of extension point '{}'", type.getName());<NEW_LINE>Map<String, Set<String>> entries = getEntries();<NEW_LINE>List<ExtensionWrapper<T>> result = new ArrayList<>();<NEW_LINE>// add extensions found in classpath and plugins<NEW_LINE>for (String pluginId : entries.keySet()) {<NEW_LINE>// classpath's extensions <=> pluginId = null<NEW_LINE>List<ExtensionWrapper<T>> <MASK><NEW_LINE>result.addAll(pluginExtensions);<NEW_LINE>}<NEW_LINE>if (result.isEmpty()) {<NEW_LINE>log.debug("No extensions found for extension point '{}'", type.getName());<NEW_LINE>} else {<NEW_LINE>log.debug("Found {} extensions for extension point '{}'", result.size(), type.getName());<NEW_LINE>}<NEW_LINE>// sort by "ordinal" property<NEW_LINE>Collections.sort(result);<NEW_LINE>return result;<NEW_LINE>} | pluginExtensions = find(type, pluginId); |
1,236,017 | public static String encodeXmlAttribute(String text, boolean exceptApos) {<NEW_LINE>if (text == null || text.length() == 0) {<NEW_LINE>return text;<NEW_LINE>}<NEW_LINE>int length = text.length();<NEW_LINE>// FIXME avoid creating this when not necessary<NEW_LINE>StringBuilder ret = new StringBuilder(length * 12 / 10);<NEW_LINE>int last = 0;<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>char c = text.charAt(i);<NEW_LINE>switch(c) {<NEW_LINE>case '&':<NEW_LINE>last = appendText(text, ret, i, last);<NEW_LINE>ret.append("&");<NEW_LINE>break;<NEW_LINE>case '>':<NEW_LINE>last = appendText(text, ret, i, last);<NEW_LINE>ret.append(">");<NEW_LINE>break;<NEW_LINE>case '<':<NEW_LINE>last = appendText(text, ret, i, last);<NEW_LINE>ret.append("<");<NEW_LINE>break;<NEW_LINE>case '\"':<NEW_LINE>last = appendText(text, ret, i, last);<NEW_LINE>ret.append(""");<NEW_LINE>break;<NEW_LINE>case '\'':<NEW_LINE>if (!exceptApos) {<NEW_LINE>last = appendText(text, ret, i, last);<NEW_LINE>ret.append("'");<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>// encoding tabs and newlines because otherwise they get replaced by spaces on parsing<NEW_LINE>case '\t':<NEW_LINE>last = appendText(text, ret, i, last);<NEW_LINE>ret.append("	");<NEW_LINE>break;<NEW_LINE>case '\r':<NEW_LINE>last = appendText(text, ret, i, last);<NEW_LINE>ret.append("
");<NEW_LINE>break;<NEW_LINE>case '\n':<NEW_LINE>last = appendText(<MASK><NEW_LINE>ret.append("
");<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>// not checking for invalid characters, preserving them as per xmlEncode() with invalidCharReplacement = null<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (last == 0) {<NEW_LINE>// no changes made to the string<NEW_LINE>return text;<NEW_LINE>}<NEW_LINE>appendText(text, ret, length, last);<NEW_LINE>return ret.toString();<NEW_LINE>} | text, ret, i, last); |
254,795 | private Map<String, Object> buildResultMap(SearchResponse response, KunderaQuery query, EntityMetadata m, MetamodelImpl metaModel) {<NEW_LINE>Map<String, Object> map = new LinkedHashMap<>();<NEW_LINE>ESResponseWrapper esResponseReader = new ESResponseWrapper();<NEW_LINE>for (SearchHit hit : response.getHits()) {<NEW_LINE>Object id = PropertyAccessorHelper.fromSourceToTargetClass(((AbstractAttribute) m.getIdAttribute()).getBindableJavaType(), String.class, hit.getId());<NEW_LINE>map.put(hit.getId(), id);<NEW_LINE>}<NEW_LINE>Map<String, Object> aggMap = esResponseReader.parseAggregations(response, query, metaModel, <MASK><NEW_LINE>ListIterable<Expression> selectExpressionOrder = esResponseReader.getSelectExpressionOrder(query);<NEW_LINE>Map<String, Object> resultMap = new HashMap<>();<NEW_LINE>resultMap.put(Constants.AGGREGATIONS, aggMap);<NEW_LINE>resultMap.put(Constants.PRIMARY_KEYS, map);<NEW_LINE>resultMap.put(Constants.SELECT_EXPRESSION_ORDER, selectExpressionOrder);<NEW_LINE>return resultMap;<NEW_LINE>} | m.getEntityClazz(), m); |
617,951 | // return true if commit success and publish success, return false if publish timeout<NEW_LINE>private boolean loadTxnCommitImpl(TLoadTxnCommitRequest request) throws UserException {<NEW_LINE>String cluster = request.getCluster();<NEW_LINE>if (Strings.isNullOrEmpty(cluster)) {<NEW_LINE>cluster = SystemInfoService.DEFAULT_CLUSTER;<NEW_LINE>}<NEW_LINE>if (request.isSetAuthCode()) {<NEW_LINE>// TODO(cmy): find a way to check<NEW_LINE>} else if (request.isSetAuthCodeUuid()) {<NEW_LINE>checkAuthCodeUuid(request.getDb(), request.getTxnId(), request.getAuthCodeUuid());<NEW_LINE>} else {<NEW_LINE>checkPasswordAndPrivs(cluster, request.getUser(), request.getPasswd(), request.getDb(), request.getTbl(), request.getUserIp(), PrivPredicate.LOAD);<NEW_LINE>}<NEW_LINE>// get database<NEW_LINE>Env env = Env.getCurrentEnv();<NEW_LINE>String fullDbName = ClusterNamespace.getFullName(cluster, request.getDb());<NEW_LINE>Database db;<NEW_LINE>if (request.isSetDbId() && request.getDbId() > 0) {<NEW_LINE>db = env.getInternalCatalog().getDbNullable(request.getDbId());<NEW_LINE>} else {<NEW_LINE>db = env.getInternalCatalog().getDbNullable(fullDbName);<NEW_LINE>}<NEW_LINE>if (db == null) {<NEW_LINE>String dbName = fullDbName;<NEW_LINE>if (Strings.isNullOrEmpty(request.getCluster())) {<NEW_LINE>dbName = request.getDb();<NEW_LINE>}<NEW_LINE>throw new UserException("unknown database, database=" + dbName);<NEW_LINE>}<NEW_LINE>long timeoutMs = request.isSetThriftRpcTimeoutMs() ? request<MASK><NEW_LINE>Table table = db.getTableOrMetaException(request.getTbl(), TableType.OLAP);<NEW_LINE>return Env.getCurrentGlobalTransactionMgr().commitAndPublishTransaction(db, Lists.newArrayList(table), request.getTxnId(), TabletCommitInfo.fromThrift(request.getCommitInfos()), timeoutMs, TxnCommitAttachment.fromThrift(request.txnCommitAttachment));<NEW_LINE>} | .getThriftRpcTimeoutMs() / 2 : 5000; |
820,685 | private static void buildConversionMap() {<NEW_LINE>// Values in the map below may be always changed<NEW_LINE>ArrayMap<String, String> keyValueMap = new ArrayMap<>(10);<NEW_LINE>keyValueMap.put("top", "0");<NEW_LINE>keyValueMap.put("left", "0");<NEW_LINE><MASK><NEW_LINE>keyValueMap.put("bottom", "DUMMY_BOTTOM");<NEW_LINE>keyValueMap.put("width", "DUMMY_WIDTH");<NEW_LINE>keyValueMap.put("height", "DUMMY_HEIGHT");<NEW_LINE>keyValueMap.put("screen_width", "DUMMY_DATA");<NEW_LINE>keyValueMap.put("screen_height", "DUMMY_DATA");<NEW_LINE>keyValueMap.put("margin", Integer.toString((int) Tools.dpToPx(2)));<NEW_LINE>keyValueMap.put("preferred_scale", Float.toString(LauncherPreferences.PREF_BUTTONSIZE));<NEW_LINE>conversionMap = new WeakReference<>(keyValueMap);<NEW_LINE>} | keyValueMap.put("right", "DUMMY_RIGHT"); |
970,770 | protected void processTasks(boolean redstoneCheck) {<NEW_LINE>if (!redstoneCheck) {<NEW_LINE>if (canBeActive) {<NEW_LINE>canBeActive = false;<NEW_LINE>updateClients = true;<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>canBeActive = true;<NEW_LINE>if (!world.isRemote && fluidUsed > 0 && activeTask == null && !inputTank.isEmpty()) {<NEW_LINE>// we were saved while a task was active. Luckily those are easy to recreate<NEW_LINE>activeTask = WeatherTask.fromFluid(inputTank.getFluidNN().getFluid());<NEW_LINE>PacketHandler.INSTANCE.sendToAllAround(new PacketActivateWeather(this, activeTask != null), this);<NEW_LINE>}<NEW_LINE>if (isActive()) {<NEW_LINE>if (getEnergyStored() > getPowerUsePerTick() && !inputTank.isEmpty()) {<NEW_LINE>setEnergyStored(getEnergyStored() - getPowerUsePerTick());<NEW_LINE>fluidUsed += inputTank.removeFluidAmount(Math.min(CapacitorKey.WEATHER_POWER_FLUID_USE.get(getCapacitorData()), getActiveTask().getRequiredFluidAmount() - fluidUsed));<NEW_LINE>}<NEW_LINE>if (fluidUsed >= getActiveTask().getRequiredFluidAmount()) {<NEW_LINE>EntityWeatherRocket e <MASK><NEW_LINE>e.setPosition(getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5);<NEW_LINE>world.spawnEntity(e);<NEW_LINE>stopTask();<NEW_LINE>updateClients = true;<NEW_LINE>}<NEW_LINE>// we have a very smooth block animation, so all clients need very detailed progress data<NEW_LINE>// TODO: check if this is really needed for the WeatherObelisk<NEW_LINE>PacketHandler.INSTANCE.sendToAllAround(getProgressPacket(), this);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (tanksDirty && shouldDoWorkThisTick(5)) {<NEW_LINE>PacketHandler.sendToAllAround(new PacketWeatherTank(this), this);<NEW_LINE>tanksDirty = false;<NEW_LINE>}<NEW_LINE>} | = new EntityWeatherRocket(world, activeTask); |
1,374,519 | protected DB2PlanConfig runTask() {<NEW_LINE>// No valid explain tables found, propose to create them in current authId<NEW_LINE>String msg = String.format(DB2Messages.<MASK><NEW_LINE>if (!UIUtils.confirmAction(DB2Messages.dialog_explain_no_tables, msg)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Ask the user in what tablespace to create the Explain tables and build a dialog with the list of usable tablespaces for the user to choose<NEW_LINE>DB2TablespaceChooser tsChooserDialog = null;<NEW_LINE>try {<NEW_LINE>final List<String> listTablespaces = DB2Utils.getListOfUsableTsForExplain(monitor, session);<NEW_LINE>// NO Usable Tablespace found: End of the game..<NEW_LINE>if (listTablespaces.isEmpty()) {<NEW_LINE>DBWorkbench.getPlatformUI().showError(DB2Messages.dialog_explain_no_tablespace_found_title, DB2Messages.dialog_explain_no_tablespace_found);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>tsChooserDialog = new DB2TablespaceChooser(UIUtils.getActiveWorkbenchShell(), listTablespaces);<NEW_LINE>} catch (SQLException e) {<NEW_LINE>log.error(e);<NEW_LINE>}<NEW_LINE>if (tsChooserDialog != null && tsChooserDialog.open() == IDialogConstants.OK_ID) {<NEW_LINE>object.setTablespace(tsChooserDialog.getSelectedTablespace());<NEW_LINE>return object;<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | dialog_explain_ask_to_create, object.getSessionUserSchema()); |
156,342 | private void fixnumStep(ThreadContext context, Ruby runtime, long step, Block block) {<NEW_LINE>// We must avoid integer overflows.<NEW_LINE>// Any method calling this method must ensure that "step" is greater than 0.<NEW_LINE>long to = ((RubyFixnum) end).getLongValue();<NEW_LINE>if (isExclusive) {<NEW_LINE>if (to == Long.MIN_VALUE) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>to--;<NEW_LINE>}<NEW_LINE>long tov = Long.MAX_VALUE - step;<NEW_LINE>if (to < tov) {<NEW_LINE>tov = to;<NEW_LINE>}<NEW_LINE>long i;<NEW_LINE>for (i = ((RubyFixnum) begin).getLongValue(); i <= tov; i += step) {<NEW_LINE>block.yield(context, RubyFixnum<MASK><NEW_LINE>}<NEW_LINE>if (i <= to) {<NEW_LINE>block.yield(context, RubyFixnum.newFixnum(runtime, i));<NEW_LINE>}<NEW_LINE>} | .newFixnum(runtime, i)); |
1,094,968 | protected void copyUserFolders(User fromUser, User toUser, Map<UUID, Presentation> presentationsMap) {<NEW_LINE>try (Transaction tx = persistence.createTransaction()) {<NEW_LINE>MetaClass effectiveMetaClass = metadata.getExtendedEntities().getEffectiveMetaClass(SearchFolder.class);<NEW_LINE>EntityManager em = persistence.getEntityManager();<NEW_LINE>try {<NEW_LINE>em.setSoftDeletion(false);<NEW_LINE>Query deleteSettingsQuery = em.createQuery(String.format("delete from %s s where s.user.id = ?1", effectiveMetaClass.getName()));<NEW_LINE>deleteSettingsQuery.setParameter(1, toUser.getId());<NEW_LINE>deleteSettingsQuery.executeUpdate();<NEW_LINE>} finally {<NEW_LINE>em.setSoftDeletion(true);<NEW_LINE>}<NEW_LINE>TypedQuery<SearchFolder> q = em.createQuery(String.format("select s from %s s where s.user.id = ?1", effectiveMetaClass.getName<MASK><NEW_LINE>q.setParameter(1, fromUser.getId());<NEW_LINE>List<SearchFolder> fromUserFolders = q.getResultList();<NEW_LINE>Map<SearchFolder, SearchFolder> copiedFolders = new HashMap<>();<NEW_LINE>for (SearchFolder searchFolder : fromUserFolders) {<NEW_LINE>copyFolder(searchFolder, toUser, copiedFolders, presentationsMap);<NEW_LINE>}<NEW_LINE>tx.commit();<NEW_LINE>}<NEW_LINE>} | ()), SearchFolder.class); |
466,172 | public String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException {<NEW_LINE>String digestAlgorithm = <MASK><NEW_LINE>String stringToEncode = values[1].execute();<NEW_LINE>String salt = values.length > 2 ? values[2].execute() : null;<NEW_LINE>String encodedString = null;<NEW_LINE>try {<NEW_LINE>MessageDigest md = MessageDigest.getInstance(digestAlgorithm);<NEW_LINE>md.update(stringToEncode.getBytes(StandardCharsets.UTF_8));<NEW_LINE>if (StringUtils.isNotEmpty(salt)) {<NEW_LINE>md.update(salt.getBytes(StandardCharsets.UTF_8));<NEW_LINE>}<NEW_LINE>byte[] bytes = md.digest();<NEW_LINE>encodedString = uppercase(Hex.encodeHexString(bytes), values, 3);<NEW_LINE>addVariableValue(encodedString, values, 4);<NEW_LINE>} catch (NoSuchAlgorithmException e) {<NEW_LINE>log.error("Error calling {} function with value {}, digest algorithm {}, salt {}, ", KEY, stringToEncode, digestAlgorithm, salt, e);<NEW_LINE>}<NEW_LINE>return encodedString;<NEW_LINE>} | values[0].execute(); |
359,427 | public Object call(ExecutionContext context, Object self, Object... args) {<NEW_LINE>// 15.4.4.9<NEW_LINE>JSObject o = Types.toObject(context, self);<NEW_LINE>long len = Types.toUint32(context, o<MASK><NEW_LINE>Arguments argsObj = (Arguments) context.resolve("arguments").getValue(context);<NEW_LINE>int numArgs = (int) argsObj.get(context, "length");<NEW_LINE>for (long k = len; k > 0; --k) {<NEW_LINE>if (o.hasProperty(context, "" + (k - 1))) {<NEW_LINE>final Object fromValue = o.get(context, "" + (k - 1));<NEW_LINE>o.put(context, "" + (k + numArgs - 1), fromValue, true);<NEW_LINE>} else {<NEW_LINE>o.delete(context, "" + (k + numArgs - 1), true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int j = 0; j < numArgs; ++j) {<NEW_LINE>o.put(context, "" + j, args[j], true);<NEW_LINE>}<NEW_LINE>o.put(context, "length", len + numArgs, true);<NEW_LINE>return len + numArgs;<NEW_LINE>} | .get(context, "length")); |
898,394 | private // SQLDCXGRP; PROTOCOL TYPE N-GDA; ENVLID 0xD3; Length Override 1<NEW_LINE>int parseSQLDCGRP(NetSqlca[] rowsetSqlca, int lastRow) {<NEW_LINE>// SQLCODE<NEW_LINE>int sqldcCode = readFastInt();<NEW_LINE>// SQLSTATE<NEW_LINE>String sqldcState = readFastString(5, CCSIDConstants.UTF8);<NEW_LINE>// REASON_CODE<NEW_LINE>int sqldcReason = readFastInt();<NEW_LINE>// LINE_NUMBER<NEW_LINE>int sqldcLinen = readFastInt();<NEW_LINE>// ROW_NUMBER<NEW_LINE>int sqldcRown = (int) readFastLong();<NEW_LINE>// save +20237 in the 0th entry of the rowsetSqlca's.<NEW_LINE>// this info is going to be used when a subsequent fetch prior is issued, and if already<NEW_LINE>// received a +20237 then we've gone beyond the first row and there is no need to<NEW_LINE>// flow another fetch to the server.<NEW_LINE>if (sqldcCode == 20237) {<NEW_LINE>rowsetSqlca[0] = new <MASK><NEW_LINE>} else {<NEW_LINE>if (rowsetSqlca[sqldcRown] != null) {<NEW_LINE>rowsetSqlca[sqldcRown].resetRowsetSqlca(sqldcCode, sqldcState);<NEW_LINE>} else {<NEW_LINE>rowsetSqlca[sqldcRown] = new NetSqlca(sqldcCode, sqldcState, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// reset all entries between lastRow and sqldcRown to null<NEW_LINE>for (int i = lastRow + 1; i < sqldcRown; i++) {<NEW_LINE>rowsetSqlca[i] = null;<NEW_LINE>}<NEW_LINE>skipFastBytes(47);<NEW_LINE>// RDBNAM<NEW_LINE>String sqldcRdb = parseFastVCS();<NEW_LINE>// skip the tokens for now, since we already have the complete message.<NEW_LINE>// MESSAGE_TOKENS<NEW_LINE>parseSQLDCTOKS();<NEW_LINE>// MESSAGE_TEXT<NEW_LINE>String sqldcMsg = parseFastNVCMorNVCS();<NEW_LINE>// skip the following for now.<NEW_LINE>// COLUMN_NAME<NEW_LINE>skipFastNVCMorNVCS();<NEW_LINE>// PARAMETER_NAME<NEW_LINE>skipFastNVCMorNVCS();<NEW_LINE>// EXTENDED_NAMES<NEW_LINE>skipFastNVCMorNVCS();<NEW_LINE>// SQLDCXGRP<NEW_LINE>parseSQLDCXGRP();<NEW_LINE>return sqldcRown;<NEW_LINE>} | NetSqlca(sqldcCode, sqldcState, null); |
1,324,661 | public void doSubSidebarNoLoad(final String subOverride) {<NEW_LINE>findViewById(R.id.loader).setVisibility(View.GONE);<NEW_LINE>invalidateOptionsMenu();<NEW_LINE>if (!subOverride.equalsIgnoreCase("all") && !subOverride.equalsIgnoreCase("frontpage") && !subOverride.equalsIgnoreCase("friends") && !subOverride.equalsIgnoreCase("mod") && !subOverride.contains("+") && !subOverride.contains(".") && !subOverride.contains("/m/")) {<NEW_LINE>if (drawerLayout != null) {<NEW_LINE>drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, GravityCompat.END);<NEW_LINE>}<NEW_LINE>findViewById(R.id.sidebar_text).setVisibility(View.GONE);<NEW_LINE>findViewById(R.id.sub_title).setVisibility(View.GONE);<NEW_LINE>findViewById(R.id.subscribers).setVisibility(View.GONE);<NEW_LINE>findViewById(R.id.active_users).setVisibility(View.GONE);<NEW_LINE>findViewById(R.id.header_sub).setBackgroundColor(Palette.getColor(subOverride));<NEW_LINE>((TextView) findViewById(R.id.sub_infotitle)).setText(subOverride);<NEW_LINE>// Sidebar buttons should use subOverride's accent color<NEW_LINE>int subColor = new ColorPreferences(this).getColor(subOverride);<NEW_LINE>((TextView) findViewById(R.id.theme_text)).setTextColor(subColor);<NEW_LINE>((TextView) findViewById(R.id.<MASK><NEW_LINE>((TextView) findViewById(R.id.post_text)).setTextColor(subColor);<NEW_LINE>((TextView) findViewById(R.id.mods_text)).setTextColor(subColor);<NEW_LINE>((TextView) findViewById(R.id.flair_text)).setTextColor(subColor);<NEW_LINE>((TextView) findViewById(R.id.sorting).findViewById(R.id.sort)).setTextColor(subColor);<NEW_LINE>((TextView) findViewById(R.id.sync)).setTextColor(subColor);<NEW_LINE>} else {<NEW_LINE>if (drawerLayout != null) {<NEW_LINE>drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, GravityCompat.END);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | wiki_text)).setTextColor(subColor); |
338,194 | private void checkSnapshotCompatibility(Project project, FileCollection currentFiles, File previousDirectory, FileExtensionFilter filter, List<String> fileArgs) {<NEW_LINE>boolean isCheckRestSpecVsSnapshot = filter.getSuffix().equals(PegasusPlugin.IDL_FILE_SUFFIX);<NEW_LINE>for (File currentFile : currentFiles) {<NEW_LINE>getProject().getLogger().info("Checking interface file: {}", currentFile.getPath());<NEW_LINE>String apiFilename;<NEW_LINE>if (isCheckRestSpecVsSnapshot) {<NEW_LINE>String fileName = currentFile.getName().substring(0, currentFile.getName().length() - PegasusPlugin.SNAPSHOT_FILE_SUFFIX.length());<NEW_LINE>apiFilename = fileName + PegasusPlugin.IDL_FILE_SUFFIX;<NEW_LINE>} else {<NEW_LINE>apiFilename = currentFile.getName();<NEW_LINE>}<NEW_LINE>String apiFilePath = previousDirectory.getPath() + File.separatorChar + apiFilename;<NEW_LINE>File <MASK><NEW_LINE>if (apiFile.exists()) {<NEW_LINE>fileArgs.add(apiFilePath);<NEW_LINE>fileArgs.add(currentFile.getPath());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | apiFile = project.file(apiFilePath); |
1,036,114 | private void initDatabasesTab() {<NEW_LINE>new ViewModelListCellFactory<StudyDatabaseItem>().withText(StudyDatabaseItem::getName).install(databaseSelector);<NEW_LINE>databaseSelector.setItems(viewModel.getNonSelectedDatabases());<NEW_LINE>setupCommonPropertiesForTables(databaseSelector, <MASK><NEW_LINE>databaseEnabledColumn.setResizable(false);<NEW_LINE>databaseEnabledColumn.setReorderable(false);<NEW_LINE>databaseEnabledColumn.setCellValueFactory(param -> param.getValue().enabledProperty());<NEW_LINE>databaseEnabledColumn.setCellFactory(CheckBoxTableCell.forTableColumn(databaseEnabledColumn));<NEW_LINE>databaseColumn.setCellValueFactory(param -> param.getValue().nameProperty());<NEW_LINE>databaseActionColumn.setCellValueFactory(param -> param.getValue().nameProperty());<NEW_LINE>new ValueTableCellFactory<org.jabref.gui.slr.StudyDatabaseItem, String>().withGraphic(item -> IconTheme.JabRefIcons.DELETE_ENTRY.getGraphicNode()).withTooltip(name -> Localization.lang("Remove")).withOnMouseClickedEvent(item -> evt -> viewModel.removeDatabase(item)).install(databaseActionColumn);<NEW_LINE>databaseTable.setItems(viewModel.getDatabases());<NEW_LINE>} | this::addDatabase, databaseColumn, databaseActionColumn); |
268,944 | public SecurityProfileIdentifier unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SecurityProfileIdentifier securityProfileIdentifier = new SecurityProfileIdentifier();<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>if (context.testExpression("name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>securityProfileIdentifier.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("arn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>securityProfileIdentifier.setArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return securityProfileIdentifier;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
952,204 | public static void main(String[] args) {<NEW_LINE>// TODO: Replace with your project ID in the form "projects/your-project-id".<NEW_LINE>String projectId = "your-project";<NEW_LINE>// TODO: Replace with the ID of your member in the form "user:member@example.com"<NEW_LINE>String member = "your-member";<NEW_LINE>// The role to be granted.<NEW_LINE>String role = "roles/logging.logWriter";<NEW_LINE>// Initializes the Cloud Resource Manager service.<NEW_LINE>CloudResourceManager crmService = null;<NEW_LINE>try {<NEW_LINE>crmService = initializeService();<NEW_LINE>} catch (IOException | GeneralSecurityException e) {<NEW_LINE>System.out.println("Unable to initialize service: \n" + e.getMessage(<MASK><NEW_LINE>}<NEW_LINE>// Grants your member the "Log writer" role for your project.<NEW_LINE>addBinding(crmService, projectId, member, role);<NEW_LINE>// Get the project's policy and print all members with the "Log Writer" role<NEW_LINE>Policy policy = getPolicy(crmService, projectId);<NEW_LINE>Binding binding = null;<NEW_LINE>List<Binding> bindings = policy.getBindings();<NEW_LINE>for (Binding b : bindings) {<NEW_LINE>if (b.getRole().equals(role)) {<NEW_LINE>binding = b;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("Role: " + binding.getRole());<NEW_LINE>System.out.print("Members: ");<NEW_LINE>for (String m : binding.getMembers()) {<NEW_LINE>System.out.print("[" + m + "] ");<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>// Removes member from the "Log writer" role.<NEW_LINE>removeMember(crmService, projectId, member, role);<NEW_LINE>} | ) + e.getStackTrace()); |
1,658,803 | public void run() throws Exception {<NEW_LINE>initShutdownHook();<NEW_LINE>log.log(Level.FINE, "Starting VdsVisitTarget");<NEW_LINE>MessageBusParams mbusParams = new MessageBusParams(new LoadTypeSet());<NEW_LINE>mbusParams.getRPCNetworkParams().setIdentity(new Identity(slobrokAddress));<NEW_LINE>if (port > 0) {<NEW_LINE>mbusParams.getRPCNetworkParams().setListenPort(port);<NEW_LINE>}<NEW_LINE>access = new MessageBusDocumentAccess(mbusParams);<NEW_LINE>VdsVisitHandler handler;<NEW_LINE>Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass(handlerClassName);<NEW_LINE>try {<NEW_LINE>// Any custom data handlers may have a constructor that takes in args,<NEW_LINE>// so that the user can pass cmd line options to them<NEW_LINE>Class<?>[] consTypes = new Class<?>[] { boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, int.class, String[].class };<NEW_LINE>Constructor<?> cons = cls.getConstructor(consTypes);<NEW_LINE>handler = (VdsVisitHandler) cons.newInstance(printIds, verbose, verbose, verbose, false, false, processTime, handlerArgs);<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>// Retry, this time matching the StdOutVisitorHandler constructor<NEW_LINE>// arg list<NEW_LINE>Class<?>[] consTypes = new Class<?>[] { boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, <MASK><NEW_LINE>Constructor<?> cons = cls.getConstructor(consTypes);<NEW_LINE>handler = (VdsVisitHandler) cons.newInstance(printIds, verbose, verbose, verbose, false, false, processTime, false);<NEW_LINE>}<NEW_LINE>VisitorDataHandler dataHandler = handler.getDataHandler();<NEW_LINE>VisitorControlHandler controlHandler = handler.getControlHandler();<NEW_LINE>VisitorDestinationParameters params = new VisitorDestinationParameters("visit-destination", dataHandler);<NEW_LINE>session = access.createVisitorDestinationSession(params);<NEW_LINE>while (!controlHandler.isDone()) {<NEW_LINE>Thread.sleep(1000);<NEW_LINE>}<NEW_LINE>} | int.class, boolean.class }; |
1,616,117 | private String toStringWithSuffix(final String suffix) {<NEW_LINE>StringBuilder toStringBuff = new StringBuilder();<NEW_LINE>toStringBuff.append(" parentHash=").append(toHexStringOrEmpty(parentHash)).append(suffix);<NEW_LINE>toStringBuff.append(" unclesHash=").append(toHexStringOrEmpty(unclesHash)).append(suffix);<NEW_LINE>toStringBuff.append(" coinbase=").append(coinbase).append(suffix);<NEW_LINE>toStringBuff.append(" stateRoot=").append(toHexStringOrEmpty(stateRoot)).append(suffix);<NEW_LINE>toStringBuff.append(" txTrieHash=").append(toHexStringOrEmpty(txTrieRoot)).append(suffix);<NEW_LINE>toStringBuff.append(" receiptsTrieHash=").append(toHexStringOrEmpty(<MASK><NEW_LINE>toStringBuff.append(" difficulty=").append(difficulty).append(suffix);<NEW_LINE>toStringBuff.append(" number=").append(number).append(suffix);<NEW_LINE>toStringBuff.append(" gasLimit=").append(toHexStringOrEmpty(gasLimit)).append(suffix);<NEW_LINE>toStringBuff.append(" gasUsed=").append(gasUsed).append(suffix);<NEW_LINE>toStringBuff.append(" timestamp=").append(timestamp).append(" (").append(Utils.longToDateTime(timestamp)).append(")").append(suffix);<NEW_LINE>toStringBuff.append(" extraData=").append(toHexStringOrEmpty(extraData)).append(suffix);<NEW_LINE>toStringBuff.append(" minGasPrice=").append(minimumGasPrice).append(suffix);<NEW_LINE>return toStringBuff.toString();<NEW_LINE>} | receiptTrieRoot)).append(suffix); |
1,122,084 | private static void createOffsetFromNode(Node node, AnnotationProvider factory, OffsetEquation eq, char op) {<NEW_LINE>JavaExpression je = JavaExpression.fromNode(node);<NEW_LINE>if (je instanceof Unknown || je == null) {<NEW_LINE>if (node instanceof NumericalAdditionNode) {<NEW_LINE>createOffsetFromNode(((NumericalAdditionNode) node).getLeftOperand(), factory, eq, op);<NEW_LINE>createOffsetFromNode(((NumericalAdditionNode) node).getRightOperand(), factory, eq, op);<NEW_LINE>} else if (node instanceof NumericalSubtractionNode) {<NEW_LINE>createOffsetFromNode(((NumericalSubtractionNode) node).getLeftOperand(), factory, eq, op);<NEW_LINE>char other = op == '+' ? '-' : '+';<NEW_LINE>createOffsetFromNode(((NumericalSubtractionNode) node).getRightOperand(), factory, eq, other);<NEW_LINE>} else {<NEW_LINE>eq.error = node.toString();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>eq.addTerm(<MASK><NEW_LINE>}<NEW_LINE>} | op, je.toString()); |
540,134 | public CreateSignalingChannelResult createSignalingChannel(CreateSignalingChannelRequest createSignalingChannelRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createSignalingChannelRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateSignalingChannelRequest> request = null;<NEW_LINE>Response<CreateSignalingChannelResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateSignalingChannelRequestMarshaller().marshall(createSignalingChannelRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<CreateSignalingChannelResult, JsonUnmarshallerContext> unmarshaller = new CreateSignalingChannelResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<CreateSignalingChannelResult> responseHandler = new JsonResponseHandler<CreateSignalingChannelResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(<MASK><NEW_LINE>}<NEW_LINE>} | awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC); |
491,174 | public ConsumerExecutor createExecutor(ExecutionContext context, int index) {<NEW_LINE>PartitioningScheme partitioningScheme = fragment.getPartitioningScheme();<NEW_LINE>List<DataType<MASK><NEW_LINE>List<DataType> outputType = SerializeDataType.convertToDataType(fragment.getOutputTypes());<NEW_LINE>if (partitioningScheme.getShuffleHandle().isSinglePartition() || partitioningScheme.getPartitionMode().equals(PartitionShuffleHandle.PartitionShuffleMode.BROADCAST) || partitioningScheme.getPartitionCount() == 1) {<NEW_LINE>return new TaskOutputCollector(inputType, outputType, outputBuffer, this.pagesSerdeFactory.createPagesSerde(outputType), context);<NEW_LINE>} else {<NEW_LINE>int chunkLimit = context.getParamManager().getInt(ConnectionParams.CHUNK_SIZE);<NEW_LINE>return new PartitionedOutputCollector(partitioningScheme.getPartitionCount(), inputType, outputType, partitioningScheme.getPartChannels(), outputBuffer, this.pagesSerdeFactory, chunkLimit, context);<NEW_LINE>}<NEW_LINE>} | > inputType = fragment.getTypes(); |
1,141,682 | public void printHistogramScaled() {<NEW_LINE>String sumType = input.getSumType();<NEW_LINE>out.print("\tpublic static void histogramScaled( " + input.getSingleBandName() + " input , " + sumType + " minValue , " + sumType + " maxValue, int[] histogram ) {\n" + "\t\tArrays.fill(histogram,0);\n" + "\n" + "\t\tfinal " + sumType + " histLength = histogram.length;\n" + "\t\tfinal " + sumType + " rangeValue = maxValue-minValue+1;\n" + "\t\t\n" + "\t\t//CONCURRENT_INLINE final List<int[]> list = new ArrayList<>();\n" + "\t\t//CONCURRENT_INLINE BoofConcurrency.loopBlocks(0,input.height,(y0,y1)->{\n" + "\t\t//CONCURRENT_BELOW final int[] h = new int[histogram.length];\n" + "\t\tfinal int[] h = histogram;\n" + "\t\t//CONCURRENT_BELOW for( int y = y0; y < y1; y++ ) {\n" + "\t\tfor( int y = 0; y < input.height; y++ ) {\n" + "\t\t\tint index = input.startIndex + y*input.stride;\n" + "\t\t\tint end = index + input.width;\n" + "\n" + "\t\t\twhile( index < end ) {\n");<NEW_LINE>if (input.isInteger()) {<NEW_LINE>if (input.getNumBits() == 64)<NEW_LINE>out.print("\t\t\t\th[(int)(histLength*(input.data[index++] - minValue)/rangeValue)]++;\n");<NEW_LINE>else<NEW_LINE>out.print("\t\t\t\th[(int)(histLength*((input.data[index++]" + <MASK><NEW_LINE>} else {<NEW_LINE>out.print("\t\t\t\th[(int)(histLength*(input.data[index++] - minValue)/rangeValue)]++;\n");<NEW_LINE>}<NEW_LINE>out.print("\t\t\t}\n" + "\t\t}\n" + "\t\t//CONCURRENT_INLINE synchronized(list){list.add(h);}});\n" + "\t\t//CONCURRENT_INLINE for (int i = 0; i < list.size(); i++) {\n" + "\t\t//CONCURRENT_INLINE \tint[] h = list.get(i);\n" + "\t\t//CONCURRENT_INLINE \tfor (int j = 0; j < histogram.length; j++) {\n" + "\t\t//CONCURRENT_INLINE \t\thistogram[j] += h[j];\n" + "\t\t//CONCURRENT_INLINE \t}\n" + "\t\t//CONCURRENT_INLINE }\n" + "\t}\n\n");<NEW_LINE>} | input.getBitWise() + ") - minValue)/rangeValue) ]++;\n"); |
1,694,326 | public void restartNode(NodeSpec nodeSpec) throws Exception {<NEW_LINE>String clientKey = getNodeClientKey(nodeSpec);<NEW_LINE>NodeClient client = nodeClientCache.getOrDefault(clientKey, null);<NEW_LINE>if (null == client) {<NEW_LINE>client = new NodeClient(nodeSpec.getIp(), nodeSpec.getClientPort());<NEW_LINE>nodeClientCache.put(clientKey, client);<NEW_LINE>}<NEW_LINE>ListenableFuture<NodeRestartResponse> future = client.restartNode();<NEW_LINE>try {<NEW_LINE>NodeRestartResponse response1 = future.get();<NEW_LINE>if (response1.getCode() == RpcCode.OK.ordinal()) {<NEW_LINE>LOG.info(<MASK><NEW_LINE>} else {<NEW_LINE>LOG.info(response1.getMessage());<NEW_LINE>throw new Exception(response1.getMessage());<NEW_LINE>}<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>stopHeartBeatMonitorNode(clientKey);<NEW_LINE>} | "restart response:" + response1.getMessage()); |
1,274,713 | public Lucene90OnHeapHnswGraph build(RandomAccessVectorValues vectors) throws IOException {<NEW_LINE>if (vectors == vectorValues) {<NEW_LINE>throw new IllegalArgumentException("Vectors to build must be independent of the source of vectors provided to HnswGraphBuilder()");<NEW_LINE>}<NEW_LINE>if (infoStream.isEnabled(HNSW_COMPONENT)) {<NEW_LINE>infoStream.message(HNSW_COMPONENT, "build graph from " + vectors.size() + " vectors");<NEW_LINE>}<NEW_LINE>long start = System<MASK><NEW_LINE>// start at node 1! node 0 is added implicitly, in the constructor<NEW_LINE>for (int node = 1; node < vectors.size(); node++) {<NEW_LINE>addGraphNode(vectors.vectorValue(node));<NEW_LINE>if (node % 10000 == 0) {<NEW_LINE>if (infoStream.isEnabled(HNSW_COMPONENT)) {<NEW_LINE>long now = System.nanoTime();<NEW_LINE>infoStream.message(HNSW_COMPONENT, String.format(Locale.ROOT, "built %d in %d/%d ms", node, ((now - t) / 1_000_000), ((now - start) / 1_000_000)));<NEW_LINE>t = now;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return hnsw;<NEW_LINE>} | .nanoTime(), t = start; |
913,695 | public void update(ECoCheckDetector<?> ecocheck) {<NEW_LINE>DogArray<ChessboardCorner> orig = ecocheck.getDetector().getCorners();<NEW_LINE>foundCorners.reset();<NEW_LINE>for (int i = 0; i < orig.size; i++) {<NEW_LINE>foundCorners.grow().setTo(orig.get(i));<NEW_LINE>}<NEW_LINE>{<NEW_LINE>DogArray<ECoCheckFound> found = ecocheck.getFound();<NEW_LINE>foundGrids.reset();<NEW_LINE>for (int i = 0; i < found.size; i++) {<NEW_LINE>ECoCheckFound grid = found.get(i);<NEW_LINE>CalibrationObservation c = foundGrids.grow();<NEW_LINE>c.points.clear();<NEW_LINE>for (int j = 0; j < grid.corners.size(); j++) {<NEW_LINE>c.points.add(grid<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>foundClusters.reset();<NEW_LINE>DogArray<ChessboardCornerGraph> clusters = ecocheck.getClusterFinder().getOutputClusters();<NEW_LINE>for (int i = 0; i < clusters.size; i++) {<NEW_LINE>clusters.get(i).convert(foundClusters.grow());<NEW_LINE>}<NEW_LINE>} | .corners.get(j)); |
1,206,090 | final DescribeLoadBasedAutoScalingResult executeDescribeLoadBasedAutoScaling(DescribeLoadBasedAutoScalingRequest describeLoadBasedAutoScalingRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeLoadBasedAutoScalingRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeLoadBasedAutoScalingRequest> request = null;<NEW_LINE>Response<DescribeLoadBasedAutoScalingResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeLoadBasedAutoScalingRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeLoadBasedAutoScalingRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "OpsWorks");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeLoadBasedAutoScaling");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeLoadBasedAutoScalingResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeLoadBasedAutoScalingResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
376,039 | private void writePage(Page page) {<NEW_LINE>int[] writerIndexes = getWriterIndexes(page);<NEW_LINE>// position count for each writer<NEW_LINE>int[] sizes = new <MASK><NEW_LINE>for (int index : writerIndexes) {<NEW_LINE>sizes[index]++;<NEW_LINE>}<NEW_LINE>// record which positions are used by which writer<NEW_LINE>int[][] writerPositions = new int[writers.size()][];<NEW_LINE>int[] counts = new int[writers.size()];<NEW_LINE>for (int position = 0; position < page.getPositionCount(); position++) {<NEW_LINE>int index = writerIndexes[position];<NEW_LINE>int count = counts[index];<NEW_LINE>if (count == 0) {<NEW_LINE>writerPositions[index] = new int[sizes[index]];<NEW_LINE>}<NEW_LINE>writerPositions[index][count] = position;<NEW_LINE>counts[index] = count + 1;<NEW_LINE>}<NEW_LINE>// invoke the writers<NEW_LINE>Page dataPage = getDataPage(page);<NEW_LINE>for (int index = 0; index < writerPositions.length; index++) {<NEW_LINE>int[] positions = writerPositions[index];<NEW_LINE>if (positions == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// If write is partitioned across multiple writers, filter page using dictionary blocks<NEW_LINE>Page pageForWriter = dataPage;<NEW_LINE>if (positions.length != dataPage.getPositionCount()) {<NEW_LINE>verify(positions.length == counts[index]);<NEW_LINE>pageForWriter = pageForWriter.getPositions(positions, 0, positions.length);<NEW_LINE>}<NEW_LINE>HiveWriter writer = writers.get(index);<NEW_LINE>long currentWritten = writer.getWrittenBytes();<NEW_LINE>long currentMemory = writer.getSystemMemoryUsage();<NEW_LINE>writer.append(pageForWriter);<NEW_LINE>writtenBytes += (writer.getWrittenBytes() - currentWritten);<NEW_LINE>systemMemoryUsage += (writer.getSystemMemoryUsage() - currentMemory);<NEW_LINE>}<NEW_LINE>} | int[writers.size()]; |
471,195 | public void filterBankDetails(ActionRequest request, ActionResponse response) {<NEW_LINE>InvoicePayment invoicePayment = request.getContext().asType(InvoicePayment.class);<NEW_LINE>Map<String, Object> partialInvoice = (Map<String, Object>) request.<MASK><NEW_LINE>Invoice invoice = Beans.get(InvoiceRepository.class).find(((Integer) partialInvoice.get("id")).longValue());<NEW_LINE>Company company = invoice.getCompany();<NEW_LINE>List<BankDetails> bankDetailsList = Beans.get(InvoicePaymentToolService.class).findCompatibleBankDetails(company, invoicePayment);<NEW_LINE>if (bankDetailsList.isEmpty()) {<NEW_LINE>response.setAttr("companyBankDetails", "domain", "self.id IN (0)");<NEW_LINE>} else {<NEW_LINE>String idList = StringTool.getIdListString(bankDetailsList);<NEW_LINE>response.setAttr("companyBankDetails", "domain", "self.id IN (" + idList + ")");<NEW_LINE>}<NEW_LINE>} | getContext().get("_invoice"); |
267,306 | protected static void verifyData(File file, RSAPublicKey key) throws AEVerifierException, Exception {<NEW_LINE>ZipInputStream zis = null;<NEW_LINE>try {<NEW_LINE>zis = new ZipInputStream(new BufferedInputStream(FileUtil.newFileInputStream(file)));<NEW_LINE>byte[] signature = null;<NEW_LINE>Signature sig = Signature.getInstance("MD5withRSA");<NEW_LINE>sig.initVerify(key);<NEW_LINE>while (true) {<NEW_LINE>ZipEntry entry = zis.getNextEntry();<NEW_LINE>if (entry == null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (entry.isDirectory()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>ByteArrayOutputStream output = null;<NEW_LINE>if (name.equalsIgnoreCase("azureus.sig")) {<NEW_LINE>output = new ByteArrayOutputStream();<NEW_LINE>}<NEW_LINE>byte[] buffer = new byte[65536];<NEW_LINE>while (true) {<NEW_LINE>int len = zis.read(buffer);<NEW_LINE>if (len <= 0) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (output == null) {<NEW_LINE>sig.update(buffer, 0, len);<NEW_LINE>} else {<NEW_LINE>output.write(buffer, 0, len);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (output != null) {<NEW_LINE>signature = output.toByteArray();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (signature == null) {<NEW_LINE>throw (new AEVerifierException(AEVerifierException.FT_SIGNATURE_MISSING, "Signature missing from file (" + file.getAbsolutePath() + ")"));<NEW_LINE>}<NEW_LINE>if (!sig.verify(signature)) {<NEW_LINE>throw (new AEVerifierException(AEVerifierException.FT_SIGNATURE_BAD, "Signature doesn't match data (" + file.getAbsolutePath() + ")"));<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (zis != null) {<NEW_LINE>zis.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String name = entry.getName(); |
1,827,438 | void removeUpdateUpdate(DocumentEvent evt) {<NEW_LINE>// Check whether removal would affect any contained text regions<NEW_LINE>// and if so remove their associated text sync groups.<NEW_LINE>int minGroupIndex = Integer.MAX_VALUE;<NEW_LINE>int removeStartOffset = evt.getOffset();<NEW_LINE>int removeEndOffset = removeStartOffset + evt.getLength();<NEW_LINE>List<TextRegion<?>> regions = rootRegion.regions();<NEW_LINE>int index = findRegionInsertIndex(regions, removeStartOffset);<NEW_LINE>if (index > 0) {<NEW_LINE>// Check whether region at index-1 is not affected by the removal<NEW_LINE>TextRegion<?> region = regions.get(index - 1);<NEW_LINE>minGroupIndex = findMinGroupIndex(minGroupIndex, region, removeStartOffset, removeEndOffset);<NEW_LINE>}<NEW_LINE>for (; index < regions.size(); index++) {<NEW_LINE>TextRegion<?> region = regions.get(index);<NEW_LINE>if (region.startOffset() >= removeEndOffset) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>minGroupIndex = findMinGroupIndex(minGroupIndex, region, removeStartOffset, removeEndOffset);<NEW_LINE>}<NEW_LINE>if (minGroupIndex != Integer.MAX_VALUE) {<NEW_LINE>int removeCount = editGroups.size() - minGroupIndex;<NEW_LINE>if (LOG.isLoggable(Level.FINE)) {<NEW_LINE>StringBuilder sb = new StringBuilder(100);<NEW_LINE>sb.append("removeUpdateUpdate(): Text remove <").append(removeStartOffset);<NEW_LINE>sb.append(",").append<MASK><NEW_LINE>sb.append(minGroupIndex).append(",").append(editGroups.size()).append(">\n");<NEW_LINE>LOG.fine(sb.toString());<NEW_LINE>}<NEW_LINE>releaseLastGroups(removeCount);<NEW_LINE>}<NEW_LINE>} | (removeEndOffset).append(">.\n Removing GROUPS <"); |
797,756 | public void registerLifecycleEventListener(final LifecycleEventListener listener) {<NEW_LINE>final WeakReference<LifecycleEventListener> weakListener = new WeakReference<>(listener);<NEW_LINE>mLifecycleListenersMap.put(listener, new abi44_0_0.com.facebook.react.bridge.LifecycleEventListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onHostResume() {<NEW_LINE>LifecycleEventListener listener = weakListener.get();<NEW_LINE>if (listener != null) {<NEW_LINE>listener.onHostResume();<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onHostPause() {<NEW_LINE>LifecycleEventListener listener = weakListener.get();<NEW_LINE>if (listener != null) {<NEW_LINE>listener.onHostPause();<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onHostDestroy() {<NEW_LINE>LifecycleEventListener listener = weakListener.get();<NEW_LINE>if (listener != null) {<NEW_LINE>listener.onHostDestroy();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>mReactContext.addLifecycleEventListener<MASK><NEW_LINE>} | (mLifecycleListenersMap.get(listener)); |
443,695 | public void Call(lua_State thread, lua_Debug ar) {<NEW_LINE>String[] hooknames = new String[] { "call", "return", "line", "count", "tail return" };<NEW_LINE>LuaAPI.lua_pushlightuserdata(thread, KEY_HOOK);<NEW_LINE>LuaAPI.lua_rawget(thread, LuaAPI.LUA_REGISTRYINDEX);<NEW_LINE>LuaAPI.lua_pushlightuserdata(thread, thread);<NEW_LINE>LuaAPI.lua_rawget(thread, -2);<NEW_LINE>if (LuaAPI.lua_isfunction(thread, -1)) {<NEW_LINE>LuaAPI.lua_pushstring(thread, hooknames[(int) ar.m_iEvent]);<NEW_LINE>if (ar.m_iCurrentLine >= 0) {<NEW_LINE>LuaAPI.lua_pushinteger(thread, ar.m_iCurrentLine);<NEW_LINE>} else {<NEW_LINE>LuaAPI.lua_pushnil(thread);<NEW_LINE>}<NEW_LINE>// LuaAPI.lua_assert( LuaAPI.lua_getinfo( thread, "lS", ar ) );<NEW_LINE>LuaAPI.<MASK><NEW_LINE>}<NEW_LINE>} | lua_call(thread, 2, 0); |
1,821,089 | private static boolean addLinks(Context context, AppSettings settings, Spannable s, Pattern p, MatchFilter matchFilter, TransformFilter transformFilter, TextView tv, View holder, String allUrls, boolean extBrowser) {<NEW_LINE>boolean hasMatches = false;<NEW_LINE>Matcher m = p.matcher(s);<NEW_LINE>while (m.find()) {<NEW_LINE><MASK><NEW_LINE>int end = m.end();<NEW_LINE>boolean allowed = true;<NEW_LINE>if (matchFilter != null) {<NEW_LINE>allowed = matchFilter.acceptMatch(s, start, end);<NEW_LINE>}<NEW_LINE>if (allowed) {<NEW_LINE>String shortUrl = makeUrl(m.group(0), m, transformFilter);<NEW_LINE>String longUrl = getLongUrl(shortUrl, allUrls);<NEW_LINE>applyLink(context, settings, tv, holder, new Link(shortUrl, longUrl), start, end, s, extBrowser);<NEW_LINE>hasMatches = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return hasMatches;<NEW_LINE>} | int start = m.start(); |
1,782,235 | private static List<GraphUpdater> createUpdatersFromConfig(UpdatersParameters config) {<NEW_LINE>List<GraphUpdater> updaters = new ArrayList<>();<NEW_LINE>for (VehicleRentalUpdaterParameters configItem : config.getVehicleRentalParameters()) {<NEW_LINE>var source = VehicleRentalDataSourceFactory.create(configItem.sourceParameters());<NEW_LINE>updaters.add(new VehicleRentalUpdater(configItem, source));<NEW_LINE>}<NEW_LINE>for (GtfsRealtimeAlertsUpdaterParameters configItem : config.getGtfsRealtimeAlertsUpdaterParameters()) {<NEW_LINE>updaters.add(new GtfsRealtimeAlertsUpdater(configItem));<NEW_LINE>}<NEW_LINE>for (PollingStoptimeUpdaterParameters configItem : config.getPollingStoptimeUpdaterParameters()) {<NEW_LINE>updaters.add(new PollingStoptimeUpdater(configItem));<NEW_LINE>}<NEW_LINE>for (var configItem : config.getVehiclePositionsUpdaterParameters()) {<NEW_LINE>updaters.add(new PollingVehiclePositionUpdater(configItem));<NEW_LINE>}<NEW_LINE>for (SiriETUpdaterParameters configItem : config.getSiriETUpdaterParameters()) {<NEW_LINE>updaters.add(new SiriETUpdater(configItem));<NEW_LINE>}<NEW_LINE>for (SiriETGooglePubsubUpdaterParameters configItem : config.getSiriETGooglePubsubUpdaterParameters()) {<NEW_LINE>updaters.<MASK><NEW_LINE>}<NEW_LINE>for (SiriSXUpdaterParameters configItem : config.getSiriSXUpdaterParameters()) {<NEW_LINE>updaters.add(new SiriSXUpdater(configItem));<NEW_LINE>}<NEW_LINE>for (SiriVMUpdaterParameters configItem : config.getSiriVMUpdaterParameters()) {<NEW_LINE>updaters.add(new SiriVMUpdater(configItem));<NEW_LINE>}<NEW_LINE>for (WebsocketGtfsRealtimeUpdaterParameters configItem : config.getWebsocketGtfsRealtimeUpdaterParameters()) {<NEW_LINE>updaters.add(new WebsocketGtfsRealtimeUpdater(configItem));<NEW_LINE>}<NEW_LINE>for (MqttGtfsRealtimeUpdaterParameters configItem : config.getMqttGtfsRealtimeUpdaterParameters()) {<NEW_LINE>updaters.add(new MqttGtfsRealtimeUpdater(configItem));<NEW_LINE>}<NEW_LINE>for (VehicleParkingUpdaterParameters configItem : config.getVehicleParkingUpdaterParameters()) {<NEW_LINE>var source = VehicleParkingDataSourceFactory.create(configItem);<NEW_LINE>updaters.add(new VehicleParkingUpdater(configItem, source));<NEW_LINE>}<NEW_LINE>for (WFSNotePollingGraphUpdaterParameters configItem : config.getWinkkiPollingGraphUpdaterParameters()) {<NEW_LINE>updaters.add(new WinkkiPollingGraphUpdater(configItem));<NEW_LINE>}<NEW_LINE>return updaters;<NEW_LINE>} | add(new SiriETGooglePubsubUpdater(configItem)); |
272,068 | public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {<NEW_LINE>builder.startObject();<NEW_LINE>if (bucketSpan != null) {<NEW_LINE>builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan.getStringRep());<NEW_LINE>}<NEW_LINE>if (categorizationFieldName != null) {<NEW_LINE>builder.field(CATEGORIZATION_FIELD_NAME.getPreferredName(), categorizationFieldName);<NEW_LINE>}<NEW_LINE>if (categorizationFilters != null) {<NEW_LINE>builder.field(CATEGORIZATION_FILTERS.getPreferredName(), categorizationFilters);<NEW_LINE>}<NEW_LINE>if (categorizationAnalyzerConfig != null) {<NEW_LINE>// This cannot be builder.field(CATEGORIZATION_ANALYZER.getPreferredName(), categorizationAnalyzerConfig, params);<NEW_LINE>// because that always writes categorizationAnalyzerConfig as an object, and in the case of a global analyzer it<NEW_LINE>// gets written as a single string.<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (latency != null) {<NEW_LINE>builder.field(LATENCY.getPreferredName(), latency.getStringRep());<NEW_LINE>}<NEW_LINE>if (summaryCountFieldName != null) {<NEW_LINE>builder.field(SUMMARY_COUNT_FIELD_NAME.getPreferredName(), summaryCountFieldName);<NEW_LINE>}<NEW_LINE>builder.startArray(DETECTORS.getPreferredName());<NEW_LINE>for (Detector detector : detectors) {<NEW_LINE>detector.toXContent(builder, params);<NEW_LINE>}<NEW_LINE>builder.endArray();<NEW_LINE>builder.field(INFLUENCERS.getPreferredName(), influencers);<NEW_LINE>if (multivariateByFields != null) {<NEW_LINE>builder.field(MULTIVARIATE_BY_FIELDS.getPreferredName(), multivariateByFields);<NEW_LINE>}<NEW_LINE>builder.endObject();<NEW_LINE>return builder;<NEW_LINE>} | categorizationAnalyzerConfig.toXContent(builder, params); |
1,502,668 | public void init() {<NEW_LINE>List<String> fileList = getFilesList();<NEW_LINE>if (fileList.size() > 0) {<NEW_LINE>try {<NEW_LINE>List<String> paths = new ArrayList<String>();<NEW_LINE>for (String s : fileList) {<NEW_LINE>if (!paths.contains(s)) {<NEW_LINE>paths.add(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Collections.sort(<MASK><NEW_LINE>File listFile = createTempFileWithFilesList();<NEW_LINE>writeCleaningFileList(listFile, paths);<NEW_LINE>File cleanerFile = getCleanerFile();<NEW_LINE>writeCleaner(cleanerFile);<NEW_LINE>SystemUtils.correctFilesPermissions(cleanerFile);<NEW_LINE>runningCommand = new ArrayList<String>();<NEW_LINE>runningCommand.add(cleanerFile.getCanonicalPath());<NEW_LINE>runningCommand.add(listFile.getCanonicalPath());<NEW_LINE>} catch (IOException e) {<NEW_LINE>// do nothing then..<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | paths, Collections.reverseOrder()); |
1,621,109 | protected void sendEntriesToSwitch(DatapathId switchId) {<NEW_LINE>IOFSwitch <MASK><NEW_LINE>if (sw == null)<NEW_LINE>return;<NEW_LINE>String stringId = sw.getId().toString();<NEW_LINE>if ((entriesFromStorage != null) && (entriesFromStorage.containsKey(stringId))) {<NEW_LINE>Map<String, OFMessage> entries = entriesFromStorage.get(stringId);<NEW_LINE>List<String> sortedList = new ArrayList<String>(entries.keySet());<NEW_LINE>// weird that Collections.sort() returns void<NEW_LINE>Collections.sort(sortedList, new FlowModSorter(stringId));<NEW_LINE>for (String entryName : sortedList) {<NEW_LINE>OFMessage message = entries.get(entryName);<NEW_LINE>if (message != null) {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Pushing static entry {} for {}", stringId, entryName);<NEW_LINE>}<NEW_LINE>writeOFMessageToSwitch(sw.getId(), message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | sw = switchService.getSwitch(switchId); |
28,750 | public void transactionPromise() {<NEW_LINE>// [START transaction_with_result]<NEW_LINE>final DocumentReference sfDocRef = db.collection("cities").document("SF");<NEW_LINE>db.runTransaction(new Transaction.Function<Double>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Double apply(Transaction transaction) throws FirebaseFirestoreException {<NEW_LINE>DocumentSnapshot snapshot = transaction.get(sfDocRef);<NEW_LINE>double newPopulation = <MASK><NEW_LINE>if (newPopulation <= 1000000) {<NEW_LINE>transaction.update(sfDocRef, "population", newPopulation);<NEW_LINE>return newPopulation;<NEW_LINE>} else {<NEW_LINE>throw new FirebaseFirestoreException("Population too high", FirebaseFirestoreException.Code.ABORTED);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}).addOnSuccessListener(new OnSuccessListener<Double>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(Double result) {<NEW_LINE>Log.d(TAG, "Transaction success: " + result);<NEW_LINE>}<NEW_LINE>}).addOnFailureListener(new OnFailureListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(@NonNull Exception e) {<NEW_LINE>Log.w(TAG, "Transaction failure.", e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// [END transaction_with_result]<NEW_LINE>} | snapshot.getDouble("population") + 1; |
1,316,563 | public static int trap(int[] height) {<NEW_LINE>int result = 0;<NEW_LINE>if (height == null || height.length <= 2)<NEW_LINE>return result;<NEW_LINE>int[] left = new int[height.length];<NEW_LINE>int[] right = new int[height.length];<NEW_LINE>// scan from left to right<NEW_LINE>int max = height[0];<NEW_LINE>left[0] = height[0];<NEW_LINE>for (int i = 1; i < height.length; i++) {<NEW_LINE>if (height[i] < max) {<NEW_LINE>left[i] = max;<NEW_LINE>} else {<NEW_LINE>left[i] = height[i];<NEW_LINE>max = height[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// scan from right to left<NEW_LINE>max = height[height.length - 1];<NEW_LINE>right[height.length - 1] = <MASK><NEW_LINE>for (int i = height.length - 2; i >= 0; i--) {<NEW_LINE>if (height[i] < max) {<NEW_LINE>right[i] = max;<NEW_LINE>} else {<NEW_LINE>right[i] = height[i];<NEW_LINE>max = height[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// calculate total<NEW_LINE>for (int i = 0; i < height.length; i++) {<NEW_LINE>result += Math.min(left[i], right[i]) - height[i];<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | height[height.length - 1]; |
604,146 | public void run() {<NEW_LINE>M2ConfigProvider conf = proj.getLookup().lookup(M2ConfigProvider.class);<NEW_LINE>ActionToGoalUtils.writeMappingsToFileAttributes(proj.getProjectDirectory(), maps);<NEW_LINE>if (remembered != null) {<NEW_LINE>try {<NEW_LINE>// NOI18N<NEW_LINE>String tit = "CUSTOM-" + remembered;<NEW_LINE>mapping.setActionName(tit);<NEW_LINE>mapping.setDisplayName(remembered);<NEW_LINE>// TODO shall we write to configuration based files or not?<NEW_LINE>ModelHandle2.putMapping(mapping, <MASK><NEW_LINE>} catch (IOException ex) {<NEW_LINE>LOG.log(Level.INFO, "Cannot write custom action mapping", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ModelRunConfig rc = createCustomRunConfig(conf);<NEW_LINE>rc.setOffline(offline);<NEW_LINE>rc.setShowDebug(debug);<NEW_LINE>rc.setRecursive(recursive);<NEW_LINE>rc.setUpdateSnapshots(updateSnapshots);<NEW_LINE>// NOI18N<NEW_LINE>setupTaskName("custom", rc, Lookup.EMPTY);<NEW_LINE>RunUtils.run(rc);<NEW_LINE>} | proj, conf.getDefaultConfig()); |
1,184,019 | public static GetTableDBTopologyResponse unmarshall(GetTableDBTopologyResponse getTableDBTopologyResponse, UnmarshallerContext _ctx) {<NEW_LINE>getTableDBTopologyResponse.setRequestId(_ctx.stringValue("GetTableDBTopologyResponse.RequestId"));<NEW_LINE>getTableDBTopologyResponse.setErrorCode(_ctx.stringValue("GetTableDBTopologyResponse.ErrorCode"));<NEW_LINE>getTableDBTopologyResponse.setErrorMessage(_ctx.stringValue("GetTableDBTopologyResponse.ErrorMessage"));<NEW_LINE>getTableDBTopologyResponse.setSuccess(_ctx.booleanValue("GetTableDBTopologyResponse.Success"));<NEW_LINE>DBTopology dBTopology = new DBTopology();<NEW_LINE>dBTopology.setTableName(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.TableName"));<NEW_LINE>dBTopology.setTableGuid(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.TableGuid"));<NEW_LINE>List<DataSource> dataSourceList <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetTableDBTopologyResponse.DBTopology.DataSourceList.Length"); i++) {<NEW_LINE>DataSource dataSource = new DataSource();<NEW_LINE>dataSource.setSid(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].Sid"));<NEW_LINE>dataSource.setHost(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].Host"));<NEW_LINE>dataSource.setDbType(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DbType"));<NEW_LINE>dataSource.setPort(_ctx.integerValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].Port"));<NEW_LINE>List<Database> databaseList = new ArrayList<Database>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DatabaseList.Length"); j++) {<NEW_LINE>Database database = new Database();<NEW_LINE>database.setDbId(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DatabaseList[" + j + "].DbId"));<NEW_LINE>database.setDbName(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DatabaseList[" + j + "].DbName"));<NEW_LINE>database.setDbType(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DatabaseList[" + j + "].DbType"));<NEW_LINE>database.setEnvType(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DatabaseList[" + j + "].EnvType"));<NEW_LINE>List<Table> tableList = new ArrayList<Table>();<NEW_LINE>for (int k = 0; k < _ctx.lengthValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DatabaseList[" + j + "].TableList.Length"); k++) {<NEW_LINE>Table table = new Table();<NEW_LINE>table.setTableName(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DatabaseList[" + j + "].TableList[" + k + "].TableName"));<NEW_LINE>table.setTableType(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DatabaseList[" + j + "].TableList[" + k + "].TableType"));<NEW_LINE>table.setTableId(_ctx.stringValue("GetTableDBTopologyResponse.DBTopology.DataSourceList[" + i + "].DatabaseList[" + j + "].TableList[" + k + "].TableId"));<NEW_LINE>tableList.add(table);<NEW_LINE>}<NEW_LINE>database.setTableList(tableList);<NEW_LINE>databaseList.add(database);<NEW_LINE>}<NEW_LINE>dataSource.setDatabaseList(databaseList);<NEW_LINE>dataSourceList.add(dataSource);<NEW_LINE>}<NEW_LINE>dBTopology.setDataSourceList(dataSourceList);<NEW_LINE>getTableDBTopologyResponse.setDBTopology(dBTopology);<NEW_LINE>return getTableDBTopologyResponse;<NEW_LINE>} | = new ArrayList<DataSource>(); |
1,652,394 | private void testReceiveMessageTopicTranxSecOff(TopicConnectionFactory topicConnectionFactory) throws NamingException, NotSupportedException, SystemException, HeuristicMixedException, HeuristicRollbackException, RollbackException, JMSException, TestException {<NEW_LINE>UserTransaction userTransaction = null;<NEW_LINE>JMSContext jmsContext = null;<NEW_LINE>try {<NEW_LINE>userTransaction = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");<NEW_LINE>userTransaction.begin();<NEW_LINE>jmsContext = topicConnectionFactory.createContext();<NEW_LINE>JMSConsumer jmsConsumer = jmsContext.createConsumer(topic);<NEW_LINE><MASK><NEW_LINE>TextMessage sentMessage = jmsContext.createTextMessage(methodName() + " at " + new Date());<NEW_LINE>jmsProducer.send(topic, sentMessage);<NEW_LINE>userTransaction.commit();<NEW_LINE>userTransaction.begin();<NEW_LINE>TextMessage receivedMessage = (TextMessage) jmsConsumer.receive();<NEW_LINE>userTransaction.commit();<NEW_LINE>if (receivedMessage == null)<NEW_LINE>throw new TestException("No message received, sent:" + sentMessage);<NEW_LINE>if (!receivedMessage.getText().equals(sentMessage.getText()))<NEW_LINE>throw new TestException("Wrong message received:" + receivedMessage + " sent:" + sentMessage);<NEW_LINE>} finally {<NEW_LINE>// If we reach here in the event of an error, the transaction might not have been completed.<NEW_LINE>if (userTransaction != null && userTransaction.getStatus() == Status.STATUS_ACTIVE)<NEW_LINE>userTransaction.rollback();<NEW_LINE>if (jmsContext != null)<NEW_LINE>jmsContext.close();<NEW_LINE>}<NEW_LINE>} | JMSProducer jmsProducer = jmsContext.createProducer(); |
1,535,103 | public void logStaxImplementation(Class<?> theClass) {<NEW_LINE>try {<NEW_LINE>URL rootUrl = getRootUrlForClass(theClass);<NEW_LINE>if (rootUrl == null) {<NEW_LINE>ourLog.info("Unable to determine location of StAX implementation containing class");<NEW_LINE>} else {<NEW_LINE>Manifest manifest;<NEW_LINE>URL metaInfUrl = new URL(rootUrl, "META-INF/MANIFEST.MF");<NEW_LINE>InputStream is = metaInfUrl.openStream();<NEW_LINE>try {<NEW_LINE>manifest = new Manifest(is);<NEW_LINE>} finally {<NEW_LINE>is.close();<NEW_LINE>}<NEW_LINE>Attributes attrs = manifest.getMainAttributes();<NEW_LINE>String title = attrs.getValue(IMPLEMENTATION_TITLE);<NEW_LINE>String symbolicName = attrs.getValue(BUNDLE_SYMBOLIC_NAME);<NEW_LINE>if (symbolicName != null) {<NEW_LINE>int i = symbolicName.indexOf(';');<NEW_LINE>if (i != -1) {<NEW_LINE>symbolicName = symbolicName.substring(0, i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String vendor = attrs.getValue(IMPLEMENTATION_VENDOR);<NEW_LINE>if (vendor == null) {<NEW_LINE>vendor = attrs.getValue(BUNDLE_VENDOR);<NEW_LINE>}<NEW_LINE>String version = attrs.getValue(IMPLEMENTATION_VERSION);<NEW_LINE>if (version == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (ourLog.isDebugEnabled()) {<NEW_LINE>ourLog.debug("FHIR XML procesing will use StAX implementation at {}\n Title: {}\n Symbolic name: {}\n Vendor: {}\n Version: {}", new Object[] { rootUrl, title, symbolicName, vendor, version });<NEW_LINE>} else {<NEW_LINE>ourLog.info("FHIR XML procesing will use StAX implementation '{}' version '{}'", title, version);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>ourLog.info("Unable to determine StAX implementation: " + e.getMessage());<NEW_LINE>}<NEW_LINE>} | version = attrs.getValue(BUNDLE_VERSION); |
283,387 | public EqualityError isVulnerable(List<Pkcs1Vector> pkcs1Vectors, RSAPublicKey publicKey) {<NEW_LINE>fingerprintPairList = getBleichenbacherMap(config.getWorkflowType(), pkcs1Vectors, publicKey);<NEW_LINE>if (fingerprintPairList.isEmpty()) {<NEW_LINE>LOGGER.warn("Could not extract Fingerprints");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>printBleichenbacherVectormap(fingerprintPairList);<NEW_LINE>EqualityError error = getEqualityError(fingerprintPairList);<NEW_LINE>if (error != EqualityError.NONE) {<NEW_LINE>CONSOLE.info("Found a side channel. Rescanning to confirm.");<NEW_LINE>// Socket Equality Errors can be caused by problems on on the<NEW_LINE>// network. In this case we do a rescan<NEW_LINE>// and check if we find the exact same answer behaviour (twice)<NEW_LINE>List<VectorResponse> secondBleichenbacherVectorMap = getBleichenbacherMap(config.getWorkflowType(), pkcs1Vectors, publicKey);<NEW_LINE>EqualityError error2 = getEqualityError(secondBleichenbacherVectorMap);<NEW_LINE>BleichenbacherVulnerabilityMap mapOne = new BleichenbacherVulnerabilityMap(fingerprintPairList, error);<NEW_LINE>BleichenbacherVulnerabilityMap mapTwo = new BleichenbacherVulnerabilityMap(secondBleichenbacherVectorMap, error2);<NEW_LINE>if (mapOne.looksIdentical(mapTwo)) {<NEW_LINE>List<VectorResponse> thirdBleichenbacherVectorMap = getBleichenbacherMap(config.<MASK><NEW_LINE>EqualityError error3 = getEqualityError(secondBleichenbacherVectorMap);<NEW_LINE>BleichenbacherVulnerabilityMap mapThree = new BleichenbacherVulnerabilityMap(thirdBleichenbacherVectorMap, error3);<NEW_LINE>if (!mapTwo.looksIdentical(mapThree)) {<NEW_LINE>LOGGER.debug("The third scan prove this vulnerability to be non existent");<NEW_LINE>shakyScans = true;<NEW_LINE>error = EqualityError.NONE;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOGGER.debug("The second scan prove this vulnerability to be non existent");<NEW_LINE>shakyScans = true;<NEW_LINE>error = EqualityError.NONE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (error != EqualityError.NONE) {<NEW_LINE>CONSOLE.info("Found a vulnerability with " + config.getWorkflowType().getDescription());<NEW_LINE>}<NEW_LINE>if (selfShutdown && !config.isExecuteAttack()) {<NEW_LINE>executor.shutdown();<NEW_LINE>}<NEW_LINE>return error;<NEW_LINE>} | getWorkflowType(), pkcs1Vectors, publicKey); |
823,200 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());<NEW_LINE>if (controller != null && permanent != null) {<NEW_LINE>new AddCountersSourceEffect(CounterType.WAGE.createInstance(), true<MASK><NEW_LINE>Cost cost = ManaUtil.createManaCost(2 * permanent.getCounters(game).getCount(CounterType.WAGE), false);<NEW_LINE>if (!cost.pay(source, game, source, controller.getId(), false)) {<NEW_LINE>new RemoveAllCountersSourceEffect(CounterType.WAGE).apply(game, source);<NEW_LINE>Player opponent;<NEW_LINE>Set<UUID> opponents = game.getOpponents(controller.getId());<NEW_LINE>if (opponents.size() == 1) {<NEW_LINE>opponent = game.getPlayer(opponents.iterator().next());<NEW_LINE>} else {<NEW_LINE>Target target = new TargetOpponent(true);<NEW_LINE>target.setNotTarget(true);<NEW_LINE>target.choose(Outcome.GainControl, source.getControllerId(), source.getSourceId(), source, game);<NEW_LINE>opponent = game.getPlayer(target.getFirstTarget());<NEW_LINE>}<NEW_LINE>if (opponent != null) {<NEW_LINE>permanent.changeControllerId(opponent.getId(), game, source);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ).apply(game, source); |
353,944 | final GetReservedNodeExchangeConfigurationOptionsResult executeGetReservedNodeExchangeConfigurationOptions(GetReservedNodeExchangeConfigurationOptionsRequest getReservedNodeExchangeConfigurationOptionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getReservedNodeExchangeConfigurationOptionsRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetReservedNodeExchangeConfigurationOptionsRequest> request = null;<NEW_LINE>Response<GetReservedNodeExchangeConfigurationOptionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetReservedNodeExchangeConfigurationOptionsRequestMarshaller().marshall(super.beforeMarshalling(getReservedNodeExchangeConfigurationOptionsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Redshift");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetReservedNodeExchangeConfigurationOptions");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetReservedNodeExchangeConfigurationOptionsResult> responseHandler = new StaxResponseHandler<GetReservedNodeExchangeConfigurationOptionsResult>(new GetReservedNodeExchangeConfigurationOptionsResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
291,327 | public Collection<Long> loadCollapsedCommenst(String repoUrl, String id) {<NEW_LINE>File file = getIssuePropertiesFile(repoUrl, id);<NEW_LINE>FileLocks.FileLock <MASK><NEW_LINE>try {<NEW_LINE>Properties p = load(file, repoUrl, id);<NEW_LINE>Set<Long> s = new HashSet<Long>();<NEW_LINE>for (Object k : p.keySet()) {<NEW_LINE>String key = k.toString();<NEW_LINE>if (key.startsWith(PROP_COLLAPSED_COMMENT_PREFIX) && "true".equals(p.get(key))) {<NEW_LINE>s.add(Long.parseLong(key.substring(PROP_COLLAPSED_COMMENT_PREFIX.length())));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return s;<NEW_LINE>} catch (IOException ex) {<NEW_LINE>Support.LOG.log(Level.WARNING, repoUrl + " " + id, ex);<NEW_LINE>} finally {<NEW_LINE>l.release();<NEW_LINE>}<NEW_LINE>return Collections.emptySet();<NEW_LINE>} | l = FileLocks.getLock(file); |
365,958 | public static String readUtf8LPP4(LittleEndianInput is) {<NEW_LINE><MASK><NEW_LINE>if (length == 0 || length == 4) {<NEW_LINE>@SuppressWarnings("unused")<NEW_LINE>int // ignore<NEW_LINE>skip = is.readInt();<NEW_LINE>return length == 0 ? null : "";<NEW_LINE>}<NEW_LINE>byte[] data = new byte[length];<NEW_LINE>is.readFully(data);<NEW_LINE>// Padding (variable): A set of bytes that MUST be of correct size such that the size of the UTF-8-LP-P4<NEW_LINE>// structure is a multiple of 4 bytes. If Padding is present, each byte MUST be 0x00. If<NEW_LINE>// the length is exactly 0x00000000, this specifies a null string, and the entire structure uses<NEW_LINE>// exactly 4 bytes. If the length is exactly 0x00000004, this specifies an empty string, and the<NEW_LINE>// entire structure also uses exactly 4 bytes<NEW_LINE>int scratchedBytes = length % 4;<NEW_LINE>if (scratchedBytes > 0) {<NEW_LINE>for (int i = 0; i < (4 - scratchedBytes); i++) {<NEW_LINE>is.readByte();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new String(data, 0, data.length, Charset.forName("UTF-8"));<NEW_LINE>} | int length = is.readInt(); |
655,724 | public Void visitBlock(BlockTree bt, Void p) {<NEW_LINE>List<CatchTree> catches = createCatches(info, make, thandles, statement);<NEW_LINE>// #89379: if inside a constructor, do not wrap the "super"/"this" call:<NEW_LINE>// please note that the "super" or "this" call is supposed to be always<NEW_LINE>// in the constructor body<NEW_LINE>BlockTree toUse = bt;<NEW_LINE>StatementTree toKeep = null;<NEW_LINE>Tree parent = getCurrentPath().getParentPath().getLeaf();<NEW_LINE>if (parent.getKind() == Kind.METHOD && bt.getStatements().size() > 0) {<NEW_LINE>MethodTree mt = (MethodTree) parent;<NEW_LINE>if (mt.getReturnType() == null) {<NEW_LINE>toKeep = bt.getStatements().get(0);<NEW_LINE>toUse = make.Block(bt.getStatements().subList(1, bt.getStatements().size()), false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!streamAlike) {<NEW_LINE>info.rewrite(bt, createBlock(bt.isStatic(), toKeep, make.Try(toUse, catches, null)));<NEW_LINE>} else {<NEW_LINE>VariableTree originalDeclaration = (VariableTree) statement.getLeaf();<NEW_LINE>VariableTree declaration = make.Variable(make.Modifiers(EnumSet.noneOf(Modifier.class)), originalDeclaration.getName(), originalDeclaration.getType(), make.Identifier("null"));<NEW_LINE>StatementTree assignment = make.ExpressionStatement(make.Assignment(make.Identifier(originalDeclaration.getName()), originalDeclaration.getInitializer()));<NEW_LINE>BlockTree finallyTree = make.Block(Collections.singletonList(createFinallyCloseBlockStatement(originalDeclaration)), false);<NEW_LINE><MASK><NEW_LINE>info.rewrite(bt, createBlock(bt.isStatic(), toKeep, declaration, make.Try(toUse, catches, finallyTree)));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | info.rewrite(originalDeclaration, assignment); |
621,595 | private InetSocketAddress slowSearchClientIP(final RegionClient client) {<NEW_LINE>String hostport = null;<NEW_LINE>synchronized (ip2client) {<NEW_LINE>for (final Map.Entry<String, RegionClient> e : ip2client.entrySet()) {<NEW_LINE>if (e.getValue() == client) {<NEW_LINE>hostport = e.getKey();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (hostport == null) {<NEW_LINE>HashMap<String, RegionClient> copy;<NEW_LINE>synchronized (ip2client) {<NEW_LINE>copy = new HashMap<String, RegionClient>(ip2client);<NEW_LINE>}<NEW_LINE>LOG.error("WTF? Should never happen! Couldn't find " + client + " in " + copy);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>LOG.warn("Couldn't connect to the RegionServer @ " + hostport);<NEW_LINE>final int lastColon = hostport.lastIndexOf(':');<NEW_LINE>if (lastColon < 1) {<NEW_LINE>LOG.error("WTF? Should never happen! No `:' found in " + hostport);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final String host = getIP(hostport.substring(0, lastColon));<NEW_LINE>int port;<NEW_LINE>try {<NEW_LINE>port = parsePortNumber(hostport.substring(lastColon + 1<MASK><NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>LOG.error("WTF? Should never happen! Bad port in " + hostport, e);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return new InetSocketAddress(host, port);<NEW_LINE>} | , hostport.length())); |
549,863 | protected WSSecTimestamp handleLayout(WSSecTimestamp timestamp) {<NEW_LINE>Collection<AssertionInfo> ais;<NEW_LINE>ais = aim.get(SP12Constants.LAYOUT);<NEW_LINE>if (ais != null) {<NEW_LINE>for (AssertionInfo ai : ais) {<NEW_LINE>Layout layout = (Layout) ai.getAssertion();<NEW_LINE>ai.setAsserted(true);<NEW_LINE>if (SPConstants.Layout.LaxTimestampLast == layout.getValue()) {<NEW_LINE>if (timestamp == null) {<NEW_LINE>ai.setNotAsserted(<MASK><NEW_LINE>} else {<NEW_LINE>ai.setAsserted(true);<NEW_LINE>Element el = timestamp.getElement();<NEW_LINE>el = (Element) DOMUtils.getDomElement(el);<NEW_LINE>secHeader.getSecurityHeader().appendChild(el);<NEW_LINE>if (bottomUpElement == null) {<NEW_LINE>bottomUpElement = el;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (SPConstants.Layout.LaxTimestampFirst == layout.getValue()) {<NEW_LINE>if (timestamp == null) {<NEW_LINE>ai.setNotAsserted(SPConstants.Layout.LaxTimestampLast + " requires a timestamp");<NEW_LINE>} else {<NEW_LINE>addTopDownElement(timestampEl.getElement());<NEW_LINE>}<NEW_LINE>} else if (timestampEl != null) {<NEW_LINE>addTopDownElement(timestampEl.getElement());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (timestampEl != null) {<NEW_LINE>addTopDownElement(timestampEl.getElement());<NEW_LINE>}<NEW_LINE>return timestamp;<NEW_LINE>} | SPConstants.Layout.LaxTimestampLast + " requires a timestamp"); |
1,358,327 | protected void createWorldOctaves(World world, Map<String, OctaveGenerator> octaves) {<NEW_LINE>Random seed = new Random(world.getSeed());<NEW_LINE>OctaveGenerator gen = new PerlinOctaveGenerator(seed, <MASK><NEW_LINE>gen.setXScale(coordinateScale);<NEW_LINE>gen.setYScale(heightScale);<NEW_LINE>gen.setZScale(coordinateScale);<NEW_LINE>octaves.put("roughness", gen);<NEW_LINE>gen = new PerlinOctaveGenerator(seed, 16, 3, 33, 3);<NEW_LINE>gen.setXScale(coordinateScale);<NEW_LINE>gen.setYScale(heightScale);<NEW_LINE>gen.setZScale(coordinateScale);<NEW_LINE>octaves.put("roughness2", gen);<NEW_LINE>gen = new PerlinOctaveGenerator(seed, 8, 3, 33, 3);<NEW_LINE>gen.setXScale(coordinateScale / detailNoiseScaleX);<NEW_LINE>gen.setYScale(heightScale / detailNoiseScaleY);<NEW_LINE>gen.setZScale(coordinateScale / detailNoiseScaleZ);<NEW_LINE>octaves.put("detail", gen);<NEW_LINE>} | 16, 3, 33, 3); |
147,456 | public static SGIHeader read(final ImageInputStream imageInput) throws IOException {<NEW_LINE>// typedef struct _SGIHeader<NEW_LINE>// {<NEW_LINE>// SHORT Magic; /* Identification number (474) */<NEW_LINE>// CHAR Storage; /* Compression flag */<NEW_LINE>// CHAR Bpc; /* Bytes per pixel */<NEW_LINE>// WORD Dimension; /* Number of image dimensions */<NEW_LINE>// WORD XSize; /* Width of image in pixels */<NEW_LINE>// WORD YSize; /* Height of image in pixels */<NEW_LINE>// WORD ZSize; /* Number of bit channels */<NEW_LINE>// LONG PixMin; /* Smallest pixel value */<NEW_LINE>// LONG PixMax; /* Largest pixel value */<NEW_LINE>// CHAR Dummy1[4]; /* Not used */<NEW_LINE>// CHAR ImageName[80]; /* Name of image */<NEW_LINE>// LONG ColorMap; /* Format of pixel data */<NEW_LINE>// CHAR Dummy2[404]; /* Not used */<NEW_LINE>// } SGIHEAD;<NEW_LINE><MASK><NEW_LINE>if (magic != SGI.MAGIC) {<NEW_LINE>throw new IIOException(String.format("Not an SGI image. Expected SGI magic %04x, read %04x", SGI.MAGIC, magic));<NEW_LINE>}<NEW_LINE>SGIHeader header = new SGIHeader();<NEW_LINE>header.compression = imageInput.readUnsignedByte();<NEW_LINE>header.bytesPerPixel = imageInput.readUnsignedByte();<NEW_LINE>header.dimensions = imageInput.readUnsignedShort();<NEW_LINE>header.width = imageInput.readUnsignedShort();<NEW_LINE>header.height = imageInput.readUnsignedShort();<NEW_LINE>header.channels = imageInput.readUnsignedShort();<NEW_LINE>header.minValue = imageInput.readInt();<NEW_LINE>header.maxValue = imageInput.readInt();<NEW_LINE>// Ignore<NEW_LINE>imageInput.readInt();<NEW_LINE>byte[] nameBytes = new byte[80];<NEW_LINE>imageInput.readFully(nameBytes);<NEW_LINE>header.name = toAsciiString(nameBytes);<NEW_LINE>header.colorMode = imageInput.readInt();<NEW_LINE>imageInput.skipBytes(404);<NEW_LINE>return header;<NEW_LINE>} | short magic = imageInput.readShort(); |
1,642,281 | public Root update(Root inRoot) throws WIMException {<NEW_LINE>System.out.println("<update> entry, inRoot: \n" + inRoot);<NEW_LINE>for (Entity entity : inRoot.getEntities()) {<NEW_LINE><MASK><NEW_LINE>IdentifierType identity = entity.getIdentifier();<NEW_LINE>String dn = identity.getExternalName();<NEW_LINE>String uniqueName = dn;<NEW_LINE>if (dn == null || dn.length() == 0) {<NEW_LINE>uniqueName = identity.getUniqueName();<NEW_LINE>}<NEW_LINE>System.out.println(" uniqueName: " + uniqueName);<NEW_LINE>String cn = getCn(uniqueName);<NEW_LINE>if (SchemaConstants.DO_PERSON_ACCOUNT.equalsIgnoreCase(typeName)) {<NEW_LINE>users.remove(cn);<NEW_LINE>} else if (SchemaConstants.DO_GROUP.equalsIgnoreCase(typeName)) {<NEW_LINE>groups.remove(cn);<NEW_LINE>} else {<NEW_LINE>throw new EntityTypeNotSupportedException("ENTITY_TYPE_NOT_SUPPORTED", "The entity type '" + typeName + "' is not supported.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Root outRoot = this.create(inRoot);<NEW_LINE>System.out.println("<update> exit, outRoot: \n" + outRoot);<NEW_LINE>return outRoot;<NEW_LINE>} | String typeName = entity.getTypeName(); |
1,354,023 | public AwsRdsDbClusterMember unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AwsRdsDbClusterMember awsRdsDbClusterMember = new AwsRdsDbClusterMember();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return 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>if (context.testExpression("IsClusterWriter", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsRdsDbClusterMember.setIsClusterWriter(context.getUnmarshaller(Boolean.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("PromotionTier", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsRdsDbClusterMember.setPromotionTier(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("DbInstanceIdentifier", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsRdsDbClusterMember.setDbInstanceIdentifier(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("DbClusterParameterGroupStatus", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsRdsDbClusterMember.setDbClusterParameterGroupStatus(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return awsRdsDbClusterMember;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,403,415 | public void bind() {<NEW_LINE>if (type == GLES20.GL_FLOAT) {<NEW_LINE>GLES20.glUniform1fv(location, /* count= */<NEW_LINE>1, value, /* offset= */<NEW_LINE>0);<NEW_LINE>checkGlError();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (type == GLES20.GL_FLOAT_MAT3) {<NEW_LINE>GLES20.glUniformMatrix3fv(location, /* count= */<NEW_LINE>1, /* transpose= */<NEW_LINE>false, value, /* offset= */<NEW_LINE>0);<NEW_LINE>checkGlError();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (type == GLES20.GL_FLOAT_MAT4) {<NEW_LINE>GLES20.glUniformMatrix4fv(location, /* count= */<NEW_LINE>1, /* transpose= */<NEW_LINE>false, value, /* offset= */<NEW_LINE>0);<NEW_LINE>checkGlError();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (texId == 0) {<NEW_LINE>throw new IllegalStateException("No call to setSamplerTexId() before bind.");<NEW_LINE>}<NEW_LINE>GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + unit);<NEW_LINE>if (type == GLES11Ext.GL_SAMPLER_EXTERNAL_OES || type == GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT) {<NEW_LINE>GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texId);<NEW_LINE>} else if (type == GLES20.GL_SAMPLER_2D) {<NEW_LINE>GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texId);<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Unexpected uniform type: " + type);<NEW_LINE>}<NEW_LINE>GLES20.glUniform1i(location, unit);<NEW_LINE>GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);<NEW_LINE>GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);<NEW_LINE>GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);<NEW_LINE>GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, <MASK><NEW_LINE>checkGlError();<NEW_LINE>} | GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE); |
1,191,891 | private ReferenceDB addRef(Address fromAddr, Address toAddr, RefType type, SourceType sourceType, int opIndex, boolean isOffset, boolean isShifted, long offsetOrShift) throws IOException {<NEW_LINE>if (isOffset && isShifted) {<NEW_LINE>throw new IllegalArgumentException("Reference may not be both shifted and offset");<NEW_LINE>}<NEW_LINE>if (opIndex < Reference.MNEMONIC) {<NEW_LINE>throw new IllegalArgumentException("Invalid opIndex specified: " + opIndex);<NEW_LINE>}<NEW_LINE>if (toAddr.getAddressSpace().isOverlaySpace()) {<NEW_LINE>toAddr = ((OverlayAddressSpace) toAddr.getAddressSpace()).translateAddress(toAddr);<NEW_LINE>}<NEW_LINE>lock.acquire();<NEW_LINE>try {<NEW_LINE>boolean isPrimary = false;<NEW_LINE>ReferenceDB oldRef = (ReferenceDB) getReference(fromAddr, toAddr, opIndex);<NEW_LINE>if (oldRef != null) {<NEW_LINE>if (!isIncompatible(oldRef, isOffset, isShifted, offsetOrShift)) {<NEW_LINE>type = combineReferenceType(type, oldRef.getReferenceType());<NEW_LINE>if (type == oldRef.getReferenceType()) {<NEW_LINE>return oldRef;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>removeReference(fromAddr, toAddr, opIndex);<NEW_LINE>isPrimary = oldRef.isPrimary();<NEW_LINE>}<NEW_LINE>boolean isStackRegisterRef = toAddr.isStackAddress() || toAddr.isRegisterAddress();<NEW_LINE>RefList fromRefs = getFromRefs(fromAddr);<NEW_LINE>RefList toRefs = null;<NEW_LINE>if (!isStackRegisterRef) {<NEW_LINE>toRefs = getToRefs(toAddr);<NEW_LINE>}<NEW_LINE>// make the 1st reference primary...<NEW_LINE>isPrimary |= fromRefs == null || (fromAddr.isMemoryAddress() && !fromRefs.hasReference(opIndex));<NEW_LINE>if (fromRefs == null) {<NEW_LINE>fromRefs = fromAdapter.createRefList(program, fromCache, fromAddr);<NEW_LINE>}<NEW_LINE>fromRefs = fromRefs.checkRefListSize(fromCache, 1);<NEW_LINE>fromRefs.addRef(fromAddr, toAddr, type, opIndex, -1, isPrimary, <MASK><NEW_LINE>if (toRefs == null && !isStackRegisterRef) {<NEW_LINE>toRefs = toAdapter.createRefList(program, toCache, toAddr);<NEW_LINE>}<NEW_LINE>if (toRefs != null) {<NEW_LINE>toRefs = toRefs.checkRefListSize(toCache, 1);<NEW_LINE>toRefs.addRef(fromAddr, toAddr, type, opIndex, -1, isPrimary, sourceType, isOffset, isShifted, offsetOrShift);<NEW_LINE>}<NEW_LINE>ReferenceDB r = toRefs == null || fromRefs.getNumRefs() < toRefs.getNumRefs() ? fromRefs.getRef(toAddr, opIndex) : toRefs.getRef(fromAddr, opIndex);<NEW_LINE>referenceAdded(r);<NEW_LINE>return r;<NEW_LINE>} finally {<NEW_LINE>lock.release();<NEW_LINE>}<NEW_LINE>} | sourceType, isOffset, isShifted, offsetOrShift); |
1,333,194 | public void start() throws IOException {<NEW_LINE>synchronized (lock) {<NEW_LINE>if (started) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>log.info(<MASK><NEW_LINE>final String loadQueueLocation = ZKPaths.makePath(zkPaths.getLoadQueuePath(), me.getName());<NEW_LINE>final String servedSegmentsLocation = ZKPaths.makePath(zkPaths.getServedSegmentsPath(), me.getName());<NEW_LINE>final String liveSegmentsLocation = ZKPaths.makePath(zkPaths.getLiveSegmentsPath(), me.getName());<NEW_LINE>loadQueueCache = new PathChildrenCache(curator, loadQueueLocation, true, true, Execs.singleThreaded("ZkCoordinator"));<NEW_LINE>try {<NEW_LINE>curator.newNamespaceAwareEnsurePath(loadQueueLocation).ensure(curator.getZookeeperClient());<NEW_LINE>curator.newNamespaceAwareEnsurePath(servedSegmentsLocation).ensure(curator.getZookeeperClient());<NEW_LINE>curator.newNamespaceAwareEnsurePath(liveSegmentsLocation).ensure(curator.getZookeeperClient());<NEW_LINE>loadQueueCache.getListenable().addListener((client, event) -> {<NEW_LINE>final ChildData child = event.getData();<NEW_LINE>switch(event.getType()) {<NEW_LINE>case CHILD_ADDED:<NEW_LINE>childAdded(child);<NEW_LINE>break;<NEW_LINE>case CHILD_REMOVED:<NEW_LINE>log.info("zNode[%s] was removed", event.getData().getPath());<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>log.info("Ignoring event[%s]", event);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>loadQueueCache.start();<NEW_LINE>} catch (Exception e) {<NEW_LINE>Throwables.propagateIfPossible(e, IOException.class);<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>started = true;<NEW_LINE>}<NEW_LINE>} | "Starting zkCoordinator for server[%s]", me.getName()); |
466,011 | public void actionPerformed(@NotNull AnActionEvent e) {<NEW_LINE><MASK><NEW_LINE>DownloadableFileDescription rebar = service.createFileDescription(url, fileName);<NEW_LINE>FileDownloader downloader = service.createDownloader(Collections.singletonList(rebar), fileName);<NEW_LINE>List<Pair<VirtualFile, DownloadableFileDescription>> pairs = downloader.downloadWithProgress(null, getEventProject(e), myLinkContainer);<NEW_LINE>if (pairs != null) {<NEW_LINE>for (Pair<VirtualFile, DownloadableFileDescription> pair : pairs) {<NEW_LINE>try {<NEW_LINE>String path = pair.first.getCanonicalPath();<NEW_LINE>if (path != null) {<NEW_LINE>FileUtil.setExecutable(new File(path));<NEW_LINE>myRebarPathSelector.setText(path);<NEW_LINE>validateRebarPath(RebarConfigurationForm.this.myRebarPathSelector.getText(), s -> myRebarVersionText.setText(s));<NEW_LINE>}<NEW_LINE>} catch (Exception ignore) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | DownloadableFileService service = DownloadableFileService.getInstance(); |
180,110 | public Problem preCheck(CompilationController info) throws IOException {<NEW_LINE>fireProgressListenerStart(refactoring.PRE_CHECK, 4);<NEW_LINE>Problem preCheckProblem = null;<NEW_LINE>info.<MASK><NEW_LINE>preCheckProblem = isElementAvail(treePathHandle, info);<NEW_LINE>if (preCheckProblem != null) {<NEW_LINE>return preCheckProblem;<NEW_LINE>}<NEW_LINE>Element el = treePathHandle.resolveElement(info);<NEW_LINE>if (!RefactoringUtils.isExecutableElement(el)) {<NEW_LINE>// NOI18N<NEW_LINE>preCheckProblem = createProblem(preCheckProblem, true, NbBundle.getMessage(ChangeParametersPlugin.class, "ERR_ChangeParamsWrongType"));<NEW_LINE>return preCheckProblem;<NEW_LINE>}<NEW_LINE>preCheckProblem = JavaPluginUtils.isSourceElement(el, info);<NEW_LINE>if (preCheckProblem != null) {<NEW_LINE>return preCheckProblem;<NEW_LINE>}<NEW_LINE>if (info.getElementUtilities().enclosingTypeElement(el).getKind() == ElementKind.ANNOTATION_TYPE) {<NEW_LINE>// NOI18N<NEW_LINE>preCheckProblem = new Problem(true, NbBundle.getMessage(ChangeParametersPlugin.class, "ERR_MethodsInAnnotationsNotSupported"));<NEW_LINE>return preCheckProblem;<NEW_LINE>}<NEW_LINE>for (ExecutableElement e : JavaRefactoringUtils.getOverriddenMethods((ExecutableElement) el, info)) {<NEW_LINE>ElementHandle<ExecutableElement> handle = ElementHandle.create(e);<NEW_LINE>if (RefactoringUtils.isFromLibrary(handle, info.getClasspathInfo())) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>preCheckProblem = createProblem(preCheckProblem, true, NbBundle.getMessage(ChangeParametersPlugin.class, "ERR_CannnotRefactorLibrary", el));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>fireProgressListenerStop();<NEW_LINE>return preCheckProblem;<NEW_LINE>} | toPhase(JavaSource.Phase.RESOLVED); |
1,615,209 | private BeanDefinitionBuilder dispatcher(Element element, ParserContext parserContext, boolean isFixedSubscriber, Element dispatcherElement) {<NEW_LINE>BeanDefinitionBuilder builder;<NEW_LINE>if (isFixedSubscriber) {<NEW_LINE>parserContext.getReaderContext().error("The 'fixed-subscriber' attribute is not allowed" + " when a <dispatcher/> child element is present.", element);<NEW_LINE>}<NEW_LINE>// configure either an ExecutorChannel or DirectChannel based on existence of 'task-executor'<NEW_LINE>String taskExecutor = dispatcherElement.getAttribute("task-executor");<NEW_LINE>if (StringUtils.hasText(taskExecutor)) {<NEW_LINE>builder = BeanDefinitionBuilder.genericBeanDefinition(ExecutorChannel.class);<NEW_LINE>builder.addConstructorArgReference(taskExecutor);<NEW_LINE>} else {<NEW_LINE>builder = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class);<NEW_LINE>}<NEW_LINE>// unless the 'load-balancer' attribute is explicitly set to 'none'<NEW_LINE>// or 'load-balancer-ref' is explicitly configured,<NEW_LINE>// configure the default RoundRobinLoadBalancingStrategy<NEW_LINE>String loadBalancer = dispatcherElement.getAttribute("load-balancer");<NEW_LINE>String <MASK><NEW_LINE>if (StringUtils.hasText(loadBalancer) && StringUtils.hasText(loadBalancerRef)) {<NEW_LINE>parserContext.getReaderContext().error("'load-balancer' and 'load-balancer-ref' are mutually exclusive", element);<NEW_LINE>}<NEW_LINE>if (StringUtils.hasText(loadBalancerRef)) {<NEW_LINE>builder.addConstructorArgReference(loadBalancerRef);<NEW_LINE>} else {<NEW_LINE>if ("none".equals(loadBalancer)) {<NEW_LINE>builder.addConstructorArgValue(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, dispatcherElement, "failover");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, dispatcherElement, "max-subscribers");<NEW_LINE>return builder;<NEW_LINE>} | loadBalancerRef = dispatcherElement.getAttribute("load-balancer-ref"); |
1,447,569 | private static String compress(String inFileName) {<NEW_LINE>String outFileName = inFileName + ".gz";<NEW_LINE>FileInputStream in = null;<NEW_LINE>try {<NEW_LINE>in = new FileInputStream(new File(inFileName));<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>GZIPOutputStream out = null;<NEW_LINE>try {<NEW_LINE>out = new GZIPOutputStream(new FileOutputStream(outFileName));<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>byte[] buf = new byte[10240];<NEW_LINE>int len = 0;<NEW_LINE>try {<NEW_LINE>while (((in.available() > 10240) && (in.read(buf)) > 0)) {<NEW_LINE>out.write(buf);<NEW_LINE>}<NEW_LINE>len = in.available();<NEW_LINE>in.read(buf, 0, len);<NEW_LINE>out.write(buf, 0, len);<NEW_LINE>in.close();<NEW_LINE>out.flush();<NEW_LINE>out.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>}<NEW_LINE>new <MASK><NEW_LINE>JSONObject target = new JSONObject();<NEW_LINE>target.put("download", new File(outFileName).getName());<NEW_LINE>target.put("size", new File(outFileName).length());<NEW_LINE>return target.toJSONString();<NEW_LINE>} | File(inFileName).delete(); |
522,449 | private void processSample() throws ParserException {<NEW_LINE>ParsableByteArray webvttData = new ParsableByteArray(sampleData);<NEW_LINE>// Validate the first line of the header.<NEW_LINE>WebvttParserUtil.validateWebvttHeaderLine(webvttData);<NEW_LINE>// Defaults to use if the header doesn't contain an X-TIMESTAMP-MAP header.<NEW_LINE>long vttTimestampUs = 0;<NEW_LINE>long tsTimestampUs = 0;<NEW_LINE>// Parse the remainder of the header looking for X-TIMESTAMP-MAP.<NEW_LINE>for (String line = webvttData.readLine(); !TextUtils.isEmpty(line); line = webvttData.readLine()) {<NEW_LINE>if (line.startsWith("X-TIMESTAMP-MAP")) {<NEW_LINE>Matcher localTimestampMatcher = LOCAL_TIMESTAMP.matcher(line);<NEW_LINE>if (!localTimestampMatcher.find()) {<NEW_LINE>throw ParserException.createForMalformedContainer("X-TIMESTAMP-MAP doesn't contain local timestamp: " + line, /* cause= */<NEW_LINE>null);<NEW_LINE>}<NEW_LINE>Matcher <MASK><NEW_LINE>if (!mediaTimestampMatcher.find()) {<NEW_LINE>throw ParserException.createForMalformedContainer("X-TIMESTAMP-MAP doesn't contain media timestamp: " + line, /* cause= */<NEW_LINE>null);<NEW_LINE>}<NEW_LINE>vttTimestampUs = WebvttParserUtil.parseTimestampUs(Assertions.checkNotNull(localTimestampMatcher.group(1)));<NEW_LINE>tsTimestampUs = TimestampAdjuster.ptsToUs(Long.parseLong(Assertions.checkNotNull(mediaTimestampMatcher.group(1))));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Find the first cue header and parse the start time.<NEW_LINE>Matcher cueHeaderMatcher = WebvttParserUtil.findNextCueHeader(webvttData);<NEW_LINE>if (cueHeaderMatcher == null) {<NEW_LINE>// No cues found. Don't output a sample, but still output a corresponding track.<NEW_LINE>buildTrackOutput(0);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long firstCueTimeUs = WebvttParserUtil.parseTimestampUs(Assertions.checkNotNull(cueHeaderMatcher.group(1)));<NEW_LINE>long sampleTimeUs = timestampAdjuster.adjustTsTimestamp(TimestampAdjuster.usToWrappedPts(firstCueTimeUs + tsTimestampUs - vttTimestampUs));<NEW_LINE>long subsampleOffsetUs = sampleTimeUs - firstCueTimeUs;<NEW_LINE>// Output the track.<NEW_LINE>TrackOutput trackOutput = buildTrackOutput(subsampleOffsetUs);<NEW_LINE>// Output the sample.<NEW_LINE>sampleDataWrapper.reset(sampleData, sampleSize);<NEW_LINE>trackOutput.sampleData(sampleDataWrapper, sampleSize);<NEW_LINE>trackOutput.sampleMetadata(sampleTimeUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null);<NEW_LINE>} | mediaTimestampMatcher = MEDIA_TIMESTAMP.matcher(line); |
907,930 | public void addAttachments(BlackboardArtifact message, MessageAttachments attachments) throws TskCoreException {<NEW_LINE>// Create attribute<NEW_LINE>BlackboardAttribute blackboardAttribute = BlackboardJsonAttrUtil.toAttribute(ATTACHMENTS_ATTR_TYPE, getModuleName(), attachments);<NEW_LINE>message.addAttribute(blackboardAttribute);<NEW_LINE>// Associate each attachment file with the message.<NEW_LINE>List<BlackboardArtifact> assocObjectArtifacts = new ArrayList<>();<NEW_LINE>Collection<FileAttachment> fileAttachments = attachments.getFileAttachments();<NEW_LINE>for (FileAttachment fileAttachment : fileAttachments) {<NEW_LINE>long attachedFileObjId = fileAttachment.getObjectId();<NEW_LINE>if (attachedFileObjId >= 0) {<NEW_LINE>AbstractFile attachedFile = message.getSleuthkitCase().getAbstractFileById(attachedFileObjId);<NEW_LINE>DataArtifact artifact = associateAttachmentWithMessage(message, attachedFile);<NEW_LINE>assocObjectArtifacts.add(artifact);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Optional<Long> ingestJobId = getIngestJobId();<NEW_LINE>getSleuthkitCase().getBlackboard().postArtifacts(assocObjectArtifacts, getModuleName()<MASK><NEW_LINE>} catch (BlackboardException ex) {<NEW_LINE>throw new TskCoreException("Error posting TSK_ASSOCIATED_ARTIFACT artifacts for attachments", ex);<NEW_LINE>}<NEW_LINE>} | , ingestJobId.orElse(null)); |
274,621 | private <PSIC> String onEvent(PSIC targetThreshhold, Object observer, ObserveEvent.Type obsType) {<NEW_LINE>if (observer != null && (observer.getClass().getName().contains("org.python") || observer.getClass().getName().contains("org.jruby"))) {<NEW_LINE>observer = new ObserverCallBack(observer, obsType);<NEW_LINE>}<NEW_LINE>if (!(targetThreshhold instanceof Integer)) {<NEW_LINE>Image img = Element.getImageFromTarget(targetThreshhold);<NEW_LINE>Boolean response = true;<NEW_LINE>if (!img.isValid() && img.hasIOException()) {<NEW_LINE>// onAppear, ...<NEW_LINE>response = handleImageMissing(img, false);<NEW_LINE>if (response == null) {<NEW_LINE>throw new RuntimeException(String.format("SikuliX: Region: onEvent: %s ImageMissing: %s", obsType, targetThreshhold));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String name = Observing.add(this, (<MASK><NEW_LINE>log(logLevel, "%s: observer %s %s: %s with: %s", toStringShort(), obsType, (observer == null ? "" : " with callback"), name, targetThreshhold);<NEW_LINE>return name;<NEW_LINE>} | ObserverCallBack) observer, obsType, targetThreshhold); |
1,328,611 | public void onGetEditorContext(GetEditorContextEvent event) {<NEW_LINE>GetEditorContextEvent.Data data = event.getData();<NEW_LINE><MASK><NEW_LINE>if (type == GetEditorContextEvent.TYPE_ACTIVE_EDITOR) {<NEW_LINE>if (consoleEditorHadFocusLast() || !columnManager_.hasActiveEditor())<NEW_LINE>type = GetEditorContextEvent.TYPE_CONSOLE_EDITOR;<NEW_LINE>else<NEW_LINE>type = GetEditorContextEvent.TYPE_SOURCE_EDITOR;<NEW_LINE>}<NEW_LINE>if (type == GetEditorContextEvent.TYPE_CONSOLE_EDITOR) {<NEW_LINE>InputEditorDisplay editor = consoleEditorProvider_.getConsoleEditor();<NEW_LINE>if (editor != null && editor instanceof DocDisplay) {<NEW_LINE>SourceColumnManager.getEditorContext("#console", "", (DocDisplay) editor, server_);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else if (type == GetEditorContextEvent.TYPE_SOURCE_EDITOR) {<NEW_LINE>if (columnManager_.requestActiveEditorContext())<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// We need to ensure a 'getEditorContext' event is always<NEW_LINE>// returned as we have a 'wait-for' event on the server side<NEW_LINE>server_.getEditorContextCompleted(GetEditorContextEvent.SelectionData.create(), new VoidServerRequestCallback());<NEW_LINE>} | int type = data.getType(); |
1,094,346 | private void onIsolinesStateChanged(@NonNull IsolinesState type) {<NEW_LINE>if (type != IsolinesState.EXPIREDDATA) {<NEW_LINE>type.activate(this, findViewById(R.id.coordinator), findViewById<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>com.mapswithme.maps.dialog.AlertDialog dialog = new com.mapswithme.maps.dialog.AlertDialog.Builder().setTitleId(R.string.downloader_update_maps).setMessageId(R.string.isolines_activation_error_dialog).setPositiveBtnId(R.string.ok).setNegativeBtnId(R.string.cancel).setFragManagerStrategyType(com.mapswithme.maps.dialog.AlertDialog.FragManagerStrategyType.ACTIVITY_FRAGMENT_MANAGER).setReqCode(REQ_CODE_ISOLINES_ERROR).build();<NEW_LINE>dialog.show(this, ISOLINES_ERROR_DIALOG_TAG);<NEW_LINE>} | (R.id.menu_frame)); |
662,220 | public boolean executeCommand(final String args) {<NEW_LINE>// get filenames<NEW_LINE>final String sourceID = getProp().getPropertyString(ScriptProperties.CLUSTER_CONFIG_SOURCE_FILE);<NEW_LINE>final String targetID = getProp().getPropertyString(ScriptProperties.CLUSTER_CONFIG_TARGET_FILE);<NEW_LINE>final int clusters = getProp().getPropertyInt(ScriptProperties.CLUSTER_CONFIG_CLUSTERS);<NEW_LINE>getProp().getPropertyString(ScriptProperties.CLUSTER_CONFIG_TYPE);<NEW_LINE>EncogLogging.log(EncogLogging.LEVEL_DEBUG, "Beginning cluster");<NEW_LINE>EncogLogging.log(EncogLogging.LEVEL_DEBUG, "source file:" + sourceID);<NEW_LINE>EncogLogging.log(EncogLogging.LEVEL_DEBUG, "target file:" + targetID);<NEW_LINE>EncogLogging.log(EncogLogging.LEVEL_DEBUG, "clusters:" + clusters);<NEW_LINE>final File sourceFile = getScript().resolveFilename(sourceID);<NEW_LINE>final File targetFile = getScript().resolveFilename(targetID);<NEW_LINE>// get formats<NEW_LINE>final CSVFormat format = getScript().determineFormat();<NEW_LINE>// mark generated<NEW_LINE>getScript().markGenerated(targetID);<NEW_LINE>// prepare to normalize<NEW_LINE>final AnalystClusterCSV cluster = new AnalystClusterCSV();<NEW_LINE>cluster.setScript(getScript());<NEW_LINE>getAnalyst().setCurrentQuantTask(cluster);<NEW_LINE>cluster.setReport(new AnalystReportBridge(getAnalyst()));<NEW_LINE>final boolean headers = <MASK><NEW_LINE>cluster.analyze(getAnalyst(), sourceFile, headers, format);<NEW_LINE>cluster.process(targetFile, clusters, getAnalyst(), DEFAULT_ITERATIONS);<NEW_LINE>getAnalyst().setCurrentQuantTask(null);<NEW_LINE>return cluster.shouldStop();<NEW_LINE>} | getScript().expectInputHeaders(sourceID); |
908,740 | protected void layoutChildren(final double x, final double y, final double w, final double h) {<NEW_LINE>final CheckBox checkBox = getSkinnable();<NEW_LINE>boxWidth = snapSize(container.prefWidth(-1));<NEW_LINE>boxHeight = snapSize(<MASK><NEW_LINE>final double computeWidth = Math.max(checkBox.prefWidth(-1), checkBox.minWidth(-1)) + labelOffset + 2 * padding;<NEW_LINE>final double labelWidth = Math.min(computeWidth - boxWidth, w - snapSize(boxWidth)) + labelOffset + 2 * padding;<NEW_LINE>final double labelHeight = Math.min(checkBox.prefHeight(labelWidth), h);<NEW_LINE>maxHeight = Math.max(boxHeight, labelHeight);<NEW_LINE>final double xOffset = computeXOffset(w, labelWidth + boxWidth, checkBox.getAlignment().getHpos()) + x;<NEW_LINE>final double yOffset = computeYOffset(h, maxHeight, checkBox.getAlignment().getVpos()) + x;<NEW_LINE>if (invalid) {<NEW_LINE>rightLine.setStartX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5);<NEW_LINE>rightLine.setStartY(maxHeight - padding - lineThick);<NEW_LINE>rightLine.setEndX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5);<NEW_LINE>rightLine.setEndY(maxHeight - padding - lineThick);<NEW_LINE>leftLine.setStartX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5);<NEW_LINE>leftLine.setStartY(maxHeight - padding - lineThick);<NEW_LINE>leftLine.setEndX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5);<NEW_LINE>leftLine.setEndY(maxHeight - padding - lineThick);<NEW_LINE>transition = new CheckBoxTransition();<NEW_LINE>if (getSkinnable().isSelected()) {<NEW_LINE>transition.play();<NEW_LINE>}<NEW_LINE>invalid = false;<NEW_LINE>}<NEW_LINE>layoutLabelInArea(xOffset + boxWidth, yOffset, labelWidth, maxHeight, checkBox.getAlignment());<NEW_LINE>container.resize(boxWidth, boxHeight);<NEW_LINE>positionInArea(container, xOffset, yOffset, boxWidth, maxHeight, 0, checkBox.getAlignment().getHpos(), checkBox.getAlignment().getVpos());<NEW_LINE>} | container.prefHeight(-1)); |
1,377,571 | private static Resource generate(Set<Triple> paths, Collection<ReportEntry> entries, PrefixMapping prefixes) {<NEW_LINE>if (entries.isEmpty())<NEW_LINE>return reportConformsTrueResource();<NEW_LINE><MASK><NEW_LINE>model.setNsPrefix("rdf", RDF.getURI());<NEW_LINE>model.setNsPrefix("rdfs", RDFS.getURI());<NEW_LINE>model.setNsPrefix("xsd", XSD.getURI());<NEW_LINE>model.setNsPrefix("sh", SHACLM.getURI());<NEW_LINE>if (prefixes != null)<NEW_LINE>model.setNsPrefixes(prefixes);<NEW_LINE>Resource report = model.createResource(SHACLM.ValidationReport);<NEW_LINE>entries.forEach(e -> e.generate(model, report));<NEW_LINE>paths.forEach(model.getGraph()::add);<NEW_LINE>report.addProperty(SHACLM.conforms, C.mFALSE);<NEW_LINE>return report;<NEW_LINE>} | Model model = ModelFactory.createDefaultModel(); |
116,362 | protected static ASTNode findClosestNode(int lineNumber, ASTNode node) {<NEW_LINE>log("findClosestNode to line " + lineNumber);<NEW_LINE>ASTNode parent = findClosestParentNode(lineNumber, node);<NEW_LINE>log("findClosestParentNode returned " + getNodeAsString(parent));<NEW_LINE>if (parent == null)<NEW_LINE>return null;<NEW_LINE>if (getLineNumber(parent) == lineNumber) {<NEW_LINE>log(parent + "|PNode " + getLineNumber(parent) + ", lfor " + lineNumber);<NEW_LINE>return parent;<NEW_LINE>}<NEW_LINE>List<ASTNode> nodes;<NEW_LINE>if (parent instanceof TypeDeclaration) {<NEW_LINE>nodes = ((TypeDeclaration) parent).bodyDeclarations();<NEW_LINE>} else if (parent instanceof Block) {<NEW_LINE>nodes = ((<MASK><NEW_LINE>} else {<NEW_LINE>log("findClosestNode() found " + getNodeAsString(parent));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (nodes.size() > 0) {<NEW_LINE>ASTNode retNode = parent;<NEW_LINE>for (ASTNode cNode : nodes) {<NEW_LINE>log(cNode + "|cNode " + getLineNumber(cNode) + ", lfor " + lineNumber);<NEW_LINE>if (getLineNumber(cNode) <= lineNumber)<NEW_LINE>retNode = cNode;<NEW_LINE>}<NEW_LINE>return retNode;<NEW_LINE>}<NEW_LINE>return parent;<NEW_LINE>} | Block) parent).statements(); |
1,656,041 | final DescribeBudgetActionsForBudgetResult executeDescribeBudgetActionsForBudget(DescribeBudgetActionsForBudgetRequest describeBudgetActionsForBudgetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeBudgetActionsForBudgetRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeBudgetActionsForBudgetRequest> request = null;<NEW_LINE>Response<DescribeBudgetActionsForBudgetResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeBudgetActionsForBudgetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeBudgetActionsForBudgetRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Budgets");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeBudgetActionsForBudget");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeBudgetActionsForBudgetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeBudgetActionsForBudgetResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
788,516 | public void apply(CompletionItem completion) throws Exception {<NEW_LINE>completion = harness.resolveCompletionItem(completion);<NEW_LINE>Either<TextEdit, InsertReplaceEdit> edit = completion.getTextEdit();<NEW_LINE>String docText = doc.getText();<NEW_LINE>if (edit != null) {<NEW_LINE>if (edit.isLeft()) {<NEW_LINE>String replaceWith = edit.getLeft().getNewText();<NEW_LINE>int cursorReplaceOffset = 0;<NEW_LINE>if (!Boolean.getBoolean("lsp.completions.indentation.enable")) {<NEW_LINE>// Apply indentfix, this is magic vscode seems to apply to edits returned by language server. So our harness has to<NEW_LINE>// mimick that behavior. See https://github.com/Microsoft/language-server-protocol/issues/83<NEW_LINE>int referenceLine = edit.getLeft().getRange().getStart().getLine();<NEW_LINE>int cursorOffset = edit.getLeft().getRange().getStart().getCharacter();<NEW_LINE>String referenceIndent = doc.getLineIndentString(referenceLine);<NEW_LINE>if (cursorOffset < referenceIndent.length()) {<NEW_LINE>referenceIndent = referenceIndent.substring(0, cursorOffset);<NEW_LINE>}<NEW_LINE>replaceWith = replaceWith.<MASK><NEW_LINE>}<NEW_LINE>// Replace the cursor string<NEW_LINE>cursorReplaceOffset = replaceWith.indexOf(VS_CODE_CURSOR_MARKER);<NEW_LINE>if (cursorReplaceOffset >= 0) {<NEW_LINE>replaceWith = replaceWith.substring(0, cursorReplaceOffset) + replaceWith.substring(cursorReplaceOffset + VS_CODE_CURSOR_MARKER.length());<NEW_LINE>} else {<NEW_LINE>cursorReplaceOffset = replaceWith.length();<NEW_LINE>}<NEW_LINE>Range rng = edit.getLeft().getRange();<NEW_LINE>int start = doc.toOffset(rng.getStart());<NEW_LINE>int end = doc.toOffset(rng.getEnd());<NEW_LINE>replaceText(start, end, replaceWith);<NEW_LINE>selectionStart = selectionEnd = start + cursorReplaceOffset;<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("InsertReplaceEdit edits not supported");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String insertText = getInsertText(completion);<NEW_LINE>String newText = docText.substring(0, selectionStart) + insertText + docText.substring(selectionStart);<NEW_LINE>selectionStart += insertText.length();<NEW_LINE>selectionEnd += insertText.length();<NEW_LINE>setRawText(newText);<NEW_LINE>}<NEW_LINE>} | replaceAll("\\n", "\n" + referenceIndent); |
1,837,181 | private static void initExpressions() throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException {<NEW_LINE>List<Class> classes = Lists.newArrayList();<NEW_LINE>ClassFinder.ClassFilter filter = new ClassFinder.ClassFilter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean filter(Class klass) {<NEW_LINE>int mod = klass.getModifiers();<NEW_LINE>return !Modifier.isAbstract(mod) && !Modifier.isInterface(mod) && VectorizedExpression.class.isAssignableFrom(klass) && klass.getAnnotation(ExpressionSignatures.class) != null;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean preFilter(String classFulName) {<NEW_LINE>return classFulName.endsWith("VectorizedExpression");<NEW_LINE>}<NEW_LINE>};<NEW_LINE>classes.addAll(ClassFinder<MASK><NEW_LINE>for (@SuppressWarnings("unchecked") Class<? extends VectorizedExpression> klass : classes) {<NEW_LINE>for (ExpressionSignature expressionSignature : ExpressionSignature.from(klass)) {<NEW_LINE>if (EXPRESSIONS.containsKey(expressionSignature)) {<NEW_LINE>Class<?> existingClass = EXPRESSIONS.get(expressionSignature).getDeclaringClass();<NEW_LINE>throw new IllegalStateException("Expression signature " + expressionSignature + " has been defined by class: " + existingClass + " , but redefined in class: " + klass);<NEW_LINE>}<NEW_LINE>EXPRESSIONS.put(expressionSignature, ExpressionConstructor.of(klass));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .findClassesInPackage("com.alibaba.polardbx", filter)); |
595,148 | private MethodSpec renderNamedGetRangeStartEnd(NamedColumnDescription col) {<NEW_LINE>com.palantir.logsafe.Preconditions.checkArgument(tableMetadata.getRowMetadata().getRowParts().size() == 1);<NEW_LINE>NameComponentDescription rowComponent = tableMetadata.getRowMetadata().<MASK><NEW_LINE>MethodSpec.Builder getterBuilder = MethodSpec.methodBuilder("getSmallRowRange" + VarName(col)).addModifiers(Modifier.PUBLIC).addJavadoc("Returns a mapping from all the row keys in a range to their value at column $L\n" + "(if that column exists for the row-key). As the $L values are all loaded in memory,\n" + "do not use for large amounts of data. The order of results is preserved in the map.", VarName(col), VarName(col)).addParameter(rowComponent.getType().getJavaClass(), "startInclusive").addParameter(rowComponent.getType().getJavaClass(), "endExclusive").returns(ParameterizedTypeName.get(ClassName.get(LinkedHashMap.class), ClassName.get(rowComponent.getType().getJavaClass()), ClassName.get(getColumnClassForGenericTypeParameter(col))));<NEW_LINE>getterBuilder.addStatement("$T rangeRequest = $T.builder()\n" + ".startRowInclusive($T.of(startInclusive).persistToBytes())\n" + ".endRowExclusive($T.of(endExclusive).persistToBytes())\n" + ".build()", RangeRequest.class, RangeRequest.class, rowType, rowType).addStatement("return getSmallRowRange$L(rangeRequest)", VarName(col));<NEW_LINE>return getterBuilder.build();<NEW_LINE>} | getRowParts().get(0); |
270,600 | private void createTimeSlot(ArrayList<MAssignmentSlot> list, Timestamp startTime, Timestamp endTime) {<NEW_LINE>// log.debug( "MSchedule.createTimeSlot");<NEW_LINE>GregorianCalendar cal = new GregorianCalendar(Language.getLoginLanguage().getLocale());<NEW_LINE>cal.setTimeInMillis(m_startDate.getTime());<NEW_LINE>// End Date for Comparison<NEW_LINE>GregorianCalendar calEnd = new GregorianCalendar(Language.getLoginLanguage().getLocale());<NEW_LINE>calEnd.setTimeInMillis(m_endDate.getTime());<NEW_LINE>while (cal.before(calEnd)) {<NEW_LINE>// 00:00..startTime<NEW_LINE>cal.set(Calendar.HOUR_OF_DAY, 0);<NEW_LINE>cal.set(Calendar.MINUTE, 0);<NEW_LINE>cal.set(Calendar.SECOND, 0);<NEW_LINE>cal.set(Calendar.MILLISECOND, 0);<NEW_LINE>Timestamp start = new Timestamp(cal.getTimeInMillis());<NEW_LINE>//<NEW_LINE>GregorianCalendar cal_1 = new GregorianCalendar(Language.getLoginLanguage().getLocale());<NEW_LINE>cal_1.<MASK><NEW_LINE>cal.set(Calendar.HOUR_OF_DAY, cal_1.get(Calendar.HOUR_OF_DAY));<NEW_LINE>cal.set(Calendar.MINUTE, cal_1.get(Calendar.MINUTE));<NEW_LINE>cal.set(Calendar.SECOND, cal_1.get(Calendar.SECOND));<NEW_LINE>Timestamp end = new Timestamp(cal.getTimeInMillis());<NEW_LINE>//<NEW_LINE>MAssignmentSlot ma = new MAssignmentSlot(start, end, Msg.getMsg(m_ctx, "ResourceNotInSlotTime"), "", MAssignmentSlot.STATUS_NotInSlotTime);<NEW_LINE>list.add(ma);<NEW_LINE>// endTime .. 00:00 next day<NEW_LINE>cal_1.setTimeInMillis(endTime.getTime());<NEW_LINE>cal.set(Calendar.HOUR_OF_DAY, cal_1.get(Calendar.HOUR_OF_DAY));<NEW_LINE>cal.set(Calendar.MINUTE, cal_1.get(Calendar.MINUTE));<NEW_LINE>cal.set(Calendar.SECOND, cal_1.get(Calendar.SECOND));<NEW_LINE>start = new Timestamp(cal.getTimeInMillis());<NEW_LINE>//<NEW_LINE>cal.set(Calendar.HOUR_OF_DAY, 0);<NEW_LINE>cal.set(Calendar.MINUTE, 0);<NEW_LINE>cal.set(Calendar.SECOND, 0);<NEW_LINE>cal.add(Calendar.DAY_OF_YEAR, 1);<NEW_LINE>end = new Timestamp(cal.getTimeInMillis());<NEW_LINE>//<NEW_LINE>ma = new MAssignmentSlot(start, end, Msg.getMsg(m_ctx, "ResourceNotInSlotTime"), "", MAssignmentSlot.STATUS_NotInSlotTime);<NEW_LINE>list.add(ma);<NEW_LINE>}<NEW_LINE>} | setTimeInMillis(startTime.getTime()); |
289,219 | private void backupData() throws BackupException {<NEW_LINE>String sourceBackupFilePrefix;<NEW_LINE>Path[] dataFiles;<NEW_LINE>// Store file hash in a separate thread<NEW_LINE>new Thread(() -> {<NEW_LINE>for (String dir : mMetadata.dataDirs) {<NEW_LINE>FileHash fileHash = new FileHash();<NEW_LINE>fileHash.path = dir;<NEW_LINE>fileHash.hash = DigestUtils.getHexDigest(DigestUtils.SHA_256, new ProxyFile(dir));<NEW_LINE>AppManager.getDb().fileHashDao().insert(fileHash);<NEW_LINE>}<NEW_LINE>}).start();<NEW_LINE>for (int i = 0; i < mMetadata.dataDirs.length; ++i) {<NEW_LINE>sourceBackupFilePrefix = DATA_PREFIX + <MASK><NEW_LINE>try {<NEW_LINE>dataFiles = TarUtils.create(mMetadata.tarType, new Path(mContext, new ProxyFile(mMetadata.dataDirs[i])), mTempBackupPath, sourceBackupFilePrefix, null, null, BackupUtils.getExcludeDirs(!mBackupFlags.backupCache(), null), false).toArray(new Path[0]);<NEW_LINE>} catch (Throwable th) {<NEW_LINE>throw new BackupException("Failed to backup data directory at " + mMetadata.dataDirs[i], th);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>dataFiles = encrypt(dataFiles);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new BackupException("Failed to encrypt " + Arrays.toString(dataFiles));<NEW_LINE>}<NEW_LINE>for (Path file : dataFiles) {<NEW_LINE>mChecksum.add(file.getName(), DigestUtils.getHexDigest(mMetadata.checksumAlgo, file));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | i + getExt(mMetadata.tarType); |
1,499,465 | private static long retain(@Pointer long self, @Pointer long sel) {<NEW_LINE>int count = ObjCRuntime.int_objc_msgSend(self, retainCount);<NEW_LINE>if (count <= 1) {<NEW_LINE>synchronized (CUSTOM_OBJECTS) {<NEW_LINE>ObjCClass cls = ObjCClass.toObjCClass(ObjCRuntime.object_getClass(self));<NEW_LINE>ObjCObject obj = ObjCObject.toObjCObject(cls.getType(), self, 0);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>long cls = ObjCRuntime.object_getClass(self);<NEW_LINE>if (logRetainRelease) {<NEW_LINE>logRetainRelease(cls, self, count, true);<NEW_LINE>}<NEW_LINE>Super sup = new Super(self, getNativeSuper(cls));<NEW_LINE>return ObjCRuntime.ptr_objc_msgSendSuper(sup.getHandle(), sel);<NEW_LINE>} | CUSTOM_OBJECTS.put(self, obj); |
1,726,875 | private void buildsPathsSection(MarkupDocBuilder markupDocBuilder, Map<String, Path> paths) {<NEW_LINE>List<SwaggerPathOperation> pathOperations = PathUtils.toPathOperationsList(paths, getHostname(), getBasePath(), config.getOperationOrdering());<NEW_LINE>if (CollectionUtils.isNotEmpty(pathOperations)) {<NEW_LINE>if (config.getPathsGroupedBy() == GroupBy.AS_IS) {<NEW_LINE>pathOperations.forEach(operation -> buildOperation(markupDocBuilder, operation, config));<NEW_LINE>} else if (config.getPathsGroupedBy() == GroupBy.TAGS) {<NEW_LINE>Validate.notEmpty(context.getSchema().getTags(), "Tags must not be empty, when operations are grouped by tags");<NEW_LINE>// Group operations by tag<NEW_LINE>Multimap<String, SwaggerPathOperation> operationsGroupedByTag = TagUtils.groupOperationsByTag(pathOperations, config.getOperationOrdering());<NEW_LINE>Map<String, Tag> tagsMap = TagUtils.toSortedMap(context.getSchema().getTags(), config.getTagOrdering());<NEW_LINE>tagsMap.forEach((String tagName, Tag tag) -> {<NEW_LINE>markupDocBuilder.sectionTitleWithAnchorLevel2(WordUtils.capitalize(tagName), tagName + "_resource");<NEW_LINE>String description = tag.getDescription();<NEW_LINE>if (StringUtils.isNotBlank(description)) {<NEW_LINE>markupDocBuilder.paragraph(description);<NEW_LINE>}<NEW_LINE>operationsGroupedByTag.get(tagName).forEach(operation -> buildOperation<MASK><NEW_LINE>});<NEW_LINE>} else if (config.getPathsGroupedBy() == GroupBy.REGEX) {<NEW_LINE>Validate.notNull(config.getHeaderPattern(), "Header regex pattern must not be empty when operations are grouped using regex");<NEW_LINE>Pattern headerPattern = config.getHeaderPattern();<NEW_LINE>Multimap<String, SwaggerPathOperation> operationsGroupedByRegex = RegexUtils.groupOperationsByRegex(pathOperations, headerPattern);<NEW_LINE>Set<String> keys = operationsGroupedByRegex.keySet();<NEW_LINE>String[] sortedHeaders = RegexUtils.toSortedArray(keys);<NEW_LINE>for (String header : sortedHeaders) {<NEW_LINE>markupDocBuilder.sectionTitleWithAnchorLevel2(WordUtils.capitalize(header), header + "_resource");<NEW_LINE>operationsGroupedByRegex.get(header).forEach(operation -> buildOperation(markupDocBuilder, operation, config));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (markupDocBuilder, operation, config)); |
560,624 | private static byte[] createCheckpointBytes(Path checkpointFile, Checkpoint checkpoint) throws IOException {<NEW_LINE>final ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(V4_FILE_SIZE) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public synchronized byte[] toByteArray() {<NEW_LINE>// don't clone<NEW_LINE>return buf;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>final String resourceDesc = "checkpoint(path=\"" + checkpointFile + "\", gen=" + checkpoint + ")";<NEW_LINE>try (OutputStreamIndexOutput indexOutput = new OutputStreamIndexOutput(resourceDesc, checkpointFile.toString(), byteOutputStream, V4_FILE_SIZE)) {<NEW_LINE>CodecUtil.<MASK><NEW_LINE>checkpoint.write(indexOutput);<NEW_LINE>CodecUtil.writeFooter(indexOutput);<NEW_LINE>assert indexOutput.getFilePointer() == V4_FILE_SIZE : "get you numbers straight; bytes written: " + indexOutput.getFilePointer() + ", buffer size: " + V4_FILE_SIZE;<NEW_LINE>assert indexOutput.getFilePointer() < 512 : "checkpoint files have to be smaller than 512 bytes for atomic writes; size: " + indexOutput.getFilePointer();<NEW_LINE>}<NEW_LINE>return byteOutputStream.toByteArray();<NEW_LINE>} | writeHeader(indexOutput, CHECKPOINT_CODEC, CURRENT_VERSION); |
201,537 | private void updateAllKeys() {<NEW_LINE>CryptoOperationHelper.Callback<KeySyncParcel, ImportKeyResult> callback = new CryptoOperationHelper.Callback<KeySyncParcel, ImportKeyResult>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public KeySyncParcel createOperationInput() {<NEW_LINE>return KeySyncParcel.createRefreshAll();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCryptoOperationSuccess(ImportKeyResult result) {<NEW_LINE>result.createNotify(getActivity()).show();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCryptoOperationCancelled() {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCryptoOperationError(ImportKeyResult result) {<NEW_LINE>result.createNotify(<MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean onCryptoSetProgress(String msg, int progress, int max) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>CryptoOperationHelper opHelper = new CryptoOperationHelper<>(3, this, callback, R.string.progress_importing);<NEW_LINE>opHelper.setProgressCancellable(true);<NEW_LINE>opHelper.cryptoOperation();<NEW_LINE>} | getActivity()).show(); |
620,852 | /*<NEW_LINE>I made this method because endpoint parameters not contain a lot of needed metadata<NEW_LINE>It is very verbose to write all of this info into the api template<NEW_LINE>This ingests all operations under a tag in the objs input and writes out one file for each endpoint<NEW_LINE>*/<NEW_LINE>protected void generateEndpoints(Map<String, Object> objs) {<NEW_LINE>if (!(Boolean) additionalProperties.get(CodegenConstants.GENERATE_APIS)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>HashMap<String, Object> operations = (HashMap<String, Object>) objs.get("operations");<NEW_LINE>ArrayList<CodegenOperation> codegenOperations = (ArrayList<CodegenOperation>) operations.get("operation");<NEW_LINE>for (CodegenOperation co : codegenOperations) {<NEW_LINE>for (Tag tag : co.tags) {<NEW_LINE>String tagName = tag.getName();<NEW_LINE>String pythonTagName = toVarName(tagName);<NEW_LINE>Map<String, Object> operationMap = new HashMap<>();<NEW_LINE>operationMap.put("operation", co);<NEW_LINE>operationMap.put("imports", co.imports);<NEW_LINE>operationMap.put("packageName", packageName);<NEW_LINE>String templateName = "endpoint.handlebars";<NEW_LINE>String filename = endpointFilename(templateName, pythonTagName, co.operationId);<NEW_LINE>try {<NEW_LINE>File written = processTemplateToFile(operationMap, templateName, filename, true, CodegenConstants.APIS);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOGGER.error(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "Error when writing template file {}", e.toString()); |
421,427 | public KeyFactory<AesGcmKeyFormat, AesGcmKey> keyFactory() {<NEW_LINE>return new KeyFactory<AesGcmKeyFormat, AesGcmKey>(AesGcmKeyFormat.class) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void validateKeyFormat(AesGcmKeyFormat format) throws GeneralSecurityException {<NEW_LINE>Validators.validateAesKeySize(format.getKeySize());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public AesGcmKeyFormat parseKeyFormat(ByteString byteString) throws InvalidProtocolBufferException {<NEW_LINE>return AesGcmKeyFormat.parseFrom(byteString, ExtensionRegistryLite.getEmptyRegistry());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public AesGcmKey createKey(AesGcmKeyFormat format) throws GeneralSecurityException {<NEW_LINE>return AesGcmKey.newBuilder().setKeyValue(ByteString.copyFrom(Random.randBytes(format.getKeySize()))).setVersion(getVersion()).build();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public AesGcmKey deriveKey(AesGcmKeyFormat format, InputStream inputStream) throws GeneralSecurityException {<NEW_LINE>Validators.validateVersion(format.getVersion(), getVersion());<NEW_LINE>byte[] pseudorandomness = new byte[format.getKeySize()];<NEW_LINE>try {<NEW_LINE>int read = inputStream.read(pseudorandomness);<NEW_LINE>if (read != format.getKeySize()) {<NEW_LINE>throw new GeneralSecurityException("Not enough pseudorandomness given");<NEW_LINE>}<NEW_LINE>return AesGcmKey.newBuilder().setKeyValue(ByteString.copyFrom(pseudorandomness)).setVersion(getVersion()).build();<NEW_LINE>} catch (IOException e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Map<String, KeyFactory.KeyFormat<AesGcmKeyFormat>> keyFormats() throws GeneralSecurityException {<NEW_LINE>Map<String, KeyFactory.KeyFormat<AesGcmKeyFormat>> result = new HashMap<>();<NEW_LINE>result.put("AES128_GCM", createKeyFormat(16, KeyTemplate.OutputPrefixType.TINK));<NEW_LINE>result.put("AES128_GCM_RAW", createKeyFormat(16, KeyTemplate.OutputPrefixType.RAW));<NEW_LINE>result.put("AES256_GCM", createKeyFormat(32, KeyTemplate.OutputPrefixType.TINK));<NEW_LINE>result.put("AES256_GCM_RAW", createKeyFormat(32, KeyTemplate.OutputPrefixType.RAW));<NEW_LINE>return Collections.unmodifiableMap(result);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | throw new GeneralSecurityException("Reading pseudorandomness failed", e); |
641,833 | public String requestDeviceCode(@RequestParam("client_id") String clientId, @RequestParam(name = "scope", required = false) String scope, Map<String, String> parameters, ModelMap model) {<NEW_LINE>ClientDetailsEntity client;<NEW_LINE>try {<NEW_LINE>client = clientService.loadClientByClientId(clientId);<NEW_LINE>// make sure this client can do the device flow<NEW_LINE>Collection<String> authorizedGrantTypes = client.getAuthorizedGrantTypes();<NEW_LINE>if (authorizedGrantTypes != null && !authorizedGrantTypes.isEmpty() && !authorizedGrantTypes.contains(DeviceTokenGranter.GRANT_TYPE)) {<NEW_LINE>throw new InvalidClientException("Unauthorized grant type: " + DeviceTokenGranter.GRANT_TYPE);<NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>logger.error("IllegalArgumentException was thrown when attempting to load client", e);<NEW_LINE>model.put(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);<NEW_LINE>return HttpCodeView.VIEWNAME;<NEW_LINE>}<NEW_LINE>if (client == null) {<NEW_LINE>logger.error("could not find client " + clientId);<NEW_LINE>model.put(HttpCodeView.CODE, HttpStatus.NOT_FOUND);<NEW_LINE>return HttpCodeView.VIEWNAME;<NEW_LINE>}<NEW_LINE>// make sure the client is allowed to ask for those scopes<NEW_LINE>Set<String> requestedScopes = OAuth2Utils.parseParameterList(scope);<NEW_LINE>Set<String> allowedScopes = client.getScope();<NEW_LINE>if (!scopeService.scopesMatch(allowedScopes, requestedScopes)) {<NEW_LINE>// client asked for scopes it can't have<NEW_LINE>logger.error("Client asked for " + requestedScopes + " but is allowed " + allowedScopes);<NEW_LINE>model.put(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);<NEW_LINE>model.put(JsonErrorView.ERROR, "invalid_scope");<NEW_LINE>return JsonErrorView.VIEWNAME;<NEW_LINE>}<NEW_LINE>// if we got here the request is legit<NEW_LINE>try {<NEW_LINE>DeviceCode dc = deviceCodeService.createNewDeviceCode(requestedScopes, client, parameters);<NEW_LINE>Map<String, Object> response = new HashMap<>();<NEW_LINE>response.put("device_code", dc.getDeviceCode());<NEW_LINE>response.put("user_code", dc.getUserCode());<NEW_LINE>response.put("verification_uri", config.getIssuer() + USER_URL);<NEW_LINE>if (client.getDeviceCodeValiditySeconds() != null) {<NEW_LINE>response.put("expires_in", client.getDeviceCodeValiditySeconds());<NEW_LINE>}<NEW_LINE>if (config.isAllowCompleteDeviceCodeUri()) {<NEW_LINE>URI verificationUriComplete = new URIBuilder(config.getIssuer() + USER_URL).addParameter("user_code", dc.getUserCode()).build();<NEW_LINE>response.put("verification_uri_complete", verificationUriComplete.toString());<NEW_LINE>}<NEW_LINE>model.put(JsonEntityView.ENTITY, response);<NEW_LINE>return JsonEntityView.VIEWNAME;<NEW_LINE>} catch (DeviceCodeCreationException dcce) {<NEW_LINE>model.put(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);<NEW_LINE>model.put(JsonErrorView.<MASK><NEW_LINE>model.put(JsonErrorView.ERROR_MESSAGE, dcce.getMessage());<NEW_LINE>return JsonErrorView.VIEWNAME;<NEW_LINE>} catch (URISyntaxException use) {<NEW_LINE>logger.error("unable to build verification_uri_complete due to wrong syntax of uri components");<NEW_LINE>model.put(HttpCodeView.CODE, HttpStatus.INTERNAL_SERVER_ERROR);<NEW_LINE>return HttpCodeView.VIEWNAME;<NEW_LINE>}<NEW_LINE>} | ERROR, dcce.getError()); |
458,489 | public static String colorToString(Color c) {<NEW_LINE>try {<NEW_LINE>Field[] fields = Color.class.getFields();<NEW_LINE>for (int i = 0; i < fields.length; i++) {<NEW_LINE>Field f = fields[i];<NEW_LINE>if (Modifier.isPublic(f.getModifiers()) && Modifier.isFinal(f.getModifiers()) && Modifier.isStatic(f.getModifiers())) {<NEW_LINE>final String name = f.getName();<NEW_LINE>final Object <MASK><NEW_LINE>if (oColor instanceof Color) {<NEW_LINE>if (c.equals(oColor)) {<NEW_LINE>return name;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>//<NEW_LINE>}<NEW_LINE>// no defined constant color, so this must be a user defined color<NEW_LINE>final String color = Integer.toHexString(c.getRGB() & 0x00ffffff);<NEW_LINE>final StringBuilder retval = new StringBuilder(7);<NEW_LINE>retval.append("#");<NEW_LINE>final int fillUp = 6 - color.length();<NEW_LINE>for (int i = 0; i < fillUp; i++) {<NEW_LINE>retval.append("0");<NEW_LINE>}<NEW_LINE>retval.append(color);<NEW_LINE>return retval.toString();<NEW_LINE>} | oColor = f.get(null); |
1,565,092 | public void visitClassExpression(ClassExpression expression) {<NEW_LINE>ClassNode type = expression.getType();<NEW_LINE>MethodVisitor mv = controller.getMethodVisitor();<NEW_LINE>if (BytecodeHelper.isClassLiteralPossible(type) || BytecodeHelper.isSameCompilationUnit(controller.getClassNode(), type)) {<NEW_LINE>if (controller.getClassNode().isInterface()) {<NEW_LINE>InterfaceHelperClassNode interfaceClassLoadingClass = controller.getInterfaceClassLoadingClass();<NEW_LINE>if (BytecodeHelper.isClassLiteralPossible(interfaceClassLoadingClass)) {<NEW_LINE>BytecodeHelper.visitClassLiteral(mv, interfaceClassLoadingClass);<NEW_LINE>controller.getOperandStack().push(ClassHelper.CLASS_Type);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>BytecodeHelper.visitClassLiteral(mv, type);<NEW_LINE>controller.getOperandStack().push(ClassHelper.CLASS_Type);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String staticFieldName = getStaticFieldName(type);<NEW_LINE>referencedClasses.put(staticFieldName, type);<NEW_LINE>String internalClassName = controller.getInternalClassName();<NEW_LINE>if (controller.getClassNode().isInterface()) {<NEW_LINE>internalClassName = BytecodeHelper.getClassInternalName(controller.getInterfaceClassLoadingClass());<NEW_LINE>mv.visitFieldInsn(GETSTATIC, internalClassName, staticFieldName, "Ljava/lang/Class;");<NEW_LINE>} else {<NEW_LINE>mv.visitMethodInsn(INVOKESTATIC, internalClassName, <MASK><NEW_LINE>}<NEW_LINE>controller.getOperandStack().push(ClassHelper.CLASS_Type);<NEW_LINE>} | "$get$" + staticFieldName, "()Ljava/lang/Class;", false); |
1,655,452 | public boolean execute(final OHttpRequest iRequest, final OHttpResponse iResponse) throws Exception {<NEW_LINE>iRequest.getData().commandInfo = "Get static content";<NEW_LINE>iRequest.getData().commandDetail = iRequest.getUrl();<NEW_LINE>OStaticContent staticContent = null;<NEW_LINE>try {<NEW_LINE>staticContent = getVirtualFolderContent(iRequest);<NEW_LINE>if (staticContent == null) {<NEW_LINE>staticContent = new OStaticContent();<NEW_LINE>loadStaticContent(iRequest, iResponse, staticContent);<NEW_LINE>}<NEW_LINE>if (staticContent.is != null && staticContent.contentSize < 0) {<NEW_LINE>ByteArrayOutputStream bytesOutput = new ByteArrayOutputStream();<NEW_LINE>GZIPOutputStream stream = new GZIPOutputStream(bytesOutput, 16384);<NEW_LINE>try {<NEW_LINE>OIOUtils.copyStream(staticContent.is, stream, -1);<NEW_LINE>stream.finish();<NEW_LINE>byte[<MASK><NEW_LINE>iResponse.sendStream(OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, staticContent.type, new ByteArrayInputStream(compressedBytes), compressedBytes.length, null, new HashMap<String, String>() {<NEW_LINE><NEW_LINE>{<NEW_LINE>put("Content-Encoding", "gzip");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} finally {<NEW_LINE>stream.close();<NEW_LINE>bytesOutput.close();<NEW_LINE>}<NEW_LINE>} else if (staticContent.is != null) {<NEW_LINE>iResponse.sendStream(OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, staticContent.type, staticContent.is, staticContent.contentSize);<NEW_LINE>} else {<NEW_LINE>iResponse.sendStream(404, "File not found", null, null, 0);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>OLogManager.instance().error(this, "Error on loading resource %s", e, iRequest.getUrl());<NEW_LINE>} finally {<NEW_LINE>if (staticContent != null && staticContent.is != null)<NEW_LINE>try {<NEW_LINE>staticContent.is.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>OLogManager.instance().warn(this, "Error on closing file", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ] compressedBytes = bytesOutput.toByteArray(); |
1,600,658 | private void loadColors(final Preferences preferences, final OutputOptions diskData) {<NEW_LINE>int rgbStandard = preferences.getInt(PREFIX + PROP_COLOR_STANDARD, getDefaultColorStandard().getRGB());<NEW_LINE>diskData.setColorStandard(new Color(rgbStandard));<NEW_LINE>int rgbError = preferences.getInt(PREFIX + PROP_COLOR_ERROR, getDefaultColorError().getRGB());<NEW_LINE>diskData.setColorError(new Color(rgbError));<NEW_LINE>int rgbInput = preferences.getInt(PREFIX + PROP_COLOR_INPUT, getDefaultColorInput().getRGB());<NEW_LINE>diskData.setColorInput(new Color(rgbInput));<NEW_LINE>int rgbBackground = preferences.getInt(PREFIX + PROP_COLOR_BACKGROUND, getDefaultColorBackground().getRGB());<NEW_LINE>diskData.setColorBackground(new Color(rgbBackground));<NEW_LINE>int rgbLink = preferences.getInt(PREFIX + PROP_COLOR_LINK, getDefaultColorLink().getRGB());<NEW_LINE>diskData.setColorLink(new Color(rgbLink));<NEW_LINE>int rgbLinkImportant = preferences.getInt(PREFIX + PROP_COLOR_LINK_IMPORTANT, getDefaultColorLinkImportant().getRGB());<NEW_LINE>diskData.setColorLinkImportant(new Color(rgbLinkImportant));<NEW_LINE>int rgbDebug = preferences.getInt(PREFIX + PROP_COLOR_DEBUG, getDefaultColorDebug().getRGB());<NEW_LINE>diskData.setColorDebug(new Color(rgbDebug));<NEW_LINE>int rgbWarning = preferences.getInt(PREFIX + PROP_COLOR_WARNING, getDefaultColorWarning().getRGB());<NEW_LINE>diskData.<MASK><NEW_LINE>int rgbFailure = preferences.getInt(PREFIX + PROP_COLOR_FAILURE, getDefaultColorFailure().getRGB());<NEW_LINE>diskData.setColorFailure(new Color(rgbFailure));<NEW_LINE>int rgbSuccess = preferences.getInt(PREFIX + PROP_COLOR_SUCCESS, getDefaultColorSuccess().getRGB());<NEW_LINE>diskData.setColorSuccess(new Color(rgbSuccess));<NEW_LINE>} | setColorWarning(new Color(rgbWarning)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.