idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
355,204 | private Map<JobId, List<Job>> jobsToRun(Map<InstanceName, Change> changes, boolean eagerTests) {<NEW_LINE>Map<JobId, List<Job>> <MASK><NEW_LINE>changes.forEach((instance, change) -> productionJobs.putAll(productionJobs(instance, change, eagerTests)));<NEW_LINE>Map<JobId, List<Job>> testJobs = testJobs(productionJobs);<NEW_LINE>Map<JobId, List<Job>> jobs = new LinkedHashMap<>(testJobs);<NEW_LINE>jobs.putAll(productionJobs);<NEW_LINE>// Add runs for idle, declared test jobs if they have no successes on their instance's change's versions.<NEW_LINE>jobSteps.forEach((job, step) -> {<NEW_LINE>if (!step.isDeclared() || job.type().isProduction() || jobs.containsKey(job))<NEW_LINE>return;<NEW_LINE>Change change = changes.get(job.application().instance());<NEW_LINE>if (change == null || !change.hasTargets())<NEW_LINE>return;<NEW_LINE>Optional<JobId> firstProductionJobWithDeployment = jobSteps.keySet().stream().filter(jobId -> jobId.type().isProduction() && jobId.type().isDeployment()).filter(jobId -> deploymentFor(jobId).isPresent()).findFirst();<NEW_LINE>Versions versions = Versions.from(change, application, firstProductionJobWithDeployment.flatMap(this::deploymentFor), systemVersion);<NEW_LINE>if (step.completedAt(change, Optional.empty()).isEmpty())<NEW_LINE>jobs.merge(job, List.of(new Job(job.type(), versions, step.readyAt(change), change)), DeploymentStatus::union);<NEW_LINE>});<NEW_LINE>return Collections.unmodifiableMap(jobs);<NEW_LINE>} | productionJobs = new LinkedHashMap<>(); |
810,500 | private void exportCSV(String separator, ExportDataDumper eDD) {<NEW_LINE>// Header<NEW_LINE>StringBuffer result = new StringBuffer();<NEW_LINE>// NOI18N<NEW_LINE>String newLine = "\r\n";<NEW_LINE>// NOI18N<NEW_LINE>String quote = "\"";<NEW_LINE>for (int i = 0; i < (columnNames.length); i++) {<NEW_LINE>result.append(quote).append(columnNames[i]).append(quote).append(separator);<NEW_LINE>}<NEW_LINE>result.deleteCharAt(result.length() - 1);<NEW_LINE>result.append(newLine);<NEW_LINE>eDD.dumpData(result);<NEW_LINE>// Data<NEW_LINE>for (int i = 0; i < nTrackedItems; i++) {<NEW_LINE>result = new StringBuffer();<NEW_LINE>result.append(quote).append(sortedClassNames[i]).append(quote).append(separator);<NEW_LINE>result.append(quote).append(percentFormat.format(((double) totalAllocObjectsSize[i]) / nTotalBytes)).append(quote).append(separator);<NEW_LINE>result.append(quote).append(totalAllocObjectsSize[i]).append<MASK><NEW_LINE>result.append(quote).append(nTotalAllocObjects[i]).append(quote).append(newLine);<NEW_LINE>eDD.dumpData(result);<NEW_LINE>}<NEW_LINE>eDD.close();<NEW_LINE>} | (quote).append(separator); |
382,008 | private ContentValues mapStory(Map<String, Object> map, Story.FILTER filter, Integer rank) {<NEW_LINE>ContentValues storyValues = new ContentValues();<NEW_LINE>try {<NEW_LINE>String by = (String) map.get("by");<NEW_LINE>Long id = (Long) map.get("id");<NEW_LINE>String type = (String) map.get("type");<NEW_LINE>Long time = (Long) map.get("time");<NEW_LINE>Long score = (Long) map.get("score");<NEW_LINE>String title = (String) map.get("title");<NEW_LINE>String url = (String) map.get("url");<NEW_LINE>Long descendants = Long.valueOf(0);<NEW_LINE>if (map.get("descendants") != null) {<NEW_LINE>descendants = (Long) map.get("descendants");<NEW_LINE>}<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.ITEM_ID, id);<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.BY, by);<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.TYPE, type);<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.TIME_AGO, time * 1000);<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.SCORE, score);<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.TITLE, title);<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.COMMENTS, descendants);<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.URL, url);<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.RANK, rank);<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.TIMESTAMP, System.currentTimeMillis());<NEW_LINE>storyValues.put(HNewsContract.StoryEntry.FILTER, filter.name());<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Log.<MASK><NEW_LINE>}<NEW_LINE>return storyValues;<NEW_LINE>} | d(ex.getMessage()); |
519,423 | public void find(FindingsListener findingsListener) {<NEW_LINE>List<Invocation> unusedStubs = new LinkedList<>(this.baseUnusedStubs);<NEW_LINE>List<InvocationMatcher> allInvocations = new LinkedList<>(this.baseAllInvocations);<NEW_LINE>Iterator<Invocation> unusedIterator = unusedStubs.iterator();<NEW_LINE>while (unusedIterator.hasNext()) {<NEW_LINE>Invocation unused = unusedIterator.next();<NEW_LINE>Iterator<InvocationMatcher<MASK><NEW_LINE>while (unstubbedIterator.hasNext()) {<NEW_LINE>InvocationMatcher unstubbed = unstubbedIterator.next();<NEW_LINE>if (unstubbed.hasSimilarMethod(unused)) {<NEW_LINE>findingsListener.foundStubCalledWithDifferentArgs(unused, unstubbed);<NEW_LINE>unusedIterator.remove();<NEW_LINE>unstubbedIterator.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Invocation i : unusedStubs) {<NEW_LINE>findingsListener.foundUnusedStub(i);<NEW_LINE>}<NEW_LINE>for (InvocationMatcher i : allInvocations) {<NEW_LINE>findingsListener.foundUnstubbed(i);<NEW_LINE>}<NEW_LINE>} | > unstubbedIterator = allInvocations.iterator(); |
1,356,106 | private AgentActiveThreadDump create2(TActiveThreadLightDump tActiveThreadLightDump) {<NEW_LINE>Objects.requireNonNull(tActiveThreadLightDump, "tActiveThreadLightDump");<NEW_LINE><MASK><NEW_LINE>AgentActiveThreadDump.Builder builder = new AgentActiveThreadDump.Builder();<NEW_LINE>builder.setThreadId(activeThreadDump.getThreadId());<NEW_LINE>builder.setThreadName(activeThreadDump.getThreadName());<NEW_LINE>builder.setThreadState(getThreadState(activeThreadDump.getThreadState()));<NEW_LINE>builder.setStartTime(tActiveThreadLightDump.getStartTime());<NEW_LINE>builder.setExecTime(System.currentTimeMillis() - tActiveThreadLightDump.getStartTime());<NEW_LINE>builder.setLocalTraceId(tActiveThreadLightDump.getLocalTraceId());<NEW_LINE>builder.setSampled(tActiveThreadLightDump.isSampled());<NEW_LINE>builder.setTransactionId(tActiveThreadLightDump.getTransactionId());<NEW_LINE>builder.setEntryPoint(tActiveThreadLightDump.getEntryPoint());<NEW_LINE>builder.setDetailMessage(StringUtils.EMPTY);<NEW_LINE>return builder.build();<NEW_LINE>} | TThreadLightDump activeThreadDump = tActiveThreadLightDump.getThreadDump(); |
649,051 | /* (non-Javadoc)<NEW_LINE>* @see tlc2.tool.liveness.AbstractDiskGraph#toDotViz(tlc2.tool.liveness.OrderOfSolution)<NEW_LINE>*/<NEW_LINE>public final String toDotViz(final OrderOfSolution oos) {<NEW_LINE>final int slen = oos.getCheckState().length;<NEW_LINE>final int alen = oos.getCheckAction().length;<NEW_LINE>// The following code relies on gnodes not being null, thus safeguard<NEW_LINE>// against accidental invocations.<NEW_LINE>// Essentially one has to wrap the toDotViz call with<NEW_LINE>// createCache/destroyCache<NEW_LINE>// for gnodes to be initialized.<NEW_LINE>if (this.gnodes == null) {<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>StringBuffer sb = new StringBuffer();<NEW_LINE>try {<NEW_LINE>sb.append("digraph DiskGraph {\n");<NEW_LINE>sb.append("nodesep = 0.7\n");<NEW_LINE>// Left to right rather than top to bottom<NEW_LINE>sb.append("rankdir=LR;\n");<NEW_LINE>sb.append(toDotVizLegend(oos));<NEW_LINE>sb.append("subgraph cluster_graph {\n");<NEW_LINE>// no border.<NEW_LINE>sb.append("color=\"white\";\n");<NEW_LINE>// TODO Reading the file front to end potentially yields node duplicates in the output. Better to create a (temporary) nodeptrtable and traverse it instead.<NEW_LINE>long nodePtr = this.nodeRAF.getFilePointer();<NEW_LINE>long nodePtrPtr = this.nodePtrRAF.getFilePointer();<NEW_LINE>long len = this.nodePtrRAF.length();<NEW_LINE>this.nodePtrRAF.seek(0);<NEW_LINE>while (this.nodePtrRAF.getFilePointer() < len) {<NEW_LINE>long fp = nodePtrRAF.readLong();<NEW_LINE>int tidx = nodePtrRAF.readInt();<NEW_LINE>long loc = nodePtrRAF.readLongNat();<NEW_LINE>GraphNode gnode = this.getNode(fp, tidx, loc);<NEW_LINE>sb.append(gnode.toDotViz(isInitState(gnode), true, slen, alen));<NEW_LINE>}<NEW_LINE>sb.append("}}");<NEW_LINE>this.nodeRAF.seek(nodePtr);<NEW_LINE>this.nodePtrRAF.seek(nodePtrPtr);<NEW_LINE>} catch (IOException e) {<NEW_LINE>MP.<MASK><NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | printError(EC.SYSTEM_DISKGRAPH_ACCESS, e); |
757,728 | public void probe() {<NEW_LINE>while (true) {<NEW_LINE>long ygc = youngGcMBean.getCollectionCount();<NEW_LINE>if (ygc == lastYoungCount) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long ogc = oldGcMBean.getCollectionCount();<NEW_LINE>long yt = youngGcMBean.getCollectionTime();<NEW_LINE>if (youngGcMBean.getCollectionCount() == ygc || oldGcMBean.getCollectionCount() == ogc) {<NEW_LINE>long ycd = ygc - lastYoungCount;<NEW_LINE>long ocd = ogc - lastOldCount;<NEW_LINE>long td = yt - lastTime;<NEW_LINE>lastYoungCount = ygc;<NEW_LINE>lastOldCount = ogc;<NEW_LINE>lastTime = yt;<NEW_LINE>if (!concurentMode && ocd > 0) {<NEW_LINE>// ignoring young part of full gc<NEW_LINE>ycd -= ocd;<NEW_LINE>}<NEW_LINE>if (ycd > 0) {<NEW_LINE>totalTime += td;<NEW_LINE>evenCount += ycd;<NEW_LINE>double avg = ((double) td) / ycd;<NEW_LINE>squareTotal += ycd * avg * avg;<NEW_LINE>if (printEvents) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("Young GC (" + ycd + " events), total time: " + td + "ms, (Old events: " + ogc + ")");<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | System.out.println(sb); |
1,181,317 | protected void updateOKStatus() {<NEW_LINE>IStatus status = null;<NEW_LINE>if (selectRemoteButton.getSelection()) {<NEW_LINE>ISelection selection = tv.getSelection();<NEW_LINE>if (selection != null && !selection.isEmpty() && manualEurekaURL.getText() != null && manualEurekaURL.getText().length() > 0) {<NEW_LINE>status = new Status(IStatus.OK, BootDashActivator.PLUGIN_ID, null);<NEW_LINE>} else {<NEW_LINE>status = new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID, "please select a remote Eureka instance");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>if (manualURL != null && manualURL.length() > 0) {<NEW_LINE>try {<NEW_LINE>URL url = new URL(manualURL);<NEW_LINE>URI uri = url.toURI();<NEW_LINE>if (uri.getHost() == null || uri.getHost().length() == 0) {<NEW_LINE>status = new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID, "please enter a valid URL");<NEW_LINE>} else {<NEW_LINE>status = new Status(IStatus.OK, BootDashActivator.PLUGIN_ID, null);<NEW_LINE>}<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>status = new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID, "please enter a valid URL");<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>status = new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID, "please enter a valid URL");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>status = new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID, "please enter URL of remote Eureka instance");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>updateStatus(status);<NEW_LINE>} | String manualURL = manualEurekaURL.getText(); |
632,942 | final DeleteProgramResult executeDeleteProgram(DeleteProgramRequest deleteProgramRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteProgramRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteProgramRequest> request = null;<NEW_LINE>Response<DeleteProgramResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DeleteProgramRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteProgramRequest));<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, "MediaTailor");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteProgram");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteProgramResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteProgramResultJsonUnmarshaller());<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.startEvent(Field.RequestMarshallTime); |
1,384,633 | private void interpolateTop(boolean topLeftAvailable, boolean topRightAvailable, byte[] topLeft, byte[] topLine, int blkX, int blkY, byte[] out) {<NEW_LINE>int a = topLeftAvailable ? topLeft[blkY >> 2] : topLine[blkX];<NEW_LINE>out[0] = (byte) ((a + (topLine[blkX] << 1) + topLine[blkX + 1] + 2) >> 2);<NEW_LINE>int i;<NEW_LINE>for (i = 1; i < 7; i++) out[i] = (byte) ((topLine[blkX + i - 1] + (topLine[blkX + i] << 1) + topLine[blkX + i + 1] + 2) >> 2);<NEW_LINE>if (topRightAvailable) {<NEW_LINE>for (; i < 15; i++) out[i] = (byte) ((topLine[blkX + i - 1] + (topLine[blkX + i] << 1) + topLine[blkX + i + 1] + 2) >> 2);<NEW_LINE>out[15] = (byte) ((topLine[blkX + 14] + (topLine[blkX + 15] << 1) + topLine[blkX + 15] + 2) >> 2);<NEW_LINE>} else {<NEW_LINE>out[7] = (byte) ((topLine[blkX + 6] + (topLine[blkX + 7] << 1) + topLine[blkX + 7] + 2) >> 2);<NEW_LINE>for (i = 8; i < 16; i++) out[i<MASK><NEW_LINE>}<NEW_LINE>} | ] = topLine[blkX + 7]; |
922,417 | public static void processAnnotation(LoggingFramework framework, AnnotationValues<?> annotation, JavacNode annotationNode) {<NEW_LINE>deleteAnnotationIfNeccessary(annotationNode, framework.getAnnotationClass());<NEW_LINE>JavacNode typeNode = annotationNode.up();<NEW_LINE>switch(typeNode.getKind()) {<NEW_LINE>case TYPE:<NEW_LINE>IdentifierName logFieldName = annotationNode.getAst().readConfiguration(ConfigurationKeys.LOG_ANY_FIELD_NAME);<NEW_LINE>if (logFieldName == null)<NEW_LINE>logFieldName = LOG;<NEW_LINE>boolean useStatic = !Boolean.FALSE.equals(annotationNode.getAst().readConfiguration(ConfigurationKeys.LOG_ANY_FIELD_IS_STATIC));<NEW_LINE>if ((((JCClassDecl) typeNode.get()).mods.flags & Flags.INTERFACE) != 0) {<NEW_LINE>annotationNode.addError(framework.getAnnotationAsString() + " is legal only on classes and enums.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (fieldExists(logFieldName.getName(), typeNode) != MemberExistsResult.NOT_EXISTS) {<NEW_LINE>annotationNode.addWarning("Field '" + logFieldName + "' already exists.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isRecord(typeNode) && !useStatic) {<NEW_LINE>annotationNode.addError("Logger fields must be static in records.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (useStatic && !isStaticAllowed(typeNode)) {<NEW_LINE>annotationNode.addError(framework.getAnnotationAsString() + " is not supported on non-static nested classes.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Object valueGuess = annotation.getValueGuess("topic");<NEW_LINE>JCExpression loggerTopic = (JCExpression) annotation.getActualExpression("topic");<NEW_LINE>if (valueGuess instanceof String && ((String) valueGuess).trim().isEmpty())<NEW_LINE>loggerTopic = null;<NEW_LINE>if (framework.getDeclaration().getParametersWithTopic() == null && loggerTopic != null) {<NEW_LINE>annotationNode.addError(framework.getAnnotationAsString() + " does not allow a topic.");<NEW_LINE>loggerTopic = null;<NEW_LINE>}<NEW_LINE>if (framework.getDeclaration().getParametersWithoutTopic() == null && loggerTopic == null) {<NEW_LINE>annotationNode.addError(<MASK><NEW_LINE>loggerTopic = typeNode.getTreeMaker().Literal("");<NEW_LINE>}<NEW_LINE>JCFieldAccess loggingType = selfType(typeNode);<NEW_LINE>createField(framework, typeNode, loggingType, annotationNode, logFieldName.getName(), useStatic, loggerTopic);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>annotationNode.addError("@Log is legal only on types.");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | framework.getAnnotationAsString() + " requires a topic."); |
172,810 | private void initComponents() {<NEW_LINE>// GEN-BEGIN:initComponents<NEW_LINE>scrollPane = new javax.swing.JScrollPane();<NEW_LINE>scriptPane = new javax.swing.JEditorPane();<NEW_LINE>hintsArea = new javax.swing.JTextArea();<NEW_LINE>setLayout(new java.awt.BorderLayout(0, 11));<NEW_LINE>scrollPane.setPreferredSize(new java.awt.Dimension(100, 100));<NEW_LINE>scrollPane.setViewportView(scriptPane);<NEW_LINE>add(scrollPane, java.awt.BorderLayout.CENTER);<NEW_LINE>hintsArea.setBackground(new java.awt.Color<MASK><NEW_LINE>hintsArea.setEditable(false);<NEW_LINE>hintsArea.setFont(javax.swing.UIManager.getFont("Label.font"));<NEW_LINE>hintsArea.setForeground(new java.awt.Color(102, 102, 153));<NEW_LINE>hintsArea.setLineWrap(true);<NEW_LINE>hintsArea.setText(NbBundle.getMessage(CustomizeScriptPanel.class, "CSP_TEXT_you_may_customize_gend2"));<NEW_LINE>hintsArea.setWrapStyleWord(true);<NEW_LINE>hintsArea.setDisabledTextColor(javax.swing.UIManager.getColor("Label.foreground"));<NEW_LINE>hintsArea.setEnabled(false);<NEW_LINE>hintsArea.setOpaque(false);<NEW_LINE>add(hintsArea, java.awt.BorderLayout.NORTH);<NEW_LINE>} | (204, 204, 204)); |
953,791 | private void addTransferOutTransaction() {<NEW_LINE>DocumentType type = new DocumentType("Depotbuchung \\- Belastung", isJointAccount);<NEW_LINE>this.addDocumentTyp(type);<NEW_LINE>Block block = new Block("^Depotbuchung \\- Belastung$");<NEW_LINE>type.addBlock(block);<NEW_LINE>Transaction<BuySellEntry> pdfTransaction = new Transaction<>();<NEW_LINE>pdfTransaction.subject(() -> {<NEW_LINE>BuySellEntry entry = new BuySellEntry();<NEW_LINE>entry.setType(PortfolioTransaction.Type.TRANSFER_OUT);<NEW_LINE>return entry;<NEW_LINE>});<NEW_LINE>// Nominale Wertpapierbezeichnung ISIN (WKN)<NEW_LINE>pdfTransaction.// EUR 25.000,00 24,75 % UBS AG (LONDON BRANCH) DE000US9RGR9 (US9RGR)<NEW_LINE>// EO-ANL. 14(16) RWE<NEW_LINE>section("currency", "shares", "name", "isin", "wkn", "nameContinued").find("Nominale Wertpapierbezeichnung ISIN \\(WKN\\)").match("^(?<currency>[\\w]{3}) (?<shares>[\\.,\\d]+) (?<name>.*) (?<isin>[\\w]{12}) \\((?<wkn>.*)\\)$").match("^(?<nameContinued>.*)$").assign((t, v) -> {<NEW_LINE>t.setSecurity(getOrCreateSecurity(v));<NEW_LINE>// Workaround for bonds<NEW_LINE>BigDecimal shares = asBigDecimal(v.get("shares"));<NEW_LINE>t.setShares(Values.Share.factorize(shares.doubleValue() / 100));<NEW_LINE>// Workaround for bonds<NEW_LINE>t.setAmount(0L);<NEW_LINE>t.setCurrencyCode(asCurrencyCode(t.getPortfolioTransaction().getSecurity().getCurrencyCode()));<NEW_LINE>}).// Valuta 30.11.2015 externe Referenz-Nr. KP40030120300340<NEW_LINE>section("date").match("^Valuta (?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}) .*$").assign(// Depotkonto-Nr.<NEW_LINE>(t, v) -> t.setDate(asDate(v.get("date")))).section("note").optional().match("^(?<note>Depotkonto\\-Nr\\. .*)$").assign((t, v) -> t.setNote(v.get("note"))<MASK><NEW_LINE>block.set(pdfTransaction);<NEW_LINE>} | ).wrap(BuySellEntryItem::new); |
672,579 | public Node initialize(Node node, Supplier<String> idGenerator) {<NEW_LINE>List<Slot> slots = new ArrayList<>();<NEW_LINE>addSlots(slots, idGenerator);<NEW_LINE>node.setSlots(slots.toArray(new Slot[0]));<NEW_LINE>node.getEditorSettings().setTypeLabel(getTypeLabel());<NEW_LINE>node.getEditorSettings(<MASK><NEW_LINE>List<String> editorComponents = new ArrayList<>();<NEW_LINE>addEditorComponents(editorComponents);<NEW_LINE>node.getEditorSettings().setComponents(editorComponents.toArray(new String[0]));<NEW_LINE>ObjectNode initialProperties = getInitialProperties();<NEW_LINE>try {<NEW_LINE>if (initialProperties != null) {<NEW_LINE>node.setProperties(JSON.writeValueAsString(initialProperties));<NEW_LINE>} else {<NEW_LINE>ObjectNode properties = JSON.createObjectNode();<NEW_LINE>configureInitialProperties(properties);<NEW_LINE>if (!properties.isEmpty()) {<NEW_LINE>node.setProperties(JSON.writeValueAsString(properties));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new RuntimeException("Error writing initial properties of: " + getType(), ex);<NEW_LINE>}<NEW_LINE>List<String> persistentPaths = new ArrayList<>();<NEW_LINE>addPersistentPropertyPaths(persistentPaths);<NEW_LINE>if (persistentPaths.size() > 0) {<NEW_LINE>node.setPersistentPropertyPaths(persistentPaths.toArray(new String[persistentPaths.size()]));<NEW_LINE>}<NEW_LINE>return node;<NEW_LINE>} | ).setNodeColor(getColor()); |
256,192 | public Set<DataObject> instantiate() throws IOException {<NEW_LINE>FileObject targetFolder = Templates.getTargetFolder(wiz);<NEW_LINE>TestNGSupport.findTestNGSupport(FileOwnerQuery.getOwner(targetFolder)).configureProject(targetFolder);<NEW_LINE>String targetName = Templates.getTargetName(wiz);<NEW_LINE>DataFolder df = DataFolder.findFolder(targetFolder);<NEW_LINE>FileObject <MASK><NEW_LINE>DataObject dTemplate = DataObject.find(template);<NEW_LINE>String pkgName = getSelectedPackageName(targetFolder);<NEW_LINE>String suiteName = pkgName + " suite";<NEW_LINE>String projectName = ProjectUtils.getInformation(FileOwnerQuery.getOwner(targetFolder)).getName();<NEW_LINE>if (pkgName == null || pkgName.trim().length() < 1) {<NEW_LINE>// NOI18N<NEW_LINE>pkgName = ".*";<NEW_LINE>suiteName = "All tests for " + projectName;<NEW_LINE>}<NEW_LINE>Map<String, String> props = new HashMap<String, String>();<NEW_LINE>props.put("suiteName", projectName);<NEW_LINE>props.put("testName", suiteName);<NEW_LINE>props.put("pkg", pkgName);<NEW_LINE>DataObject dobj = dTemplate.createFromTemplate(df, targetName, props);<NEW_LINE>return Collections.singleton(dobj);<NEW_LINE>} | template = Templates.getTemplate(wiz); |
537,075 | private void rewriteNewArrayTree(WorkingCopy copy, TreeMaker mk, TreePath natPath, TypeMirror compType) {<NEW_LINE>NewArrayTree nat = (NewArrayTree) natPath.getLeaf();<NEW_LINE>TypeMirror existing = copy.getTrees().getTypeMirror(natPath);<NEW_LINE>int existingDim = numberOfDimensions(existing);<NEW_LINE>int newDim = numberOfDimensions(compType);<NEW_LINE>if (existingDim == newDim + 1) /* newDim is counted from component type, lacks the enclosing array */<NEW_LINE>{<NEW_LINE>// simple, number of dimensions does not change<NEW_LINE>copy.rewrite(nat.getType(), mk.Type(compType));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<ExpressionTree> l = new ArrayList<ExpressionTree>(nat.getDimensions().subList(0, Math.min(newDim + 1, nat.getDimensions().size())));<NEW_LINE>Tree replacement = mk.NewArray(mk.Type(compType), l, null);<NEW_LINE>GeneratorUtilities.get(copy).copyComments(nat, replacement, true);<NEW_LINE>GeneratorUtilities.get(copy).<MASK><NEW_LINE>copy.rewrite(nat, replacement);<NEW_LINE>} | copyComments(nat, replacement, false); |
1,541,410 | public AccessRules unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AccessRules accessRules = new AccessRules();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("getObject", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>accessRules.setGetObject(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("allowPublicOverrides", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>accessRules.setAllowPublicOverrides(context.getUnmarshaller(Boolean.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return accessRules;<NEW_LINE>} | class).unmarshall(context)); |
703,282 | public void createMenuItems(Bundle savedInstanceState) {<NEW_LINE>if (group == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>app = requiredMyApplication();<NEW_LINE>selectedGpxHelper = app.getSelectedGpxHelper();<NEW_LINE>mapMarkersHelper = app.getMapMarkersHelper();<NEW_LINE>items.add(new TitleItem(getCategoryName(app, group.getName())));<NEW_LINE>GPXFile gpxFile = group.getGpx();<NEW_LINE>boolean currentTrack = group.getGpx().showCurrentTrack;<NEW_LINE>SelectedGpxFile selectedGpxFile;<NEW_LINE>if (currentTrack) {<NEW_LINE>selectedGpxFile = selectedGpxHelper.getSelectedCurrentRecordingTrack();<NEW_LINE>} else {<NEW_LINE>selectedGpxFile = selectedGpxHelper.getSelectedFileByPath(gpxFile.path);<NEW_LINE>}<NEW_LINE>boolean trackPoints = group.getType() == GpxDisplayItemType.TRACK_POINTS;<NEW_LINE>if (trackPoints && selectedGpxFile != null) {<NEW_LINE>items<MASK><NEW_LINE>}<NEW_LINE>items.add(createEditNameItem());<NEW_LINE>if (trackPoints) {<NEW_LINE>items.add(createChangeColorItem());<NEW_LINE>}<NEW_LINE>items.add(new OptionsDividerItem(app));<NEW_LINE>if (!currentTrack) {<NEW_LINE>items.add(createCopyToMarkersItem(gpxFile));<NEW_LINE>}<NEW_LINE>items.add(createCopyToFavoritesItem());<NEW_LINE>items.add(new OptionsDividerItem(app));<NEW_LINE>items.add(createDeleteGroupItem());<NEW_LINE>} | .add(createShowOnMapItem(selectedGpxFile)); |
68,573 | private static void addToPool(ResourceLocation pool, ResourceLocation toAdd, int weight) {<NEW_LINE>StructureTemplatePool old = BuiltinRegistries.TEMPLATE_POOL.get(pool);<NEW_LINE>// Fixed seed to prevent inconsistencies between different worlds<NEW_LINE>List<StructurePoolElement> shuffled;<NEW_LINE>if (old != null)<NEW_LINE>shuffled = old.getShuffledTemplates(new Random(0));<NEW_LINE>else<NEW_LINE>shuffled = ImmutableList.of();<NEW_LINE>Object2IntMap<StructurePoolElement> newPieces = new Object2IntLinkedOpenHashMap<>();<NEW_LINE>for (StructurePoolElement p : shuffled) newPieces.computeInt(p, (StructurePoolElement pTemp, Integer i) -> (i == null ? 0 : i) + 1);<NEW_LINE>newPieces.put(SingleJigsawAccess.construct(Either.left(toAdd), () -> ProcessorLists.EMPTY, Projection.RIGID), weight);<NEW_LINE>List<Pair<StructurePoolElement, Integer>> newPieceList = newPieces.object2IntEntrySet().stream().map(e -> Pair.of(e.getKey(), e.getIntValue())).collect(Collectors.toList());<NEW_LINE><MASK><NEW_LINE>Registry.register(BuiltinRegistries.TEMPLATE_POOL, pool, new StructureTemplatePool(pool, name, newPieceList));<NEW_LINE>} | ResourceLocation name = old.getName(); |
714,897 | private static void applyDiffOptions(String[] lines1, String[] lines2, BuiltInDiffProvider.Options options) {<NEW_LINE>if (options.ignoreLeadingAndtrailingWhitespace && options.ignoreInnerWhitespace) {<NEW_LINE>for (int i = 0; i < lines1.length; i++) {<NEW_LINE>lines1[i] = spaces.matcher(lines1[i]).replaceAll("");<NEW_LINE>}<NEW_LINE>for (int i = 0; i < lines2.length; i++) {<NEW_LINE>lines2[i] = spaces.matcher(lines2[i]).replaceAll("");<NEW_LINE>}<NEW_LINE>} else if (options.ignoreLeadingAndtrailingWhitespace) {<NEW_LINE>for (int i = 0; i < lines1.length; i++) {<NEW_LINE>lines1[i] = lines1[i].trim();<NEW_LINE>}<NEW_LINE>for (int i = 0; i < lines2.length; i++) {<NEW_LINE>lines2[i] = lines2[i].trim();<NEW_LINE>}<NEW_LINE>} else if (options.ignoreInnerWhitespace) {<NEW_LINE>for (int i = 0; i < lines1.length; i++) {<NEW_LINE>replaceInnerSpaces(lines1, i);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < lines2.length; i++) {<NEW_LINE>replaceInnerSpaces(lines2, i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (options.ignoreCase) {<NEW_LINE>for (int i = 0; i < lines1.length; i++) {<NEW_LINE>lines1[i] = lines1[i].toUpperCase();<NEW_LINE>}<NEW_LINE>for (int i = 0; i < lines2.length; i++) {<NEW_LINE>lines2[i] = <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | lines2[i].toUpperCase(); |
226,738 | private File retrolambda(File userDir, BuildRequest request, File classDir, boolean rename) throws Exception {<NEW_LINE>File output = new File(classDir.getParentFile(), classDir.getName() + "_retrolamda");<NEW_LINE>output.mkdir();<NEW_LINE>HashMap<String, String> env = new HashMap<String, String>();<NEW_LINE>String retrolambda = System.getProperty("retrolambdaJarPath", null);<NEW_LINE>if (retrolambda == null) {<NEW_LINE>getResourceAsFile("/com/codename1/builder/retrolambda.jar", ".jar").getAbsolutePath();<NEW_LINE>}<NEW_LINE>if (codenameOneJar == null) {<NEW_LINE>throw new IllegalStateException("CodenameOne jar is not set");<NEW_LINE>}<NEW_LINE>if (!codenameOneJar.exists()) {<NEW_LINE>throw new IOException("Cannot find codename one jar at " + codenameOneJar);<NEW_LINE>}<NEW_LINE>String codenameOneJarPath = codenameOneJar.getAbsolutePath();<NEW_LINE>File java8Home = new File(System.getProperty("java.home"));<NEW_LINE>String java = new File(java8Home, "bin" + File.<MASK><NEW_LINE>String defaultMethods = "-Dretrolambda.defaultMethods=true";<NEW_LINE>;<NEW_LINE>if (!// "-Dretrolambda.classpath="+classDir.getAbsolutePath()+":src/iOSPort.jar:JavaAPI.jar",<NEW_LINE>exec(// "-Dretrolambda.classpath="+classDir.getAbsolutePath()+":src/iOSPort.jar:JavaAPI.jar",<NEW_LINE>userDir, // "-Dretrolambda.classpath="+classDir.getAbsolutePath()+":src/iOSPort.jar:JavaAPI.jar",<NEW_LINE>env, // "-Dretrolambda.classpath="+classDir.getAbsolutePath()+":src/iOSPort.jar:JavaAPI.jar",<NEW_LINE>java, // "-Dretrolambda.classpath="+classDir.getAbsolutePath()+":src/iOSPort.jar:JavaAPI.jar",<NEW_LINE>"-Dretrolambda.inputDir=" + classDir.getAbsolutePath(), "-Dretrolambda.classpath=" + classDir.getAbsolutePath() + File.pathSeparator + codenameOneJarPath, "-Dretrolambda.outputDir=" + output.getAbsolutePath(), "-Dretrolambda.bytecodeVersion=49", defaultMethods, "-jar", retrolambda)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Remove stale references to java/lang/invoke classes.<NEW_LINE>stripInvokeClassConstantsRecursive(output);<NEW_LINE>if (rename) {<NEW_LINE>delTree(classDir, true);<NEW_LINE>if (is_windows) {<NEW_LINE>Files.move(output.toPath(), classDir.toPath(), StandardCopyOption.REPLACE_EXISTING);<NEW_LINE>} else {<NEW_LINE>output.renameTo(classDir);<NEW_LINE>}<NEW_LINE>remapClasses(classDir, getDefaultClassMapping());<NEW_LINE>} else {<NEW_LINE>remapClasses(output, getDefaultClassMapping());<NEW_LINE>}<NEW_LINE>return output;<NEW_LINE>} | separator + "java").getAbsolutePath(); |
756,947 | private static LastInvoiceInfo extractLastSalesInvoiceInfo(@Nullable final I_C_BPartner_Product_Stats_Invoice_Online_V record) {<NEW_LINE>if (record == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final InvoiceId invoiceId = InvoiceId.ofRepoId(record.getC_Invoice_ID());<NEW_LINE>if (// shall not happen<NEW_LINE>invoiceId == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final LocalDate invoiceDate = TimeUtil.asLocalDate(record.getDateInvoiced());<NEW_LINE>if (// shall not happen<NEW_LINE>invoiceDate == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final BigDecimal priceValue = record.getPriceActual();<NEW_LINE>final CurrencyId currencyId = CurrencyId.<MASK><NEW_LINE>final Money price = Money.ofOrNull(priceValue, currencyId);<NEW_LINE>if (// shall not happen<NEW_LINE>price == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return LastInvoiceInfo.builder().invoiceId(invoiceId).invoiceDate(invoiceDate).price(price).build();<NEW_LINE>} | ofRepoIdOrNull(record.getC_Currency_ID()); |
1,731,231 | private void checkContentLanguageHeaderNorwegian(String detectedLanguage, String detectedLanguageName, String detectedLanguageCode) throws SAXException {<NEW_LINE>if ("".equals(httpContentLangHeader) || httpContentLangHeader.contains(",")) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>String contentLangCode = new ULocale(lowerCaseContentLang).getLanguage();<NEW_LINE>if (!("no".equals(contentLangCode) || "nn".equals(contentLangCode) || "nb".equals(contentLangCode))) {<NEW_LINE>warn("This document appears to be written in" + " Norwegian but the value of the HTTP" + " \u201CContent-Language\u201D header is" + " \u201C" + lowerCaseContentLang + "\u201D. Consider" + " changing it to \u201Cnn\u201D or \u201Cnn\u201D" + " (or variant) instead.");<NEW_LINE>}<NEW_LINE>} | String lowerCaseContentLang = httpContentLangHeader.toLowerCase(); |
280,111 | public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {<NEW_LINE>if (cl.hasOption(enable.getOpt())) {<NEW_LINE>extensions = ServiceLoader.load(ShellExtension.class);<NEW_LINE>for (ShellExtension se : extensions) {<NEW_LINE>loadedExtensions.add(se.getExtensionName());<NEW_LINE>String header = "-- " + se.getExtensionName() + " Extension Commands ---------";<NEW_LINE>loadedHeaders.add(header);<NEW_LINE>shellState.commandGrouping.put(header, se.getCommands());<NEW_LINE>for (Command cmd : se.getCommands()) {<NEW_LINE>String name = se.getExtensionName() + "::" + cmd.getName();<NEW_LINE>loadedCommands.add(name);<NEW_LINE>shellState.commandFactory.put(name, cmd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (cl.hasOption(disable.getOpt())) {<NEW_LINE>// Remove the headers<NEW_LINE>for (String header : loadedHeaders) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// remove the commands<NEW_LINE>for (String name : loadedCommands) {<NEW_LINE>shellState.commandFactory.remove(name);<NEW_LINE>}<NEW_LINE>// Reset state<NEW_LINE>loadedExtensions.clear();<NEW_LINE>extensions.reload();<NEW_LINE>} else if (cl.hasOption(list.getOpt())) {<NEW_LINE>shellState.printLines(loadedExtensions.iterator(), true);<NEW_LINE>} else {<NEW_LINE>printHelp(shellState);<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | shellState.commandGrouping.remove(header); |
741,120 | public void start() {<NEW_LINE>if (hasRedissonInstance) {<NEW_LINE>redisson = Redisson.create(config);<NEW_LINE>}<NEW_LINE>retrieveAddresses();<NEW_LINE>if (config.getRedissonNodeInitializer() != null) {<NEW_LINE>config.getRedissonNodeInitializer().onStartup(this);<NEW_LINE>}<NEW_LINE>int mapReduceWorkers = config.getMapReduceWorkers();<NEW_LINE>if (mapReduceWorkers != -1) {<NEW_LINE>if (mapReduceWorkers == 0) {<NEW_LINE>mapReduceWorkers = Runtime.getRuntime().availableProcessors();<NEW_LINE>}<NEW_LINE>WorkerOptions options = WorkerOptions.defaults().workers(mapReduceWorkers).beanFactory(config.getBeanFactory());<NEW_LINE>redisson.getExecutorService(RExecutorService.MAPREDUCE_NAME).registerWorkers(options);<NEW_LINE>log.info("{} map reduce worker(s) registered", mapReduceWorkers);<NEW_LINE>}<NEW_LINE>for (Entry<String, Integer> entry : config.getExecutorServiceWorkers().entrySet()) {<NEW_LINE>String name = entry.getKey();<NEW_LINE>int workers = entry.getValue();<NEW_LINE>WorkerOptions options = WorkerOptions.defaults().workers(workers).beanFactory(config.getBeanFactory());<NEW_LINE>redisson.getExecutorService<MASK><NEW_LINE>log.info("{} worker(s) registered for ExecutorService with '{}' name", workers, name);<NEW_LINE>}<NEW_LINE>log.info("Redisson node started!");<NEW_LINE>} | (name).registerWorkers(options); |
1,779,789 | public Set<K> keySet() {<NEW_LINE>return new AbstractSet<K>() {<NEW_LINE><NEW_LINE>final List<String<MASK><NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Iterator<K> iterator() {<NEW_LINE>return new Iterator<K>() {<NEW_LINE><NEW_LINE>final Iterator<String> it = keys.iterator();<NEW_LINE><NEW_LINE>String lastEncodedKey;<NEW_LINE><NEW_LINE>public boolean hasNext() {<NEW_LINE>return it.hasNext();<NEW_LINE>}<NEW_LINE><NEW_LINE>public K next() {<NEW_LINE>lastEncodedKey = it.next();<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>K toReturn = (K) keyCoder.decode(state, StringQuoter.split(StringQuoter.quote(lastEncodedKey)));<NEW_LINE>return toReturn;<NEW_LINE>}<NEW_LINE><NEW_LINE>public void remove() {<NEW_LINE>Splittable.NULL.assign(data, lastEncodedKey);<NEW_LINE>reified.setReified(lastEncodedKey, null);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int size() {<NEW_LINE>return keys.size();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | > keys = data.getPropertyKeys(); |
828,644 | public Object importMoveLine(Object bean, Map<String, Object> values) throws AxelorException {<NEW_LINE>assert bean instanceof MoveLine;<NEW_LINE>MoveLine moveLine = (MoveLine) bean;<NEW_LINE>String accountId = (String) values.get("account_importId");<NEW_LINE>Account account = getAccount(accountId);<NEW_LINE>if (account != null) {<NEW_LINE>moveLine.setAccountCode(account.getCode());<NEW_LINE>moveLine.setAccountName(account.getName());<NEW_LINE>} else {<NEW_LINE>moveLine.setAccountCode((String) values.get("accountCode"));<NEW_LINE>moveLine.setAccountName((String) values.get("accountName"));<NEW_LINE>}<NEW_LINE>String taxLineId = (String) values.get("taxLine_importId");<NEW_LINE>TaxLine taxLine = getTaxLine(taxLineId);<NEW_LINE>if (taxLine != null) {<NEW_LINE>moveLine.setTaxCode(taxLine.getTax().getCode());<NEW_LINE>moveLine.<MASK><NEW_LINE>} else {<NEW_LINE>moveLine.setTaxCode((String) values.get("taxCode"));<NEW_LINE>moveLine.setTaxRate(new BigDecimal((String) values.get("taxRate")));<NEW_LINE>}<NEW_LINE>String partnerId = (String) values.get("partner_importId");<NEW_LINE>Partner partner = getPartner(partnerId);<NEW_LINE>if (partner != null) {<NEW_LINE>moveLine.setPartnerSeq(partner.getPartnerSeq());<NEW_LINE>moveLine.setPartnerFullName(partner.getFullName());<NEW_LINE>} else {<NEW_LINE>moveLine.setPartnerSeq((String) values.get("partnerSeq"));<NEW_LINE>moveLine.setPartnerFullName((String) values.get("partnerFullName"));<NEW_LINE>}<NEW_LINE>moveLineRepository.save(moveLine);<NEW_LINE>return moveLine;<NEW_LINE>} | setTaxRate(taxLine.getValue()); |
1,383,731 | protected void trainModel() throws LibrecException {<NEW_LINE>MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().iterations(1).updater(Updater.NESTEROVS).learningRate(learningRate).weightInit(WeightInit.XAVIER_UNIFORM).optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT).regularization(true).l2(lambdaReg).list().layer(0, // .activation(Activation.SIGMOID)<NEW_LINE>new DenseLayer.Builder().nIn(inputDim).nOut(hiddenDim).activation(Activation.fromString(hiddenActivation)).biasInit(0.1).build()).layer(1, // .activation(Activation.IDENTITY)<NEW_LINE>new OutputLayer.Builder(new AutoRecLossFunction()).nIn(hiddenDim).nOut(inputDim).activation(Activation.fromString(outputActivation)).biasInit(0.1).build()).pretrain(false).backprop(true).build();<NEW_LINE>autoRecModel = new MultiLayerNetwork(conf);<NEW_LINE>autoRecModel.init();<NEW_LINE>for (int iter = 1; iter <= numIterations; iter++) {<NEW_LINE>loss = 0.0d;<NEW_LINE>AutoRecLossFunction.trainMask = trainSetMask;<NEW_LINE><MASK><NEW_LINE>loss = autoRecModel.score();<NEW_LINE>if (isConverged(iter) && earlyStop) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>lastLoss = loss;<NEW_LINE>}<NEW_LINE>} | autoRecModel.fit(trainSet, trainSet); |
1,347,922 | private void applyOffsetToItem(CompoundTag item, Point3i offset) {<NEW_LINE>if (item == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>CompoundTag tag = Helper.tagFromCompound(item, "tag");<NEW_LINE>if (tag == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String id = Helper.stringFromCompound(item, "id", "");<NEW_LINE>switch(id) {<NEW_LINE>case "minecraft:compass":<NEW_LINE>CompoundTag lodestonePos = Helper.tagFromCompound(tag, "LodestonePos");<NEW_LINE>Helper.applyIntOffsetIfRootPresent(lodestonePos, "X", "Y", "Z", offset);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// recursively update all items in child containers<NEW_LINE>CompoundTag blockEntityTag = Helper.tagFromCompound(tag, "BlockEntityTag");<NEW_LINE>ListTag<CompoundTag> items = <MASK><NEW_LINE>if (items != null) {<NEW_LINE>items.forEach(i -> applyOffsetToItem(i, offset));<NEW_LINE>}<NEW_LINE>} | Helper.tagFromCompound(blockEntityTag, "Items"); |
610,233 | public ListenableFuture<?> execute(DropColumn statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector) {<NEW_LINE>QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getTable());<NEW_LINE>Optional<TableHandle> tableHandleOptional = metadata.getTableHandle(session, tableName);<NEW_LINE>if (!tableHandleOptional.isPresent()) {<NEW_LINE>if (!statement.isTableExists()) {<NEW_LINE>throw new SemanticException(MISSING_TABLE, statement, "Table '%s' does not exist", tableName);<NEW_LINE>}<NEW_LINE>return immediateFuture(null);<NEW_LINE>}<NEW_LINE>Optional<ConnectorMaterializedViewDefinition> optionalMaterializedView = metadata.getMaterializedView(session, tableName);<NEW_LINE>if (optionalMaterializedView.isPresent()) {<NEW_LINE>if (!statement.isTableExists()) {<NEW_LINE>throw new SemanticException(NOT_SUPPORTED, statement, "'%s' is a materialized view, and drop column is not supported", tableName);<NEW_LINE>}<NEW_LINE>return immediateFuture(null);<NEW_LINE>}<NEW_LINE>TableHandle tableHandle = tableHandleOptional.get();<NEW_LINE>String column = statement.getColumn().<MASK><NEW_LINE>accessControl.checkCanDropColumn(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);<NEW_LINE>ColumnHandle columnHandle = metadata.getColumnHandles(session, tableHandle).get(column);<NEW_LINE>if (columnHandle == null) {<NEW_LINE>if (!statement.isColumnExists()) {<NEW_LINE>throw new SemanticException(MISSING_COLUMN, statement, "Column '%s' does not exist", column);<NEW_LINE>}<NEW_LINE>return immediateFuture(null);<NEW_LINE>}<NEW_LINE>if (metadata.getColumnMetadata(session, tableHandle, columnHandle).isHidden()) {<NEW_LINE>throw new SemanticException(NOT_SUPPORTED, statement, "Cannot drop hidden column");<NEW_LINE>}<NEW_LINE>if (metadata.getTableMetadata(session, tableHandle).getColumns().stream().filter(info -> !info.isHidden()).count() <= 1) {<NEW_LINE>throw new SemanticException(NOT_SUPPORTED, statement, "Cannot drop the only column in a table");<NEW_LINE>}<NEW_LINE>metadata.dropColumn(session, tableHandle, columnHandle);<NEW_LINE>return immediateFuture(null);<NEW_LINE>} | getValue().toLowerCase(ENGLISH); |
154,056 | public static void createThumbnailPdf(Context context, String localPath, MegaApiAndroid megaApi, long handle) {<NEW_LINE>logDebug(<MASK><NEW_LINE>MegaNode pdfNode = megaApi.getNodeByHandle(handle);<NEW_LINE>if (pdfNode == null) {<NEW_LINE>logWarning("Pdf is NULL");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int pageNumber = 0;<NEW_LINE>PdfiumCore pdfiumCore = new PdfiumCore(context);<NEW_LINE>FileOutputStream out = null;<NEW_LINE>File thumbDir = getThumbFolder(context);<NEW_LINE>File thumb = new File(thumbDir, pdfNode.getBase64Handle() + ".jpg");<NEW_LINE>File file = new File(localPath);<NEW_LINE>try {<NEW_LINE>PdfDocument pdfDocument = pdfiumCore.newDocument(ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY));<NEW_LINE>pdfiumCore.openPage(pdfDocument, pageNumber);<NEW_LINE>int width = pdfiumCore.getPageWidthPoint(pdfDocument, pageNumber);<NEW_LINE>int height = pdfiumCore.getPageHeightPoint(pdfDocument, pageNumber);<NEW_LINE>Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);<NEW_LINE>pdfiumCore.renderPageBitmap(pdfDocument, bmp, pageNumber, 0, 0, width, height);<NEW_LINE>Bitmap resizedBitmap = Bitmap.createScaledBitmap(bmp, 200, 200, false);<NEW_LINE>out = new FileOutputStream(thumb);<NEW_LINE>// bmp is your Bitmap instance<NEW_LINE>boolean result = resizedBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);<NEW_LINE>if (result) {<NEW_LINE>logDebug("Compress OK!");<NEW_LINE>megaApi.setThumbnail(pdfNode, thumb.getAbsolutePath());<NEW_LINE>} else {<NEW_LINE>logDebug("Not Compress");<NEW_LINE>}<NEW_LINE>pdfiumCore.closeDocument(pdfDocument);<NEW_LINE>} catch (Exception e) {<NEW_LINE>// todo with exception<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>if (out != null)<NEW_LINE>out.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>// todo with exception<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "createThumbnailPdf: " + localPath + " : " + handle); |
661,440 | public void allocatePorts(int start, PortAllocBridge from) {<NEW_LINE>if (start == 0)<NEW_LINE>start = BASEPORT;<NEW_LINE>int offset = 0;<NEW_LINE>if (getHttp() == null) {<NEW_LINE>if (requireSpecificPorts) {<NEW_LINE>allocatedSearchPort = <MASK><NEW_LINE>} else {<NEW_LINE>allocatedSearchPort = from.allocatePort("http");<NEW_LINE>}<NEW_LINE>portsMeta.on(offset++).tag("http").tag("query").tag("external").tag("state");<NEW_LINE>// XXX unused - remove:<NEW_LINE>from.allocatePort("http/1");<NEW_LINE>portsMeta.on(offset++).tag("http").tag("external");<NEW_LINE>} else if (getHttp().getHttpServer().isEmpty()) {<NEW_LINE>// no http server ports<NEW_LINE>} else {<NEW_LINE>for (ConnectorFactory connectorFactory : getHttp().getHttpServer().get().getConnectorFactories()) {<NEW_LINE>int port = getPort(connectorFactory);<NEW_LINE>String name = "http/" + connectorFactory.getName();<NEW_LINE>from.requirePort(port, name);<NEW_LINE>if (offset == 0) {<NEW_LINE>portsMeta.on(offset++).tag("http").tag("query").tag("external").tag("state");<NEW_LINE>} else {<NEW_LINE>portsMeta.on(offset++).tag("http").tag("external");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (messageBusEnabled()) {<NEW_LINE>allocatedMessagingPort = from.allocatePort("messaging");<NEW_LINE>portsMeta.on(offset++).tag("rpc").tag("messaging");<NEW_LINE>}<NEW_LINE>if (rpcServerEnabled()) {<NEW_LINE>allocatedRpcPort = from.allocatePort("rpc/admin");<NEW_LINE>portsMeta.on(offset++).tag("rpc").tag("admin");<NEW_LINE>}<NEW_LINE>} | from.requirePort(start, "http"); |
575,477 | final SendEmailResult executeSendEmail(SendEmailRequest sendEmailRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(sendEmailRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SendEmailRequest> request = null;<NEW_LINE>Response<SendEmailResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new SendEmailRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(sendEmailRequest));<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, "SESv2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SendEmail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<SendEmailResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SendEmailResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,021,534 | // Turtle [16] NumericLiteral<NEW_LINE>final public Node NumericLiteral() throws ParseException {<NEW_LINE>Token t;<NEW_LINE>switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {<NEW_LINE>case INTEGER:<NEW_LINE>{<NEW_LINE>t = jj_consume_token(INTEGER);<NEW_LINE>{<NEW_LINE>if ("" != null)<NEW_LINE>return createLiteralInteger(t.image, <MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case DECIMAL:<NEW_LINE>{<NEW_LINE>t = jj_consume_token(DECIMAL);<NEW_LINE>{<NEW_LINE>if ("" != null)<NEW_LINE>return createLiteralDecimal(t.image, t.beginLine, t.beginColumn);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case DOUBLE:<NEW_LINE>{<NEW_LINE>t = jj_consume_token(DOUBLE);<NEW_LINE>{<NEW_LINE>if ("" != null)<NEW_LINE>return createLiteralDouble(t.image, t.beginLine, t.beginColumn);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>jj_la1[18] = jj_gen;<NEW_LINE>jj_consume_token(-1);<NEW_LINE>throw new ParseException();<NEW_LINE>}<NEW_LINE>throw new Error("Missing return statement in function");<NEW_LINE>} | t.beginLine, t.beginColumn); |
1,081,984 | public void validate(final AccountDimension accountDimension) {<NEW_LINE>final Set<String> mandatoryFieldsNotFilled = new HashSet<>();<NEW_LINE>//<NEW_LINE>// Validate C_AcctSchema_ID<NEW_LINE>if (AcctSchemaId.equals(accountDimension.getAcctSchemaId(), acctSchemaId)) {<NEW_LINE>throw new AdempiereException("C_AcctSchema_ID not matched" + "\n Expected: " + acctSchemaId + "\n Was: " + accountDimension.getAcctSchemaId());<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Validate Alias<NEW_LINE>if (getValidCombinationOptions().isUseAccountAlias()) {<NEW_LINE>final String alias = accountDimension.getAlias();<NEW_LINE>if (Check.isEmpty(alias, true)) {<NEW_LINE>mandatoryFieldsNotFilled.add(msgBL.translate(getCtx(), I_C_ValidCombination.COLUMNNAME_Alias));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Validate: AD_Client_ID<NEW_LINE>if (accountDimension.getAD_Client_ID() <= 0) {<NEW_LINE>mandatoryFieldsNotFilled.add(msgBL.translate(getCtx(), I_C_ValidCombination.COLUMNNAME_AD_Client_ID));<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Validate segments<NEW_LINE>final AcctSchemaElementsMap elements = getAcctSchemaElements();<NEW_LINE>for (final AcctSchemaElement ase : elements.onlyDisplayedInEditor()) {<NEW_LINE>if (!ase.isMandatory()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final AcctSchemaElementType elementType = ase.getElementType();<NEW_LINE>final Object segmentValue = getSegmentValue(accountDimension, elementType);<NEW_LINE>if (segmentValue instanceof Integer) {<NEW_LINE>final int segmentId = NumberUtils.asInt(segmentValue, 0);<NEW_LINE>if (segmentId > 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>mandatoryFieldsNotFilled.add(ase.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// If we found segments not set throw exception<NEW_LINE>if (!mandatoryFieldsNotFilled.isEmpty()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>//<NEW_LINE>// C_ElementValue_ID (i.e. the account number) shall be set<NEW_LINE>if (accountDimension.getC_ElementValue_ID() <= 0) {<NEW_LINE>throw new FillMandatoryException(I_C_ValidCombination.COLUMNNAME_Account_ID);<NEW_LINE>}<NEW_LINE>} | throw new FillMandatoryException(true, mandatoryFieldsNotFilled); |
527,797 | private static void analyzeTags(String key, Extractor extractor) throws IOException {<NEW_LINE>System.out.println("Tag: " + key);<NEW_LINE>Map<String, Tag> parsedMap = new LinkedHashMap<>();<NEW_LINE>List<Tag> failed = new ArrayList<>();<NEW_LINE>int count = 0;<NEW_LINE>for (Tag tag : loadTags(key)) {<NEW_LINE>count += tag.getCount();<NEW_LINE>double val = extractor.extract(tag.getValue());<NEW_LINE>if (Double.isNaN(val)) {<NEW_LINE>failed.add(tag);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>System.out.println("\"" + tag.getValue() + "\" -> " + val);<NEW_LINE>String normalized = Double.toString(val);<NEW_LINE>if (parsedMap.containsKey(normalized)) {<NEW_LINE>Tag <MASK><NEW_LINE>existing.setCount(existing.getCount() + tag.getCount());<NEW_LINE>} else {<NEW_LINE>parsedMap.put(normalized, new Tag(normalized, tag.getCount()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Tag tag : failed) {<NEW_LINE>System.out.println("Unable to parse \"" + tag.getValue() + "\" (" + tag.getCount() + " occurrences)");<NEW_LINE>}<NEW_LINE>int parsedCount = parsedMap.values().stream().mapToInt(Tag::getCount).sum();<NEW_LINE>double percentage = parsedCount / (double) count * 100;<NEW_LINE>System.out.println("Success rate: " + percentage + "%");<NEW_LINE>} | existing = parsedMap.get(normalized); |
1,062,270 | public static byte[] createOIDFiltersExtension(Hashtable filters) throws IOException {<NEW_LINE>ByteArrayOutputStream buf = new ByteArrayOutputStream();<NEW_LINE>// Placeholder for length<NEW_LINE>TlsUtils.writeUint16(0, buf);<NEW_LINE>if (null != filters) {<NEW_LINE>Enumeration keys = filters.keys();<NEW_LINE>while (keys.hasMoreElements()) {<NEW_LINE>ASN1ObjectIdentifier certificateExtensionOID = (ASN1ObjectIdentifier) keys.nextElement();<NEW_LINE>byte[] certificateExtensionValues = (byte[<MASK><NEW_LINE>if (null == certificateExtensionOID || null == certificateExtensionValues) {<NEW_LINE>throw new TlsFatalAlert(AlertDescription.internal_error);<NEW_LINE>}<NEW_LINE>byte[] derEncoding = certificateExtensionOID.getEncoded(ASN1Encoding.DER);<NEW_LINE>TlsUtils.writeOpaque8(derEncoding, buf);<NEW_LINE>TlsUtils.writeOpaque16(certificateExtensionValues, buf);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return patchOpaque16(buf);<NEW_LINE>} | ]) filters.get(certificateExtensionOID); |
1,268,962 | public final /*<NEW_LINE>Can't use @Messages, as the package is shared with startup.base; generated Bundle<NEW_LINE>files would overwrite each other.<NEW_LINE>@Messages({<NEW_LINE>"MSG_start_load_cache=Loading cached objects...",<NEW_LINE>"MSG_end_load_cache=Loading cached objects...done."<NEW_LINE>})<NEW_LINE>*/<NEW_LINE>FileSystem loadCache() throws IOException {<NEW_LINE>String location = cacheLocation();<NEW_LINE>FileSystem fs = null;<NEW_LINE>if (location != null) {<NEW_LINE>Main.setStatusText(NbBundle.getMessage(BinaryLayerFactoryProvider.class, "MSG_start_load_cache"));<NEW_LINE>ByteBuffer bb = Stamps.getModulesJARs().asMappedByteBuffer(location);<NEW_LINE>if (bb != null) {<NEW_LINE>try {<NEW_LINE>// NOI18N<NEW_LINE>StartLog.logStart("Loading layers");<NEW_LINE>fs = load(createEmptyFileSystem(), bb);<NEW_LINE>Main.setStatusText(NbBundle.getMessage(BinaryLayerFactoryProvider.class, "MSG_end_load_cache"));<NEW_LINE>// NOI18N<NEW_LINE>StartLog.logEnd("Loading layers");<NEW_LINE>} catch (IOException ex) {<NEW_LINE>err.log(Level.WARNING, "Ignoring cache of layers");<NEW_LINE>if (err.isLoggable(Level.FINE)) {<NEW_LINE>err.log(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return fs;<NEW_LINE>} | Level.WARNING, "Ignoring cache of layers", ex); |
1,353,693 | public static DataWriter create(FileSystemContext context, long blockId, long blockSize, WorkerNetAddress address, OutStreamOptions options) throws IOException {<NEW_LINE>AlluxioConfiguration alluxioConf = context.getClusterConf();<NEW_LINE>boolean shortCircuit = alluxioConf.getBoolean(PropertyKey.USER_SHORT_CIRCUIT_ENABLED);<NEW_LINE>boolean shortCircuitPreferred = alluxioConf.getBoolean(PropertyKey.USER_SHORT_CIRCUIT_PREFERRED);<NEW_LINE>boolean ufsFallbackEnabled = options.getWriteType() == WriteType.ASYNC_THROUGH && alluxioConf.getBoolean(PropertyKey.USER_FILE_UFS_TIER_ENABLED);<NEW_LINE>boolean workerIsLocal = CommonUtils.isLocalHost(address, alluxioConf);<NEW_LINE>if (workerIsLocal && context.hasProcessLocalWorker() && !ufsFallbackEnabled) {<NEW_LINE>LOG.debug("Creating worker process local output stream for block {} @ {}", blockId, address);<NEW_LINE>return BlockWorkerDataWriter.create(context, blockId, blockSize, options);<NEW_LINE>}<NEW_LINE>LOG.debug("Doesn't create worker process local output stream for block {} @ {} " + "(data locates in local worker: {}, client locates in local worker process: {}, " + "ufs fallback enabled: {})", blockId, address, workerIsLocal, context.hasProcessLocalWorker(), ufsFallbackEnabled);<NEW_LINE>boolean domainSocketSupported = NettyUtils.isDomainSocketSupported(address);<NEW_LINE>if (workerIsLocal && shortCircuit && (shortCircuitPreferred || !domainSocketSupported)) {<NEW_LINE>if (ufsFallbackEnabled) {<NEW_LINE>LOG.<MASK><NEW_LINE>return UfsFallbackLocalFileDataWriter.create(context, address, blockId, blockSize, options);<NEW_LINE>}<NEW_LINE>LOG.debug("Creating short circuit output stream for block {} @ {}", blockId, address);<NEW_LINE>return LocalFileDataWriter.create(context, address, blockId, blockSize, options);<NEW_LINE>} else {<NEW_LINE>LOG.debug("Creating gRPC output stream for block {} @ {} from client {} " + "(data locates in local worker: {}, shortCircuitEnabled: {}, " + "shortCircuitPreferred: {}, domainSocketSupported: {})", blockId, address, NetworkAddressUtils.getClientHostName(alluxioConf), workerIsLocal, shortCircuit, shortCircuitPreferred, domainSocketSupported);<NEW_LINE>return GrpcDataWriter.create(context, address, blockId, blockSize, RequestType.ALLUXIO_BLOCK, options);<NEW_LINE>}<NEW_LINE>} | info("Creating UFS-fallback short circuit output stream for block {} @ {}", blockId, address); |
764,515 | private void addLabelAndReference(Program program, Instruction switchInstruction, Address target, String label) {<NEW_LINE>program.getReferenceManager().addMemoryReference(switchInstruction.getMinAddress(), target, RefType.COMPUTED_JUMP, SourceType.ANALYSIS, CodeUnit.MNEMONIC);<NEW_LINE>// put switch table cases into namespace for the switch<NEW_LINE>// create namespace if necessary<NEW_LINE>Namespace space = null;<NEW_LINE>String switchName = switchInstruction.getMnemonicString() + "_" + switchInstruction.getAddress().toString();<NEW_LINE>try {<NEW_LINE>space = program.getSymbolTable().createNameSpace(null, switchName, SourceType.ANALYSIS);<NEW_LINE>} catch (DuplicateNameException e) {<NEW_LINE>space = program.getSymbolTable(<MASK><NEW_LINE>} catch (InvalidInputException e) {<NEW_LINE>// just go with default space<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>program.getSymbolTable().createLabel(target, label, space, SourceType.ANALYSIS);<NEW_LINE>} catch (InvalidInputException e1) {<NEW_LINE>Msg.error(this, e1.getMessage());<NEW_LINE>}<NEW_LINE>} | ).getNamespace(switchName, null); |
656,507 | private void openInviteDialog(Activity activity, final OnInviteListener onInviteListener) {<NEW_LINE>// build request<NEW_LINE>GameRequestContent.Builder builder = new GameRequestContent.Builder();<NEW_LINE>builder.setMessage(mMessage);<NEW_LINE>builder.setData(mData);<NEW_LINE>builder.setTo(mTo);<NEW_LINE>if (mSuggestions != null) {<NEW_LINE>ArrayList<String> arrayList = new ArrayList<String>();<NEW_LINE>for (String suggested : mSuggestions) {<NEW_LINE>arrayList.add(suggested);<NEW_LINE>}<NEW_LINE>builder.setSuggestions(arrayList);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>// set dialog<NEW_LINE>GameRequestDialog dialog = new GameRequestDialog(activity);<NEW_LINE>if (dialog.canShow(gameRequestContent)) {<NEW_LINE>dialog.registerCallback(sessionManager.getCallbackManager(), new FacebookCallback<GameRequestDialog.Result>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(GameRequestDialog.Result result) {<NEW_LINE>String requestId = result.getRequestId();<NEW_LINE>if (mOnInviteListener != null) {<NEW_LINE>mOnInviteListener.onComplete(result.getRequestRecipients(), requestId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCancel() {<NEW_LINE>if (mOnInviteListener != null) {<NEW_LINE>mOnInviteListener.onFail("Canceled by user");<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(FacebookException e) {<NEW_LINE>if (mOnInviteListener != null) {<NEW_LINE>mOnInviteListener.onFail(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>dialog.show(gameRequestContent);<NEW_LINE>}<NEW_LINE>} | GameRequestContent gameRequestContent = builder.build(); |
1,585,118 | public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode iterations, ValueNode condition) {<NEW_LINE>// This directive has an actual definition that only works well if the bytecode<NEW_LINE>// parser inlines it, so also provide this plugin equivalent to its definition:<NEW_LINE>// injectBranchProbability(1. - 1. / iterations, condition)<NEW_LINE>if (iterations.isJavaConstant()) {<NEW_LINE>double iterationsConstant;<NEW_LINE>if (iterations.stamp(NodeView.DEFAULT) instanceof IntegerStamp) {<NEW_LINE>iterationsConstant = iterations.asJavaConstant().asLong();<NEW_LINE>} else if (iterations.stamp(NodeView.DEFAULT) instanceof FloatStamp) {<NEW_LINE>iterationsConstant = iterations.asJavaConstant().asDouble();<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>ValueNode probabilityNode = b.add(ConstantNode.forDouble(probability));<NEW_LINE>b.addPush(JavaKind.Boolean, new BranchProbabilityNode(probabilityNode, condition));<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | double probability = 1. - 1. / iterationsConstant; |
948,381 | public static ListAnsInstancesResponse unmarshall(ListAnsInstancesResponse listAnsInstancesResponse, UnmarshallerContext _ctx) {<NEW_LINE>listAnsInstancesResponse.setRequestId(_ctx.stringValue("ListAnsInstancesResponse.RequestId"));<NEW_LINE>listAnsInstancesResponse.setHttpCode(_ctx.stringValue("ListAnsInstancesResponse.HttpCode"));<NEW_LINE>listAnsInstancesResponse.setTotalCount(_ctx.integerValue("ListAnsInstancesResponse.TotalCount"));<NEW_LINE>listAnsInstancesResponse.setMessage(_ctx.stringValue("ListAnsInstancesResponse.Message"));<NEW_LINE>listAnsInstancesResponse.setPageSize(_ctx.integerValue("ListAnsInstancesResponse.PageSize"));<NEW_LINE>listAnsInstancesResponse.setPageNumber(_ctx.integerValue("ListAnsInstancesResponse.PageNumber"));<NEW_LINE>listAnsInstancesResponse.setErrorCode(_ctx.stringValue("ListAnsInstancesResponse.ErrorCode"));<NEW_LINE>listAnsInstancesResponse.setSuccess(_ctx.booleanValue("ListAnsInstancesResponse.Success"));<NEW_LINE>List<NacosAnsInstance> data = new ArrayList<NacosAnsInstance>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListAnsInstancesResponse.Data.Length"); i++) {<NEW_LINE>NacosAnsInstance nacosAnsInstance = new NacosAnsInstance();<NEW_LINE>nacosAnsInstance.setDefaultKey(_ctx.stringValue("ListAnsInstancesResponse.Data[" + i + "].DefaultKey"));<NEW_LINE>nacosAnsInstance.setEphemeral(_ctx.booleanValue("ListAnsInstancesResponse.Data[" + i + "].Ephemeral"));<NEW_LINE>nacosAnsInstance.setMarked(_ctx.booleanValue("ListAnsInstancesResponse.Data[" + i + "].Marked"));<NEW_LINE>nacosAnsInstance.setIp(_ctx.stringValue("ListAnsInstancesResponse.Data[" + i + "].Ip"));<NEW_LINE>nacosAnsInstance.setInstanceId(_ctx.stringValue("ListAnsInstancesResponse.Data[" + i + "].InstanceId"));<NEW_LINE>nacosAnsInstance.setPort(_ctx.integerValue("ListAnsInstancesResponse.Data[" + i + "].Port"));<NEW_LINE>nacosAnsInstance.setLastBeat(_ctx.longValue("ListAnsInstancesResponse.Data[" + i + "].LastBeat"));<NEW_LINE>nacosAnsInstance.setOkCount(_ctx.integerValue("ListAnsInstancesResponse.Data[" + i + "].OkCount"));<NEW_LINE>nacosAnsInstance.setWeight(_ctx.integerValue("ListAnsInstancesResponse.Data[" + i + "].Weight"));<NEW_LINE>nacosAnsInstance.setInstanceHeartBeatInterval(_ctx.integerValue("ListAnsInstancesResponse.Data[" + i + "].InstanceHeartBeatInterval"));<NEW_LINE>nacosAnsInstance.setIpDeleteTimeout(_ctx.integerValue("ListAnsInstancesResponse.Data[" + i + "].IpDeleteTimeout"));<NEW_LINE>nacosAnsInstance.setApp(_ctx.stringValue("ListAnsInstancesResponse.Data[" + i + "].App"));<NEW_LINE>nacosAnsInstance.setFailCount(_ctx.integerValue("ListAnsInstancesResponse.Data[" + i + "].FailCount"));<NEW_LINE>nacosAnsInstance.setHealthy(_ctx.booleanValue("ListAnsInstancesResponse.Data[" + i + "].Healthy"));<NEW_LINE>nacosAnsInstance.setEnabled(_ctx.booleanValue<MASK><NEW_LINE>nacosAnsInstance.setDatumKey(_ctx.stringValue("ListAnsInstancesResponse.Data[" + i + "].DatumKey"));<NEW_LINE>nacosAnsInstance.setClusterName(_ctx.stringValue("ListAnsInstancesResponse.Data[" + i + "].ClusterName"));<NEW_LINE>nacosAnsInstance.setInstanceHeartBeatTimeOut(_ctx.integerValue("ListAnsInstancesResponse.Data[" + i + "].InstanceHeartBeatTimeOut"));<NEW_LINE>nacosAnsInstance.setServiceName(_ctx.stringValue("ListAnsInstancesResponse.Data[" + i + "].ServiceName"));<NEW_LINE>nacosAnsInstance.setMetadata(_ctx.mapValue("ListAnsInstancesResponse.Data[" + i + "].Metadata"));<NEW_LINE>data.add(nacosAnsInstance);<NEW_LINE>}<NEW_LINE>listAnsInstancesResponse.setData(data);<NEW_LINE>return listAnsInstancesResponse;<NEW_LINE>} | ("ListAnsInstancesResponse.Data[" + i + "].Enabled")); |
889,860 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>* @see com.aptana.editor.js.parsing.ast.JSTreeWalker#visit(com.aptana.editor.js.parsing.ast.JSConstructNode)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void visit(JSConstructNode node) {<NEW_LINE>checkCancellation();<NEW_LINE>IParseNode child = node.getExpression();<NEW_LINE>if (child instanceof JSNode) {<NEW_LINE>List<String> <MASK><NEW_LINE>List<String> returnTypes = new ArrayList<String>(types.size());<NEW_LINE>for (String typeName : types) {<NEW_LINE>if (typeName.startsWith(JSTypeConstants.GENERIC_CLASS_OPEN)) {<NEW_LINE>returnTypes.add(JSTypeUtil.getClassType(typeName));<NEW_LINE>} else if (typeName.startsWith(JSTypeConstants.GENERIC_FUNCTION_OPEN)) {<NEW_LINE>returnTypes.addAll(JSTypeUtil.getFunctionSignatureReturnTypeNames(typeName));<NEW_LINE>} else {<NEW_LINE>returnTypes.add(typeName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String typeName : returnTypes) {<NEW_LINE>this.addType(typeName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>_monitor.worked(1);<NEW_LINE>} | types = this.getTypes(child); |
732,031 | public void padIcon(Icon icon, int percent) {<NEW_LINE>for (String id : icon.getIds()) {<NEW_LINE>// Calculate padding percentage<NEW_LINE>int w = images.get(id).getWidth();<NEW_LINE>int h = images.get(id).getHeight();<NEW_LINE>int wPad = (int) ((percent / 100.0) * w);<NEW_LINE>int hPad = (int) (<MASK><NEW_LINE>BufferedImage padded = new BufferedImage(w + wPad, h + hPad, BufferedImage.TYPE_INT_ARGB);<NEW_LINE>Graphics g = padded.getGraphics();<NEW_LINE>// Pad all sides (by half)<NEW_LINE>g.drawImage(images.get(id), wPad / 2, hPad / 2, null);<NEW_LINE>g.dispose();<NEW_LINE>images.put(id, padded);<NEW_LINE>imageIcons.put(id, new ImageIcon(padded));<NEW_LINE>icon.padded = true;<NEW_LINE>}<NEW_LINE>} | (percent / 100.0) * h); |
376,854 | private void buildTypeConstants(final Index index, FileScopeImpl fileScope, final List<Occurence> occurences) {<NEW_LINE>if (CancelSupport.getDefault().isCancelled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Collection<? extends TypeElement> types = resolveTypes(index, elementInfo);<NEW_LINE>if (!types.isEmpty()) {<NEW_LINE>final Exact typeConstantName = NameKind.exact(elementInfo.getName());<NEW_LINE>final Set<TypeConstantElement> constants = new HashSet<>();<NEW_LINE>for (TypeElement typeElement : types) {<NEW_LINE>if (CancelSupport.getDefault().isCancelled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>constants.addAll(ElementFilter.forName(typeConstantName).filter(index.getAllTypeConstants(typeElement)));<NEW_LINE>}<NEW_LINE>if (elementInfo.setDeclarations(constants)) {<NEW_LINE><MASK><NEW_LINE>buildStaticConstantDeclarations(elementInfo, fileScope, cachedOccurences);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | buildStaticConstantInvocations(elementInfo, fileScope, cachedOccurences); |
1,718,429 | // @see https://gist.github.com/viperwarp/2beb6bbefcc268dee7ad<NEW_LINE>public static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException {<NEW_LINE>WritableMap map = new WritableNativeMap();<NEW_LINE>Iterator<String> iterator = jsonObject.keys();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>String key = iterator.next();<NEW_LINE>Object value = jsonObject.get(key);<NEW_LINE>if (value instanceof JSONObject) {<NEW_LINE>map.putMap(key, convertJsonToMap((JSONObject) value));<NEW_LINE>} else if (value instanceof Boolean) {<NEW_LINE>map.putBoolean(key, (Boolean) value);<NEW_LINE>} else if (value instanceof Integer) {<NEW_LINE>map.putInt<MASK><NEW_LINE>} else if (value instanceof Double) {<NEW_LINE>map.putDouble(key, (Double) value);<NEW_LINE>} else if (value instanceof String) {<NEW_LINE>map.putString(key, (String) value);<NEW_LINE>} else {<NEW_LINE>map.putString(key, value.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | (key, (Integer) value); |
1,412,989 | private List<Collection<AnchorURL>> extractPdfLinks(final PDDocument pdf) {<NEW_LINE>List<Collection<AnchorURL>> linkCollections = new ArrayList<>(pdf.getNumberOfPages());<NEW_LINE>for (PDPage page : pdf.getPages()) {<NEW_LINE>final Collection<AnchorURL> pdflinks = new ArrayList<AnchorURL>();<NEW_LINE>try {<NEW_LINE>List<PDAnnotation> annotations = page.getAnnotations();<NEW_LINE>if (annotations != null) {<NEW_LINE>for (PDAnnotation pdfannotation : annotations) {<NEW_LINE>if (pdfannotation instanceof PDAnnotationLink) {<NEW_LINE>PDAction link = ((PDAnnotationLink) pdfannotation).getAction();<NEW_LINE>if (link != null && link instanceof PDActionURI) {<NEW_LINE>PDActionURI pdflinkuri = (PDActionURI) link;<NEW_LINE><MASK><NEW_LINE>AnchorURL url = new AnchorURL(uristr);<NEW_LINE>pdflinks.add(url);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>}<NEW_LINE>linkCollections.add(pdflinks);<NEW_LINE>}<NEW_LINE>return linkCollections;<NEW_LINE>} | String uristr = pdflinkuri.getURI(); |
1,216,147 | final CopyFpgaImageResult executeCopyFpgaImage(CopyFpgaImageRequest copyFpgaImageRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(copyFpgaImageRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CopyFpgaImageRequest> request = null;<NEW_LINE>Response<CopyFpgaImageResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CopyFpgaImageRequestMarshaller().marshall(super.beforeMarshalling(copyFpgaImageRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CopyFpgaImage");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<CopyFpgaImageResult> responseHandler = new StaxResponseHandler<CopyFpgaImageResult>(new CopyFpgaImageResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
1,480,208 | public static boolean isExecutable(IPath path) {<NEW_LINE>if (path == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (file == null || !file.exists() || file.isDirectory()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// OK, file exists<NEW_LINE>try {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>Method m = File.class.getMethod("canExecute");<NEW_LINE>if (m != null) {<NEW_LINE>return (Boolean) m.invoke(file);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>// File.canExecute() doesn't exist; do our best to determine if file is executable...<NEW_LINE>if (Platform.OS_WIN32.equals(Platform.getOS())) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>IFileStore fileStore = EFS.getLocalFileSystem().getStore(path);<NEW_LINE>return fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_EXECUTABLE);<NEW_LINE>} | File file = path.toFile(); |
1,278,603 | public Optional<Map<String, String>> extractCustomSplitInfo(FileSplit split) {<NEW_LINE>if (split instanceof RealtimeBootstrapBaseFileSplit) {<NEW_LINE>ImmutableMap.Builder<String, String> customSplitInfo = ImmutableMap.builder();<NEW_LINE>RealtimeBootstrapBaseFileSplit hudiSplit = (RealtimeBootstrapBaseFileSplit) split;<NEW_LINE>customSplitInfo.put(CUSTOM_FILE_SPLIT_CLASS_KEY, RealtimeBootstrapBaseFileSplit.class.getName());<NEW_LINE>customSplitInfo.put(BASE_PATH_KEY, hudiSplit.getBasePath());<NEW_LINE>customSplitInfo.put(MAX_COMMIT_TIME_KEY, hudiSplit.getMaxCommitTime());<NEW_LINE>customSplitInfo.put(DELTA_FILE_PATHS_KEY, String.join(","<MASK><NEW_LINE>customSplitInfo.put(BOOTSTRAP_FILE_SPLIT_PATH, hudiSplit.getBootstrapFileSplit().getPath().toString());<NEW_LINE>customSplitInfo.put(BOOTSTRAP_FILE_SPLIT_START, String.valueOf(hudiSplit.getBootstrapFileSplit().getStart()));<NEW_LINE>customSplitInfo.put(BOOTSTRAP_FILE_SPLIT_LEN, String.valueOf(hudiSplit.getBootstrapFileSplit().getLength()));<NEW_LINE>return Optional.of(customSplitInfo.build());<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>} | , hudiSplit.getDeltaLogPaths())); |
583,046 | public Result evaluate(Environment environment) {<NEW_LINE>for (BooleanExpr subroutine : _subroutines) {<NEW_LINE>Result subroutineResult = subroutine.evaluate(environment);<NEW_LINE>if (subroutineResult.getExit()) {<NEW_LINE>// Reached an exit/terminal action. Return regardless of boolean value<NEW_LINE>return subroutineResult;<NEW_LINE>} else if (!subroutineResult.getFallThrough()) {<NEW_LINE>// Found first match, short-circuit here<NEW_LINE>return subroutineResult.toBuilder().setReturn(false).build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (defaultPolicy != null) {<NEW_LINE>CallExpr callDefaultPolicy = new CallExpr(environment.getDefaultPolicy());<NEW_LINE>Result defaultPolicyResult = callDefaultPolicy.evaluate(environment);<NEW_LINE>return defaultPolicyResult.toBuilder().setReturn(false).build();<NEW_LINE>} else {<NEW_LINE>throw new BatfishException("Default policy is not set");<NEW_LINE>}<NEW_LINE>} | String defaultPolicy = environment.getDefaultPolicy(); |
81,711 | public void testMinute() {<NEW_LINE>final String method = "testMinute";<NEW_LINE>if (svLogger.isLoggable(Level.FINER)) {<NEW_LINE>svLogger.entering(CLASSNAME, method);<NEW_LINE>}<NEW_LINE>if (svLogger.isLoggable(Level.FINEST)) {<NEW_LINE>svLogger.logp(Level.<MASK><NEW_LINE>}<NEW_LINE>TimerConfig tc = new TimerConfig();<NEW_LINE>tc.setPersistent(false);<NEW_LINE>tc.setInfo("checkTimerServiceAPIforBogusHour");<NEW_LINE>ScheduleExpression invalidMinuteScheduleExpression = new ScheduleExpression();<NEW_LINE>// 587889<NEW_LINE>invalidMinuteScheduleExpression.minute(-1);<NEW_LINE>try {<NEW_LINE>// F743-9442<NEW_LINE>createCalTimerWithInvalidSchedExpr(invalidMinuteScheduleExpression, tc);<NEW_LINE>} catch (IllegalArgumentException iae) {<NEW_LINE>// pass<NEW_LINE>}<NEW_LINE>// 587889<NEW_LINE>invalidMinuteScheduleExpression.minute(60);<NEW_LINE>try {<NEW_LINE>// F743-9442<NEW_LINE>createCalTimerWithInvalidSchedExpr(invalidMinuteScheduleExpression, tc);<NEW_LINE>} catch (IllegalArgumentException iae) {<NEW_LINE>// pass<NEW_LINE>}<NEW_LINE>// increment: every 60 sec., starting at 00:00:30 (60 is invalid - must be [0,59]<NEW_LINE>// 587889<NEW_LINE>invalidMinuteScheduleExpression.minute("30/60");<NEW_LINE>try {<NEW_LINE>// F743-9442<NEW_LINE>createCalTimerWithInvalidSchedExpr(invalidMinuteScheduleExpression, tc);<NEW_LINE>} catch (IllegalArgumentException iae) {<NEW_LINE>// pass<NEW_LINE>}<NEW_LINE>} | FINEST, CLASSNAME, method, "testing invalid minute in ScheduleExpression"); |
1,572,577 | public void addImpassableRoad(@Nullable final MapActivity mapActivity, @NonNull final LatLon loc, final boolean showDialog, final boolean skipWritingSettings, @Nullable final String appModeKey) {<NEW_LINE>final Location ll = new Location("");<NEW_LINE>ll.setLatitude(loc.getLatitude());<NEW_LINE>ll.setLongitude(loc.getLongitude());<NEW_LINE>ApplicationMode defaultAppMode = app.getRoutingHelper().getAppMode();<NEW_LINE>final ApplicationMode appMode = appModeKey != null ? ApplicationMode.valueOfStringKey(appModeKey, defaultAppMode) : defaultAppMode;<NEW_LINE>List<RouteSegmentResult> roads = app.getMeasurementEditingContext() != null ? app.getMeasurementEditingContext().getRoadSegmentData(appMode) : app.getRoutingHelper().getRoute().getOriginalRoute();<NEW_LINE>if (mapActivity != null && roads != null) {<NEW_LINE>RotatedTileBox tb = mapActivity.getMapView().getCurrentRotatedTileBox().copy();<NEW_LINE>float maxDistPx = MAX_AVOID_ROUTE_SEARCH_RADIUS_DP * tb.getDensity();<NEW_LINE>RouteSegmentSearchResult searchResult = RouteSegmentSearchResult.searchRouteSegment(loc.getLatitude(), loc.getLongitude(), maxDistPx / tb.getPixDensity(), roads);<NEW_LINE>if (searchResult != null) {<NEW_LINE>QuadPoint point = searchResult.getPoint();<NEW_LINE>LatLon newLoc = new LatLon(MapUtils.get31LatitudeY((int) point.y), MapUtils.get31LongitudeX(<MASK><NEW_LINE>ll.setLatitude(newLoc.getLatitude());<NEW_LINE>ll.setLongitude(newLoc.getLongitude());<NEW_LINE>RouteDataObject object = roads.get(searchResult.getRoadIndex()).getObject();<NEW_LINE>AvoidRoadInfo avoidRoadInfo = getAvoidRoadInfoForDataObject(object, newLoc.getLatitude(), newLoc.getLongitude(), appMode.getStringKey());<NEW_LINE>addImpassableRoadInternal(avoidRoadInfo, showDialog, mapActivity, newLoc);<NEW_LINE>if (!skipWritingSettings) {<NEW_LINE>app.getSettings().addImpassableRoad(avoidRoadInfo);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>app.getLocationProvider().getRouteSegment(ll, appMode, false, new ResultMatcher<RouteDataObject>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean publish(RouteDataObject object) {<NEW_LINE>if (object == null) {<NEW_LINE>if (mapActivity != null) {<NEW_LINE>Toast.makeText(mapActivity, R.string.error_avoid_specific_road, Toast.LENGTH_LONG).show();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>AvoidRoadInfo avoidRoadInfo = getAvoidRoadInfoForDataObject(object, ll.getLatitude(), ll.getLongitude(), appMode.getStringKey());<NEW_LINE>addImpassableRoadInternal(avoidRoadInfo, showDialog, mapActivity, loc);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isCancelled() {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (!skipWritingSettings) {<NEW_LINE>AvoidRoadInfo avoidRoadInfo = getAvoidRoadInfoForDataObject(null, loc.getLatitude(), loc.getLongitude(), appMode.getStringKey());<NEW_LINE>app.getSettings().addImpassableRoad(avoidRoadInfo);<NEW_LINE>}<NEW_LINE>} | (int) point.x)); |
1,564,638 | public ListIdentityPoolsResult listIdentityPools(ListIdentityPoolsRequest listIdentityPoolsRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listIdentityPoolsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<ListIdentityPoolsRequest> request = null;<NEW_LINE>Response<ListIdentityPoolsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListIdentityPoolsRequestMarshaller().marshall(listIdentityPoolsRequest);<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<ListIdentityPoolsResult, JsonUnmarshallerContext> unmarshaller = new ListIdentityPoolsResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<ListIdentityPoolsResult> responseHandler = new JsonResponseHandler<ListIdentityPoolsResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
225,014 | private void meetingEnded(MeetingEnded message) {<NEW_LINE>Meeting m = getMeeting(message.meetingId);<NEW_LINE>if (m != null) {<NEW_LINE>long now = System.currentTimeMillis();<NEW_LINE>m.setEndTime(now);<NEW_LINE>Map<String, Object> logData = new HashMap<>();<NEW_LINE>logData.put("meetingId", m.getInternalId());<NEW_LINE>logData.put("externalMeetingId", m.getExternalId());<NEW_LINE>logData.put("name", m.getName());<NEW_LINE>logData.put("duration", m.getDuration());<NEW_LINE>logData.put("record", m.isRecord());<NEW_LINE>logData.put("logCode", "meeting_ended");<NEW_LINE><MASK><NEW_LINE>Gson gson = new Gson();<NEW_LINE>String logStr = gson.toJson(logData);<NEW_LINE>log.info(" --analytics-- data={}", logStr);<NEW_LINE>String endCallbackUrl = "endCallbackUrl".toLowerCase();<NEW_LINE>Map<String, String> metadata = m.getMetadata();<NEW_LINE>if (!m.isBreakout()) {<NEW_LINE>if (metadata.containsKey(endCallbackUrl)) {<NEW_LINE>String callbackUrl = metadata.get(endCallbackUrl);<NEW_LINE>try {<NEW_LINE>callbackUrl = new URIBuilder(new URI(callbackUrl)).addParameter("recordingmarks", m.haveRecordingMarks() ? "true" : "false").addParameter("meetingID", m.getExternalId()).build().toURL().toString();<NEW_LINE>MeetingEndedEvent event = new MeetingEndedEvent(m.getInternalId(), m.getExternalId(), m.getName(), callbackUrl);<NEW_LINE>processMeetingEndedCallback(event);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Error in callback url=[{}]", callbackUrl, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!StringUtils.isEmpty(m.getMeetingEndedCallbackURL())) {<NEW_LINE>String meetingEndedCallbackURL = m.getMeetingEndedCallbackURL();<NEW_LINE>callbackUrlService.handleMessage(new MeetingEndedEvent(m.getInternalId(), m.getExternalId(), m.getName(), meetingEndedCallbackURL));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Remove Learning Dashboard files<NEW_LINE>if (!m.getDisabledFeatures().contains("learningDashboard") && m.getLearningDashboardCleanupDelayInMinutes() > 0) {<NEW_LINE>learningDashboardService.removeJsonDataFile(message.meetingId, m.getLearningDashboardCleanupDelayInMinutes());<NEW_LINE>}<NEW_LINE>processRemoveEndedMeeting(message);<NEW_LINE>}<NEW_LINE>} | logData.put("description", "Meeting has ended."); |
1,038,302 | ActionResult<Wo> execute(EffectivePerson effectivePerson, String processId, JsonElement jsonElement) throws Exception {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>Wo wo = new Wo();<NEW_LINE>Work work = null;<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>Process process = business.element().get(processId, Process.class);<NEW_LINE>Application application = business.element().get(process.getApplication(), Application.class);<NEW_LINE>Begin begin = business.element().getBeginWithProcess(process.getId());<NEW_LINE>work = create(application, process, begin);<NEW_LINE>emc.beginTransaction(Work.class);<NEW_LINE>if ((null != jsonElement) && jsonElement.isJsonObject()) {<NEW_LINE>WorkDataHelper workDataHelper = new WorkDataHelper(emc, work);<NEW_LINE>workDataHelper.update(jsonElement);<NEW_LINE>}<NEW_LINE>emc.persist(work, CheckPersistType.all);<NEW_LINE>emc.commit();<NEW_LINE>wo.<MASK><NEW_LINE>}<NEW_LINE>MessageFactory.work_create(work);<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>} | setId(work.getId()); |
873,124 | public String debugLocksState() {<NEW_LINE><MASK><NEW_LINE>if (!(this.usedInit())) {<NEW_LINE>s += "unused";<NEW_LINE>return s;<NEW_LINE>}<NEW_LINE>s += "used, ";<NEW_LINE>if (!(segmentIndexInit())) {<NEW_LINE>s += "segment uninitialized";<NEW_LINE>return s;<NEW_LINE>}<NEW_LINE>s += ("segment " + (segmentIndex())) + ", ";<NEW_LINE>if (!(locksInit())) {<NEW_LINE>s += "locks uninitialized";<NEW_LINE>return s;<NEW_LINE>}<NEW_LINE>s += ("local state: " + (localLockState())) + ", ";<NEW_LINE>s += ("read lock count: " + (rootContextLockedOnThisSegment().totalReadLockCount())) + ", ";<NEW_LINE>s += ("update lock count: " + (rootContextLockedOnThisSegment().totalUpdateLockCount())) + ", ";<NEW_LINE>s += "write lock count: " + (rootContextLockedOnThisSegment().totalWriteLockCount());<NEW_LINE>return s;<NEW_LINE>} | String s = (this) + ": "; |
591,487 | protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {<NEW_LINE>super.onBindPreferenceViewHolder(preference, holder);<NEW_LINE>if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String key = preference.getKey();<NEW_LINE>if (ROUTE_PARAMETERS_INFO.equals(key)) {<NEW_LINE>holder.itemView.setBackgroundColor(ColorUtilities.getActivityBgColor(app, isNightMode()));<NEW_LINE>} else if (ROUTE_PARAMETERS_IMAGE.equals(key)) {<NEW_LINE>ImageView imageView = (ImageView) holder.itemView.<MASK><NEW_LINE>if (imageView != null) {<NEW_LINE>int bgResId = isNightMode() ? R.drawable.img_settings_device_bottom_dark : R.drawable.img_settings_device_bottom_light;<NEW_LINE>Drawable layerDrawable = app.getUIUtilities().getLayeredIcon(bgResId, R.drawable.img_settings_sreen_route_parameters);<NEW_LINE>imageView.setImageDrawable(layerDrawable);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | findViewById(R.id.device_image); |
980,567 | private void checkSQLServerTables() throws SQLException {<NEW_LINE>LOGGER.entering(CLASSNAME, "checkSQLServerTables");<NEW_LINE>setCreateSQLServerStringsMap();<NEW_LINE>createTableIfNotExists(tableNames.get(CHECKPOINT_TABLE_KEY), SQLServerCreateStrings.get(SQLSERVER_CREATE_TABLE_CHECKPOINTDATA));<NEW_LINE>createTableIfNotExists(tableNames.get(JOB_INSTANCE_TABLE_KEY), SQLServerCreateStrings.get(SQLSERVER_CREATE_TABLE_JOBINSTANCEDATA));<NEW_LINE>createTableIfNotExists(tableNames.get(EXECUTION_INSTANCE_TABLE_KEY), SQLServerCreateStrings.get(SQLSERVER_CREATE_TABLE_EXECUTIONINSTANCEDATA));<NEW_LINE>createTableIfNotExists(tableNames.get(STEP_EXECUTION_INSTANCE_TABLE_KEY), SQLServerCreateStrings.get(SQLSERVER_CREATE_TABLE_STEPINSTANCEDATA));<NEW_LINE>createTableIfNotExists(tableNames.get(JOB_STATUS_TABLE_KEY), SQLServerCreateStrings.get(SQLSERVER_CREATE_TABLE_JOBSTATUS));<NEW_LINE>createTableIfNotExists(tableNames.get(STEP_STATUS_TABLE_KEY), SQLServerCreateStrings.get(SQLSERVER_CREATE_TABLE_STEPSTATUS));<NEW_LINE><MASK><NEW_LINE>} | LOGGER.exiting(CLASSNAME, "checkSQLServerTables"); |
772,456 | public void project(double camX, double camY, double camZ, Point2D_F64 output) {<NEW_LINE>// angle between incoming ray and principle axis<NEW_LINE>// Principle Axis = (0,0,z)<NEW_LINE>// Incoming Ray = (x,y,z)<NEW_LINE>// uses dot product<NEW_LINE>double theta = Math.acos(camZ / UtilPoint3D_F64.norm(camX, camY, camZ));<NEW_LINE>// compute symmetric projection function<NEW_LINE>double r = polynomial(model.symmetric, theta);<NEW_LINE>// angle on the image plane of the incoming ray<NEW_LINE>double phi = <MASK><NEW_LINE>// u_r[0] or u_phi[1]<NEW_LINE>double cosphi = Math.cos(phi);<NEW_LINE>// u_r[1] or -u_phi[0]<NEW_LINE>double sinphi = Math.sin(phi);<NEW_LINE>// distorted (normalized) coordinates<NEW_LINE>double distX, distY;<NEW_LINE>if (isAsymmetric) {<NEW_LINE>// distortion terms. radial and tangential<NEW_LINE>double disRad = polynomial(model.radial, theta) * polytrig(model.radialTrig, cosphi, sinphi);<NEW_LINE>double disTan = polynomial(model.tangent, theta) * polytrig(model.tangentTrig, cosphi, sinphi);<NEW_LINE>// put it all together to get normalized image coordinates<NEW_LINE>distX = (r + disRad) * cosphi - disTan * sinphi;<NEW_LINE>distY = (r + disRad) * sinphi + disTan * cosphi;<NEW_LINE>} else {<NEW_LINE>distX = r * cosphi;<NEW_LINE>distY = r * sinphi;<NEW_LINE>}<NEW_LINE>// project into pixels<NEW_LINE>double skew = zeroSkew ? 0.0 : model.skew;<NEW_LINE>output.x = (model.fx * distX + skew * distY + model.cx);<NEW_LINE>output.y = (model.fy * distY + model.cy);<NEW_LINE>} | Math.atan2(camY, camX); |
1,845,524 | static ReportSettings readSettingsFromConfig(final AppConfig config) {<NEW_LINE>final SortedMap<DomainID, List<UserPermission>> searchFilters = Collections.unmodifiableSortedMap(new TreeMap<>(config.getDomainConfigs().values().stream().collect(Collectors.toMap(DomainConfig::getDomainID, domainConfig -> domainConfig.readSettingAsUserPermission(PwmSetting.REPORTING_USER_MATCH)))));<NEW_LINE>final ReportSettings.ReportSettingsBuilder builder = ReportSettings.builder();<NEW_LINE>builder.maxCacheAge(TimeDuration.of(Long.parseLong(config.readAppProperty(AppProperty.REPORTING_MAX_REPORT_AGE_SECONDS)), TimeDuration.Unit.SECONDS));<NEW_LINE>builder.searchFilter(searchFilters);<NEW_LINE>builder.maxSearchSize((int) config.readSettingAsLong(PwmSetting.REPORTING_MAX_QUERY_SIZE));<NEW_LINE>builder.dailyJobEnabled(config.readSettingAsBoolean(PwmSetting.REPORTING_ENABLE_DAILY_JOB));<NEW_LINE>builder.searchTimeout(TimeDuration.of(Long.parseLong(config.readAppProperty(AppProperty.REPORTING_LDAP_SEARCH_TIMEOUT_MS)), TimeDuration.Unit.MILLISECONDS));<NEW_LINE>{<NEW_LINE>int reportJobOffset = (int) <MASK><NEW_LINE>if (reportJobOffset > 60 * 60 * 24) {<NEW_LINE>reportJobOffset = 0;<NEW_LINE>}<NEW_LINE>builder.jobOffsetSeconds(reportJobOffset);<NEW_LINE>}<NEW_LINE>builder.trackDays(parseDayIntervalStr(config));<NEW_LINE>builder.reportJobThreads(Integer.parseInt(config.readAppProperty(AppProperty.REPORTING_LDAP_SEARCH_THREADS)));<NEW_LINE>builder.reportJobIntensity(config.readSettingAsEnum(PwmSetting.REPORTING_JOB_INTENSITY, JobIntensity.class));<NEW_LINE>return builder.build();<NEW_LINE>} | config.readSettingAsLong(PwmSetting.REPORTING_JOB_TIME_OFFSET); |
1,176,849 | public WebResourceResponse onShouldInterceptRequest(Object request) {<NEW_LINE>String url = request instanceof String ? (String) request : null;<NEW_LINE>String method = "GET";<NEW_LINE>Map<String, String> headers = null;<NEW_LINE>boolean hasGesture = false;<NEW_LINE>boolean isForMainFrame = true;<NEW_LINE>boolean isRedirect = false;<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && request instanceof WebResourceRequest) {<NEW_LINE>WebResourceRequest webResourceRequest = (WebResourceRequest) request;<NEW_LINE>url = webResourceRequest.getUrl().toString();<NEW_LINE>headers = webResourceRequest.getRequestHeaders();<NEW_LINE>hasGesture = webResourceRequest.hasGesture();<NEW_LINE>isForMainFrame = webResourceRequest.isForMainFrame();<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {<NEW_LINE>isRedirect = webResourceRequest.isRedirect();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final Map<String, Object> obj = new HashMap<>();<NEW_LINE>obj.put("url", url);<NEW_LINE>obj.put("method", method);<NEW_LINE>obj.put("headers", headers);<NEW_LINE>obj.put("isForMainFrame", isForMainFrame);<NEW_LINE>obj.put("hasGesture", hasGesture);<NEW_LINE>obj.put("isRedirect", isRedirect);<NEW_LINE>Util.WaitFlutterResult flutterResult;<NEW_LINE>try {<NEW_LINE>flutterResult = Util.invokeMethodAndWait(channel, "shouldInterceptRequest", obj);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (flutterResult.error != null) {<NEW_LINE>Log.e(LOG_TAG, flutterResult.error);<NEW_LINE>} else if (flutterResult.result != null) {<NEW_LINE>Map<String, Object> res = (Map<String, Object>) flutterResult.result;<NEW_LINE>String contentType = (String) res.get("contentType");<NEW_LINE>String contentEncoding = (String) res.get("contentEncoding");<NEW_LINE>byte[] data = (byte[]) res.get("data");<NEW_LINE>Map<String, String> responseHeaders = (Map<String, String>) res.get("headers");<NEW_LINE>Integer statusCode = (<MASK><NEW_LINE>String reasonPhrase = (String) res.get("reasonPhrase");<NEW_LINE>ByteArrayInputStream inputStream = (data != null) ? new ByteArrayInputStream(data) : null;<NEW_LINE>if ((responseHeaders == null && statusCode == null && reasonPhrase == null) || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {<NEW_LINE>return new WebResourceResponse(contentType, contentEncoding, inputStream);<NEW_LINE>} else {<NEW_LINE>return new WebResourceResponse(contentType, contentEncoding, statusCode, reasonPhrase, responseHeaders, inputStream);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | Integer) res.get("statusCode"); |
617,541 | private void addPartialType(SourceBuilder code) {<NEW_LINE>code.addLine("").addLine("private static final class %s %s {", datatype.getPartialType().declaration(), datatype.getRebuildableType().map(rebuildable -> extending(rebuildable, false)).orElse(extending(datatype.getType(), datatype.isInterfaceType())));<NEW_LINE>addPartialFields(code);<NEW_LINE>addPartialConstructor(code);<NEW_LINE>addPartialGetters(code);<NEW_LINE>addPartialToBuilderMethod(code);<NEW_LINE>if (datatype.standardMethodUnderride(StandardMethod.EQUALS) != FINAL) {<NEW_LINE>addPartialEquals(code);<NEW_LINE>}<NEW_LINE>if (datatype.standardMethodUnderride(StandardMethod.HASH_CODE) != FINAL) {<NEW_LINE>addPartialHashCode(code);<NEW_LINE>}<NEW_LINE>if (datatype.standardMethodUnderride(StandardMethod.TO_STRING) != FINAL) {<NEW_LINE>addToString(<MASK><NEW_LINE>}<NEW_LINE>code.addLine("}");<NEW_LINE>} | code, datatype, generatorsByProperty, true); |
1,452,289 | private static final <E, D> EntryList of(Iterable<E> elements, StaticArrayEntry.GetColVal<E, D> getter, StaticArrayEntry.DataHandler<D> datahandler) {<NEW_LINE>Preconditions.checkArgument(elements != null && getter != null && datahandler != null);<NEW_LINE>int num = 0;<NEW_LINE>int datalen = 0;<NEW_LINE>EntryMetaData[] metadataschema = null;<NEW_LINE>for (E element : elements) {<NEW_LINE>num++;<NEW_LINE>datalen += datahandler.getSize(getter.getColumn(element));<NEW_LINE>datalen += datahandler.getSize<MASK><NEW_LINE>if (metadataschema == null)<NEW_LINE>metadataschema = getter.getMetaSchema(element);<NEW_LINE>datalen += getMetaDataSize(metadataschema, element, getter);<NEW_LINE>}<NEW_LINE>if (num == 0)<NEW_LINE>return EMPTY_LIST;<NEW_LINE>byte[] data = new byte[datalen];<NEW_LINE>long[] limitAndValuePos = new long[num];<NEW_LINE>int pos = 0;<NEW_LINE>int offset = 0;<NEW_LINE>for (E element : elements) {<NEW_LINE>if (element == null)<NEW_LINE>throw new IllegalArgumentException("Unexpected null element in result set");<NEW_LINE>offset = writeMetaData(data, offset, metadataschema, element, getter);<NEW_LINE>D col = getter.getColumn(element);<NEW_LINE>datahandler.copy(col, data, offset);<NEW_LINE>int valuePos = datahandler.getSize(col);<NEW_LINE>offset += valuePos;<NEW_LINE>D val = getter.getValue(element);<NEW_LINE>datahandler.copy(val, data, offset);<NEW_LINE>offset += datahandler.getSize(val);<NEW_LINE>limitAndValuePos[pos] = getOffsetandValue(offset, valuePos);<NEW_LINE>pos++;<NEW_LINE>}<NEW_LINE>assert offset == data.length;<NEW_LINE>assert pos == limitAndValuePos.length;<NEW_LINE>return new StaticArrayEntryList(data, limitAndValuePos, metadataschema);<NEW_LINE>} | (getter.getValue(element)); |
18,423 | private static List<List<String>> doParse(String appliesTo) {<NEW_LINE>boolean quoted = false;<NEW_LINE>int index = 0;<NEW_LINE>List<String> entry = new ArrayList<String>();<NEW_LINE>List<List<String>> result = new ArrayList<MASK><NEW_LINE>for (int i = 0; i < appliesTo.length(); i++) {<NEW_LINE>char c = appliesTo.charAt(i);<NEW_LINE>if (c == '"') {<NEW_LINE>quoted = !quoted;<NEW_LINE>}<NEW_LINE>if (!quoted) {<NEW_LINE>if (c == ',') {<NEW_LINE>entry.add(appliesTo.substring(index, i));<NEW_LINE>// We've read one applies to entry in<NEW_LINE>// Add to result and start a new one<NEW_LINE>index = i + 1;<NEW_LINE>result.add(entry);<NEW_LINE>entry = new ArrayList<String>();<NEW_LINE>} else if (c == ';') {<NEW_LINE>entry.add(appliesTo.substring(index, i));<NEW_LINE>index = i + 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>entry.add(appliesTo.substring(index));<NEW_LINE>result.add(entry);<NEW_LINE>return result;<NEW_LINE>} | <List<String>>(); |
519,292 | public void marshall(ImportFileTaskInformation importFileTaskInformation, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (importFileTaskInformation == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getCompletionTime(), COMPLETIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getImportName(), IMPORTNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getInputS3Bucket(), INPUTS3BUCKET_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getNumberOfRecordsFailed(), NUMBEROFRECORDSFAILED_BINDING);<NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getNumberOfRecordsSuccess(), NUMBEROFRECORDSSUCCESS_BINDING);<NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getStartTime(), STARTTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getStatusReportS3Bucket(), STATUSREPORTS3BUCKET_BINDING);<NEW_LINE>protocolMarshaller.marshall(importFileTaskInformation.getStatusReportS3Key(), STATUSREPORTS3KEY_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | importFileTaskInformation.getInputS3Key(), INPUTS3KEY_BINDING); |
522,172 | final ListOnPremisesInstancesResult executeListOnPremisesInstances(ListOnPremisesInstancesRequest listOnPremisesInstancesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listOnPremisesInstancesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListOnPremisesInstancesRequest> request = null;<NEW_LINE>Response<ListOnPremisesInstancesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListOnPremisesInstancesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listOnPremisesInstancesRequest));<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, "CodeDeploy");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListOnPremisesInstancesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListOnPremisesInstancesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListOnPremisesInstances"); |
1,126,031 | public void push(File hostSource, String deviceDestination) {<NEW_LINE>checkState(hostSource.exists());<NEW_LINE>String path = hostSource.getAbsolutePath();<NEW_LINE>if (hostSource.isFile()) {<NEW_LINE>// Some version of adb opens file with O_NOFOLLOW FLAG.<NEW_LINE>// That means symbolic link doesn't work, resolve it now.<NEW_LINE>try {<NEW_LINE>path = hostSource.getCanonicalPath();<NEW_LINE>if (!hostSource.getName().equals(new File(path).getName())) {<NEW_LINE>File tmp = new File(Files.createTempDir(), hostSource.getName());<NEW_LINE>Files.copy(hostSource, tmp);<NEW_LINE>path = tmp.getCanonicalPath();<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE><MASK><NEW_LINE>// Do nothing, we hope we happen to have a good version of adb.<NEW_LINE>// Error could be caught by makeAdbCall.<NEW_LINE>path = hostSource.getAbsolutePath();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>makeAdbCall("push", path, deviceDestination);<NEW_LINE>} | logger.info("IO Exception:" + ex); |
507,691 | public UnifyResult apply(UnifyRuleCall call) {<NEW_LINE>// Child of projectTarget is equivalent to child of filterQuery.<NEW_LINE>try {<NEW_LINE>// TODO: make sure that constants are ok<NEW_LINE>final MutableProject target = (MutableProject) call.target;<NEW_LINE>final RexShuttle shuttle = getRexShuttle(target);<NEW_LINE>final RexNode newCondition;<NEW_LINE>final MutableFilter query = (MutableFilter) call.query;<NEW_LINE>try {<NEW_LINE>newCondition = query.condition.accept(shuttle);<NEW_LINE>} catch (MatchFailed e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final MutableFilter newFilter = MutableFilter.of(target, newCondition);<NEW_LINE>if (query.getParent() instanceof MutableProject) {<NEW_LINE>final MutableRel inverse = invert(((MutableProject) query.getParent()).<MASK><NEW_LINE>return call.create(query.getParent()).result(inverse);<NEW_LINE>} else {<NEW_LINE>final MutableRel inverse = invert(query, newFilter, target);<NEW_LINE>return call.result(inverse);<NEW_LINE>}<NEW_LINE>} catch (MatchFailed e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | getNamedProjects(), newFilter, shuttle); |
839,902 | private double pseudoRandom(final long seed, int input) {<NEW_LINE>// Default constants from "man drand48"<NEW_LINE>final long mult = 0x5DEECE66DL;<NEW_LINE>final long add = 0xBL;<NEW_LINE>// 48 bit<NEW_LINE>final long mask = (1L << 48) - 1;<NEW_LINE>// Produce an initial seed each<NEW_LINE>final long i1 = (input ^ seed ^ mult) & mask;<NEW_LINE>final long i2 = (input ^ (seed >>> 16) ^ mult) & mask;<NEW_LINE>// Compute the first random each<NEW_LINE>final long l1 = (i1 * mult + add) & mask;<NEW_LINE>final long l2 = (i2 * mult + add) & mask;<NEW_LINE>// Use 53 bit total:<NEW_LINE>// 48 - 22 = 26<NEW_LINE>final int r1 = (int) (l1 >>> 22);<NEW_LINE>// 48 - 21 = 27<NEW_LINE>final int r2 = (int<MASK><NEW_LINE>double random = ((((long) r1) << 27) + r2) / (double) (1L << 53);<NEW_LINE>return random;<NEW_LINE>} | ) (l2 >>> 21); |
89,669 | static IsNewStrategy basedOn(Neo4jPersistentEntity<?> entityMetaData) {<NEW_LINE><MASK><NEW_LINE>IdDescription idDescription = entityMetaData.getIdDescription();<NEW_LINE>Class<?> valueType = entityMetaData.getRequiredIdProperty().getType();<NEW_LINE>if (idDescription.isExternallyGeneratedId() && valueType.isPrimitive()) {<NEW_LINE>throw new IllegalArgumentException(String.format("Cannot use %s with externally generated, primitive ids.", DefaultNeo4jIsNewStrategy.class.getName()));<NEW_LINE>}<NEW_LINE>Function<Object, Object> valueLookup;<NEW_LINE>Neo4jPersistentProperty versionProperty = entityMetaData.getVersionProperty();<NEW_LINE>if (idDescription.isAssignedId()) {<NEW_LINE>if (versionProperty == null) {<NEW_LINE>log.warn(() -> "Instances of " + entityMetaData.getType() + " with an assigned id will always be treated as new without version property!");<NEW_LINE>valueType = Void.class;<NEW_LINE>valueLookup = source -> null;<NEW_LINE>} else {<NEW_LINE>valueType = versionProperty.getType();<NEW_LINE>valueLookup = source -> entityMetaData.getPropertyAccessor(source).getProperty(versionProperty);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>valueLookup = source -> entityMetaData.getIdentifierAccessor(source).getIdentifier();<NEW_LINE>}<NEW_LINE>return new DefaultNeo4jIsNewStrategy(idDescription, valueType, valueLookup);<NEW_LINE>} | Assert.notNull(entityMetaData, "Entity meta data must not be null."); |
459,344 | public BLangNode transform(UnionTypeDescriptorNode unionTypeDescriptorNode) {<NEW_LINE>List<TypeDescriptorNode> nodes = flattenUnionType(unionTypeDescriptorNode);<NEW_LINE>List<TypeDescriptorNode> finiteTypeElements = new ArrayList<>();<NEW_LINE>List<List<TypeDescriptorNode>> unionTypeElementsCollection = new ArrayList<>();<NEW_LINE>for (TypeDescriptorNode type : nodes) {<NEW_LINE>if (type.kind() == SyntaxKind.SINGLETON_TYPE_DESC) {<NEW_LINE>finiteTypeElements.add(type);<NEW_LINE>unionTypeElementsCollection.add(new ArrayList<>());<NEW_LINE>} else {<NEW_LINE>List<TypeDescriptorNode> lastOfOthers;<NEW_LINE>if (unionTypeElementsCollection.isEmpty()) {<NEW_LINE>lastOfOthers = new ArrayList<>();<NEW_LINE>unionTypeElementsCollection.add(lastOfOthers);<NEW_LINE>} else {<NEW_LINE>lastOfOthers = unionTypeElementsCollection.get(unionTypeElementsCollection.size() - 1);<NEW_LINE>}<NEW_LINE>lastOfOthers.add(type);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<TypeDescriptorNode> unionElements = new ArrayList<>();<NEW_LINE>reverseFlatMap(unionTypeElementsCollection, unionElements);<NEW_LINE>BLangFiniteTypeNode bLangFiniteTypeNode = <MASK><NEW_LINE>for (TypeDescriptorNode finiteTypeEl : finiteTypeElements) {<NEW_LINE>SingletonTypeDescriptorNode singletonTypeNode = (SingletonTypeDescriptorNode) finiteTypeEl;<NEW_LINE>BLangLiteral literal = createSimpleLiteral(singletonTypeNode.simpleContExprNode(), true);<NEW_LINE>bLangFiniteTypeNode.addValue(literal);<NEW_LINE>}<NEW_LINE>if (unionElements.isEmpty()) {<NEW_LINE>return bLangFiniteTypeNode;<NEW_LINE>}<NEW_LINE>BLangUnionTypeNode unionTypeNode = (BLangUnionTypeNode) TreeBuilder.createUnionTypeNode();<NEW_LINE>unionTypeNode.pos = getPosition(unionTypeDescriptorNode);<NEW_LINE>for (TypeDescriptorNode unionElement : unionElements) {<NEW_LINE>unionTypeNode.memberTypeNodes.add(createTypeNode(unionElement));<NEW_LINE>}<NEW_LINE>bLangFiniteTypeNode.setPosition(unionTypeNode.pos);<NEW_LINE>if (!finiteTypeElements.isEmpty()) {<NEW_LINE>unionTypeNode.memberTypeNodes.add(deSugarTypeAsUserDefType(bLangFiniteTypeNode));<NEW_LINE>}<NEW_LINE>return unionTypeNode;<NEW_LINE>} | (BLangFiniteTypeNode) TreeBuilder.createFiniteTypeNode(); |
628,109 | protected void onPostExecute(String response) {<NEW_LINE>LiveUpdatesFragment f = fragment.get();<NEW_LINE>if (response != null && f != null) {<NEW_LINE>TextViewEx descriptionTime = f.descriptionTime;<NEW_LINE>if (descriptionTime != null) {<NEW_LINE>SimpleDateFormat source = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);<NEW_LINE>source.setTimeZone(TimeZone.getTimeZone("UTC"));<NEW_LINE>SimpleDateFormat dest = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);<NEW_LINE>dest.setTimeZone(TimeZone.getDefault());<NEW_LINE>try {<NEW_LINE>LOG.debug("response = " + response);<NEW_LINE>Date <MASK><NEW_LINE>if (parsed != null) {<NEW_LINE>long dateTime = parsed.getTime();<NEW_LINE>LOG.debug("dateTime = " + dateTime);<NEW_LINE>descriptionTime.setText(dest.format(parsed));<NEW_LINE>}<NEW_LINE>} catch (ParseException e) {<NEW_LINE>LOG.error(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | parsed = source.parse(response); |
849,537 | private void onDemandOnce(PRestriction restriction, boolean category, PRestriction result, OnDemandResult oResult, Spinner spOnce) {<NEW_LINE>oResult.once = true;<NEW_LINE>// Get duration<NEW_LINE>String value = <MASK><NEW_LINE>if (value == null)<NEW_LINE>result.time = new Date().getTime() + PrivacyManager.cRestrictionCacheTimeoutMs;<NEW_LINE>else {<NEW_LINE>char unit = value.charAt(value.length() - 1);<NEW_LINE>value = value.substring(0, value.length() - 1);<NEW_LINE>if (unit == 's')<NEW_LINE>result.time = new Date().getTime() + Integer.parseInt(value) * 1000;<NEW_LINE>else if (unit == 'm')<NEW_LINE>result.time = new Date().getTime() + Integer.parseInt(value) * 60 * 1000;<NEW_LINE>else<NEW_LINE>result.time = new Date().getTime() + PrivacyManager.cRestrictionCacheTimeoutMs;<NEW_LINE>try {<NEW_LINE>int userId = Util.getUserId(restriction.uid);<NEW_LINE>String sel = Integer.toString(spOnce.getSelectedItemPosition());<NEW_LINE>setSettingInternal(new PSetting(userId, "", PrivacyManager.cSettingODOnceDuration, sel));<NEW_LINE>} catch (Throwable ex) {<NEW_LINE>Util.bug(null, ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Util.log(null, Log.WARN, (result.restricted ? "Deny" : "Allow") + " once " + restriction + " category=" + category + " until=" + new Date(result.time));<NEW_LINE>CRestriction key = new CRestriction(result, null);<NEW_LINE>key.setExpiry(result.time);<NEW_LINE>if (category) {<NEW_LINE>key.setMethodName(null);<NEW_LINE>key.setExtra(null);<NEW_LINE>}<NEW_LINE>synchronized (mAskedOnceCache) {<NEW_LINE>if (mAskedOnceCache.containsKey(key))<NEW_LINE>mAskedOnceCache.remove(key);<NEW_LINE>mAskedOnceCache.put(key, key);<NEW_LINE>}<NEW_LINE>} | (String) spOnce.getSelectedItem(); |
1,688,670 | // @Override<NEW_LINE>// protected Coordinate[] shiftCoordinates(Coordinate[] array) {<NEW_LINE>// array = super.shiftCoordinates(array);<NEW_LINE>//<NEW_LINE>// for (int i = 0; i < array.length; i++) {<NEW_LINE>// array[i] = new Coordinate(xOffset + index*this.instanceSeparation, yOffset, zOffset);<NEW_LINE>// array[i] = array[i].add(0, shiftY, shiftZ);<NEW_LINE>// }<NEW_LINE>//<NEW_LINE>// return array;<NEW_LINE>// }<NEW_LINE>@Override<NEW_LINE>public void componentChanged(ComponentChangeEvent e) {<NEW_LINE>super.componentChanged(e);<NEW_LINE>RocketComponent body;<NEW_LINE>double parentRadius;<NEW_LINE>for (body = this.getParent(); body != null; body = body.getParent()) {<NEW_LINE>if (body instanceof SymmetricComponent)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (body == null) {<NEW_LINE>parentRadius = 0;<NEW_LINE>} else {<NEW_LINE>SymmetricComponent s = (SymmetricComponent) body;<NEW_LINE>double x1, x2;<NEW_LINE>x1 = this.toRelative(Coordinate.NUL, body)[0].x;<NEW_LINE>x2 = this.toRelative(new Coordinate(length, 0, 0), body)[0].x;<NEW_LINE>x1 = MathUtil.clamp(x1, <MASK><NEW_LINE>x2 = MathUtil.clamp(x2, 0, body.getLength());<NEW_LINE>parentRadius = Math.max(s.getRadius(x1), s.getRadius(x2));<NEW_LINE>}<NEW_LINE>this.radialOffset = parentRadius + radius;<NEW_LINE>} | 0, body.getLength()); |
414,951 | public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode mode, boolean ignorePassableBlocks) {<NEW_LINE>Validate.notNull(start, "Start location equals null");<NEW_LINE>Validate.isTrue(this.equals(start.getWorld()), "Start location a different world");<NEW_LINE>start.checkFinite();<NEW_LINE>Validate.notNull(direction, "Direction equals null");<NEW_LINE>direction.checkFinite();<NEW_LINE>Validate.isTrue(direction.lengthSquared() > 0, "Direction's magnitude is 0");<NEW_LINE>Validate.notNull(mode, "mode equals null");<NEW_LINE>if (maxDistance < 0.0D)<NEW_LINE>return null;<NEW_LINE>Vector dir = direction.clone().normalize().multiply(maxDistance);<NEW_LINE>Vec3d startPos = new Vec3d(start.getX(), start.getY(), start.getZ());<NEW_LINE>Vec3d endPos = new Vec3d(start.getX() + dir.getX(), start.getY() + dir.getY(), start.getZ() + dir.getZ());<NEW_LINE>HitResult nmsHitResult = this.getHandle().raycast(new RaycastContext(startPos, endPos, ignorePassableBlocks ? RaycastContext.ShapeType.COLLIDER : RaycastContext.ShapeType.OUTLINE, CardboardFluidRaytraceMode.<MASK><NEW_LINE>return CardboardRayTraceResult.fromNMS(this, nmsHitResult);<NEW_LINE>} | toMc(mode), null)); |
1,051,096 | private boolean findUseTemplates(SaasMethod m, Authenticator authenticator, SaasBean.SessionKeyAuthentication.UseTemplates skUseTemplates) throws IOException {<NEW_LINE>if (authenticator == null)<NEW_LINE>throw new IOException("No authentication element inside sessionkey element in saas-metadata.");<NEW_LINE>if (authenticator.getUseTemplates() != null) {<NEW_LINE><MASK><NEW_LINE>List<Template> templates = null;<NEW_LINE>if (!isDropTargetWeb() && useTemplates.getDesktop() != null && useTemplates.getDesktop().getTemplate() != null) {<NEW_LINE>templates = useTemplates.getDesktop().getTemplate();<NEW_LINE>} else if (isDropTargetWeb() && useTemplates.getWeb() != null && useTemplates.getWeb().getTemplate() != null) {<NEW_LINE>templates = useTemplates.getWeb().getTemplate();<NEW_LINE>}<NEW_LINE>if (templates == null || templates.isEmpty())<NEW_LINE>throw new IOException(Constants.UNSUPPORTED_DROP);<NEW_LINE>List<SaasBean.SessionKeyAuthentication.UseTemplates.Template> templateNames = new ArrayList<SaasBean.SessionKeyAuthentication.UseTemplates.Template>();<NEW_LINE>Map<String, Map<String, String>> artifactsMap = getArtifactTemplates(m);<NEW_LINE>// for(Template t:templates) {<NEW_LINE>// if(t.getHref() != null && !t.getHref().equals("")) {<NEW_LINE>// String artifactUrl = artifactsMap.get(t.getHref());<NEW_LINE>// if(artifactUrl != null)<NEW_LINE>// templateNames.add(skUseTemplates.createTemplate(<NEW_LINE>// t.getHref(), t.getType(), artifactUrl));<NEW_LINE>// }<NEW_LINE>// }<NEW_LINE>for (Map.Entry e1 : artifactsMap.entrySet()) {<NEW_LINE>String dropTypes = (String) e1.getKey();<NEW_LINE>Map<String, String> artifacts = (Map<String, String>) e1.getValue();<NEW_LINE>for (Map.Entry e2 : artifacts.entrySet()) {<NEW_LINE>String href = (String) e2.getKey();<NEW_LINE>String[] val = ((String) e2.getValue()).split(":");<NEW_LINE>templateNames.add(skUseTemplates.createTemplate(dropTypes, href, val[0], val[1]));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>skUseTemplates.setTemplates(templateNames);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | UseTemplates useTemplates = authenticator.getUseTemplates(); |
1,738,989 | public List<FileSystemAction> determineFileSystemActions(MemoryDatabase winnersDatabase, boolean cleanupOccurred, List<PartialFileHistory> localFileHistoriesWithLastVersion) throws Exception {<NEW_LINE>this.assembler = new Assembler(config, localDatabase, winnersDatabase);<NEW_LINE>List<FileSystemAction> fileSystemActions = new ArrayList<FileSystemAction>();<NEW_LINE>// Load file history cache<NEW_LINE>logger.log(Level.INFO, "- Loading current file tree...");<NEW_LINE>Map<FileHistoryId, FileVersion> localFileHistoryIdCache = fillFileHistoryIdCache(localFileHistoriesWithLastVersion);<NEW_LINE>logger.<MASK><NEW_LINE>for (PartialFileHistory winningFileHistory : winnersDatabase.getFileHistories()) {<NEW_LINE>// Get remote file version and content<NEW_LINE>FileVersion winningLastVersion = winningFileHistory.getLastVersion();<NEW_LINE>File winningLastFile = new File(config.getLocalDir(), winningLastVersion.getPath());<NEW_LINE>// Get local file version and content<NEW_LINE>FileVersion localLastVersion = localFileHistoryIdCache.get(winningFileHistory.getFileHistoryId());<NEW_LINE>File localLastFile = (localLastVersion != null) ? new File(config.getLocalDir(), localLastVersion.getPath()) : null;<NEW_LINE>logger.log(Level.INFO, " + Comparing local version: " + localLastVersion);<NEW_LINE>logger.log(Level.INFO, " with winning version : " + winningLastVersion);<NEW_LINE>// Sync algorithm ////<NEW_LINE>// No local file version in local database<NEW_LINE>if (localLastVersion == null) {<NEW_LINE>determineActionNoLocalLastVersion(winningLastVersion, winningLastFile, winnersDatabase, fileSystemActions);<NEW_LINE>} else // Local version found in local database<NEW_LINE>{<NEW_LINE>FileVersionComparison localFileToVersionComparison = fileVersionComparator.compare(localLastVersion, localLastFile, true);<NEW_LINE>// Local file on disk as expected<NEW_LINE>if (localFileToVersionComparison.areEqual()) {<NEW_LINE>determineActionWithLocalVersionAndLocalFileAsExpected(winningLastVersion, winningLastFile, localLastVersion, localLastFile, winnersDatabase, fileSystemActions);<NEW_LINE>} else // Local file NOT what was expected<NEW_LINE>{<NEW_LINE>determineActionWithLocalVersionAndLocalFileDiffers(winningLastVersion, winningLastFile, localLastVersion, localLastFile, winnersDatabase, fileSystemActions, localFileToVersionComparison);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Find file histories that are in the local database and not in the<NEW_LINE>// winner's database. They will be assumed to be deleted.<NEW_LINE>if (cleanupOccurred) {<NEW_LINE>logger.log(Level.INFO, "- Determine filesystem actions (for deleted histories in winner's branch)...");<NEW_LINE>Map<FileHistoryId, FileVersion> winnerFileHistoryIdCache = fillFileHistoryIdCache(winnersDatabase.getFileHistories());<NEW_LINE>for (PartialFileHistory localFileHistoryWithLastVersion : localFileHistoriesWithLastVersion) {<NEW_LINE>boolean localFileHistoryInWinnersDatabase = winnerFileHistoryIdCache.get(localFileHistoryWithLastVersion.getFileHistoryId()) != null;<NEW_LINE>// If the file history is also present in the winner's database, it<NEW_LINE>// has already been processed above. So we'll ignore it here.<NEW_LINE>if (!localFileHistoryInWinnersDatabase) {<NEW_LINE>FileVersion localLastVersion = localFileHistoryWithLastVersion.getLastVersion();<NEW_LINE>File localLastFile = (localLastVersion != null) ? new File(config.getLocalDir(), localLastVersion.getPath()) : null;<NEW_LINE>determineActionFileHistoryNotInWinnerBranch(localLastVersion, localLastFile, fileSystemActions);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return fileSystemActions;<NEW_LINE>} | log(Level.INFO, "- Determine filesystem actions ..."); |
674,388 | public static GetUserInstanceResponse unmarshall(GetUserInstanceResponse getUserInstanceResponse, UnmarshallerContext context) {<NEW_LINE>getUserInstanceResponse.setRequestId<MASK><NEW_LINE>getUserInstanceResponse.setCode(context.integerValue("GetUserInstanceResponse.Code"));<NEW_LINE>getUserInstanceResponse.setMessage(context.stringValue("GetUserInstanceResponse.Message"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setTotal(context.integerValue("GetUserInstanceResponse.Data.Total"));<NEW_LINE>List<Instance> detail = new ArrayList<Instance>();<NEW_LINE>for (int i = 0; i < context.lengthValue("GetUserInstanceResponse.Data.Detail.Length"); i++) {<NEW_LINE>Instance instance = new Instance();<NEW_LINE>instance.setProject(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].Project"));<NEW_LINE>instance.setInstanceId(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].InstanceId"));<NEW_LINE>instance.setStatus(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].Status"));<NEW_LINE>instance.setUserAccount(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].UserAccount"));<NEW_LINE>instance.setNickName(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].NickName"));<NEW_LINE>instance.setCluster(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].Cluster"));<NEW_LINE>instance.setRunTime(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].RunTime"));<NEW_LINE>instance.setCpuUsed(context.longValue("GetUserInstanceResponse.Data.Detail[" + i + "].CpuUsed"));<NEW_LINE>instance.setCpuRequest(context.longValue("GetUserInstanceResponse.Data.Detail[" + i + "].CpuRequest"));<NEW_LINE>instance.setCpuUsedTotal(context.longValue("GetUserInstanceResponse.Data.Detail[" + i + "].CpuUsedTotal"));<NEW_LINE>instance.setCpuUsedRatioMax(context.floatValue("GetUserInstanceResponse.Data.Detail[" + i + "].CpuUsedRatioMax"));<NEW_LINE>instance.setCpuUsedRatioMin(context.floatValue("GetUserInstanceResponse.Data.Detail[" + i + "].CpuUsedRatioMin"));<NEW_LINE>instance.setMemUsed(context.longValue("GetUserInstanceResponse.Data.Detail[" + i + "].MemUsed"));<NEW_LINE>instance.setMemRequest(context.longValue("GetUserInstanceResponse.Data.Detail[" + i + "].MemRequest"));<NEW_LINE>instance.setMemUsedTotal(context.longValue("GetUserInstanceResponse.Data.Detail[" + i + "].MemUsedTotal"));<NEW_LINE>instance.setMemUsedRatioMax(context.floatValue("GetUserInstanceResponse.Data.Detail[" + i + "].MemUsedRatioMax"));<NEW_LINE>instance.setMemUsedRatioMin(context.floatValue("GetUserInstanceResponse.Data.Detail[" + i + "].MemUsedRatioMin"));<NEW_LINE>instance.setTaskType(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].TaskType"));<NEW_LINE>instance.setSkynetId(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].SkynetId"));<NEW_LINE>instance.setQuotaName(context.stringValue("GetUserInstanceResponse.Data.Detail[" + i + "].QuotaName"));<NEW_LINE>instance.setQuotaId(context.integerValue("GetUserInstanceResponse.Data.Detail[" + i + "].QuotaId"));<NEW_LINE>detail.add(instance);<NEW_LINE>}<NEW_LINE>data.setDetail(detail);<NEW_LINE>getUserInstanceResponse.setData(data);<NEW_LINE>return getUserInstanceResponse;<NEW_LINE>} | (context.stringValue("GetUserInstanceResponse.RequestId")); |
1,798,720 | public void deleteAttachmentFilesForViewOnceMessage(long mmsId) {<NEW_LINE>Log.d(TAG, "[deleteAttachmentFilesForViewOnceMessage] mmsId: " + mmsId);<NEW_LINE>SQLiteDatabase database = databaseHelper.getSignalWritableDatabase();<NEW_LINE>Cursor cursor = null;<NEW_LINE>try {<NEW_LINE>cursor = database.query(TABLE_NAME, new String[] { DATA, CONTENT_TYPE, ROW_ID, UNIQUE_ID }, MMS_ID + " = ?", new String[] { mmsId + "" }, null, null, null);<NEW_LINE>while (cursor != null && cursor.moveToNext()) {<NEW_LINE>deleteAttachmentOnDisk(CursorUtil.requireString(cursor, DATA), CursorUtil.requireString(cursor, CONTENT_TYPE), new AttachmentId(CursorUtil.requireLong(cursor, ROW_ID), CursorUtil.requireLong(cursor, UNIQUE_ID)));<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (cursor != null)<NEW_LINE>cursor.close();<NEW_LINE>}<NEW_LINE>ContentValues values = new ContentValues();<NEW_LINE>values.put(DATA, (String) null);<NEW_LINE>values.put(DATA_RANDOM, (byte[]) null);<NEW_LINE>values.put<MASK><NEW_LINE>values.put(FILE_NAME, (String) null);<NEW_LINE>values.put(CAPTION, (String) null);<NEW_LINE>values.put(SIZE, 0);<NEW_LINE>values.put(WIDTH, 0);<NEW_LINE>values.put(HEIGHT, 0);<NEW_LINE>values.put(TRANSFER_STATE, TRANSFER_PROGRESS_DONE);<NEW_LINE>values.put(VISUAL_HASH, (String) null);<NEW_LINE>values.put(CONTENT_TYPE, MediaUtil.VIEW_ONCE);<NEW_LINE>database.update(TABLE_NAME, values, MMS_ID + " = ?", new String[] { mmsId + "" });<NEW_LINE>notifyAttachmentListeners();<NEW_LINE>long threadId = SignalDatabase.mms().getThreadIdForMessage(mmsId);<NEW_LINE>if (threadId > 0) {<NEW_LINE>notifyConversationListeners(threadId);<NEW_LINE>}<NEW_LINE>} | (DATA_HASH, (String) null); |
85,869 | public ListenerResult listen(WorkflowContext context) throws WorkflowListenerException {<NEW_LINE>LOGGER.info("Create sort config for context={}", context);<NEW_LINE>ProcessForm form = context.getProcessForm();<NEW_LINE>if (form instanceof UpdateGroupProcessForm) {<NEW_LINE>UpdateGroupProcessForm updateGroupProcessForm = (UpdateGroupProcessForm) form;<NEW_LINE>OperateType operateType = updateGroupProcessForm.getOperateType();<NEW_LINE>if (operateType == OperateType.SUSPEND || operateType == OperateType.DELETE) {<NEW_LINE>return ListenerResult.success();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>InlongGroupInfo groupInfo = this.getGroupInfo(form);<NEW_LINE>String groupId = groupInfo.getInlongGroupId();<NEW_LINE>if (StringUtils.isEmpty(groupId)) {<NEW_LINE>LOGGER.warn("GroupId is null for context={}", context);<NEW_LINE>return ListenerResult.success();<NEW_LINE>}<NEW_LINE>List<SinkResponse> sinkResponseList = streamSinkService.listSink(groupId, null);<NEW_LINE>if (CollectionUtils.isEmpty(sinkResponseList)) {<NEW_LINE><MASK><NEW_LINE>return ListenerResult.success();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Map<String, DataFlowInfo> dataFlowInfoMap = sinkResponseList.stream().map(sink -> {<NEW_LINE>DataFlowInfo flowInfo = commonOperateService.createDataFlow(groupInfo, sink);<NEW_LINE>return Pair.of(sink.getInlongStreamId(), flowInfo);<NEW_LINE>}).collect(Collectors.toMap(Pair::getKey, Pair::getValue));<NEW_LINE>String dataFlows = OBJECT_MAPPER.writeValueAsString(dataFlowInfoMap);<NEW_LINE>InlongGroupExtInfo extInfo = new InlongGroupExtInfo();<NEW_LINE>extInfo.setInlongGroupId(groupId);<NEW_LINE>extInfo.setKeyName(InlongGroupSettings.DATA_FLOW);<NEW_LINE>extInfo.setKeyValue(dataFlows);<NEW_LINE>if (groupInfo.getExtList() == null) {<NEW_LINE>groupInfo.setExtList(Lists.newArrayList());<NEW_LINE>}<NEW_LINE>upsertDataFlow(groupInfo, extInfo);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("create sort config failed for sink list={} ", sinkResponseList, e);<NEW_LINE>throw new WorkflowListenerException("create sort config failed: " + e.getMessage());<NEW_LINE>}<NEW_LINE>return ListenerResult.success();<NEW_LINE>} | LOGGER.warn("Sink not found by groupId={}", groupId); |
837,284 | public void afterPush(File[] files, String[] changesets, String hookUsageName) {<NEW_LINE>if (files.length == 0) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.warning("calling after push for zero files");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File file = files[0];<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.FINE, "push hook start for {0}", file);<NEW_LINE>Repository repo = null;<NEW_LINE>for (String changeset : changesets) {<NEW_LINE>PushOperation operation = config.popPushAction(changeset);<NEW_LINE>if (operation == null) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.FINE, " no push hook scheduled for {0}", file);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (repo == null) {<NEW_LINE>// don't go for the repository until we really need it<NEW_LINE>// true -> ask user if repository unknown<NEW_LINE>repo = RepositoryQuery.getRepository(FileUtil.toFileObject(file), true);<NEW_LINE>// might have deleted in the meantime<NEW_LINE>if (repo == null) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.WARNING, " could not find issue tracker for {0}", file);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Issue[] issues = repo.getIssues(operation.getIssueID());<NEW_LINE>if (issues == null || issues.length == 0) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.FINE, " no issue found with id {0}", operation.getIssueID());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>issues[0].addComment(operation.getMsg(), operation.isClose());<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(<MASK><NEW_LINE>// NOI18N<NEW_LINE>VCSHooksConfig.logHookUsage(hookUsageName, getSelectedRepository());<NEW_LINE>} | Level.FINE, "push hook end for {0}", file); |
751,159 | protected void parseMetadata(Metadata metadata) {<NEW_LINE>if (metadata == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (Directory directory : metadata.getDirectories()) {<NEW_LINE>if (directory instanceof PsdHeaderDirectory) {<NEW_LINE>parsedInfo.format = ImageFormat.PSD;<NEW_LINE>if (((PsdHeaderDirectory) directory).containsTag(PsdHeaderDirectory.TAG_IMAGE_WIDTH) && ((PsdHeaderDirectory) directory).containsTag(PsdHeaderDirectory.TAG_IMAGE_HEIGHT)) {<NEW_LINE>parsedInfo.width = ((PsdHeaderDirectory) directory).getInteger(PsdHeaderDirectory.TAG_IMAGE_WIDTH);<NEW_LINE>parsedInfo.height = ((PsdHeaderDirectory) directory<MASK><NEW_LINE>}<NEW_LINE>if (((PsdHeaderDirectory) directory).containsTag(PsdHeaderDirectory.TAG_BITS_PER_CHANNEL)) {<NEW_LINE>Integer i = ((PsdHeaderDirectory) directory).getInteger(PsdHeaderDirectory.TAG_BITS_PER_CHANNEL);<NEW_LINE>if (i != null) {<NEW_LINE>parsedInfo.bitDepth = i;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (((PsdHeaderDirectory) directory).containsTag(PsdHeaderDirectory.TAG_COLOR_MODE)) {<NEW_LINE>Integer i = ((PsdHeaderDirectory) directory).getInteger(PsdHeaderDirectory.TAG_COLOR_MODE);<NEW_LINE>if (i != null) {<NEW_LINE>((PSDParseInfo) parsedInfo).colorMode = ColorMode.typeOf(i.intValue());<NEW_LINE>switch(((PSDParseInfo) parsedInfo).colorMode) {<NEW_LINE>case GRAYSCALE:<NEW_LINE>parsedInfo.numComponents = 1;<NEW_LINE>parsedInfo.colorSpaceType = ColorSpaceType.TYPE_GRAY;<NEW_LINE>break;<NEW_LINE>case INDEXED:<NEW_LINE>case RGB:<NEW_LINE>parsedInfo.numComponents = 3;<NEW_LINE>parsedInfo.colorSpaceType = ColorSpaceType.TYPE_RGB;<NEW_LINE>break;<NEW_LINE>case CMYK:<NEW_LINE>parsedInfo.numComponents = 4;<NEW_LINE>parsedInfo.colorSpaceType = ColorSpaceType.TYPE_CMYK;<NEW_LINE>break;<NEW_LINE>case LAB:<NEW_LINE>parsedInfo.numComponents = 3;<NEW_LINE>parsedInfo.colorSpaceType = ColorSpaceType.TYPE_Lab;<NEW_LINE>default:<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (((PsdHeaderDirectory) directory).containsTag(PsdHeaderDirectory.TAG_CHANNEL_COUNT)) {<NEW_LINE>Integer i = ((PsdHeaderDirectory) directory).getInteger(PsdHeaderDirectory.TAG_CHANNEL_COUNT);<NEW_LINE>if (i != null) {<NEW_LINE>((PSDParseInfo) parsedInfo).channelCount = i;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).getInteger(PsdHeaderDirectory.TAG_IMAGE_HEIGHT); |
1,249,346 | public void initUserDirs() throws IOException {<NEW_LINE>File _userDirFile = null;<NEW_LINE>String _userDir = null;<NEW_LINE>// NOI18N<NEW_LINE>String ioUserDir = System.getProperty("user.home");<NEW_LINE>// NOI18N<NEW_LINE>String <MASK><NEW_LINE>if (username != null) {<NEW_LINE>for (int i = 0; i < username.length(); i++) {<NEW_LINE>char c = username.charAt(i);<NEW_LINE>if (Character.isDigit(c) || c == '_') {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (c >= 'A' && c <= 'Z') {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (c >= 'a' && c <= 'z') {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>username = "" + username.hashCode();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>_userDirFile = new File(ioUserDir);<NEW_LINE>_userDir = _userDirFile.getAbsolutePath();<NEW_LINE>if (shell != null) {<NEW_LINE>_userDir = WindowsSupport.getInstance().convertToShellPath(_userDir);<NEW_LINE>}<NEW_LINE>userDirFile = _userDirFile;<NEW_LINE>userDir = _userDir;<NEW_LINE>} | username = environment.get("USERNAME"); |
776,730 | public Optional<TransactionWebhookPayload> parseTransactionPayload(String body, String signature, Map<String, String> additionalInfo, PaymentContext paymentContext) {<NEW_LINE>try {<NEW_LINE>var stripeEvent = Webhook.constructEvent(body, signature, getWebhookSignatureKey<MASK><NEW_LINE>String eventType = stripeEvent.getType();<NEW_LINE>if (eventType.startsWith("charge.")) {<NEW_LINE>return deserializeObject(stripeEvent).map(obj -> new StripeChargeTransactionWebhookPayload(eventType, (Charge) obj));<NEW_LINE>} else if (eventType.startsWith("payment_intent.")) {<NEW_LINE>return deserializeObject(stripeEvent).map(obj -> new StripePaymentIntentWebhookPayload(eventType, (PaymentIntent) obj));<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("got exception while handling stripe webhook", e);<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>} | (paymentContext.getConfigurationLevel())); |
413,067 | public Request<CopyDBClusterParameterGroupRequest> marshall(CopyDBClusterParameterGroupRequest copyDBClusterParameterGroupRequest) {<NEW_LINE>if (copyDBClusterParameterGroupRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<CopyDBClusterParameterGroupRequest> request = new DefaultRequest<CopyDBClusterParameterGroupRequest>(copyDBClusterParameterGroupRequest, "AmazonNeptune");<NEW_LINE>request.addParameter("Action", "CopyDBClusterParameterGroup");<NEW_LINE>request.addParameter("Version", "2014-10-31");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>if (copyDBClusterParameterGroupRequest.getSourceDBClusterParameterGroupIdentifier() != null) {<NEW_LINE>request.addParameter("SourceDBClusterParameterGroupIdentifier", StringUtils.fromString(copyDBClusterParameterGroupRequest.getSourceDBClusterParameterGroupIdentifier()));<NEW_LINE>}<NEW_LINE>if (copyDBClusterParameterGroupRequest.getTargetDBClusterParameterGroupIdentifier() != null) {<NEW_LINE>request.addParameter("TargetDBClusterParameterGroupIdentifier", StringUtils.fromString(copyDBClusterParameterGroupRequest.getTargetDBClusterParameterGroupIdentifier()));<NEW_LINE>}<NEW_LINE>if (copyDBClusterParameterGroupRequest.getTargetDBClusterParameterGroupDescription() != null) {<NEW_LINE>request.addParameter("TargetDBClusterParameterGroupDescription", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>if (copyDBClusterParameterGroupRequest.getTags() != null) {<NEW_LINE>java.util.List<Tag> tagsList = copyDBClusterParameterGroupRequest.getTags();<NEW_LINE>if (tagsList.isEmpty()) {<NEW_LINE>request.addParameter("Tags", "");<NEW_LINE>} else {<NEW_LINE>int tagsListIndex = 1;<NEW_LINE>for (Tag tagsListValue : tagsList) {<NEW_LINE>if (tagsListValue != null) {<NEW_LINE>if (tagsListValue.getKey() != null) {<NEW_LINE>request.addParameter("Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey()));<NEW_LINE>}<NEW_LINE>if (tagsListValue.getValue() != null) {<NEW_LINE>request.addParameter("Tags.Tag." + tagsListIndex + ".Value", StringUtils.fromString(tagsListValue.getValue()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tagsListIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (copyDBClusterParameterGroupRequest.getTargetDBClusterParameterGroupDescription())); |
99,893 | private static void optimizeOperator(int operator, ASTNode tk, ASTNode tkOp, ASTLinkedList astLinkedList, ASTLinkedList optimizedAst, ParserContext pCtx) {<NEW_LINE>switch(operator) {<NEW_LINE>case Operator.REGEX:<NEW_LINE>optimizedAst.addTokenNode(new RegExMatchNode(tk, astLinkedList.nextNode(), pCtx));<NEW_LINE>break;<NEW_LINE>case Operator.CONTAINS:<NEW_LINE>optimizedAst.addTokenNode(new Contains(tk, astLinkedList.nextNode(), pCtx));<NEW_LINE>break;<NEW_LINE>case Operator.INSTANCEOF:<NEW_LINE>optimizedAst.addTokenNode(new Instance(tk, astLinkedList.nextNode(), pCtx));<NEW_LINE>break;<NEW_LINE>case Operator.CONVERTABLE_TO:<NEW_LINE>optimizedAst.addTokenNode((new Convertable(tk, astLinkedList.nextNode(), pCtx)));<NEW_LINE>break;<NEW_LINE>case Operator.SIMILARITY:<NEW_LINE>optimizedAst.addTokenNode(new Strsim(tk, astLinkedList.nextNode(), pCtx));<NEW_LINE>break;<NEW_LINE>case Operator.SOUNDEX:<NEW_LINE>optimizedAst.addTokenNode(new Soundslike(tk, astLinkedList.nextNode(), pCtx));<NEW_LINE>break;<NEW_LINE>case TERNARY:<NEW_LINE>if (pCtx.isStrongTyping() && tk.getEgressType() != Boolean.class && tk.getEgressType() != Boolean.TYPE)<NEW_LINE>throw new RuntimeException(<MASK><NEW_LINE>default:<NEW_LINE>optimizedAst.addTokenNode(tk, tkOp);<NEW_LINE>}<NEW_LINE>} | "Condition of ternary operator is not of type boolean. Found " + tk.getEgressType()); |
463,823 | private static void onCreate(@NonNull Context context, @NonNull NotificationManager notificationManager) {<NEW_LINE>NotificationChannelGroup messagesGroup = new NotificationChannelGroup(CATEGORY_MESSAGES, context.getResources().getString(R.string.NotificationChannel_group_chats));<NEW_LINE>notificationManager.createNotificationChannelGroup(messagesGroup);<NEW_LINE>NotificationChannel messages = new NotificationChannel(getMessagesChannel(context), context.getString(R.string.NotificationChannel_channel_messages), NotificationManager.IMPORTANCE_HIGH);<NEW_LINE>NotificationChannel calls = new NotificationChannel(CALLS, context.getString(R.string.NotificationChannel_calls), NotificationManager.IMPORTANCE_HIGH);<NEW_LINE>NotificationChannel failures = new NotificationChannel(FAILURES, context.getString(R.string.NotificationChannel_failures), NotificationManager.IMPORTANCE_HIGH);<NEW_LINE>NotificationChannel backups = new NotificationChannel(BACKUPS, context.getString(R.string.NotificationChannel_backups), NotificationManager.IMPORTANCE_LOW);<NEW_LINE>NotificationChannel lockedStatus = new NotificationChannel(LOCKED_STATUS, context.getString(R.string.NotificationChannel_locked_status), NotificationManager.IMPORTANCE_LOW);<NEW_LINE>NotificationChannel other = new NotificationChannel(OTHER, context.getString(R.string<MASK><NEW_LINE>NotificationChannel voiceNotes = new NotificationChannel(VOICE_NOTES, context.getString(R.string.NotificationChannel_voice_notes), NotificationManager.IMPORTANCE_LOW);<NEW_LINE>NotificationChannel joinEvents = new NotificationChannel(JOIN_EVENTS, context.getString(R.string.NotificationChannel_contact_joined_signal), NotificationManager.IMPORTANCE_DEFAULT);<NEW_LINE>NotificationChannel background = new NotificationChannel(BACKGROUND, context.getString(R.string.NotificationChannel_background_connection), getDefaultBackgroundChannelImportance(notificationManager));<NEW_LINE>NotificationChannel callStatus = new NotificationChannel(CALL_STATUS, context.getString(R.string.NotificationChannel_call_status), NotificationManager.IMPORTANCE_LOW);<NEW_LINE>messages.setGroup(CATEGORY_MESSAGES);<NEW_LINE>setVibrationEnabled(messages, SignalStore.settings().isMessageVibrateEnabled());<NEW_LINE>messages.setSound(SignalStore.settings().getMessageNotificationSound(), getRingtoneAudioAttributes());<NEW_LINE>setLedPreference(messages, SignalStore.settings().getMessageLedColor());<NEW_LINE>calls.setShowBadge(false);<NEW_LINE>backups.setShowBadge(false);<NEW_LINE>lockedStatus.setShowBadge(false);<NEW_LINE>other.setShowBadge(false);<NEW_LINE>setVibrationEnabled(other, false);<NEW_LINE>voiceNotes.setShowBadge(false);<NEW_LINE>joinEvents.setShowBadge(false);<NEW_LINE>background.setShowBadge(false);<NEW_LINE>callStatus.setShowBadge(false);<NEW_LINE>notificationManager.createNotificationChannels(Arrays.asList(messages, calls, failures, backups, lockedStatus, other, voiceNotes, joinEvents, background, callStatus));<NEW_LINE>if (TextSecurePreferences.isUpdateApkEnabled(context)) {<NEW_LINE>NotificationChannel appUpdates = new NotificationChannel(APP_UPDATES, context.getString(R.string.NotificationChannel_app_updates), NotificationManager.IMPORTANCE_HIGH);<NEW_LINE>notificationManager.createNotificationChannel(appUpdates);<NEW_LINE>} else {<NEW_LINE>notificationManager.deleteNotificationChannel(APP_UPDATES);<NEW_LINE>}<NEW_LINE>} | .NotificationChannel_other), NotificationManager.IMPORTANCE_LOW); |
163,037 | public static Renderable documentJavaElement(SourceLinks sourceLinks, IJavaProject project, IJavaElement je) {<NEW_LINE>Builder<Renderable> renderableBuilder = ImmutableList.builder();<NEW_LINE>if (je instanceof IMember) {<NEW_LINE>IMember member = (IMember) je;<NEW_LINE>renderableBuilder.add(Renderables.lineBreak());<NEW_LINE>renderableBuilder.add(Renderables.inlineSnippet(Renderables.text(member.signature())));<NEW_LINE>IType containingType = je instanceof IType ? (IType) je : ((IMember) je).getDeclaringType();<NEW_LINE>if (je != null) {<NEW_LINE>String type = containingType.getFullyQualifiedName();<NEW_LINE>Optional<String> url = sourceLinks.sourceLinkUrlForFQName(project, type);<NEW_LINE>renderableBuilder.<MASK><NEW_LINE>if (url.isPresent()) {<NEW_LINE>renderableBuilder.add(Renderables.link(type, url.get()));<NEW_LINE>} else {<NEW_LINE>renderableBuilder.add(Renderables.inlineSnippet(Renderables.text(type)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>IJavadoc javadoc = je.getJavaDoc();<NEW_LINE>renderableBuilder.add(Renderables.lineBreak());<NEW_LINE>renderableBuilder.add(Renderables.paragraph(javadoc == null ? Renderables.NO_DESCRIPTION : javadoc.getRenderable()));<NEW_LINE>return Renderables.concat(renderableBuilder.build());<NEW_LINE>} | add(Renderables.lineBreak()); |
566,338 | public synchronized void createUser(String principal, AuthenticationToken token) throws AccumuloSecurityException {<NEW_LINE>if (!(token instanceof KerberosToken)) {<NEW_LINE>throw new UnsupportedOperationException("Expected a KerberosToken but got a " + token.<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>createUserNodeInZk(Base64.getEncoder().encodeToString(principal.getBytes(UTF_8)));<NEW_LINE>} catch (KeeperException e) {<NEW_LINE>if (e.code().equals(KeeperException.Code.NODEEXISTS)) {<NEW_LINE>throw new AccumuloSecurityException(principal, SecurityErrorCode.USER_EXISTS, e);<NEW_LINE>}<NEW_LINE>log.error("Failed to create user in ZooKeeper", e);<NEW_LINE>throw new AccumuloSecurityException(principal, SecurityErrorCode.CONNECTION_ERROR, e);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>log.error("Interrupted trying to create node for user", e);<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | getClass().getSimpleName()); |
583,016 | private static void doOpen(@Nonnull File _dir, @Nullable File _toSelect) throws IOException, ExecutionException {<NEW_LINE>String dir = FileUtil.toSystemDependentName(FileUtil.toCanonicalPath(_dir.getPath()));<NEW_LINE>String toSelect = _toSelect != null ? FileUtil.toSystemDependentName(FileUtil.toCanonicalPath(_toSelect.getPath())) : null;<NEW_LINE>if (SystemInfo.isWindows) {<NEW_LINE>String cmd = toSelect != null ? "explorer /select,\"" + shortPath(toSelect) + '"' : "explorer /root,\"" + shortPath(dir) + '"';<NEW_LINE>LOG.debug(cmd);<NEW_LINE>// no advanced quoting/escaping is needed<NEW_LINE>Process process = Runtime.getRuntime().exec(cmd);<NEW_LINE>new CapturingProcessHandler(process, null, cmd).runProcess().checkSuccess(LOG);<NEW_LINE>} else if (SystemInfo.isMac) {<NEW_LINE>GeneralCommandLine cmd = toSelect != null ? new GeneralCommandLine("open", "-R", toSelect) : new GeneralCommandLine("open", dir);<NEW_LINE>LOG.debug(cmd.toString());<NEW_LINE>ExecUtil.execAndGetOutput(cmd).checkSuccess(LOG);<NEW_LINE>} else if (fileManagerApp.getValue() != null) {<NEW_LINE>schedule(new GeneralCommandLine(fileManagerApp.getValue(), toSelect != null ? toSelect : dir));<NEW_LINE>} else if (SystemInfo.hasXdgOpen()) {<NEW_LINE>schedule(new GeneralCommandLine("xdg-open", dir));<NEW_LINE>} else if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {<NEW_LINE>LOG.<MASK><NEW_LINE>Desktop.getDesktop().open(new File(dir));<NEW_LINE>} else {<NEW_LINE>Messages.showErrorDialog("This action isn't supported on the current platform", "Cannot Open File");<NEW_LINE>}<NEW_LINE>} | debug("opening " + dir + " via desktop API"); |
1,665,091 | public void add(RetryMessage retryMessage) {<NEW_LINE>Objects.requireNonNull(retryMessage, "retryMessage");<NEW_LINE>if (!retryMessage.isRetryAvailable()) {<NEW_LINE>logger.warn("discard retry message({}).", retryMessage);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int retryCount = retryMessage.getRetryCount();<NEW_LINE>if (retryCount >= this.maxRetryCount) {<NEW_LINE>logger.<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final int queueSize = queue.size();<NEW_LINE>if (queueSize >= capacity) {<NEW_LINE>logger.warn("discard retry message. queueSize:{}", queueSize);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (queueSize >= halfCapacity && retryCount >= 1) {<NEW_LINE>logger.warn("discard retry message. retryCount:{}", retryCount);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final boolean offer = this.queue.offer(retryMessage);<NEW_LINE>if (!offer) {<NEW_LINE>logger.warn("offer() fail. discard retry message. retryCount:{}", retryCount);<NEW_LINE>}<NEW_LINE>} | warn("discard retry message({}). queue-maxRetryCount:{}", retryMessage, maxRetryCount); |
1,763,985 | public static MWMResponse extractFromIntent(@SuppressWarnings("unused") final Context context, final Intent intent) {<NEW_LINE>final MWMResponse response = new MWMResponse();<NEW_LINE>// parse point<NEW_LINE>final double lat = intent.<MASK><NEW_LINE>final double lon = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, INVALID_LL);<NEW_LINE>final String name = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME);<NEW_LINE>final String id = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID);<NEW_LINE>// parse additional info<NEW_LINE>response.mZoomLevel = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_ZOOM, 9);<NEW_LINE>if (lat != INVALID_LL && lon != INVALID_LL) {<NEW_LINE>response.mPoint = new MWMPoint(lat, lon, name, id);<NEW_LINE>} else {<NEW_LINE>response.mPoint = null;<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LAT, INVALID_LL); |
1,274,111 | public final void normalize() throws ReadOnlyException {<NEW_LINE>checkReadOnly();<NEW_LINE>try {<NEW_LINE>getChildNodes().getEventManager().setFirePolicy(TreeEventManager.FIRE_LATER);<NEW_LINE>for (int i = 0; true; i++) {<NEW_LINE>TreeChild child = item(i);<NEW_LINE>if (child instanceof TreeElement) {<NEW_LINE>((TreeElement) child).normalize();<NEW_LINE>} else if (child instanceof TreeText) {<NEW_LINE>while (true) {<NEW_LINE>TreeChild <MASK><NEW_LINE>if (child2 instanceof TreeText) {<NEW_LINE>try {<NEW_LINE>((TreeText) child).appendData(((TreeText) child2).getData());<NEW_LINE>removeChild(child2);<NEW_LINE>} catch (InvalidArgumentException exc) {<NEW_LINE>// from TreeText.appendChild : impossible because TreeText.getData<NEW_LINE>// get out from 'while (true)'<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// get out from 'while (true)'<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IndexOutOfBoundsException e) { | child2 = item(i + 1); |
600,530 | private void initFreeMarkerConfiguration(ScriptContext ctx) {<NEW_LINE>if (conf == null) {<NEW_LINE>synchronized (this) {<NEW_LINE>if (conf != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Object cfg = ctx.getAttribute(FREEMARKER_CONFIG);<NEW_LINE>if (cfg instanceof Configuration) {<NEW_LINE>conf = (Configuration) cfg;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Object tfo = ctx.getAttribute(FREEMARKER_TEMPLATE);<NEW_LINE>fo = tfo instanceof <MASK><NEW_LINE>Configuration tmpConf = new RsrcLoader(fo, ctx);<NEW_LINE>try {<NEW_LINE>initConfProps(tmpConf, ctx);<NEW_LINE>initTemplateDir(tmpConf, fo, ctx);<NEW_LINE>} catch (RuntimeException rexp) {<NEW_LINE>throw rexp;<NEW_LINE>} catch (Exception exp) {<NEW_LINE>throw new RuntimeException(exp);<NEW_LINE>}<NEW_LINE>conf = tmpConf;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | FileObject ? (FileObject) tfo : null; |
533,763 | public static DescribeImageGatewayConfigResponse unmarshall(DescribeImageGatewayConfigResponse describeImageGatewayConfigResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeImageGatewayConfigResponse.setRequestId(_ctx.stringValue("DescribeImageGatewayConfigResponse.RequestId"));<NEW_LINE>Imagegw imagegw = new Imagegw();<NEW_LINE>imagegw.setDefaultImageLocation(_ctx.stringValue("DescribeImageGatewayConfigResponse.Imagegw.DefaultImageLocation"));<NEW_LINE>imagegw.setPullUpdateTimeout(_ctx.longValue("DescribeImageGatewayConfigResponse.Imagegw.PullUpdateTimeout"));<NEW_LINE>imagegw.setMongoDBURI(_ctx.stringValue("DescribeImageGatewayConfigResponse.Imagegw.MongoDBURI"));<NEW_LINE>imagegw.setImageExpirationTimeout(_ctx.stringValue("DescribeImageGatewayConfigResponse.Imagegw.ImageExpirationTimeout"));<NEW_LINE>imagegw.setUpdateDateTime(_ctx.stringValue("DescribeImageGatewayConfigResponse.Imagegw.UpdateDateTime"));<NEW_LINE>List<LocationInfo> locations = new ArrayList<LocationInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeImageGatewayConfigResponse.Imagegw.Locations.Length"); i++) {<NEW_LINE>LocationInfo locationInfo = new LocationInfo();<NEW_LINE>locationInfo.setLocation(_ctx.stringValue("DescribeImageGatewayConfigResponse.Imagegw.Locations[" + i + "].Location"));<NEW_LINE>locationInfo.setRemoteType(_ctx.stringValue<MASK><NEW_LINE>locationInfo.setAuthentication(_ctx.stringValue("DescribeImageGatewayConfigResponse.Imagegw.Locations[" + i + "].Authentication"));<NEW_LINE>locationInfo.setURL(_ctx.stringValue("DescribeImageGatewayConfigResponse.Imagegw.Locations[" + i + "].URL"));<NEW_LINE>locations.add(locationInfo);<NEW_LINE>}<NEW_LINE>imagegw.setLocations(locations);<NEW_LINE>describeImageGatewayConfigResponse.setImagegw(imagegw);<NEW_LINE>return describeImageGatewayConfigResponse;<NEW_LINE>} | ("DescribeImageGatewayConfigResponse.Imagegw.Locations[" + i + "].RemoteType")); |
1,765,868 | final RegisterUsageResult executeRegisterUsage(RegisterUsageRequest registerUsageRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(registerUsageRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RegisterUsageRequest> request = null;<NEW_LINE>Response<RegisterUsageResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new RegisterUsageRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(registerUsageRequest));<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, "Marketplace Metering");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RegisterUsage");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RegisterUsageResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RegisterUsageResultJsonUnmarshaller());<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.startEvent(Field.RequestMarshallTime); |
1,308,966 | public boolean clear(int index, boolean send) {<NEW_LINE>if (this.slots.containsKey(index)) {<NEW_LINE>Item item = new ItemBlock(Block.get(BlockID<MASK><NEW_LINE>Item old = this.slots.get(index);<NEW_LINE>InventoryHolder holder = this.getHolder();<NEW_LINE>if (holder instanceof Entity) {<NEW_LINE>EntityInventoryChangeEvent ev = new EntityInventoryChangeEvent((Entity) holder, old, item, index);<NEW_LINE>Server.getInstance().getPluginManager().callEvent(ev);<NEW_LINE>if (ev.isCancelled()) {<NEW_LINE>this.sendSlot(index, this.getViewers());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>item = ev.getNewItem();<NEW_LINE>}<NEW_LINE>if (holder instanceof BlockEntity) {<NEW_LINE>((BlockEntity) holder).setDirty();<NEW_LINE>}<NEW_LINE>if (item.getId() != Item.AIR) {<NEW_LINE>this.slots.put(index, item.clone());<NEW_LINE>} else {<NEW_LINE>this.slots.remove(index);<NEW_LINE>}<NEW_LINE>this.onSlotChange(index, old, send);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .AIR), null, 0); |
682,771 | private static RouterFunction<?> routingFunction() {<NEW_LINE>return route(GET("/test"), serverRequest -> ok().body(fromValue("helloworld"))).andRoute(POST("/login"), serverRequest -> serverRequest.body(toFormData()).map(MultiValueMap::toSingleValueMap).map(formData -> {<NEW_LINE>System.out.println("form data: " + formData.toString());<NEW_LINE>if ("baeldung".equals(formData.get("user")) && "you_know_what_to_do".equals(formData.get("token"))) {<NEW_LINE>return ok().body(Mono.just("welcome back!"), String.class).block();<NEW_LINE>}<NEW_LINE>return ServerResponse.badRequest().build().block();<NEW_LINE>})).andRoute(POST("/upload"), serverRequest -> serverRequest.body(toDataBuffers()).collectList().map(dataBuffers -> {<NEW_LINE>AtomicLong atomicLong = new AtomicLong(0);<NEW_LINE>dataBuffers.forEach(d -> atomicLong.addAndGet(d.asByteBuffer().array().length));<NEW_LINE>System.out.println("data length:" + atomicLong.get());<NEW_LINE>return ok().body(fromValue(atomicLong.toString())).block();<NEW_LINE>})).and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))).andNest(path("/actor"), route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class).doOnNext(actors::add).then(ok().build()))).filter((request, next) -> {<NEW_LINE>System.out.println(<MASK><NEW_LINE>return next.handle(request);<NEW_LINE>});<NEW_LINE>} | "Before handler invocation: " + request.path()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.