idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
161,194 | private Iterator<CityVO> retrieveAllCities(final int adClientId, final int countryId, final int regionId) {<NEW_LINE>if (countryId <= 0) {<NEW_LINE>return Collections.emptyIterator();<NEW_LINE>}<NEW_LINE>final List<Object> sqlParams = new ArrayList<Object>();<NEW_LINE>final StringBuilder sql = new StringBuilder(<MASK><NEW_LINE>sqlParams.add(adClientId);<NEW_LINE>if (regionId > 0) {<NEW_LINE>sql.append(" AND cy.C_Region_ID=?");<NEW_LINE>sqlParams.add(regionId);<NEW_LINE>}<NEW_LINE>if (countryId > 0) {<NEW_LINE>sql.append(" AND COALESCE(cy.C_Country_ID, r.C_Country_ID)=?");<NEW_LINE>sqlParams.add(countryId);<NEW_LINE>}<NEW_LINE>sql.append(" ORDER BY cy.Name, r.Name");<NEW_LINE>return IteratorUtils.asIterator(new AbstractPreparedStatementBlindIterator<CityVO>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected PreparedStatement createPreparedStatement() throws SQLException {<NEW_LINE>final PreparedStatement pstmt = DB.prepareStatement(sql.toString(), ITrx.TRXNAME_None);<NEW_LINE>DB.setParameters(pstmt, sqlParams);<NEW_LINE>return pstmt;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected CityVO fetch(ResultSet rs) throws SQLException {<NEW_LINE>final CityVO vo = new CityVO(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getString(4));<NEW_LINE>return vo;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | "SELECT cy.C_City_ID, cy.Name, cy.C_Region_ID, r.Name" + " FROM C_City cy" + " LEFT OUTER JOIN C_Region r ON (r.C_Region_ID=cy.C_Region_ID)" + " WHERE cy.AD_Client_ID IN (0,?)"); |
960,998 | protected char[] resolvePath(char[] basePath, char[] relPath) throws URIException {<NEW_LINE>// REMINDME: paths are never null<NEW_LINE>String base = (basePath == null) ? "" : new String(basePath);<NEW_LINE>// _path could be empty<NEW_LINE>if (relPath == null || relPath.length == 0) {<NEW_LINE>return normalize(basePath);<NEW_LINE>} else if (relPath[0] == '/') {<NEW_LINE>return normalize(relPath);<NEW_LINE>} else {<NEW_LINE>int at = base.lastIndexOf('/');<NEW_LINE>if (at != -1) {<NEW_LINE>basePath = base.substring(0, at + 1).toCharArray();<NEW_LINE>}<NEW_LINE>StringBuilder buff = new StringBuilder(base.length() + relPath.length);<NEW_LINE>buff.append((at != -1) ? base.substring(0, at + 1) : "/");<NEW_LINE>buff.append(relPath);<NEW_LINE>return normalize(buff.<MASK><NEW_LINE>}<NEW_LINE>} | toString().toCharArray()); |
1,159,523 | public final void accept(Context<?> ctx) {<NEW_LINE>if (field.getDataType().isEmbeddable() && minValue.getDataType().isEmbeddable() && maxValue.getDataType().isEmbeddable()) {<NEW_LINE>RowN f = row(embeddedFields(field));<NEW_LINE>RowN min <MASK><NEW_LINE>RowN max = row(embeddedFields(maxValue));<NEW_LINE>ctx.visit(not ? symmetric ? f.notBetweenSymmetric(min).and(max) : f.notBetween(min).and(max) : symmetric ? f.betweenSymmetric(min).and(max) : f.between(min).and(max));<NEW_LINE>} else if (symmetric && NO_SUPPORT_SYMMETRIC.contains(ctx.dialect())) {<NEW_LINE>ctx.visit(not ? field.notBetween(minValue, maxValue).and(field.notBetween(maxValue, minValue)) : field.between(minValue, maxValue).or(field.between(maxValue, minValue)));<NEW_LINE>} else {<NEW_LINE>ctx.visit(field);<NEW_LINE>if (not)<NEW_LINE>ctx.sql(' ').visit(K_NOT);<NEW_LINE>ctx.sql(' ').visit(K_BETWEEN);<NEW_LINE>if (symmetric)<NEW_LINE>ctx.sql(' ').visit(K_SYMMETRIC);<NEW_LINE>ctx.sql(' ').visit(minValue);<NEW_LINE>ctx.sql(' ').visit(K_AND);<NEW_LINE>ctx.sql(' ').visit(maxValue);<NEW_LINE>}<NEW_LINE>} | = row(embeddedFields(minValue)); |
1,408,109 | public boolean isConnectedInDirection(LinkedDiGraphNode<N, E> source, Predicate<E> edgeFilter, LinkedDiGraphNode<N, E> dest) {<NEW_LINE>List<LinkedDiGraphEdge<N, E>> outEdges = source.getOutEdges();<NEW_LINE>int outEdgesLen = outEdges.size();<NEW_LINE>List<LinkedDiGraphEdge<N, E>> inEdges = dest.getInEdges();<NEW_LINE><MASK><NEW_LINE>// It is possible that there is a large asymmetry between the nodes, so pick the direction<NEW_LINE>// to search based on the shorter list since the edge lists should be symmetric.<NEW_LINE>if (outEdgesLen < inEdgesLen) {<NEW_LINE>for (DiGraphEdge<N, E> outEdge : outEdges) {<NEW_LINE>if (outEdge.getDestination() == dest && edgeFilter.apply(outEdge.getValue())) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (DiGraphEdge<N, E> inEdge : inEdges) {<NEW_LINE>if (inEdge.getSource() == source && edgeFilter.apply(inEdge.getValue())) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | int inEdgesLen = inEdges.size(); |
1,456,551 | private static double distance(double lat1, double lon1, double lat2, double lon2) {<NEW_LINE>// Radius of the earth<NEW_LINE>final int R = 6371;<NEW_LINE>Double latDistance = Math.toRadians(lat2 - lat1);<NEW_LINE>Double lonDistance = <MASK><NEW_LINE>Double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2);<NEW_LINE>Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));<NEW_LINE>// convert to meters<NEW_LINE>double distance = R * c * 1000;<NEW_LINE>distance = Math.pow(distance, 2);<NEW_LINE>return Math.sqrt(distance);<NEW_LINE>} | Math.toRadians(lon2 - lon1); |
1,417,233 | public static Trace trace(Client client, Shell shell, TraceRequest request, Listener listener) {<NEW_LINE>AtomicBoolean done = new AtomicBoolean();<NEW_LINE>GapidClient.StreamSender<Service.TraceRequest> sender = client.streamTrace(message -> {<NEW_LINE>Widgets.scheduleIfNotDisposed(shell, () <MASK><NEW_LINE>if (message.getStatus() == Service.TraceStatus.Done && done.compareAndSet(false, true)) {<NEW_LINE>return GapidClient.Result.DONE;<NEW_LINE>}<NEW_LINE>return GapidClient.Result.CONTINUE;<NEW_LINE>});<NEW_LINE>Rpc.listen(sender.getFuture(), new UiCallback<Void, Throwable>(shell, LOG) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected Throwable onRpcThread(Result<Void> result) {<NEW_LINE>done.set(true);<NEW_LINE>try {<NEW_LINE>result.get();<NEW_LINE>return null;<NEW_LINE>} catch (RpcException | ExecutionException e) {<NEW_LINE>return e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onUiThread(Throwable result) {<NEW_LINE>// Give some time for all the output to pump through.<NEW_LINE>Widgets.scheduleIfNotDisposed(shell, 500, () -> {<NEW_LINE>if (result == null) {<NEW_LINE>listener.onFinished();<NEW_LINE>} else {<NEW_LINE>listener.onFailure(result);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>sender.send(Service.TraceRequest.newBuilder().setInitialize(request.options).build());<NEW_LINE>return new Trace() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean start() {<NEW_LINE>return sendEvent(Service.TraceEvent.Begin);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean getStatus() {<NEW_LINE>return sendEvent(Service.TraceEvent.Status);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean stop() {<NEW_LINE>return sendEvent(Service.TraceEvent.Stop);<NEW_LINE>}<NEW_LINE><NEW_LINE>private boolean sendEvent(Service.TraceEvent event) {<NEW_LINE>if (done.get()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>sender.send(Service.TraceRequest.newBuilder().setQueryEvent(event).build());<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | -> listener.onProgress(message)); |
1,698,987 | public static void retrieveJaxWsFromResource(FileObject projectDir) throws IOException {<NEW_LINE>final // NOI18N<NEW_LINE>String // NOI18N<NEW_LINE>jaxWsContent = readResource(WSUtils<MASK><NEW_LINE>// NOI18N<NEW_LINE>final FileObject nbprojFo = projectDir.getFileObject("nbproject");<NEW_LINE>// NOI18N<NEW_LINE>assert nbprojFo != null : "Cannot find nbproject directory";<NEW_LINE>FileSystem fs = nbprojFo.getFileSystem();<NEW_LINE>fs.runAtomicAction(new FileSystem.AtomicAction() {<NEW_LINE><NEW_LINE>public void run() throws IOException {<NEW_LINE>// NOI18N<NEW_LINE>FileObject jaxWsFo = FileUtil.createData(nbprojFo, "jax-ws.xml");<NEW_LINE>FileLock lock = jaxWsFo.lock();<NEW_LINE>BufferedWriter bw = null;<NEW_LINE>try {<NEW_LINE>bw = new BufferedWriter(new OutputStreamWriter(jaxWsFo.getOutputStream(lock), StandardCharsets.UTF_8));<NEW_LINE>bw.write(jaxWsContent);<NEW_LINE>} finally {<NEW_LINE>lock.releaseLock();<NEW_LINE>if (bw != null) {<NEW_LINE>bw.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | .class.getResourceAsStream("/org/netbeans/modules/websvc/jaxwsmodel/resources/jax-ws.xml")); |
395,254 | public App updateAppInLocal(App app) {<NEW_LINE>String appId = app.getAppId();<NEW_LINE>App managedApp = appRepository.findByAppId(appId);<NEW_LINE>if (managedApp == null) {<NEW_LINE>throw new BadRequestException(String.format("App not exists. AppId = %s", appId));<NEW_LINE>}<NEW_LINE>managedApp.setName(app.getName());<NEW_LINE>managedApp.setOrgId(app.getOrgId());<NEW_LINE>managedApp.setOrgName(app.getOrgName());<NEW_LINE>String ownerName = app.getOwnerName();<NEW_LINE>UserInfo owner = userService.findByUserId(ownerName);<NEW_LINE>if (owner == null) {<NEW_LINE>throw new BadRequestException(String.format("App's owner not exists. owner = %s", ownerName));<NEW_LINE>}<NEW_LINE>managedApp.setOwnerName(owner.getUserId());<NEW_LINE>managedApp.<MASK><NEW_LINE>String operator = userInfoHolder.getUser().getUserId();<NEW_LINE>managedApp.setDataChangeLastModifiedBy(operator);<NEW_LINE>return appRepository.save(managedApp);<NEW_LINE>} | setOwnerEmail(owner.getEmail()); |
178,067 | public void endElement() {<NEW_LINE>super.endElement();<NEW_LINE>XMLElement e = parser.getCurrentElement();<NEW_LINE>String name = e.getName();<NEW_LINE>if (openElements == 0 && (name.equals("html") || name.equals("svg"))) {<NEW_LINE>checkProperties();<NEW_LINE>} else if (name.equals("object")) {<NEW_LINE>imbricatedObjects--;<NEW_LINE>if (imbricatedObjects == 0 && imbricatedCanvases == 0) {<NEW_LINE>checkFallback("Object");<NEW_LINE>}<NEW_LINE>} else if (name.equals("canvas")) {<NEW_LINE>imbricatedCanvases--;<NEW_LINE>if (imbricatedObjects == 0 && imbricatedCanvases == 0) {<NEW_LINE>checkFallback("Canvas");<NEW_LINE>}<NEW_LINE>} else if (name.equals("video")) {<NEW_LINE>if (imbricatedObjects == 0 && imbricatedCanvases == 0) {<NEW_LINE>checkFallback("Video");<NEW_LINE>}<NEW_LINE>inVideo = false;<NEW_LINE>} else if (name.equals("audio")) {<NEW_LINE>if (imbricatedObjects == 0 && imbricatedCanvases == 0) {<NEW_LINE>checkFallback("Audio");<NEW_LINE>}<NEW_LINE>inAudio = false;<NEW_LINE>} else if (name.equals("a")) {<NEW_LINE>if (anchorNeedsText) {<NEW_LINE>report.message(MessageId.ACC_004, EPUBLocation.create(path, parser.getLineNumber(), parser<MASK><NEW_LINE>anchorNeedsText = false;<NEW_LINE>}<NEW_LINE>if ((inSvg || context.mimeType.equals("image/svg+xml")) && !hasTitle) {<NEW_LINE>report.message(MessageId.ACC_011, EPUBLocation.create(path, parser.getLineNumber(), parser.getColumnNumber(), e.getName()));<NEW_LINE>}<NEW_LINE>} else if (name.equals("math")) {<NEW_LINE>inMathML = false;<NEW_LINE>if (!hasAltorAnnotation) {<NEW_LINE>report.message(MessageId.ACC_009, EPUBLocation.create(path, parser.getLineNumber(), parser.getColumnNumber(), "math"));<NEW_LINE>}<NEW_LINE>} else if (name.equals("nav") && inRegionBasedNav) {<NEW_LINE>inRegionBasedNav = false;<NEW_LINE>} else if (name.equals("picture")) {<NEW_LINE>inPicture = false;<NEW_LINE>} else if (name.equals("svg")) {<NEW_LINE>inSvg = false;<NEW_LINE>}<NEW_LINE>} | .getColumnNumber(), "a")); |
1,349,479 | public void startImport(View view) {<NEW_LINE>String fileName = trimFileName(mEditText.<MASK><NEW_LINE>// Step 1 check for suffixes.<NEW_LINE>if (!isFileNameValid(fileName)) {<NEW_LINE>Toast.makeText(this, getText(R.string.import_control_invalid_name), Toast.LENGTH_SHORT).show();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!mIsFileVerified) {<NEW_LINE>Toast.makeText(this, getText(R.string.import_control_verifying_file), Toast.LENGTH_LONG).show();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>new File(Tools.CTRLMAP_PATH + "/TMP_IMPORT_FILE.json").renameTo(new File(Tools.CTRLMAP_PATH + "/" + fileName + ".json"));<NEW_LINE>Toast.makeText(getApplicationContext(), getText(R.string.import_control_done), Toast.LENGTH_SHORT).show();<NEW_LINE>finishAndRemoveTask();<NEW_LINE>} | getText().toString()); |
339,810 | public Object inject(HttpRequest request, HttpResponse response, boolean unwrapAsync) {<NEW_LINE>// Liberty change start<NEW_LINE>MultivaluedMap<String, String> decodedFormParams = request.getDecodedFormParameters();<NEW_LINE>MediaType mediaType = request.getHttpHeaders().getMediaType();<NEW_LINE>if (String.class.equals(type) && mediaType != null && mediaType.getType().equalsIgnoreCase("multipart")) {<NEW_LINE>MultivaluedMap<String, String> formParams = request.getFormParameters();<NEW_LINE>if (formParams == null || formParams.size() < 1) {<NEW_LINE>try {<NEW_LINE>Type genericType = (new ArrayList<IAttachment>() {<NEW_LINE>}).getClass().getGenericSuperclass();<NEW_LINE>MessageBodyReader<Object> mbr = (MessageBodyReader<Object>) factory.getMessageBodyReader((Class) List.class, baseGenericType, annotations, mediaType);<NEW_LINE>List<IAttachment> list = (List<IAttachment>) mbr.readFrom((Class) List.class, genericType, annotations, mediaType, request.getHttpHeaders().getRequestHeaders(), request.getInputStream());<NEW_LINE>for (IAttachment att : list) {<NEW_LINE>IAttachmentImpl impl = (IAttachmentImpl) att;<NEW_LINE>decodedFormParams.putSingle(impl.getFieldName(), impl.getBodyAsString());<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<String> list = decodedFormParams.get(paramName);<NEW_LINE>// Liberty change end<NEW_LINE>if (list != null && encode) {<NEW_LINE>List<String> encodedList = new ArrayList<String>();<NEW_LINE>for (String s : list) {<NEW_LINE>encodedList.add<MASK><NEW_LINE>}<NEW_LINE>list = encodedList;<NEW_LINE>}<NEW_LINE>return extractValues(list);<NEW_LINE>} | (Encode.encodeString(s)); |
313,678 | void displayDefaultValues() {<NEW_LINE><MASK><NEW_LINE>System.out.println("failureRateThreshold = " + config.getFailureRateThreshold());<NEW_LINE>System.out.println("minimumNumberOfCalls = " + config.getMinimumNumberOfCalls());<NEW_LINE>System.out.println("permittedNumberOfCallsInHalfOpenState = " + config.getPermittedNumberOfCallsInHalfOpenState());<NEW_LINE>System.out.println("maxWaitDurationInHalfOpenState = " + config.getMaxWaitDurationInHalfOpenState());<NEW_LINE>System.out.println("slidingWindowSize = " + config.getSlidingWindowSize());<NEW_LINE>System.out.println("slidingWindowType = " + config.getSlidingWindowType());<NEW_LINE>System.out.println("slowCallRateThreshold = " + config.getSlowCallRateThreshold());<NEW_LINE>System.out.println("slowCallDurationThreshold = " + config.getSlowCallDurationThreshold());<NEW_LINE>System.out.println("automaticTransitionFromOpenToHalfOpenEnabled = " + config.isAutomaticTransitionFromOpenToHalfOpenEnabled());<NEW_LINE>System.out.println("writableStackTraceEnabled = " + config.isWritableStackTraceEnabled());<NEW_LINE>} | CircuitBreakerConfig config = CircuitBreakerConfig.ofDefaults(); |
1,027,877 | public void queueIncomingDataEvent(SipMessageByteBuffer buffer, SIPConnection source) {<NEW_LINE>if (source == null) {<NEW_LINE>throw new IllegalArgumentException("queueIncomingDataEvent: source is null!");<NEW_LINE>}<NEW_LINE>if (m_threads == null) {<NEW_LINE>if (s_logger.isTraceDebugEnabled()) {<NEW_LINE>int len = buffer.getMarkedBytesNumber();<NEW_LINE>StringBuffer msg = new StringBuffer();<NEW_LINE>msg.append('[');<NEW_LINE>msg.append(len);<NEW_LINE>msg.append("] bytes received from [");<NEW_LINE>msg.append(source.toString());<NEW_LINE>msg.append("]\n");<NEW_LINE>boolean hide = SIPTransactionStack.instance().getConfiguration().hideAnything();<NEW_LINE>if (hide) {<NEW_LINE>msg.append("<raw packet is hidden>");<NEW_LINE>} else {<NEW_LINE>Debug.hexDump(buffer.getBytes(), 0, len, msg);<NEW_LINE>}<NEW_LINE>s_logger.traceDebug(msg.toString());<NEW_LINE>}<NEW_LINE>TransportCommLayerMgr.instance(<MASK><NEW_LINE>} else {<NEW_LINE>Event event = new IncomingDataEvent(buffer, source);<NEW_LINE>queue(event);<NEW_LINE>}<NEW_LINE>} | ).onRead(buffer, source); |
1,300,391 | public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) {<NEW_LINE>// Switch the current policy and compilation result for this unit to the requested one.<NEW_LINE>CompilationResult unitResult = new CompilationResult(sourceUnit, 1, 1, this.options.maxProblemsPerUnit);<NEW_LINE>try {<NEW_LINE>CompilationUnitDeclaration parsedUnit = basicParser().dietParse(sourceUnit, unitResult);<NEW_LINE>this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction);<NEW_LINE>this.lookupEnvironment.completeTypeBindings(parsedUnit, true);<NEW_LINE>} catch (AbortCompilationUnit e) {<NEW_LINE>// at this point, currentCompilationUnitResult may not be sourceUnit, but some other<NEW_LINE>// one requested further along to resolve sourceUnit.<NEW_LINE>if (unitResult.compilationUnit == sourceUnit) {<NEW_LINE>// only report once<NEW_LINE>// requestor.acceptResult(unitResult.tagAsAccepted());<NEW_LINE>} else {<NEW_LINE>// want to abort enclosing request to compile<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Display unit error in debug mode<NEW_LINE>if (BasicSearchEngine.VERBOSE) {<NEW_LINE>if (unitResult.problemCount > 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | System.out.println(unitResult); |
524,964 | protected void buildTopInternal(View view) {<NEW_LINE>buildDescription(view);<NEW_LINE>if (showLocalTransportRoutes()) {<NEW_LINE>buildRow(view, 0, null, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false, false), false, 0, false, null, true);<NEW_LINE>}<NEW_LINE>if (showNearbyTransportRoutes()) {<NEW_LINE>CollapsableView collapsableView = getCollapsableTransportStopRoutesView(view.getContext(), false, true);<NEW_LINE>String routesWithingDistance = app.getString(R.string.transport_nearby_routes_within) + " " + OsmAndFormatter.<MASK><NEW_LINE>buildRow(view, 0, null, routesWithingDistance, 0, true, collapsableView, false, 0, false, null, true);<NEW_LINE>}<NEW_LINE>} | getFormattedDistance(TransportStopController.SHOW_STOPS_RADIUS_METERS, app); |
1,013,765 | public ConfigManager putObject(@NonNull String key, @NonNull Object v) {<NEW_LINE>if (v == null || key == null) {<NEW_LINE>throw new NullPointerException("null key/value not allowed");<NEW_LINE>}<NEW_LINE>if (v instanceof Float || v instanceof Double) {<NEW_LINE>putFloat(key, ((Number) v).floatValue());<NEW_LINE>} else if (v instanceof Long) {<NEW_LINE>putLong(key, (long) v);<NEW_LINE>} else if (v instanceof Integer) {<NEW_LINE>putInt(key, (int) v);<NEW_LINE>} else if (v instanceof Boolean) {<NEW_LINE>putBoolean(key, (boolean) v);<NEW_LINE>} else if (v instanceof String) {<NEW_LINE>putString(key, (String) v);<NEW_LINE>} else if (v instanceof Set) {<NEW_LINE>putStringSet(key, (Set<String>) v);<NEW_LINE>} else if (v instanceof byte[]) {<NEW_LINE>putBytes(key, (byte[]) v);<NEW_LINE>} else if (v instanceof String[]) {<NEW_LINE>HashSet<String> set = new HashSet<>(((String<MASK><NEW_LINE>Collections.addAll(set, (String[]) v);<NEW_LINE>putStringSet(key, set);<NEW_LINE>} else if (v instanceof Serializable) {<NEW_LINE>try {<NEW_LINE>ByteArrayOutputStream outputStream = new ByteArrayOutputStream();<NEW_LINE>ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);<NEW_LINE>objectOutputStream.writeObject(v);<NEW_LINE>mmkv.putBytes(key, outputStream.toByteArray());<NEW_LINE>mmkv.putInt(key.concat(TYPE_SUFFIX), TYPE_SERIALIZABLE);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mmkv.putString(key, new Gson().toJson(v));<NEW_LINE>mmkv.putInt(key.concat(TYPE_SUFFIX), TYPE_JSON);<NEW_LINE>mmkv.putString(key.concat(CLASS_SUFFIX), v.getClass().getName());<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | []) v).length); |
1,752,905 | // invokes all methods starting with "test"<NEW_LINE>public void run() {<NEW_LINE>Util.TRACE_ENTRY();<NEW_LINE>String className = this.getClass().getCanonicalName();<NEW_LINE>String methodName = "";<NEW_LINE>String testToRun = System.getProperty("fat.test.method.name", "");<NEW_LINE>Util.TRACE("fat.test.method.name=" + testToRun);<NEW_LINE>try {<NEW_LINE>setup();<NEW_LINE>} catch (Exception e) {<NEW_LINE>Util.LOG("FAT0001E: Client setup failed." + Util.LS, e);<NEW_LINE>Util.TRACE_EXIT();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Util.CODEPATH();<NEW_LINE>for (Method m : this.getClass().getDeclaredMethods()) {<NEW_LINE>methodName = m.getName();<NEW_LINE>boolean testMethod = m.isAnnotationPresent(ClientTest.class);<NEW_LINE>Util.TRACE("methodName=" + methodName + ",isAnnotationPresent(ClientTest.class)=" + testMethod);<NEW_LINE>if (true == testMethod && (0 == testToRun.length() || methodName.equals(testToRun))) {<NEW_LINE>try {<NEW_LINE>// trace entry on behalf of the called method<NEW_LINE>Util.getLogger().entering(className, methodName);<NEW_LINE>m.invoke(this, null);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (t instanceof java.lang.reflect.InvocationTargetException)<NEW_LINE>t = t.getCause();<NEW_LINE>StackTraceElement[] elem = t.getStackTrace();<NEW_LINE>String where = (null == elem || 0 == elem.length ? "" : " at " + elem[0].getFileName() + ":" + elem<MASK><NEW_LINE>Util.LOG("Test '" + methodName + "' failed" + where + " with an exception: " + t.toString());<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>t.printStackTrace(new PrintWriter(stringWriter));<NEW_LINE>Util.LOG(stringWriter);<NEW_LINE>} finally {<NEW_LINE>// trace entry on behalf of the called method<NEW_LINE>Util.getLogger().exiting(className, methodName);<NEW_LINE>}<NEW_LINE>// no point continuing unless we're running multiple methods<NEW_LINE>if (0 != testToRun.length())<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Util.TRACE_EXIT();<NEW_LINE>} | [0].getLineNumber()); |
316,127 | private void loadNode614() {<NEW_LINE>BaseDataVariableTypeNode node = new BaseDataVariableTypeNode(this.context, Identifiers.SubscriptionDiagnosticsType_TransferRequestCount, new QualifiedName(0, "TransferRequestCount"), new LocalizedText("en", "TransferRequestCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.UInt32, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.SubscriptionDiagnosticsType_TransferRequestCount, Identifiers.HasTypeDefinition, Identifiers.BaseDataVariableType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.SubscriptionDiagnosticsType_TransferRequestCount, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.SubscriptionDiagnosticsType_TransferRequestCount, Identifiers.HasComponent, Identifiers.SubscriptionDiagnosticsType<MASK><NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), false)); |
916,092 | public static EntryLogMetadataRecyclable deserialize(DataInputStream in) throws IOException {<NEW_LINE>EntryLogMetadataRecyclable metadata = EntryLogMetadataRecyclable.get();<NEW_LINE>try {<NEW_LINE>short serVersion = in.readShort();<NEW_LINE>if ((serVersion != DEFAULT_SERIALIZATION_VERSION)) {<NEW_LINE>throw new IOException(String.format("%s. expected =%d, found=%d", "serialization version doesn't match", DEFAULT_SERIALIZATION_VERSION, serVersion));<NEW_LINE>}<NEW_LINE>metadata.entryLogId = in.readLong();<NEW_LINE>metadata.totalSize = in.readLong();<NEW_LINE>metadata.remainingSize = in.readLong();<NEW_LINE>long ledgersMapSize = in.readLong();<NEW_LINE>for (int i = 0; i < ledgersMapSize; i++) {<NEW_LINE>long ledgerId = in.readLong();<NEW_LINE>long entryId = in.readLong();<NEW_LINE>metadata.<MASK><NEW_LINE>}<NEW_LINE>return metadata;<NEW_LINE>} catch (IOException e) {<NEW_LINE>metadata.recycle();<NEW_LINE>throw e;<NEW_LINE>} catch (Exception e) {<NEW_LINE>metadata.recycle();<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>} | ledgersMap.put(ledgerId, entryId); |
1,503,541 | private void validateResponse(HttpResponse response) throws IOException {<NEW_LINE>StatusLine status = response.getStatusLine();<NEW_LINE>if (status.getStatusCode() >= 400) {<NEW_LINE>String messagePrefix = String.format("The server returned status code %d. Possible reasons include:", status.getStatusCode());<NEW_LINE>List<String> reasons = Arrays.asList("This agent has been deleted from the configuration", "This agent is pending approval", "There is possibly a reverse proxy (or load balancer) that has been misconfigured. See " + docsUrl("/installation/configure-reverse-proxy.html#agents-and-reverse-proxies") + " for details.");<NEW_LINE>String delimiter = "\n - ";<NEW_LINE>throw new ClientProtocolException(messagePrefix + delimiter + String.join(delimiter, reasons));<NEW_LINE>}<NEW_LINE>if (status.getStatusCode() >= 300) {<NEW_LINE>throw new NoHttpResponseException("Did not receive successful HTTP response: status code = " + status.getStatusCode() + ", status message = [" + <MASK><NEW_LINE>}<NEW_LINE>} | status.getReasonPhrase() + "]"); |
1,644,266 | private void bidiCommit() {<NEW_LINE>int xLocation = getX();<NEW_LINE>BidiLevelNode root = new BidiLevelNode();<NEW_LINE>List branches = new ArrayList();<NEW_LINE>// branches does not include this LineRoot; all the non-leaf child<NEW_LINE>// fragments of a<NEW_LINE>// parent will be listed before the parent itself in this list<NEW_LINE><MASK><NEW_LINE>List result = new ArrayList();<NEW_LINE>root.emit(result);<NEW_LINE>int i = isMirrored ? result.size() - 1 : 0;<NEW_LINE>while (i >= 0 && i < result.size()) {<NEW_LINE>FlowBox box = (FlowBox) result.get(i);<NEW_LINE>box.setX(xLocation);<NEW_LINE>xLocation += box.getWidth();<NEW_LINE>i += isMirrored ? -1 : 1;<NEW_LINE>}<NEW_LINE>// set the bounds of the composite boxes, and break overlapping ones<NEW_LINE>// into two<NEW_LINE>layoutNestedLines(branches);<NEW_LINE>} | buildBidiTree(this, root, branches); |
1,491,801 | public Object apply(final ActionContext ctx, final Object caller, final Object[] sources) throws FrameworkException {<NEW_LINE>try {<NEW_LINE>assertArrayHasMinLengthAndMaxLengthAndAllElementsNotNull(sources, 2, 3);<NEW_LINE>final Object source = sources[0];<NEW_LINE>final Object target = sources[1];<NEW_LINE>final Boolean overwrite = (sources.length == 3 && Boolean.TRUE.<MASK><NEW_LINE>if (source instanceof NodeInterface && target instanceof NodeInterface) {<NEW_LINE>final NodeInterface sourceNode = (NodeInterface) source;<NEW_LINE>final NodeInterface targetNode = (NodeInterface) target;<NEW_LINE>for (final Security security : sourceNode.getIncomingRelationships(Security.class)) {<NEW_LINE>final Set<Permission> permissions = new HashSet();<NEW_LINE>final Principal principal = security.getSourceNode();<NEW_LINE>for (final String perm : security.getPermissions()) {<NEW_LINE>permissions.add(Permissions.valueOf(perm));<NEW_LINE>}<NEW_LINE>if (overwrite) {<NEW_LINE>targetNode.setAllowed(permissions, principal, ctx.getSecurityContext());<NEW_LINE>} else {<NEW_LINE>targetNode.grant(permissions, principal, ctx.getSecurityContext());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logParameterError(caller, sources, ctx.isJavaScriptContext());<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>logParameterError(caller, sources, e.getMessage(), ctx.isJavaScriptContext());<NEW_LINE>return usage(ctx.isJavaScriptContext());<NEW_LINE>}<NEW_LINE>} | equals(sources[2])); |
1,037,153 | private static void writeSpine(EpubBook book, EpubWriter epubWriter, XmlSerializer serializer) throws IllegalArgumentException, IllegalStateException, IOException {<NEW_LINE>serializer.startTag(NAMESPACE_OPF, OPFTags.spine);<NEW_LINE>Resource tocResource = book.getSpine().getTocResource();<NEW_LINE><MASK><NEW_LINE>serializer.attribute(EpubWriter.EMPTY_NAMESPACE_PREFIX, OPFAttributes.toc, tocResourceId);<NEW_LINE>if (// there is a cover page<NEW_LINE>book.getCoverPage() != null && book.getSpine().findFirstResourceById(book.getCoverPage().getId()) < 0) {<NEW_LINE>// cover page is not already in the spine<NEW_LINE>// write the cover html file<NEW_LINE>serializer.startTag(NAMESPACE_OPF, OPFTags.itemref);<NEW_LINE>serializer.attribute(EpubWriter.EMPTY_NAMESPACE_PREFIX, OPFAttributes.idref, book.getCoverPage().getId());<NEW_LINE>serializer.attribute(EpubWriter.EMPTY_NAMESPACE_PREFIX, OPFAttributes.linear, "no");<NEW_LINE>serializer.endTag(NAMESPACE_OPF, OPFTags.itemref);<NEW_LINE>}<NEW_LINE>writeSpineItems(book.getSpine(), serializer);<NEW_LINE>serializer.endTag(NAMESPACE_OPF, OPFTags.spine);<NEW_LINE>} | String tocResourceId = tocResource.getId(); |
377,942 | private void initEventMessageClass() {<NEW_LINE>String messageType = MessageType.event.name();<NEW_LINE>EventType[] eventTypes = new EventType[] { EventType.subscribe, EventType.unsubscribe };<NEW_LINE>for (EventType eventType : eventTypes) {<NEW_LINE>messageClassMap.put(new WeixinMessageKey(messageType, eventType.name(), AccountType.MP), ScribeEventMessage.class);<NEW_LINE>}<NEW_LINE>for (EventType eventType : eventTypes) {<NEW_LINE>messageClassMap.put(new WeixinMessageKey(messageType, eventType.name(), AccountType.QY), ScribeEventMessage.class);<NEW_LINE>}<NEW_LINE>for (AccountType accountType : AccountType.values()) {<NEW_LINE>messageClassMap.put(new WeixinMessageKey(messageType, EventType.location.name(), accountType), LocationEventMessage.class);<NEW_LINE>messageClassMap.put(new WeixinMessageKey(messageType, EventType.location_select.name(), accountType), MenuLocationEventMessage.class);<NEW_LINE>for (EventType eventType : new EventType[] { EventType.click, EventType.view }) {<NEW_LINE>messageClassMap.put(new WeixinMessageKey(messageType, eventType.name(), accountType), MenuEventMessage.class);<NEW_LINE>}<NEW_LINE>for (EventType eventType : new EventType[] { EventType.scancode_push, EventType.scancode_waitmsg }) {<NEW_LINE>messageClassMap.put(new WeixinMessageKey(messageType, eventType.name(), accountType), MenuScanEventMessage.class);<NEW_LINE>}<NEW_LINE>for (EventType eventType : new EventType[] { EventType.pic_sysphoto, EventType.pic_photo_or_album, EventType.pic_weixin }) {<NEW_LINE>messageClassMap.put(new WeixinMessageKey(messageType, eventType.name()<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , accountType), MenuPhotoEventMessage.class); |
1,173,873 | protected ElasticSearchIndexMetadata convertMetadata(String index, ImmutableOpenMap<String, ?> metaData) {<NEW_LINE>MappingMetadata mappingMetadata;<NEW_LINE>Object properties = null;<NEW_LINE>if (metaData.containsKey("properties")) {<NEW_LINE>Object res = metaData.get("properties");<NEW_LINE>if (res instanceof MappingMetadata) {<NEW_LINE>mappingMetadata = ((MappingMetadata) res);<NEW_LINE>} else if (res instanceof CompressedXContent) {<NEW_LINE>mappingMetadata = new MappingMetadata(((CompressedXContent) res));<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("unsupported index metadata" + metaData);<NEW_LINE>}<NEW_LINE>properties = mappingMetadata.sourceAsMap();<NEW_LINE>} else {<NEW_LINE>Object res;<NEW_LINE>if (metaData.size() == 1) {<NEW_LINE>res = metaData.values().iterator().next().value;<NEW_LINE>} else {<NEW_LINE>res = metaData.get("_doc");<NEW_LINE>}<NEW_LINE>if (res instanceof MappingMetadata) {<NEW_LINE>mappingMetadata = ((MappingMetadata) res);<NEW_LINE>} else if (res instanceof CompressedXContent) {<NEW_LINE>mappingMetadata = new MappingMetadata(((CompressedXContent) res));<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("unsupported index metadata" + metaData);<NEW_LINE>}<NEW_LINE>properties = mappingMetadata.<MASK><NEW_LINE>}<NEW_LINE>if (properties == null) {<NEW_LINE>throw new UnsupportedOperationException("unsupported index metadata" + metaData);<NEW_LINE>}<NEW_LINE>return new DefaultElasticSearchIndexMetadata(index, convertProperties(properties));<NEW_LINE>} | getSourceAsMap().get("properties"); |
324,863 | public boolean apply(Game game, Ability source) {<NEW_LINE>Permanent permanent = getTargetPointer(<MASK><NEW_LINE>if (permanent != null) {<NEW_LINE>Player player = game.getPlayer(permanent.getControllerId());<NEW_LINE>if (player != null) {<NEW_LINE>Library library = player.getLibrary();<NEW_LINE>if (library.hasCards()) {<NEW_LINE>Cards cards = new CardsImpl();<NEW_LINE>Card toBattlefield = null;<NEW_LINE>for (Card card : library.getCards(game)) {<NEW_LINE>cards.add(card);<NEW_LINE>if (card.isCreature(game)) {<NEW_LINE>toBattlefield = card;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (toBattlefield != null) {<NEW_LINE>player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);<NEW_LINE>}<NEW_LINE>player.revealCards(source, cards, game);<NEW_LINE>cards.remove(toBattlefield);<NEW_LINE>if (!cards.isEmpty()) {<NEW_LINE>player.shuffleLibrary(source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ).getFirstTargetPermanentOrLKI(game, source); |
1,684,330 | public void on_data_available(DataReader dataReader) {<NEW_LINE>MessagePayloadDataReader reader = MessagePayloadDataReaderHelper.narrow(dataReader);<NEW_LINE>MessagePayloadSeqHolder payloads = new MessagePayloadSeqHolder(new MessagePayload[0]);<NEW_LINE>SampleInfoSeqHolder infos = new SampleInfoSeqHolder(new SampleInfo[0]);<NEW_LINE>if (!readOneSample(reader, payloads, infos))<NEW_LINE>return;<NEW_LINE>int length = payloads.value.length;<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>MessagePayload messagePayload = payloads.value[i];<NEW_LINE>SampleInfo sampleInfo = infos.value[i];<NEW_LINE>int handle = sampleInfo.instance_handle;<NEW_LINE>AbstractMessageImpl message = <MASK><NEW_LINE>try {<NEW_LINE>if (consumer.isDurableAcknowledged(message))<NEW_LINE>continue;<NEW_LINE>} catch (JMSException e) {<NEW_LINE>throw new IllegalStateException(e);<NEW_LINE>}<NEW_LINE>DataReaderHandlePair dataReaderHandlePair = new DataReaderHandlePair(reader, handle);<NEW_LINE>sessionImpl.getMessageDeliveryExecutor().execute(new MessageDispatcher(message, dataReaderHandlePair, consumer, sessionImpl));<NEW_LINE>}<NEW_LINE>} | buildMessageFromPayload(messagePayload, handle, sessionImpl); |
134,470 | List<VcapPojo> parseVcapService(String vcapServices) {<NEW_LINE>final List<VcapPojo> results = new ArrayList<>();<NEW_LINE>log("VcapParser.parse: vcapServices = " + vcapServices);<NEW_LINE>if (StringUtils.hasText(vcapServices)) {<NEW_LINE>try {<NEW_LINE>final JsonParser parser = JsonParserFactory.getJsonParser();<NEW_LINE>final Map<String, Object> servicesMap = parser.parseMap(vcapServices);<NEW_LINE>final Set<Map.Entry<String, Object>> services = servicesMap.entrySet();<NEW_LINE>Assert.notNull(services, "Services entrySet cannot be null.");<NEW_LINE>for (final Map.Entry<String, Object> serviceEntry : services) {<NEW_LINE>final String name = serviceEntry.getKey();<NEW_LINE>if (name.startsWith(AZURE) || USER_PROVIDED.equals(name)) {<NEW_LINE>Assert.isInstanceOf(List.class, serviceEntry.getValue());<NEW_LINE>final List<VcapServiceConfig> azureServices = <MASK><NEW_LINE>results.addAll(azureServices.stream().map(service -> parseService(name, service, vcapServices)).filter(Objects::nonNull).collect(Collectors.toList()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (JsonParseException e) {<NEW_LINE>LOGGER.error("Error parsing " + vcapServices, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | getVcapServiceConfigList(serviceEntry.getValue()); |
1,308,900 | public static void main(String[] args) {<NEW_LINE>if (args.length == 0) {<NEW_LINE>Options.help(true);<NEW_LINE>}<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>List<String> files = null;<NEW_LINE>Options options = new Options();<NEW_LINE>try {<NEW_LINE>files = options.load(args);<NEW_LINE>if (files.isEmpty()) {<NEW_LINE>Options.usage("no source files");<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>ErrorUtil.error(e.getMessage());<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>run(files, options);<NEW_LINE>TimingLevel timingLevel = options.timingLevel();<NEW_LINE>if (timingLevel == TimingLevel.TOTAL || timingLevel == TimingLevel.ALL) {<NEW_LINE>System.out.printf("j2objc execution time: %d ms\n", System.currentTimeMillis() - startTime);<NEW_LINE>}<NEW_LINE>// Run last, since it calls System.exit() with the number of errors.<NEW_LINE><MASK><NEW_LINE>} | checkErrors(options.treatWarningsAsErrors()); |
121,471 | protected BackupTaskResult doInBackground() {<NEW_LINE>boolean success = true;<NEW_LINE>String decryptedString = "";<NEW_LINE>try {<NEW_LINE>byte[] data = StorageAccessHelper.loadFile(applicationContext, uri);<NEW_LINE>if (oldFormat) {<NEW_LINE>SecretKey key = EncryptionHelper.generateSymmetricKeyFromPassword(password);<NEW_LINE>byte[] decrypted = EncryptionHelper.decrypt(key, data);<NEW_LINE>decryptedString = new String(decrypted, StandardCharsets.UTF_8);<NEW_LINE>} else {<NEW_LINE>byte[] iterBytes = Arrays.copyOfRange(<MASK><NEW_LINE>byte[] salt = Arrays.copyOfRange(data, Constants.INT_LENGTH, Constants.INT_LENGTH + Constants.ENCRYPTION_IV_LENGTH);<NEW_LINE>byte[] encrypted = Arrays.copyOfRange(data, Constants.INT_LENGTH + Constants.ENCRYPTION_IV_LENGTH, data.length);<NEW_LINE>int iter = ByteBuffer.wrap(iterBytes).getInt();<NEW_LINE>SecretKey key = EncryptionHelper.generateSymmetricKeyPBKDF2(password, iter, salt);<NEW_LINE>byte[] decrypted = EncryptionHelper.decrypt(key, encrypted);<NEW_LINE>decryptedString = new String(decrypted, StandardCharsets.UTF_8);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>success = false;<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>if (success) {<NEW_LINE>return BackupTaskResult.success(BackupTaskResult.ResultType.RESTORE, decryptedString);<NEW_LINE>} else {<NEW_LINE>return BackupTaskResult.failure(BackupTaskResult.ResultType.RESTORE, R.string.backup_toast_import_decryption_failed);<NEW_LINE>}<NEW_LINE>} | data, 0, Constants.INT_LENGTH); |
693,427 | private static TreePath findMatchedChild(@Nonnull TreeModel model, @Nonnull TreePath treePath, @Nonnull PathElement pathElement) {<NEW_LINE>Object parent = treePath.getLastPathComponent();<NEW_LINE>int childCount = model.getChildCount(parent);<NEW_LINE>if (childCount <= 0)<NEW_LINE>return null;<NEW_LINE>boolean idMatchedFound = false;<NEW_LINE>Object idMatchedChild = null;<NEW_LINE>for (int j = 0; j < childCount; j++) {<NEW_LINE>Object child = <MASK><NEW_LINE>Match match = pathElement.getMatchTo(child);<NEW_LINE>if (match == Match.OBJECT) {<NEW_LINE>return treePath.pathByAddingChild(child);<NEW_LINE>}<NEW_LINE>if (match == Match.ID_TYPE && !idMatchedFound) {<NEW_LINE>idMatchedChild = child;<NEW_LINE>idMatchedFound = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (idMatchedFound) {<NEW_LINE>return treePath.pathByAddingChild(idMatchedChild);<NEW_LINE>}<NEW_LINE>int index = Math.max(0, Math.min(pathElement.index, childCount - 1));<NEW_LINE>Object child = model.getChild(parent, index);<NEW_LINE>return treePath.pathByAddingChild(child);<NEW_LINE>} | model.getChild(parent, j); |
1,432,881 | // method from master_integration<NEW_LINE>@NonNull<NEW_LINE>private List<I_M_HU> createNewlyPickedHUs(@NonNull final I_M_ShipmentSchedule scheduleRecord, @NonNull final I_M_HU sourceHURecord, @NonNull final Quantity quantityToSplit, final boolean pickAccordingToPackingInstruction) {<NEW_LINE>final <MASK><NEW_LINE>// split a part out of the current HU<NEW_LINE>final HUsToNewCUsRequest cuRequest = // new, from PR https://github.com/metasfresh/metasfresh/pull/12146<NEW_LINE>HUsToNewCUsRequest.builder().keepNewCUsUnderSameParent(false).// FIXME: we shall consider not reserved or reserved ones too if they are reserved for us<NEW_LINE>reservedVHUsPolicy(// OLD<NEW_LINE>ReservedHUsPolicy.CONSIDER_ALL).// .onlyFromUnreservedHUs(false) // note: the HUs returned by the query do not contain HUs which are reserved to someone else<NEW_LINE>productId(ProductId.ofRepoId(scheduleRecord.getM_Product_ID())).qtyCU(quantityToSplit).sourceHU(sourceHURecord).build();<NEW_LINE>final List<I_M_HU> newCURecords = huTransformService.husToNewCUs(cuRequest);<NEW_LINE>final List<I_M_HU> newHURecords;<NEW_LINE>if (pickAccordingToPackingInstruction) {<NEW_LINE>final HUPIItemProductId piItemProductId = huShipmentScheduleBL.getEffectivePackingMaterialId(scheduleRecord);<NEW_LINE>if (// there is no packing instruction for TUs to put the CUs into<NEW_LINE>piItemProductId == null || piItemProductId.isVirtualHU()) {<NEW_LINE>newHURecords = newCURecords;<NEW_LINE>} else {<NEW_LINE>final I_M_HU_PI_Item_Product huPIItemProduct = hupiItemProductDAO.getById(piItemProductId);<NEW_LINE>newHURecords = new ArrayList<>();<NEW_LINE>for (final I_M_HU newCU : newCURecords) {<NEW_LINE>newHURecords.addAll(huTransformService.cuToNewTUs(newCU, null, /*consume the complete CU*/<NEW_LINE>huPIItemProduct, true));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>newHURecords = newCURecords;<NEW_LINE>}<NEW_LINE>return newHURecords;<NEW_LINE>} | HUTransformService huTransformService = HUTransformService.newInstance(); |
1,709,268 | public Completion interpret(ExecutionContext context, boolean debug) {<NEW_LINE>Object exprRef = getRhs().interpret(context, debug);<NEW_LINE>Object exprValue = getValue(this.rhsGet, context, exprRef);<NEW_LINE>if (exprValue == Types.NULL || exprValue == Types.UNDEFINED) {<NEW_LINE>return (Completion.createNormal());<NEW_LINE>}<NEW_LINE>JSObject obj = Types.toObject(context, exprValue);<NEW_LINE>Object v = null;<NEW_LINE>List<String> names = obj<MASK><NEW_LINE>for (String each : names) {<NEW_LINE>Object lhsRef = getExpr().interpret(context, debug);<NEW_LINE>if (lhsRef instanceof Reference) {<NEW_LINE>((Reference) lhsRef).putValue(context, each);<NEW_LINE>}<NEW_LINE>Completion completion = (Completion) getBlock().interpret(context, debug);<NEW_LINE>if (completion.value != null) {<NEW_LINE>v = completion.value;<NEW_LINE>}<NEW_LINE>if (completion.type == Completion.Type.BREAK) {<NEW_LINE>if (completion.target == null || getLabels().contains(completion.target)) {<NEW_LINE>return (Completion.createNormal(v));<NEW_LINE>} else {<NEW_LINE>return (completion);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (completion.type == Completion.Type.RETURN || completion.type == Completion.Type.BREAK) {<NEW_LINE>return (completion);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (Completion.createNormal(v));<NEW_LINE>} | .getAllEnumerablePropertyNames().toList(); |
1,251,907 | private void createResultData(Composite panel, String label, int rate) {<NEW_LINE>GridData gridData;<NEW_LINE>// spacer column<NEW_LINE>Label c1 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>c1.setLayoutData(gridData);<NEW_LINE>// label<NEW_LINE>Label c2 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>gridData.horizontalAlignment = GridData.END;<NEW_LINE>c2.setLayoutData(gridData);<NEW_LINE>c2.setText(label);<NEW_LINE>// bytes<NEW_LINE>Label c3 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>gridData.horizontalAlignment = GridData.CENTER;<NEW_LINE>c3.setLayoutData(gridData);<NEW_LINE>c3.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec(rate));<NEW_LINE>// bits<NEW_LINE>Label c4 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>gridData.horizontalAlignment = GridData.CENTER;<NEW_LINE>c4.setLayoutData(gridData);<NEW_LINE>c4.setText(DisplayFormatters.formatByteCountToBitsPerSec2(rate));<NEW_LINE>// spacer column<NEW_LINE>Label c5 = new <MASK><NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>c5.setLayoutData(gridData);<NEW_LINE>} | Label(panel, SWT.NULL); |
559,452 | private void generateAudioSource() throws IOException, OmniNotConnectedException, OmniInvalidResponseException, OmniUnknownMessageTypeException {<NEW_LINE>String groupString = "Group\t%s\t\"%s\"\t(%s)\n";<NEW_LINE>String itemString = "%s\t%s\t\"%s\"\t(%s)\t{omnilink=\"%s:%d\"}\n";<NEW_LINE>String groupName = "AudioSources";<NEW_LINE>groups.append(String.format(groupString, groupName, "Audio Sources", "All"));<NEW_LINE>int objnum = 0;<NEW_LINE>Message m;<NEW_LINE>while ((m = c.reqObjectProperties(Message.OBJ_TYPE_AUDIO_SOURCE, objnum, 1, ObjectProperties.FILTER_1_NAMED, ObjectProperties.FILTER_2_NONE, ObjectProperties.FILTER_3_NONE)).getMessageType() == Message.MESG_TYPE_OBJ_PROP) {<NEW_LINE>AudioSourceProperties <MASK><NEW_LINE>objnum = o.getNumber();<NEW_LINE>String group = addUniqueGroup(groupName + "_" + cleanString(o.getName()));<NEW_LINE>groups.append(String.format(groupString, group, o.getName(), "OmniAudioSources"));<NEW_LINE>// String name = group + "_" + cleanString(o.getName());<NEW_LINE>audioSources.add(new SiteItem(group, o.getName(), o.getName()));<NEW_LINE>items.append(String.format(itemString, "String", group + "_Text", "Now Playeing: [%s]", group, "audiosource_text", objnum));<NEW_LINE>items.append(String.format(itemString, "String", group + "_Field1", "Field 1 [%s]", group, "audiosource_field1", objnum));<NEW_LINE>items.append(String.format(itemString, "String", group + "_Field2", "Field 2 [%s]", group, "audiosource_field2", objnum));<NEW_LINE>items.append(String.format(itemString, "String", group + "_Field3", "Field 3 [%s]", group, "audiosource_field3", objnum));<NEW_LINE>}<NEW_LINE>} | o = ((AudioSourceProperties) m); |
1,006,914 | public final int unnestRecords(final int recordCount) {<NEW_LINE>Preconditions.checkArgument(svMode == NONE, "Unnest does not support selection vector inputs.");<NEW_LINE>final int initialInnerValueIndex = runningInnerValueIndex;<NEW_LINE>int nonEmptyArray = 0;<NEW_LINE>outer: {<NEW_LINE>// index in the output vector that we are writing to<NEW_LINE>int outputIndex = 0;<NEW_LINE>final int valueCount = accessor.getValueCount();<NEW_LINE>for (; valueIndex < valueCount; valueIndex++) {<NEW_LINE>final int innerValueCount = accessor.getInnerValueCountAt(valueIndex);<NEW_LINE>logger.trace("Unnest: CurrentRowId: {}, innerValueCount: {}, outputIndex: {}, output limit: {}", valueIndex, innerValueCount, outputIndex, outputLimit);<NEW_LINE>if (innerValueCount > 0) {<NEW_LINE>++nonEmptyArray;<NEW_LINE>}<NEW_LINE>for (; innerValueIndex < innerValueCount; innerValueIndex++) {<NEW_LINE>// If we've hit the batch size limit, stop and flush what we've got so far.<NEW_LINE>if (outputIndex == outputLimit) {<NEW_LINE>// Flush this batch.<NEW_LINE>break outer;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// rowId starts at 1, so the value for rowId is valueIndex+1<NEW_LINE>rowIdVectorMutator.setSafe(outputIndex, valueIndex + 1);<NEW_LINE>} finally {<NEW_LINE>outputIndex++;<NEW_LINE>runningInnerValueIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>innerValueIndex = 0;<NEW_LINE>}<NEW_LINE>// forevery value in the array<NEW_LINE>}<NEW_LINE>// for every incoming record<NEW_LINE>final int delta = runningInnerValueIndex - initialInnerValueIndex;<NEW_LINE>logger.debug("Unnest: Finished processing current batch. [Details: LastProcessedRowIndex: {}, " + "RowsWithNonEmptyArrays: {}, outputIndex: {}, outputLimit: {}, TotalIncomingRecords: {}]", valueIndex, nonEmptyArray, delta, outputLimit, accessor.getValueCount());<NEW_LINE><MASK><NEW_LINE>for (TransferPair t : transfers) {<NEW_LINE>t.splitAndTransfer(initialInnerValueIndex, delta);<NEW_LINE>// Get the corresponding ValueVector in output container and transfer the data<NEW_LINE>final ValueVector vectorWithData = t.getTo();<NEW_LINE>final ValueVector outputVector = outgoing.getContainer().addOrGet(vectorWithData.getField(), callBack);<NEW_LINE>Preconditions.checkState(!callBack.getSchemaChangedAndReset(), "Outgoing container doesn't have " + "expected ValueVector of type %s, present in TransferPair of unnest field", vectorWithData.getClass());<NEW_LINE>vectorWithData.makeTransferPair(outputVector).transfer();<NEW_LINE>}<NEW_LINE>return delta;<NEW_LINE>} | final SchemaChangeCallBack callBack = new SchemaChangeCallBack(); |
1,807,584 | public void onStanza(ConnectionItem connection, Stanza stanza) {<NEW_LINE>Jid from = stanza.getFrom();<NEW_LINE>if (from == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!(connection instanceof AccountItem) || !(stanza instanceof Message)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AccountJid account = ((AccountItem) connection).getAccount();<NEW_LINE>Message message = (Message) stanza;<NEW_LINE><MASK><NEW_LINE>if (session == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (ExtensionElement packetExtension : stanza.getExtensions()) {<NEW_LINE>if (packetExtension instanceof Feature) {<NEW_LINE>Feature feature = (Feature) packetExtension;<NEW_LINE>if (!feature.isValid()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>DataForm.Type dataFormType = feature.getDataFormType();<NEW_LINE>if (dataFormType == DataForm.Type.form) {<NEW_LINE>onFormReceived(account, from, session, feature);<NEW_LINE>} else if (dataFormType == DataForm.Type.submit) {<NEW_LINE>onSubmitReceived(account, from, session, feature);<NEW_LINE>} else if (dataFormType == DataForm.Type.result) {<NEW_LINE>onResultReceived(account, session, feature);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String session = message.getThread(); |
1,391,545 | ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>Process process = emc.find(id, Process.class);<NEW_LINE>if (null == process) {<NEW_LINE>throw new ExceptionProcessNotExisted(id);<NEW_LINE>}<NEW_LINE>Application application = emc.find(process.getApplication(), Application.class);<NEW_LINE>if (null == application) {<NEW_LINE>throw new ExceptionApplicationNotExist(process.getApplication());<NEW_LINE>}<NEW_LINE>if (!business.editable(effectivePerson, application)) {<NEW_LINE>throw new ExceptionApplicationAccessDenied(effectivePerson.getDistinguishedName(), application.getName(), application.getId());<NEW_LINE>}<NEW_LINE>emc.beginTransaction(Process.class);<NEW_LINE>if (StringUtils.isEmpty(process.getEdition())) {<NEW_LINE>process<MASK><NEW_LINE>process.setEdition(process.getId());<NEW_LINE>process.setEditionEnable(true);<NEW_LINE>process.setEditionNumber(1.0);<NEW_LINE>process.setEditionName(process.getName() + "_V" + process.getEditionNumber());<NEW_LINE>this.updateCreatePersonLastUpdatePerson(effectivePerson, business, process);<NEW_LINE>} else {<NEW_LINE>if (!BooleanUtils.isTrue(process.getEditionEnable())) {<NEW_LINE>process.setLastUpdateTime(new Date());<NEW_LINE>process.setEditionEnable(true);<NEW_LINE>this.updateCreatePersonLastUpdatePerson(effectivePerson, business, process);<NEW_LINE>}<NEW_LINE>for (Process p : business.entityManagerContainer().listEqualAndEqual(Process.class, Process.application_FIELDNAME, process.getApplication(), Process.edition_FIELDNAME, process.getEdition())) {<NEW_LINE>if (!process.getId().equals(p.getId()) && BooleanUtils.isTrue(p.getEditionEnable())) {<NEW_LINE>p.setLastUpdateTime(new Date());<NEW_LINE>p.setEditionEnable(false);<NEW_LINE>this.updateCreatePersonLastUpdatePerson(effectivePerson, business, p);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>emc.commit();<NEW_LINE>cacheNotify();<NEW_LINE>Wo wo = new Wo();<NEW_LINE>wo.setValue(true);<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | .setLastUpdateTime(new Date()); |
1,498,128 | private boolean recoverTheLastLogDataFile(File file) {<NEW_LINE>String[] splits = file.getName().split(FILE_NAME_SEPARATOR);<NEW_LINE>long startIndex = Long.parseLong(splits[0]);<NEW_LINE>Pair<File, Pair<Long, Long>> fileStartAndEndIndex = getLogIndexFile(startIndex);<NEW_LINE>if (fileStartAndEndIndex.right.left == startIndex) {<NEW_LINE><MASK><NEW_LINE>String newDataFileName = file.getName().replaceAll(String.valueOf(Long.MAX_VALUE), String.valueOf(endIndex));<NEW_LINE>File newLogDataFile = SystemFileFactory.INSTANCE.getFile(file.getParent() + File.separator + newDataFileName);<NEW_LINE>if (!file.renameTo(newLogDataFile)) {<NEW_LINE>logger.error("rename log data file={} failed when recover", file.getAbsoluteFile());<NEW_LINE>}<NEW_LINE>logDataFileList.remove(logDataFileList.size() - 1);<NEW_LINE>logDataFileList.add(newLogDataFile);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | long endIndex = fileStartAndEndIndex.right.right; |
65,141 | protected PreparedStatement prepareStatement(String sql, Object[] params) throws SQLException {<NEW_LINE>PreparedStatement statement = connection.prepareStatement(sql);<NEW_LINE>for (int i = 0; i < params.length; i++) {<NEW_LINE>if (params[i] == null) {<NEW_LINE>statement.setNull(i + 1, nullType);<NEW_LINE>} else if (params[i] instanceof Integer) {<NEW_LINE>statement.setInt(i + 1, (Integer) params[i]);<NEW_LINE>} else if (params[i] instanceof Boolean) {<NEW_LINE>statement.setBoolean(i + 1, <MASK><NEW_LINE>} else if (params[i] instanceof String) {<NEW_LINE>statement.setString(i + 1, params[i].toString());<NEW_LINE>} else if (params[i] == JdbcNullTypes.StringNull) {<NEW_LINE>statement.setNull(i + 1, nullType);<NEW_LINE>} else if (params[i] == JdbcNullTypes.IntegerNull) {<NEW_LINE>statement.setNull(i + 1, nullType);<NEW_LINE>} else if (params[i] == JdbcNullTypes.BooleanNull) {<NEW_LINE>statement.setNull(i + 1, nullType);<NEW_LINE>} else {<NEW_LINE>throw new FlywayException("Unhandled object of type '" + params[i].getClass().getName() + "'. " + "Please contact support or leave an issue on GitHub.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return statement;<NEW_LINE>} | (Boolean) params[i]); |
1,057,600 | public DescribeReservedElasticsearchInstancesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeReservedElasticsearchInstancesResult describeReservedElasticsearchInstancesResult = new DescribeReservedElasticsearchInstancesResult();<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 describeReservedElasticsearchInstancesResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeReservedElasticsearchInstancesResult.setNextToken(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("ReservedElasticsearchInstances", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeReservedElasticsearchInstancesResult.setReservedElasticsearchInstances(new ListUnmarshaller<ReservedElasticsearchInstance>(ReservedElasticsearchInstanceJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return describeReservedElasticsearchInstancesResult;<NEW_LINE>} | class).unmarshall(context)); |
734,324 | private void doFileFilters(File[] files) {<NEW_LINE>// System.out.println("Doing file filters");<NEW_LINE>final File[] cFiles = files;<NEW_LINE>final JPanel fileFilterPanel = new JPanel();<NEW_LINE>fileFilterPanel.setLayout(new BoxLayout(fileFilterPanel, BoxLayout.PAGE_AXIS));<NEW_LINE>JLabel text = new JLabel("<html>Please indicate any constraints on the files you want to load. All files in specified folders that satisfy all of the given constraints will be loaded. Just press Okay to load all files.</html>");<NEW_LINE>// text.setBorder(BorderFactory.createLineBorder(Color.black));<NEW_LINE>text.setAlignmentX(SwingConstants.LEADING);<NEW_LINE>JPanel textPanel = new JPanel(new BorderLayout());<NEW_LINE>textPanel.setPreferredSize(new Dimension(100, 50));<NEW_LINE>// textPanel.setBorder(BorderFactory.createLineBorder(Color.black));<NEW_LINE>textPanel.add(text);<NEW_LINE>fileFilterPanel.add(textPanel);<NEW_LINE>fileFilterPanel.add(Box.createVerticalStrut(5));<NEW_LINE>Box defaultFilter = getNewFilter();<NEW_LINE>// defaultFilter.setBorder(BorderFactory.createLineBorder(Color.black));<NEW_LINE>// fileFilterPanel.setBorder(BorderFactory.createLineBorder(Color.black));<NEW_LINE>fileFilterPanel.add(defaultFilter);<NEW_LINE>final JOptionPane fileFilterDialog = new JOptionPane();<NEW_LINE>fileFilterDialog.setMessage(fileFilterPanel);<NEW_LINE>JButton[<MASK><NEW_LINE>JButton okay = new JButton("Okay");<NEW_LINE>JButton add = new JButton("Add another filter");<NEW_LINE>JButton cancel = new JButton("Cancel");<NEW_LINE>options[0] = okay;<NEW_LINE>options[1] = add;<NEW_LINE>options[2] = cancel;<NEW_LINE>fileFilterDialog.setOptions(options);<NEW_LINE>final JDialog dialog = fileFilterDialog.createDialog(null, "Set file filters...");<NEW_LINE>okay.addActionListener(arg0 -> {<NEW_LINE>// first check if we have a file range option and make sure it's valid<NEW_LINE>final EnumMap<FilterType, String> filters = getFilters(fileFilterPanel);<NEW_LINE>if (filters.containsKey(FilterType.isInRange)) {<NEW_LINE>try {<NEW_LINE>// if we can creat it, then it's not invalid!<NEW_LINE>new NumberRangesFileFilter(filters.get(FilterType.isInRange), false);<NEW_LINE>} catch (Exception e) {<NEW_LINE>JOptionPane.showMessageDialog(dialog, new JLabel("<html>Please check the range you specified for the file number. Ranges must be numerical, and disjoint <br>ranges should be separated by commas. For example \"1-200,250-375\" is a valid range.</html>"), "Error in File Number Range", JOptionPane.ERROR_MESSAGE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>dialog.setVisible(false);<NEW_LINE>startFileLoadingThread(filters, cFiles);<NEW_LINE>});<NEW_LINE>add.addActionListener(e -> {<NEW_LINE>fileFilterPanel.add(getNewFilter());<NEW_LINE>dialog.pack();<NEW_LINE>});<NEW_LINE>cancel.addActionListener(e -> dialog.setVisible(false));<NEW_LINE>dialog.getRootPane().setDefaultButton(okay);<NEW_LINE>dialog.pack();<NEW_LINE>dialog.setLocationRelativeTo(this);<NEW_LINE>dialog.setVisible(true);<NEW_LINE>} | ] options = new JButton[3]; |
256,396 | private static <T, E extends Number> void testCasts_generics() {<NEW_LINE><MASK><NEW_LINE>// cast to type variable with bound, casting Integer instance to Number<NEW_LINE>E e = (E) o;<NEW_LINE>// cast to type variable without bound, casting Integer instance to Object<NEW_LINE>T t = (T) o;<NEW_LINE>assertThrowsClassCastException(() -> {<NEW_LINE>Object error = new Error();<NEW_LINE>// casting Error instance to Number, exception.<NEW_LINE>E unused = (E) error;<NEW_LINE>});<NEW_LINE>class Pameterized<T, E extends Number> {<NEW_LINE>}<NEW_LINE>Object c = new Pameterized<Number, Number>();<NEW_LINE>// cast to parameterized type.<NEW_LINE>Pameterized<Error, Number> cc = (Pameterized<Error, Number>) c;<NEW_LINE>Object[] is = new Integer[1];<NEW_LINE>Object[] os = new Object[1];<NEW_LINE>E[] es = (E[]) is;<NEW_LINE>T[] ts = (T[]) is;<NEW_LINE>assertThrowsClassCastException(() -> {<NEW_LINE>E[] ees = (E[]) os;<NEW_LINE>});<NEW_LINE>T[] tts = (T[]) os;<NEW_LINE>} | Object o = new Integer(1); |
96,404 | private void updateOutline(@NotNull FlutterOutline outline) {<NEW_LINE>currentOutline = outline;<NEW_LINE>final DefaultMutableTreeNode rootNode = getRootNode();<NEW_LINE>rootNode.removeAllChildren();<NEW_LINE>outlinesWithWidgets.clear();<NEW_LINE>outlineToNodeMap.clear();<NEW_LINE>if (outline.getChildren() != null) {<NEW_LINE>computeOutlinesWithWidgets(outline);<NEW_LINE>updateOutlineImpl(rootNode, outline.getChildren());<NEW_LINE>}<NEW_LINE>getTreeModel().reload(rootNode);<NEW_LINE>tree.expandAll();<NEW_LINE>if (currentEditor != null) {<NEW_LINE>final Caret caret = currentEditor.getCaretModel().getPrimaryCaret();<NEW_LINE>applyEditorSelectionToTree(caret);<NEW_LINE>}<NEW_LINE>if (FlutterSettings.getInstance().isEnableHotUi() && propertyEditPanel == null) {<NEW_LINE>propertyEditSplitter = new Splitter(false, 0.75f);<NEW_LINE>propertyEditPanel = new PropertyEditorPanel(inspectorGroupManagerService, project, <MASK><NEW_LINE>propertyEditPanel.initalize(null, activeOutlines, currentFile);<NEW_LINE>propertyEditToolbarGroup = new DefaultActionGroup();<NEW_LINE>final ActionToolbar windowToolbar = ActionManager.getInstance().createActionToolbar("PropertyArea", propertyEditToolbarGroup, true);<NEW_LINE>final SimpleToolWindowPanel window = new SimpleToolWindowPanel(true, true);<NEW_LINE>window.setToolbar(windowToolbar.getComponent());<NEW_LINE>final JScrollPane propertyScrollPane = ScrollPaneFactory.createScrollPane(propertyEditPanel);<NEW_LINE>window.setContent(propertyScrollPane);<NEW_LINE>propertyEditSplitter.setFirstComponent(window.getComponent());<NEW_LINE>final InspectorGroupManagerService.Client inspectorStateServiceClient = new InspectorGroupManagerService.Client(project) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onInspectorAvailabilityChanged() {<NEW_LINE>super.onInspectorAvailabilityChanged();<NEW_LINE>// Only show the screen mirror if there is a running device and<NEW_LINE>// the inspector supports the neccessary apis.<NEW_LINE>if (getInspectorService() != null && getInspectorService().isHotUiScreenMirrorSupported()) {<NEW_LINE>// Wait to create the preview area until it is needed.<NEW_LINE>if (previewArea == null) {<NEW_LINE>previewArea = new PreviewArea(project, outlinesWithWidgets, project);<NEW_LINE>}<NEW_LINE>propertyEditSplitter.setSecondComponent(previewArea.getComponent());<NEW_LINE>} else {<NEW_LINE>propertyEditSplitter.setSecondComponent(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>inspectorGroupManagerService.addListener(inspectorStateServiceClient, project);<NEW_LINE>splitter.setSecondComponent(propertyEditSplitter);<NEW_LINE>}<NEW_LINE>// TODO(jacobr): this is the wrong spot.<NEW_LINE>if (propertyEditToolbarGroup != null) {<NEW_LINE>final TitleAction propertyTitleAction = new TitleAction("Properties");<NEW_LINE>propertyEditToolbarGroup.removeAll();<NEW_LINE>propertyEditToolbarGroup.add(propertyTitleAction);<NEW_LINE>}<NEW_LINE>} | flutterAnalysisServer, false, false, project); |
1,629,155 | private JavacNode buildTypeUse(JCTree typeUse) {<NEW_LINE>if (setAndGetAsHandled(typeUse))<NEW_LINE>return null;<NEW_LINE>if (typeUse == null)<NEW_LINE>return null;<NEW_LINE>if (typeUse.getClass().getName().equals("com.sun.tools.javac.tree.JCTree$JCAnnotatedType")) {<NEW_LINE>initJcAnnotatedType(typeUse.getClass());<NEW_LINE>Collection<?> anns = Permit.permissiveReadField(Collection.class, JCANNOTATEDTYPE_ANNOTATIONS, typeUse);<NEW_LINE>JCExpression underlying = Permit.permissiveReadField(JCExpression.class, JCANNOTATEDTYPE_UNDERLYINGTYPE, typeUse);<NEW_LINE>List<JavacNode> childNodes = new ArrayList<JavacNode>();<NEW_LINE>if (anns != null)<NEW_LINE>for (Object annotation : anns) if (annotation instanceof JCAnnotation)<NEW_LINE>addIfNotNull(childNodes, buildAnnotation((JCAnnotation) annotation, true));<NEW_LINE>addIfNotNull(childNodes, buildTypeUse(underlying));<NEW_LINE>return putInMap(new JavacNode(this, typeUse<MASK><NEW_LINE>}<NEW_LINE>if (typeUse instanceof JCWildcard) {<NEW_LINE>JCTree inner = ((JCWildcard) typeUse).inner;<NEW_LINE>List<JavacNode> childNodes = inner == null ? Collections.<JavacNode>emptyList() : new ArrayList<JavacNode>();<NEW_LINE>if (inner != null)<NEW_LINE>addIfNotNull(childNodes, buildTypeUse(inner));<NEW_LINE>return putInMap(new JavacNode(this, typeUse, childNodes, Kind.TYPE_USE));<NEW_LINE>}<NEW_LINE>if (typeUse instanceof JCArrayTypeTree) {<NEW_LINE>JCTree inner = ((JCArrayTypeTree) typeUse).elemtype;<NEW_LINE>List<JavacNode> childNodes = inner == null ? Collections.<JavacNode>emptyList() : new ArrayList<JavacNode>();<NEW_LINE>if (inner != null)<NEW_LINE>addIfNotNull(childNodes, buildTypeUse(inner));<NEW_LINE>return putInMap(new JavacNode(this, typeUse, childNodes, Kind.TYPE_USE));<NEW_LINE>}<NEW_LINE>if (typeUse instanceof JCFieldAccess) {<NEW_LINE>JCTree inner = ((JCFieldAccess) typeUse).selected;<NEW_LINE>List<JavacNode> childNodes = inner == null ? Collections.<JavacNode>emptyList() : new ArrayList<JavacNode>();<NEW_LINE>if (inner != null)<NEW_LINE>addIfNotNull(childNodes, buildTypeUse(inner));<NEW_LINE>return putInMap(new JavacNode(this, typeUse, childNodes, Kind.TYPE_USE));<NEW_LINE>}<NEW_LINE>if (typeUse instanceof JCIdent) {<NEW_LINE>return putInMap(new JavacNode(this, typeUse, Collections.<JavacNode>emptyList(), Kind.TYPE_USE));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | , childNodes, Kind.TYPE_USE)); |
1,822,106 | // using JAX-RS providers, users need to add dependencies for implementations, see pom for an example.<NEW_LINE>@Path("/errorCodeWithHeaderJAXRS")<NEW_LINE>@POST<NEW_LINE>@ApiResponses({ @ApiResponse(code = 200, response = MultiResponse200.class, message = ""), @ApiResponse(code = 400, response = MultiResponse400.class, message = ""), @ApiResponse(code = 500, response = MultiResponse500.class, message = "") })<NEW_LINE>@ResponseHeaders({ @ResponseHeader(name = "x-code", response = String.class) })<NEW_LINE>public javax.ws.rs.core.Response errorCodeWithHeaderJAXRS(MultiRequest request) {<NEW_LINE>javax.ws.rs.core.Response response;<NEW_LINE>if (request.getCode() == 400) {<NEW_LINE>MultiResponse400 r = new MultiResponse400();<NEW_LINE>r.setCode(request.getCode());<NEW_LINE>r.setMessage(request.getMessage());<NEW_LINE>// If got many types for different status code, we can only using InvocationException for failed error code like 400-500.<NEW_LINE>// The result for Failed Family(e.g. 400-500), can not set return value as target type directly or will give exception.<NEW_LINE>response = javax.ws.rs.core.Response.status(Status.BAD_REQUEST).entity(new InvocationException(Status.BAD_REQUEST, r)).header("x-code", "400").build();<NEW_LINE>} else if (request.getCode() == 500) {<NEW_LINE>MultiResponse500 r = new MultiResponse500();<NEW_LINE>r.setCode(request.getCode());<NEW_LINE>r.setMessage(request.getMessage());<NEW_LINE>response = javax.ws.rs.core.Response.status(Status.INTERNAL_SERVER_ERROR).entity(new InvocationException(Status.INTERNAL_SERVER_ERROR, r)).header("x-code", "500").build();<NEW_LINE>} else {<NEW_LINE>MultiResponse200 r = new MultiResponse200();<NEW_LINE>r.<MASK><NEW_LINE>r.setMessage(request.getMessage());<NEW_LINE>// If error code is OK family(like 200), we can use the target type.<NEW_LINE>response = javax.ws.rs.core.Response.status(Status.OK).entity(r).header("x-code", "200").build();<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | setCode(request.getCode()); |
1,372,115 | public void update(@Nonnull final AnActionEvent e) {<NEW_LINE>final Presentation presentation = e.getPresentation();<NEW_LINE>final Project project = e.getProject();<NEW_LINE>if (project == null || project.isDisposed()) {<NEW_LINE>presentation.setEnabledAndVisible(false);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>presentation.setVisible(myExecutor.isApplicable(project));<NEW_LINE>if (!presentation.isVisible()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (DumbService.getInstance(project).isDumb() || !project.isInitialized()) {<NEW_LINE>presentation.setEnabled(false);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final RunnerAndConfigurationSettings selectedConfiguration = getConfiguration(project);<NEW_LINE>boolean enabled = false;<NEW_LINE>String text;<NEW_LINE>final String textWithMnemonic = getTemplatePresentation().getTextWithMnemonic();<NEW_LINE>if (selectedConfiguration != null) {<NEW_LINE>presentation.setIcon<MASK><NEW_LINE>final ProgramRunner runner = RunnerRegistry.getInstance().getRunner(myExecutor.getId(), selectedConfiguration.getConfiguration());<NEW_LINE>ExecutionTarget target = ExecutionTargetManager.getActiveTarget(project);<NEW_LINE>enabled = ExecutionTargetManager.canRun(selectedConfiguration, target) && runner != null && !isStarting(project, myExecutor.getId(), runner.getRunnerId());<NEW_LINE>if (enabled) {<NEW_LINE>presentation.setDescription(myExecutor.getDescription());<NEW_LINE>}<NEW_LINE>text = myExecutor.getActionText(selectedConfiguration.getName());<NEW_LINE>} else {<NEW_LINE>text = textWithMnemonic;<NEW_LINE>}<NEW_LINE>presentation.setEnabled(enabled);<NEW_LINE>presentation.setText(text);<NEW_LINE>} | (getInformativeIcon(project, selectedConfiguration)); |
1,496,363 | public void onResponse(QueryPage<ModelSnapshot> searchResponse) {<NEW_LINE>long nextToKeepMs = deleteAllBeforeMs;<NEW_LINE>try {<NEW_LINE>List<ModelSnapshot> snapshots = new ArrayList<>();<NEW_LINE>for (ModelSnapshot snapshot : searchResponse.results()) {<NEW_LINE>// We don't want to delete the currently used snapshot or a snapshot marked to be retained<NEW_LINE>if (snapshot.getSnapshotId().equals(job.getModelSnapshotId()) || snapshot.isRetain()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (snapshot.getTimestamp() == null) {<NEW_LINE>LOGGER.warn(<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>long timestampMs = snapshot.getTimestamp().getTime();<NEW_LINE>if (timestampMs >= nextToKeepMs) {<NEW_LINE>do {<NEW_LINE>nextToKeepMs += MS_IN_ONE_DAY;<NEW_LINE>} while (timestampMs >= nextToKeepMs);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>snapshots.add(snapshot);<NEW_LINE>}<NEW_LINE>deleteModelSnapshots(snapshots, job.getId(), listener);<NEW_LINE>} catch (Exception e) {<NEW_LINE>onFailure(e);<NEW_LINE>}<NEW_LINE>} | "Model snapshot document [{}] has a null timestamp field", snapshot.getSnapshotId()); |
13,348 | private static OHashTable.BucketPath prevLevelUp(final OHashTable.BucketPath bucketPath) {<NEW_LINE>if (bucketPath.parent == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final int nodeLocalDepth = bucketPath.nodeLocalDepth;<NEW_LINE>final int pointersSize <MASK><NEW_LINE>final OHashTable.BucketPath parent = bucketPath.parent;<NEW_LINE>if (parent.itemIndex > MAX_LEVEL_SIZE / 2) {<NEW_LINE>final int prevParentIndex = ((parent.itemIndex - MAX_LEVEL_SIZE / 2) / pointersSize) * pointersSize + MAX_LEVEL_SIZE / 2 - 1;<NEW_LINE>return new OHashTable.BucketPath(parent.parent, 0, prevParentIndex, parent.nodeIndex, parent.nodeLocalDepth, parent.nodeGlobalDepth);<NEW_LINE>}<NEW_LINE>final int prevParentIndex = (parent.itemIndex / pointersSize) * pointersSize - 1;<NEW_LINE>if (prevParentIndex >= 0) {<NEW_LINE>return new BucketPath(parent.parent, 0, prevParentIndex, parent.nodeIndex, parent.nodeLocalDepth, parent.nodeGlobalDepth);<NEW_LINE>}<NEW_LINE>return prevLevelUp(new OHashTable.BucketPath(parent.parent, 0, 0, parent.nodeIndex, parent.nodeLocalDepth, -1));<NEW_LINE>} | = 1 << (MAX_LEVEL_DEPTH - nodeLocalDepth); |
1,359,497 | public boolean eIsSet(int featureID) {<NEW_LINE>switch(featureID) {<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__LOGGER:<NEW_LINE>return LOGGER_EDEFAULT == null ? logger != null : !LOGGER_EDEFAULT.equals(logger);<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__UID:<NEW_LINE>return UID_EDEFAULT == null ? uid != null <MASK><NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__POLL:<NEW_LINE>return poll != POLL_EDEFAULT;<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__ENABLED_A:<NEW_LINE>return ENABLED_A_EDEFAULT == null ? enabledA != null : !ENABLED_A_EDEFAULT.equals(enabledA);<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__TINKERFORGE_DEVICE:<NEW_LINE>return tinkerforgeDevice != null;<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__IP_CONNECTION:<NEW_LINE>return IP_CONNECTION_EDEFAULT == null ? ipConnection != null : !IP_CONNECTION_EDEFAULT.equals(ipConnection);<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__CONNECTED_UID:<NEW_LINE>return CONNECTED_UID_EDEFAULT == null ? connectedUid != null : !CONNECTED_UID_EDEFAULT.equals(connectedUid);<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__POSITION:<NEW_LINE>return position != POSITION_EDEFAULT;<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__DEVICE_IDENTIFIER:<NEW_LINE>return deviceIdentifier != DEVICE_IDENTIFIER_EDEFAULT;<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__NAME:<NEW_LINE>return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__BRICKD:<NEW_LINE>return basicGetBrickd() != null;<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__SWITCH_STATE:<NEW_LINE>return SWITCH_STATE_EDEFAULT == null ? switchState != null : !SWITCH_STATE_EDEFAULT.equals(switchState);<NEW_LINE>case ModelPackage.MBRICKLET_SOLID_STATE_RELAY__DEVICE_TYPE:<NEW_LINE>return DEVICE_TYPE_EDEFAULT == null ? deviceType != null : !DEVICE_TYPE_EDEFAULT.equals(deviceType);<NEW_LINE>}<NEW_LINE>return super.eIsSet(featureID);<NEW_LINE>} | : !UID_EDEFAULT.equals(uid); |
881,341 | public void deleteById(String id) {<NEW_LINE>String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));<NEW_LINE>}<NEW_LINE>String privateCloudName = <MASK><NEW_LINE>if (privateCloudName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'privateClouds'.", id)));<NEW_LINE>}<NEW_LINE>String hcxEnterpriseSiteName = Utils.getValueFromIdByName(id, "hcxEnterpriseSites");<NEW_LINE>if (hcxEnterpriseSiteName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'hcxEnterpriseSites'.", id)));<NEW_LINE>}<NEW_LINE>this.deleteWithResponse(resourceGroupName, privateCloudName, hcxEnterpriseSiteName, Context.NONE);<NEW_LINE>} | Utils.getValueFromIdByName(id, "privateClouds"); |
307,966 | final AdminUpdateAuthEventFeedbackResult executeAdminUpdateAuthEventFeedback(AdminUpdateAuthEventFeedbackRequest adminUpdateAuthEventFeedbackRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(adminUpdateAuthEventFeedbackRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AdminUpdateAuthEventFeedbackRequest> request = null;<NEW_LINE>Response<AdminUpdateAuthEventFeedbackResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AdminUpdateAuthEventFeedbackRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(adminUpdateAuthEventFeedbackRequest));<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, "Cognito Identity Provider");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AdminUpdateAuthEventFeedback");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AdminUpdateAuthEventFeedbackResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AdminUpdateAuthEventFeedbackResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,576,117 | public static Library createLibrary(@Nullable final LibraryType type, @Nonnull final JComponent parentComponent, @Nonnull final Project project, @Nonnull final LibrariesModifiableModel modifiableModel) {<NEW_LINE>final NewLibraryConfiguration configuration = createNewLibraryConfiguration(type, parentComponent, project);<NEW_LINE>if (configuration == null)<NEW_LINE>return null;<NEW_LINE>final LibraryType<?<MASK><NEW_LINE>final Library library = modifiableModel.createLibrary(LibraryEditingUtil.suggestNewLibraryName(modifiableModel, configuration.getDefaultLibraryName()), libraryType != null ? libraryType.getKind() : null);<NEW_LINE>final NewLibraryEditor editor = new NewLibraryEditor(libraryType, configuration.getProperties());<NEW_LINE>configuration.addRoots(editor);<NEW_LINE>final Library.ModifiableModel model = library.getModifiableModel();<NEW_LINE>editor.applyTo((LibraryEx.ModifiableModelEx) model);<NEW_LINE>WriteAction.run(model::commit);<NEW_LINE>return library;<NEW_LINE>} | > libraryType = configuration.getLibraryType(); |
1,630,756 | public void accept(Writable writable) {<NEW_LINE>String str = writable.toString();<NEW_LINE>String[] split = str.split(delim);<NEW_LINE>if (split.length != 2) {<NEW_LINE>throw new IllegalStateException("Could not parse lat/long string: \"" + str + "\"");<NEW_LINE>}<NEW_LINE>double latDeg = Double.parseDouble(split[0]);<NEW_LINE>double longDeg = Double.parseDouble(split[1]);<NEW_LINE>Preconditions.checkState(latDeg >= -90.0 && latDeg <= 90.0, "Invalid latitude: must be -90 to -90. Got: %s", latDeg);<NEW_LINE>Preconditions.checkState(latDeg >= -180.0 && latDeg <= 180.0, "Invalid longitude: must be -180 to -180. Got: %s", longDeg);<NEW_LINE>double lat = latDeg * PI_180;<NEW_LINE>double lng = longDeg * PI_180;<NEW_LINE>double x = Math.cos(lat) * Math.cos(lng);<NEW_LINE>double y = Math.cos(lat) * Math.sin(lng);<NEW_LINE>double <MASK><NEW_LINE>sumx += x;<NEW_LINE>sumy += y;<NEW_LINE>sumz += z;<NEW_LINE>count++;<NEW_LINE>} | z = Math.sin(lat); |
860,460 | private Element loadRemotePolicy(String uri, String defName) {<NEW_LINE>ExtendedURIResolver resolver = new ExtendedURIResolver();<NEW_LINE>InputSource src = null;<NEW_LINE>try {<NEW_LINE>src = resolver.resolve(uri, "classpath:");<NEW_LINE>} catch (ConnectException | SocketTimeoutException e1) {<NEW_LINE>}<NEW_LINE>if (null == src) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>XMLStreamReader reader = null;<NEW_LINE>try {<NEW_LINE>reader = StaxUtils.createXMLStreamReader(src);<NEW_LINE>Document doc = StaxUtils.read(reader);<NEW_LINE>uri = getPolicyId(doc.getDocumentElement());<NEW_LINE>if (StringUtils.isEmpty(uri)) {<NEW_LINE>uri = defName;<NEW_LINE>Attr att = doc.createAttributeNS(PolicyConstants.WSU_NAMESPACE_URI, "wsu:" + PolicyConstants.WSU_ID_ATTR_NAME);<NEW_LINE>att.setNodeValue(defName);<NEW_LINE>doc.<MASK><NEW_LINE>}<NEW_LINE>return doc.getDocumentElement();<NEW_LINE>} catch (XMLStreamException e) {<NEW_LINE>LOG.log(Level.WARNING, e.getMessage());<NEW_LINE>return null;<NEW_LINE>} finally {<NEW_LINE>StaxUtils.close(reader);<NEW_LINE>}<NEW_LINE>} | getDocumentElement().setAttributeNodeNS(att); |
696,120 | public PageResult<UserVO> findPageByParam(UserPageListRequest userPageListRequest) {<NEW_LINE>Page pageRequest = new Page(userPageListRequest.getPageNo(), userPageListRequest.getPageSize());<NEW_LINE>QueryWrapper<User> queryWrapper = new QueryWrapper<>();<NEW_LINE>if (StringUtils.isNotEmpty(userPageListRequest.getName())) {<NEW_LINE>queryWrapper.like("name", userPageListRequest.getName());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(userPageListRequest.getUsername())) {<NEW_LINE>queryWrapper.like("username", userPageListRequest.getUsername());<NEW_LINE>}<NEW_LINE>queryWrapper.eq("is_deleted", Constants.IS_DELETE_FALSE);<NEW_LINE>IPage<User> page = userMapper.selectPage(pageRequest, queryWrapper);<NEW_LINE>List<UserVO> list = BeanMapper.mapList(page.getRecords(), <MASK><NEW_LINE>PageResult<UserVO> pageResult = new PageResult<UserVO>();<NEW_LINE>pageResult.setCurrentPage(page.getCurrent());<NEW_LINE>pageResult.setTotalCount(page.getTotal());<NEW_LINE>pageResult.setList(list);<NEW_LINE>pageResult.setTotalPage(page.getSize());<NEW_LINE>return pageResult;<NEW_LINE>} | User.class, UserVO.class); |
623,552 | private void initInternal(PinotConfiguration config) throws Exception {<NEW_LINE>// directly, without sub-namespace<NEW_LINE>_httpSegmentFetcher.init(config);<NEW_LINE>// directly, without sub-namespace<NEW_LINE>_pinotFSSegmentFetcher.init(config);<NEW_LINE>List<String> protocols = config.getProperty(PROTOCOLS_KEY, Collections.emptyList());<NEW_LINE>for (String protocol : protocols) {<NEW_LINE>String segmentFetcherClassName = config.getProperty(protocol + SEGMENT_FETCHER_CLASS_KEY_SUFFIX);<NEW_LINE>SegmentFetcher segmentFetcher;<NEW_LINE>if (segmentFetcherClassName == null) {<NEW_LINE>LOGGER.info("Segment fetcher class is not configured for protocol: {}, using default", protocol);<NEW_LINE>switch(protocol) {<NEW_LINE>case CommonConstants.HTTP_PROTOCOL:<NEW_LINE>segmentFetcher = new HttpSegmentFetcher();<NEW_LINE>break;<NEW_LINE>case CommonConstants.HTTPS_PROTOCOL:<NEW_LINE>segmentFetcher = new HttpsSegmentFetcher();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>segmentFetcher = new PinotFSSegmentFetcher();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOGGER.info("Creating segment fetcher for protocol: {} with class: {}", protocol, segmentFetcherClassName);<NEW_LINE>segmentFetcher = (SegmentFetcher) Class.forName(segmentFetcherClassName).newInstance();<NEW_LINE>}<NEW_LINE>String authToken = config.getProperty(AUTH_TOKEN_KEY);<NEW_LINE>Map<String, Object> subConfigMap = config.subset(protocol).toMap();<NEW_LINE>if (!subConfigMap.containsKey(AUTH_TOKEN_KEY) && StringUtils.isNotBlank(authToken)) {<NEW_LINE>subConfigMap.put(AUTH_TOKEN_KEY, authToken);<NEW_LINE>}<NEW_LINE>segmentFetcher.init(new PinotConfiguration(subConfigMap));<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | _segmentFetcherMap.put(protocol, segmentFetcher); |
1,054,326 | public // LEFT AssertOneRows<NEW_LINE>List<OptExpression> transformUnCorrelateCheckOneRows(OptExpression input, LogicalApplyOperator apply, OptimizerContext context) {<NEW_LINE>// assert one rows will check rows, and fill null row if result is empty<NEW_LINE>OptExpression assertOptExpression = new OptExpression(LogicalAssertOneRowOperator.createLessEqOne(""));<NEW_LINE>assertOptExpression.getInputs().add(input.getInputs().get(1));<NEW_LINE>OptExpression joinOptExpression = new OptExpression(new LogicalJoinOperator(JoinOperator.CROSS_JOIN, null));<NEW_LINE>joinOptExpression.getInputs().add(input.getInputs().get(0));<NEW_LINE>joinOptExpression.getInputs().add(assertOptExpression);<NEW_LINE><MASK><NEW_LINE>Map<ColumnRefOperator, ScalarOperator> allOutput = Maps.newHashMap();<NEW_LINE>allOutput.put(apply.getOutput(), apply.getSubqueryOperator());<NEW_LINE>// add all left outer column<NEW_LINE>Arrays.stream(input.getInputs().get(0).getOutputColumns().getColumnIds()).mapToObj(factory::getColumnRef).forEach(d -> allOutput.put(d, d));<NEW_LINE>OptExpression projectExpression = new OptExpression(new LogicalProjectOperator(allOutput));<NEW_LINE>projectExpression.getInputs().add(joinOptExpression);<NEW_LINE>return Lists.newArrayList(projectExpression);<NEW_LINE>} | ColumnRefFactory factory = context.getColumnRefFactory(); |
1,691,948 | public void calculate(@NonNull final IPricingContext pricingCtx, @NonNull final IPricingResult result) {<NEW_LINE>if (!applies(pricingCtx, result)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final I_M_PriceList_Version ctxPriceListVersion = getPriceListVersionEffective(pricingCtx);<NEW_LINE>if (ctxPriceListVersion == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ZoneId timeZone = orgDAO.getTimeZone(pricingCtx.getOrgId());<NEW_LINE>final I_M_ProductPrice productPrice = getProductPriceOrNull(pricingCtx.getProductId(), ctxPriceListVersion, TimeUtil.asZonedDateTime(pricingCtx.getPriceDate(), timeZone));<NEW_LINE>if (productPrice == null) {<NEW_LINE>logger.trace("Not found (PLV)");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final PriceListVersionId resultPriceListVersionId = PriceListVersionId.ofRepoId(productPrice.getM_PriceList_Version_ID());<NEW_LINE>final I_M_PriceList_Version resultPriceListVersion = getOrLoadPriceListVersion(resultPriceListVersionId, ctxPriceListVersion);<NEW_LINE>final I_M_PriceList priceList = priceListsRepo.getById(resultPriceListVersion.getM_PriceList_ID());<NEW_LINE>final ProductId productId = ProductId.ofRepoId(productPrice.getM_Product_ID());<NEW_LINE>final ProductCategoryId productCategoryId = productsRepo.retrieveProductCategoryByProductId(productId);<NEW_LINE>result.<MASK><NEW_LINE>result.setPriceList(productPrice.getPriceList());<NEW_LINE>result.setPriceLimit(productPrice.getPriceLimit());<NEW_LINE>result.setCurrencyId(CurrencyId.ofRepoId(priceList.getC_Currency_ID()));<NEW_LINE>result.setProductId(productId);<NEW_LINE>result.setProductCategoryId(productCategoryId);<NEW_LINE>result.setPriceEditable(productPrice.isPriceEditable());<NEW_LINE>result.setDiscountEditable(result.isDiscountEditable() && productPrice.isDiscountEditable());<NEW_LINE>result.setEnforcePriceLimit(extractEnforcePriceLimit(priceList));<NEW_LINE>result.setTaxIncluded(priceList.isTaxIncluded());<NEW_LINE>result.setTaxCategoryId(TaxCategoryId.ofRepoId(productPrice.getC_TaxCategory_ID()));<NEW_LINE>result.setPriceListVersionId(resultPriceListVersionId);<NEW_LINE>// 06942 : use product price uom all the time<NEW_LINE>result.setPriceUomId(getProductPriceUomId(productPrice));<NEW_LINE>result.setInvoicableQtyBasedOn(InvoicableQtyBasedOn.fromRecordString(productPrice.getInvoicableQtyBasedOn()));<NEW_LINE>result.setCalculated(true);<NEW_LINE>//<NEW_LINE>// Override with calculated BOM price if suitable<NEW_LINE>BOMPriceCalculator.builder().bomProductId(productId).asiAware(pricingCtx.getAttributeSetInstanceAware().orElse(null)).priceListVersion(resultPriceListVersion).calculate().ifPresent(bomPrices -> updatePricingResultFromBOMPrices(result, bomPrices));<NEW_LINE>} | setPriceStd(productPrice.getPriceStd()); |
540,448 | private void forcefulClose(final ChannelHandlerContext ctx, final ForcefulCloseCommand msg, ChannelPromise promise) throws Exception {<NEW_LINE>connection().forEachActiveStream(new Http2StreamVisitor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean visit(Http2Stream stream) throws Http2Exception {<NEW_LINE>NettyClientStream.TransportState clientStream = clientStream(stream);<NEW_LINE>Tag tag = clientStream != null ? clientStream.tag() : PerfMark.createTag();<NEW_LINE>PerfMark.startTask("NettyClientHandler.forcefulClose", tag);<NEW_LINE>PerfMark.linkIn(msg.getLink());<NEW_LINE>try {<NEW_LINE>if (clientStream != null) {<NEW_LINE>clientStream.transportReportStatus(msg.getStatus()<MASK><NEW_LINE>resetStream(ctx, stream.id(), Http2Error.CANCEL.code(), ctx.newPromise());<NEW_LINE>}<NEW_LINE>stream.close();<NEW_LINE>return true;<NEW_LINE>} finally {<NEW_LINE>PerfMark.stopTask("NettyClientHandler.forcefulClose", tag);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>close(ctx, promise);<NEW_LINE>} | , true, new Metadata()); |
1,752,165 | public void execute() throws MojoExecutionException, MojoFailureException {<NEW_LINE>if (sourceFiles == null || sourceFiles.size() == 0) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File args4jBuildDir = new File(args4jBuildDirPath);<NEW_LINE>if (!args4jBuildDir.exists() && !args4jBuildDir.mkdirs()) {<NEW_LINE>throw new MojoExecutionException("Couldn't create the directory " + args4jBuildDir.getAbsolutePath());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>String path = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();<NEW_LINE>String enc = System.getProperty("file.encoding");<NEW_LINE>path = URLDecoder.decode(path, enc);<NEW_LINE>jar = new File(path);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new MojoExecutionException("Couldn't find the jar of the arg4s tools");<NEW_LINE>}<NEW_LINE>getLog().debug("Jar path:" + jar);<NEW_LINE>for (String relativeSourceFilePath : sourceFiles) {<NEW_LINE>try {<NEW_LINE>File sourceFile = new File(sourceDir, relativeSourceFilePath);<NEW_LINE>if (!sourceFile.exists()) {<NEW_LINE>getLog().warn("Source file " + sourceFile.getAbsolutePath() + " not found. Skipping");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>getLog().debug("Generating usage for " + sourceFile.getAbsolutePath());<NEW_LINE>generateUsage(sourceFile.getAbsolutePath(), args4jBuildDir);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new MojoExecutionException("Failed to generate usage for " + relativeSourceFilePath, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getLog().info("No sourceFiles defined. Skipping"); |
941,908 | private static Map<String, Set<String>> projectDependencies(Set<Project> projects) {<NEW_LINE>Map<String, Set<String>> project2DirectDependencies = new HashMap<>();<NEW_LINE>List<Project> todoList = new LinkedList<>(projects);<NEW_LINE>while (!todoList.isEmpty()) {<NEW_LINE>Project prj = todoList.remove(0);<NEW_LINE>String projectName = prj.getProjectDirectory().getNameExt();<NEW_LINE>if (project2DirectDependencies.containsKey(projectName))<NEW_LINE>continue;<NEW_LINE>SubprojectProvider subProject = prj.getLookup().lookup(SubprojectProvider.class);<NEW_LINE>if (subProject == null) {<NEW_LINE>project2DirectDependencies.put(projectName, Collections.<String>emptySet());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Set<String> <MASK><NEW_LINE>for (Project dep : subProject.getSubprojects()) {<NEW_LINE>if (// XXX - should be fixed in the provider<NEW_LINE>Objects.equals(projectName, dep.getProjectDirectory().getNameExt()))<NEW_LINE>continue;<NEW_LINE>todoList.add(dep);<NEW_LINE>deps.add(dep.getProjectDirectory().getNameExt());<NEW_LINE>}<NEW_LINE>project2DirectDependencies.put(projectName, deps);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>List<String> sortedProjects = org.openide.util.Utilities.topologicalSort(project2DirectDependencies.keySet(), project2DirectDependencies);<NEW_LINE>Map<String, Set<String>> project2AllDependencies = new HashMap<>();<NEW_LINE>Collections.reverse(sortedProjects);<NEW_LINE>for (String prj : sortedProjects) {<NEW_LINE>Set<String> dependencies = new HashSet<>();<NEW_LINE>for (String dep : project2DirectDependencies.get(prj)) {<NEW_LINE>dependencies.add(dep);<NEW_LINE>dependencies.addAll(project2AllDependencies.get(dep));<NEW_LINE>}<NEW_LINE>project2AllDependencies.put(prj, dependencies);<NEW_LINE>}<NEW_LINE>return project2AllDependencies;<NEW_LINE>} catch (TopologicalSortException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>return Collections.emptyMap();<NEW_LINE>}<NEW_LINE>} | deps = new HashSet<>(); |
1,131,017 | public void process(Element element, EComponentHolder holder) {<NEW_LINE>ExecutableElement executableElement = (ExecutableElement) element;<NEW_LINE>String returnTypeName = executableElement.getReturnType().toString();<NEW_LINE>AbstractJClass returnType = getJClass(returnTypeName);<NEW_LINE>JMethod method = codeModelHelper.overrideAnnotatedMethod(executableElement, holder);<NEW_LINE>codeModelHelper.removeBody(method);<NEW_LINE>JVar db = method.params().get(0);<NEW_LINE>JBlock body = method.body();<NEW_LINE>body.invoke(db, "beginTransaction");<NEW_LINE><MASK><NEW_LINE>IJExpression activitySuper = holder.getGeneratedClass().staticRef("super");<NEW_LINE>JInvocation superCall = JExpr.invoke(activitySuper, method);<NEW_LINE>for (JVar param : method.params()) {<NEW_LINE>superCall.arg(param);<NEW_LINE>}<NEW_LINE>JBlock tryBody = tryBlock.body();<NEW_LINE>if ("void".equals(returnTypeName)) {<NEW_LINE>tryBody.add(superCall);<NEW_LINE>tryBody.invoke(db, "setTransactionSuccessful");<NEW_LINE>tryBody._return();<NEW_LINE>} else {<NEW_LINE>JVar result = tryBody.decl(returnType, "result_", superCall);<NEW_LINE>tryBody.invoke(db, "setTransactionSuccessful");<NEW_LINE>tryBody._return(result);<NEW_LINE>}<NEW_LINE>JCatchBlock catchBlock = tryBlock._catch(getJClass(RuntimeException.class));<NEW_LINE>JVar exceptionParam = catchBlock.param("e");<NEW_LINE>JBlock catchBody = catchBlock.body();<NEW_LINE>JInvocation errorInvoke = catchBody.staticInvoke(getClasses().LOG, "e");<NEW_LINE>errorInvoke.arg(logTagForClassHolder(holder));<NEW_LINE>errorInvoke.arg("Error in transaction");<NEW_LINE>errorInvoke.arg(exceptionParam);<NEW_LINE>catchBody._throw(exceptionParam);<NEW_LINE>tryBlock._finally().invoke(db, "endTransaction");<NEW_LINE>} | JTryBlock tryBlock = body._try(); |
587,312 | private void mergeCompleted(SegmentProperties segmentProperties, UpdateableSegmentMetadata transactionMetadata, MergeSegmentOperation mergeOp) {<NEW_LINE>// We have processed a MergeSegmentOperation, pop the first operation off and decrement the counter.<NEW_LINE>StorageOperation processedOperation = this.operations.removeFirst();<NEW_LINE>assert processedOperation != null && processedOperation instanceof MergeSegmentOperation : "First outstanding operation was not a MergeSegmentOperation";<NEW_LINE>MergeSegmentOperation mop = (MergeSegmentOperation) processedOperation;<NEW_LINE>assert mop.getSourceSegmentId() == transactionMetadata.getId() : "First outstanding operation was a MergeSegmentOperation for the wrong Transaction id.";<NEW_LINE>int newCount = this.mergeTransactionCount.decrementAndGet();<NEW_LINE>assert newCount >= 0 : "Negative value for mergeTransactionCount";<NEW_LINE>// Post-merger validation. Verify we are still in agreement with the storage.<NEW_LINE>long expectedNewLength = this.metadata.getStorageLength() + mergeOp.getLength();<NEW_LINE>if (segmentProperties.getLength() != expectedNewLength) {<NEW_LINE>throw new CompletionException(new DataCorruptionException(String.format("Transaction Segment '%s' was merged into parent '%s' but the parent segment has an unexpected StorageLength after the merger. Previous=%d, MergeLength=%d, Expected=%d, Actual=%d", transactionMetadata.getName(), this.metadata.getName(), segmentProperties.getLength(), mergeOp.getLength(), expectedNewLength, segmentProperties.getLength())));<NEW_LINE>}<NEW_LINE>updateMetadata(segmentProperties);<NEW_LINE>updateMetadataForTransactionPostMerger(<MASK><NEW_LINE>} | transactionMetadata, mop.getStreamSegmentId()); |
1,782,280 | public boolean onMenuItemClick(MenuItem item) {<NEW_LINE>// prompt user to make sure they really want this<NEW_LINE>new androidx.appcompat.app.AlertDialog.Builder(PortForwardListActivity.this, R.style.AlertDialogTheme).setMessage(getString(R.string.delete_message, portForward.getNickname())).setPositiveButton(R.string.delete_pos, new DialogInterface.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(DialogInterface dialog, int which) {<NEW_LINE>try {<NEW_LINE>// Delete the port forward from the host if needed.<NEW_LINE>if (hostBridge != null)<NEW_LINE>hostBridge.removePortForward(portForward);<NEW_LINE>hostdb.deletePortForward(portForward);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.<MASK><NEW_LINE>}<NEW_LINE>updateHandler.sendEmptyMessage(-1);<NEW_LINE>}<NEW_LINE>}).setNegativeButton(R.string.delete_neg, null).create().show();<NEW_LINE>return true;<NEW_LINE>} | e(TAG, "Could not delete port forward", e); |
172,936 | Map<String, Object> serialize(T object, ErrorPath path) {<NEW_LINE>// TODO(wuandy): Add logic to skip @DocumentId annotated fields in serialization.<NEW_LINE>if (!clazz.isAssignableFrom(object.getClass())) {<NEW_LINE>throw new IllegalArgumentException("Can't serialize object of class " + object.getClass() + " with BeanMapper for class " + clazz);<NEW_LINE>}<NEW_LINE>Map<String, Object> result = new HashMap<>();<NEW_LINE>for (String property : properties.values()) {<NEW_LINE>// Skip @DocumentId annotated properties;<NEW_LINE>if (documentIdPropertyNames.contains(property)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Object propertyValue;<NEW_LINE>if (getters.containsKey(property)) {<NEW_LINE>Method getter = getters.get(property);<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>// Must be a field<NEW_LINE>Field field = fields.get(property);<NEW_LINE>if (field == null) {<NEW_LINE>throw new IllegalStateException("Bean property without field or getter: " + property);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>propertyValue = field.get(object);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Object serializedValue;<NEW_LINE>if (serverTimestamps.contains(property) && propertyValue == null) {<NEW_LINE>// Replace null ServerTimestamp-annotated fields with the sentinel.<NEW_LINE>serializedValue = FieldValue.serverTimestamp();<NEW_LINE>} else {<NEW_LINE>serializedValue = CustomClassMapper.serialize(propertyValue, path.child(property));<NEW_LINE>}<NEW_LINE>result.put(property, serializedValue);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | propertyValue = invoke(getter, object); |
642,064 | public void parse(InputStream in, DistanceCacheWriter cache) {<NEW_LINE>reader.reset(in);<NEW_LINE>IndefiniteProgress prog = LOG.isVerbose() ? new IndefiniteProgress("Parsing distance matrix", LOG) : null;<NEW_LINE>try {<NEW_LINE>int id1, id2;<NEW_LINE>while (reader.nextLineExceptComments()) {<NEW_LINE>if (!tokenizer.valid()) {<NEW_LINE>throw new IllegalArgumentException("Less than three values in line " + reader.getLineNumber());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>id1 = tokenizer.getIntBase10();<NEW_LINE>tokenizer.advance();<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new IllegalArgumentException("Error in line " + <MASK><NEW_LINE>}<NEW_LINE>if (!tokenizer.valid()) {<NEW_LINE>throw new IllegalArgumentException("Less than three values in line " + reader.getLineNumber());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>id2 = tokenizer.getIntBase10();<NEW_LINE>tokenizer.advance();<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new IllegalArgumentException("Error in line " + reader.getLineNumber() + ": id2 is not an integer!");<NEW_LINE>}<NEW_LINE>if (!tokenizer.valid()) {<NEW_LINE>throw new IllegalArgumentException("Less than three values in line " + reader.getLineNumber());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>cache.put(id1, id2, tokenizer.getDouble());<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new IllegalArgumentException("Error in line " + reader.getLineNumber() + ":" + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>tokenizer.advance();<NEW_LINE>if (tokenizer.valid()) {<NEW_LINE>throw new IllegalArgumentException("More than three values in line " + reader.getLineNumber());<NEW_LINE>}<NEW_LINE>LOG.incrementProcessed(prog);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new IllegalArgumentException("Error while parsing line " + reader.getLineNumber() + ".");<NEW_LINE>}<NEW_LINE>LOG.setCompleted(prog);<NEW_LINE>} | reader.getLineNumber() + ": id1 is not an integer!"); |
456,468 | public static QueryDeviceRecordLifeCycleResponse unmarshall(QueryDeviceRecordLifeCycleResponse queryDeviceRecordLifeCycleResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryDeviceRecordLifeCycleResponse.setRequestId(_ctx.stringValue("QueryDeviceRecordLifeCycleResponse.RequestId"));<NEW_LINE>queryDeviceRecordLifeCycleResponse.setSuccess(_ctx.booleanValue("QueryDeviceRecordLifeCycleResponse.Success"));<NEW_LINE>queryDeviceRecordLifeCycleResponse.setErrorMessage(_ctx.stringValue("QueryDeviceRecordLifeCycleResponse.ErrorMessage"));<NEW_LINE>queryDeviceRecordLifeCycleResponse.setCode(_ctx.integerValue("QueryDeviceRecordLifeCycleResponse.Code"));<NEW_LINE>List<DataItem> data <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryDeviceRecordLifeCycleResponse.Data.Length"); i++) {<NEW_LINE>DataItem dataItem = new DataItem();<NEW_LINE>dataItem.setIotId(_ctx.stringValue("QueryDeviceRecordLifeCycleResponse.Data[" + i + "].IotId"));<NEW_LINE>dataItem.setDay(_ctx.integerValue("QueryDeviceRecordLifeCycleResponse.Data[" + i + "].Day"));<NEW_LINE>data.add(dataItem);<NEW_LINE>}<NEW_LINE>queryDeviceRecordLifeCycleResponse.setData(data);<NEW_LINE>return queryDeviceRecordLifeCycleResponse;<NEW_LINE>} | = new ArrayList<DataItem>(); |
479,343 | final ExportTableToPointInTimeResult executeExportTableToPointInTime(ExportTableToPointInTimeRequest exportTableToPointInTimeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(exportTableToPointInTimeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ExportTableToPointInTimeRequest> request = null;<NEW_LINE>Response<ExportTableToPointInTimeResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ExportTableToPointInTimeRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(exportTableToPointInTimeRequest));<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, "DynamoDB");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ExportTableToPointInTime");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ExportTableToPointInTimeResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ExportTableToPointInTimeResultJsonUnmarshaller());<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,670,189 | public void dataTypeRenamed(DataTypeManager dtm, DataTypePath oldPath, DataTypePath newPath) {<NEW_LINE>DataTypeManager originalDTM = getOriginalDataTypeManager();<NEW_LINE>if (dtm != originalDTM) {<NEW_LINE>// Different DTM than the one for this data type.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!isLoaded()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (oldPath.getDataTypeName().equals(newPath.getDataTypeName())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String newName = newPath.getDataTypeName();<NEW_LINE>String oldName = oldPath.getDataTypeName();<NEW_LINE>// Does the old name match our original name.<NEW_LINE>// Check originalCompositeId to ensure original type is managed<NEW_LINE>if (originalCompositeId != DataTypeManager.NULL_DATATYPE_ID && oldPath.equals(originalDataTypePath)) {<NEW_LINE>originalDataTypePath = newPath;<NEW_LINE>try {<NEW_LINE>if (viewComposite.getName().equals(oldName)) {<NEW_LINE>setName(newName);<NEW_LINE>compositeInfoChanged();<NEW_LINE>}<NEW_LINE>} catch (DuplicateNameException e) {<NEW_LINE>Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);<NEW_LINE>} catch (InvalidNameException e) {<NEW_LINE>Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>DataType dt = viewDTM.getDataType(oldPath);<NEW_LINE>if (dt != null) {<NEW_LINE>try {<NEW_LINE>dt.setName(newName);<NEW_LINE>fireTableDataChanged();<NEW_LINE>componentDataChanged();<NEW_LINE>} catch (InvalidNameException e) {<NEW_LINE>Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);<NEW_LINE>} catch (DuplicateNameException e) {<NEW_LINE>Msg.error(this, "Unexpected Exception: " + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
532,647 | public SRemoteServiceCalled convertToSObject(RemoteServiceCalled input) {<NEW_LINE>if (input == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>SRemoteServiceCalled result = new SRemoteServiceCalled();<NEW_LINE>result.<MASK><NEW_LINE>result.setUuid(input.getUuid());<NEW_LINE>result.setRid(input.getRid());<NEW_LINE>result.setDate(input.getDate());<NEW_LINE>result.setAccessMethod(SAccessMethod.values()[input.getAccessMethod().ordinal()]);<NEW_LINE>result.setState(SNotifictionResultEnum.values()[input.getState().ordinal()]);<NEW_LINE>result.setPercentage(input.getPercentage());<NEW_LINE>result.getInfos().addAll(input.getInfos());<NEW_LINE>result.getWarnings().addAll(input.getWarnings());<NEW_LINE>result.getErrors().addAll(input.getErrors());<NEW_LINE>User executorVal = input.getExecutor();<NEW_LINE>result.setExecutorId(executorVal == null ? -1 : executorVal.getOid());<NEW_LINE>Service serviceVal = input.getService();<NEW_LINE>result.setServiceId(serviceVal == null ? -1 : serviceVal.getOid());<NEW_LINE>return result;<NEW_LINE>} | setOid(input.getOid()); |
120,738 | public static ListPreferredEcsTypesResponse unmarshall(ListPreferredEcsTypesResponse listPreferredEcsTypesResponse, UnmarshallerContext _ctx) {<NEW_LINE>listPreferredEcsTypesResponse.setRequestId(_ctx.stringValue("ListPreferredEcsTypesResponse.RequestId"));<NEW_LINE>listPreferredEcsTypesResponse.setSupportSpotInstance(_ctx.booleanValue("ListPreferredEcsTypesResponse.SupportSpotInstance"));<NEW_LINE>List<SeriesInfo> series = new ArrayList<SeriesInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListPreferredEcsTypesResponse.Series.Length"); i++) {<NEW_LINE>SeriesInfo seriesInfo = new SeriesInfo();<NEW_LINE>seriesInfo.setSeriesId(_ctx.stringValue("ListPreferredEcsTypesResponse.Series[" + i + "].SeriesId"));<NEW_LINE>seriesInfo.setSeriesName(_ctx.stringValue("ListPreferredEcsTypesResponse.Series[" + i + "].SeriesName"));<NEW_LINE>Roles roles = new Roles();<NEW_LINE>List<String> manager = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("ListPreferredEcsTypesResponse.Series[" + i + "].Roles.Manager.Length"); j++) {<NEW_LINE>manager.add(_ctx.stringValue("ListPreferredEcsTypesResponse.Series[" + i <MASK><NEW_LINE>}<NEW_LINE>roles.setManager(manager);<NEW_LINE>List<String> compute = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("ListPreferredEcsTypesResponse.Series[" + i + "].Roles.Compute.Length"); j++) {<NEW_LINE>compute.add(_ctx.stringValue("ListPreferredEcsTypesResponse.Series[" + i + "].Roles.Compute[" + j + "]"));<NEW_LINE>}<NEW_LINE>roles.setCompute(compute);<NEW_LINE>List<String> login = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("ListPreferredEcsTypesResponse.Series[" + i + "].Roles.Login.Length"); j++) {<NEW_LINE>login.add(_ctx.stringValue("ListPreferredEcsTypesResponse.Series[" + i + "].Roles.Login[" + j + "]"));<NEW_LINE>}<NEW_LINE>roles.setLogin(login);<NEW_LINE>seriesInfo.setRoles(roles);<NEW_LINE>series.add(seriesInfo);<NEW_LINE>}<NEW_LINE>listPreferredEcsTypesResponse.setSeries(series);<NEW_LINE>return listPreferredEcsTypesResponse;<NEW_LINE>} | + "].Roles.Manager[" + j + "]")); |
618,859 | private // These metrics can be useful for diagnosing native memory usage.<NEW_LINE>void updateBufferPoolMetrics() {<NEW_LINE>for (BufferPoolMXBean bufferPoolMXBean : bufferPoolMXBeanList) {<NEW_LINE>String normalizedKeyName = bufferPoolMXBean.getName().replaceAll("[^\\w]", "-");<NEW_LINE>final ByteAmount memoryUsed = ByteAmount.fromBytes(bufferPoolMXBean.getMemoryUsed());<NEW_LINE>final ByteAmount totalCapacity = ByteAmount.fromBytes(bufferPoolMXBean.getTotalCapacity());<NEW_LINE>final ByteAmount count = ByteAmount.fromBytes(bufferPoolMXBean.getCount());<NEW_LINE>// The estimated memory the JVM is using for this buffer pool<NEW_LINE>jvmBufferPoolMemoryUsage.safeScope(normalizedKeyName + "-memory-used").<MASK><NEW_LINE>// The estimated total capacity of the buffers in this pool<NEW_LINE>jvmBufferPoolMemoryUsage.safeScope(normalizedKeyName + "-total-capacity").setValue(totalCapacity.asMegabytes());<NEW_LINE>// THe estimated number of buffers in this pool<NEW_LINE>jvmBufferPoolMemoryUsage.safeScope(normalizedKeyName + "-count").setValue(count.asMegabytes());<NEW_LINE>}<NEW_LINE>} | setValue(memoryUsed.asMegabytes()); |
626,061 | public static Completable requestPermissions(final Activity activity, List<String> permissions) {<NEW_LINE>return Completable.create(emitter -> {<NEW_LINE>Logger.debug("Start Dexter " + new Date().getTime());<NEW_LINE>try {<NEW_LINE>Dexter.withActivity(activity).withPermissions(permissions).withListener(new MultiplePermissionsListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPermissionsChecked(MultiplePermissionsReport report) {<NEW_LINE>if (report.areAllPermissionsGranted()) {<NEW_LINE>Logger.debug("Dexter Complete" + new Date().getTime());<NEW_LINE>emitter.onComplete();<NEW_LINE>} else {<NEW_LINE>Logger.debug("Dexter Error" + new <MASK><NEW_LINE>emitter.onError(new Throwable(activity.getString(R.string.permission_denied)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions1, PermissionToken token) {<NEW_LINE>token.continuePermissionRequest();<NEW_LINE>}<NEW_LINE>}).check();<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(e);<NEW_LINE>}<NEW_LINE>}).subscribeOn(RX.main()).observeOn(RX.main());<NEW_LINE>} | Date().getTime()); |
155,202 | public static void addMethodMetaData(ActionReport ar, Map<String, MethodMetaData> mmd) {<NEW_LINE>List<Map> methodMetaData = new ArrayList<Map>();<NEW_LINE>MethodMetaData getMetaData = mmd.get("GET");<NEW_LINE>methodMetaData.add(new HashMap() {<NEW_LINE><NEW_LINE>{<NEW_LINE>put("name", "GET");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (getMetaData != null) {<NEW_LINE>// are they extra params for a GET command?<NEW_LINE>Map<String, Object> getMetaDataMap = new HashMap<String, Object>();<NEW_LINE>if (getMetaData.sizeParameterMetaData() > 0) {<NEW_LINE>getMetaDataMap.put(MESSAGE_PARAMETERS, buildMethodMetadataMap(getMetaData));<NEW_LINE>}<NEW_LINE>methodMetaData.add(getMetaDataMap);<NEW_LINE>}<NEW_LINE>MethodMetaData postMetaData = mmd.get("POST");<NEW_LINE>Map<String, Object> postMetaDataMap = new <MASK><NEW_LINE>if (postMetaData != null) {<NEW_LINE>postMetaDataMap.put("name", "POST");<NEW_LINE>// if (postMetaData.sizeQueryParamMetaData() > 0) {<NEW_LINE>// postMetaDataMap.put(QUERY_PARAMETERS, buildMethodMetadataMap(postMetaData, true));<NEW_LINE>// }<NEW_LINE>if (postMetaData.sizeParameterMetaData() > 0) {<NEW_LINE>postMetaDataMap.put(MESSAGE_PARAMETERS, buildMethodMetadataMap(postMetaData));<NEW_LINE>}<NEW_LINE>methodMetaData.add(postMetaDataMap);<NEW_LINE>}<NEW_LINE>MethodMetaData deleteMetaData = mmd.get("DELETE");<NEW_LINE>if (deleteMetaData != null) {<NEW_LINE>Map<String, Object> deleteMetaDataMap = new HashMap<String, Object>();<NEW_LINE>deleteMetaDataMap.put("name", "DELETE");<NEW_LINE>deleteMetaDataMap.put(MESSAGE_PARAMETERS, buildMethodMetadataMap(deleteMetaData));<NEW_LINE>methodMetaData.add(deleteMetaDataMap);<NEW_LINE>}<NEW_LINE>ar.getExtraProperties().put("methods", methodMetaData);<NEW_LINE>} | HashMap<String, Object>(); |
820,821 | protected void checkTables() throws SQLException {<NEW_LINE>logger.entering(CLASSNAME, "checkMySQLTables");<NEW_LINE>setCreateMySQLStringsMap(tableNames);<NEW_LINE>createTableIfNotExists(tableNames.get(CHECKPOINT_TABLE_KEY), createMySQLStrings.get(MYSQL_CREATE_TABLE_CHECKPOINTDATA));<NEW_LINE>createTableIfNotExists(tableNames.get(JOB_INSTANCE_TABLE_KEY), createMySQLStrings.get(MYSQL_CREATE_TABLE_JOBINSTANCEDATA));<NEW_LINE>createTableIfNotExists(tableNames.get(EXECUTION_INSTANCE_TABLE_KEY)<MASK><NEW_LINE>createTableIfNotExists(tableNames.get(STEP_EXECUTION_INSTANCE_TABLE_KEY), createMySQLStrings.get(MYSQL_CREATE_TABLE_STEPINSTANCEDATA));<NEW_LINE>createTableIfNotExists(tableNames.get(JOB_STATUS_TABLE_KEY), createMySQLStrings.get(MYSQL_CREATE_TABLE_JOBSTATUS));<NEW_LINE>createTableIfNotExists(tableNames.get(STEP_STATUS_TABLE_KEY), createMySQLStrings.get(MYSQL_CREATE_TABLE_STEPSTATUS));<NEW_LINE>logger.exiting(CLASSNAME, "checkMySQLTables");<NEW_LINE>} | , createMySQLStrings.get(MYSQL_CREATE_TABLE_EXECUTIONINSTANCEDATA)); |
562,333 | public static void sendReceiveMessagesThroughConnect(String connectPodName, String topicName, final String kafkaClientsPodName, final String scraperPodName, String namespace, String clusterName) {<NEW_LINE>LOGGER.info("Send and receive messages through KafkaConnect");<NEW_LINE>KafkaConnectUtils.waitUntilKafkaConnectRestApiIsAvailable(namespace, connectPodName);<NEW_LINE>KafkaConnectorUtils.createFileSinkConnector(namespace, scraperPodName, topicName, Constants.DEFAULT_SINK_FILE_PATH, KafkaConnectResources.url<MASK><NEW_LINE>InternalKafkaClient internalKafkaClient = new InternalKafkaClient.Builder().withUsingPodName(kafkaClientsPodName).withTopicName(topicName).withNamespaceName(namespace).withClusterName(clusterName).withMessageCount(100).withListenerName(Constants.PLAIN_LISTENER_DEFAULT_NAME).build();<NEW_LINE>internalKafkaClient.checkProducedAndConsumedMessages(internalKafkaClient.sendMessagesPlain(), internalKafkaClient.receiveMessagesPlain());<NEW_LINE>KafkaConnectUtils.waitForMessagesInKafkaConnectFileSink(namespace, connectPodName, Constants.DEFAULT_SINK_FILE_PATH, "99");<NEW_LINE>} | (clusterName, namespace, 8083)); |
570,324 | static private final void ExpandBuff(boolean wrapAround) {<NEW_LINE>char[] newbuffer = new char[bufsize + 2048];<NEW_LINE>int[] newbufline = new int[bufsize + 2048];<NEW_LINE>int[] newbufcolumn = new int[bufsize + 2048];<NEW_LINE>try {<NEW_LINE>if (wrapAround) {<NEW_LINE>System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);<NEW_LINE>System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);<NEW_LINE>buffer = newbuffer;<NEW_LINE>System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);<NEW_LINE>System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);<NEW_LINE>bufline = newbufline;<NEW_LINE>System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);<NEW_LINE>System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);<NEW_LINE>bufcolumn = newbufcolumn;<NEW_LINE>maxNextCharInd = (bufpos += (bufsize - tokenBegin));<NEW_LINE>} else {<NEW_LINE>System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);<NEW_LINE>buffer = newbuffer;<NEW_LINE>System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);<NEW_LINE>bufline = newbufline;<NEW_LINE>System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);<NEW_LINE>bufcolumn = newbufcolumn;<NEW_LINE>maxNextCharInd = (bufpos -= tokenBegin);<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>bufsize += 2048;<NEW_LINE>available = bufsize;<NEW_LINE>tokenBegin = 0;<NEW_LINE>} | Error(t.getMessage()); |
281,581 | LiveVariableLattice flowThrough(Node node, LiveVariableLattice input) {<NEW_LINE>final BitSet gen = new BitSet(input.liveSet.size());<NEW_LINE>final BitSet kill = new BitSet(input.liveSet.size());<NEW_LINE>// Make kills conditional if the node can end abruptly by an exception.<NEW_LINE>boolean conditional = false;<NEW_LINE>List<? extends DiGraphEdge<Node, Branch>> edgeList = getCfg().getOutEdges(node);<NEW_LINE>for (DiGraphEdge<Node, Branch> edge : edgeList) {<NEW_LINE>if (Branch.ON_EX.equals(edge.getValue())) {<NEW_LINE>conditional = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>computeGenKill(<MASK><NEW_LINE>LiveVariableLattice result = new LiveVariableLattice(input);<NEW_LINE>// L_in = L_out - Kill + Gen<NEW_LINE>result.liveSet.andNot(kill);<NEW_LINE>result.liveSet.or(gen);<NEW_LINE>return result;<NEW_LINE>} | node, gen, kill, conditional); |
1,247,449 | public void save(OutputStream os, SaveFileFormat save) {<NEW_LINE>referenceTracker.inspectTypes(world);<NEW_LINE>referenceTracker.preWrite(save);<NEW_LINE>save.archetypes = new ArchetypeMapper(world, save.entities);<NEW_LINE>componentCollector.preWrite(save);<NEW_LINE>entitySerializer.serializationState = save;<NEW_LINE>transmuterEntrySerializer.identifiers = save.componentIdentifiers;<NEW_LINE>entitySerializer.archetypeMapper = new ArchetypeMapper(world, save.entities);<NEW_LINE>entitySerializer.archetypeMapper.serializationState = save;<NEW_LINE>save.componentIdentifiers.build();<NEW_LINE>Output output = new Output(os);<NEW_LINE>kryo.writeObject(output, save.componentIdentifiers);<NEW_LINE>kryo.writeObject(output, save.archetypes);<NEW_LINE>output.writeInt(<MASK><NEW_LINE>kryo.writeObject(output, save);<NEW_LINE>output.flush();<NEW_LINE>output.close();<NEW_LINE>entitySerializer.clearSerializerCache();<NEW_LINE>} | save.entities.size()); |
833,920 | private void initComponents() {<NEW_LINE>setLayout(new BorderLayout());<NEW_LINE>setOpaque(false);<NEW_LINE>if (!hasData) {<NEW_LINE>setLayout(new BorderLayout());<NEW_LINE>add(MessageComponent.noData("Per thread allocations", JFRSnapshotSamplerViewProvider.ThreadAllocationsChecker.checkedTypes<MASK><NEW_LINE>} else {<NEW_LINE>tableModel = new TreadsAllocTableModel();<NEW_LINE>table = new ProfilerTable(tableModel, true, true, null);<NEW_LINE>table.setMainColumn(0);<NEW_LINE>table.setFitWidthColumn(0);<NEW_LINE>table.setSortColumn(1);<NEW_LINE>table.setDefaultSortOrder(SortOrder.DESCENDING);<NEW_LINE>table.setDefaultSortOrder(0, SortOrder.ASCENDING);<NEW_LINE>renderers = new HideableBarRenderer[1];<NEW_LINE>renderers[0] = new HideableBarRenderer(new NumberPercentRenderer(Formatters.bytesFormat()));<NEW_LINE>LabelRenderer threadRenderer = new LabelRenderer();<NEW_LINE>threadRenderer.setIcon(Icons.getIcon(ProfilerIcons.THREAD));<NEW_LINE>threadRenderer.setFont(threadRenderer.getFont().deriveFont(Font.BOLD));<NEW_LINE>table.setColumnRenderer(0, threadRenderer);<NEW_LINE>table.setColumnRenderer(1, renderers[0]);<NEW_LINE>add(new ProfilerTableContainer(table, false, null), BorderLayout.CENTER);<NEW_LINE>}<NEW_LINE>} | ()), BorderLayout.CENTER); |
1,668,460 | protected Polygon[] convertAvoidAreas(JSONObject geoJson) throws StatusCodeException {<NEW_LINE>// It seems that arrays in json.simple cannot be converted to strings simply<NEW_LINE>org.json.JSONObject complexJson = new org.json.JSONObject();<NEW_LINE>complexJson.put("type", geoJson.get("type"));<NEW_LINE>List<List<Double[]>> coordinates = (List<List<Double[]>>) geoJson.get("coordinates");<NEW_LINE>complexJson.put("coordinates", coordinates);<NEW_LINE>Geometry convertedGeom;<NEW_LINE>try {<NEW_LINE>convertedGeom = GeometryJSON.parse(complexJson);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new ParameterValueException(<MASK><NEW_LINE>}<NEW_LINE>Polygon[] avoidAreas;<NEW_LINE>if (convertedGeom instanceof Polygon) {<NEW_LINE>avoidAreas = new Polygon[] { (Polygon) convertedGeom };<NEW_LINE>} else if (convertedGeom instanceof MultiPolygon) {<NEW_LINE>MultiPolygon multiPoly = (MultiPolygon) convertedGeom;<NEW_LINE>avoidAreas = new Polygon[multiPoly.getNumGeometries()];<NEW_LINE>for (int i = 0; i < multiPoly.getNumGeometries(); i++) avoidAreas[i] = (Polygon) multiPoly.getGeometryN(i);<NEW_LINE>} else {<NEW_LINE>throw new ParameterValueException(GenericErrorCodes.INVALID_PARAMETER_VALUE, RequestOptions.PARAM_AVOID_POLYGONS);<NEW_LINE>}<NEW_LINE>return avoidAreas;<NEW_LINE>} | GenericErrorCodes.INVALID_JSON_FORMAT, RequestOptions.PARAM_AVOID_POLYGONS); |
308,449 | public Request<DescribeReservedInstancesListingsRequest> marshall(DescribeReservedInstancesListingsRequest describeReservedInstancesListingsRequest) {<NEW_LINE>if (describeReservedInstancesListingsRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<DescribeReservedInstancesListingsRequest> request = new DefaultRequest<DescribeReservedInstancesListingsRequest>(describeReservedInstancesListingsRequest, "AmazonEC2");<NEW_LINE>request.addParameter("Action", "DescribeReservedInstancesListings");<NEW_LINE>request.addParameter("Version", "2016-11-15");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>com.amazonaws.internal.SdkInternalList<Filter> describeReservedInstancesListingsRequestFiltersList = (com.amazonaws.internal.SdkInternalList<Filter>) describeReservedInstancesListingsRequest.getFilters();<NEW_LINE>if (!describeReservedInstancesListingsRequestFiltersList.isEmpty() || !describeReservedInstancesListingsRequestFiltersList.isAutoConstruct()) {<NEW_LINE>int filtersListIndex = 1;<NEW_LINE>for (Filter describeReservedInstancesListingsRequestFiltersListValue : describeReservedInstancesListingsRequestFiltersList) {<NEW_LINE>if (describeReservedInstancesListingsRequestFiltersListValue.getName() != null) {<NEW_LINE>request.addParameter("Filter." + filtersListIndex + ".Name", StringUtils.fromString(describeReservedInstancesListingsRequestFiltersListValue.getName()));<NEW_LINE>}<NEW_LINE>com.amazonaws.internal.SdkInternalList<String> filterValuesList = (com.amazonaws.internal.SdkInternalList<String>) describeReservedInstancesListingsRequestFiltersListValue.getValues();<NEW_LINE>if (!filterValuesList.isEmpty() || !filterValuesList.isAutoConstruct()) {<NEW_LINE>int valuesListIndex = 1;<NEW_LINE>for (String filterValuesListValue : filterValuesList) {<NEW_LINE>if (filterValuesListValue != null) {<NEW_LINE>request.addParameter("Filter." + filtersListIndex + ".Value." + valuesListIndex, StringUtils.fromString(filterValuesListValue));<NEW_LINE>}<NEW_LINE>valuesListIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>filtersListIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (describeReservedInstancesListingsRequest.getReservedInstancesId() != null) {<NEW_LINE>request.addParameter("ReservedInstancesId", StringUtils.fromString(describeReservedInstancesListingsRequest.getReservedInstancesId()));<NEW_LINE>}<NEW_LINE>if (describeReservedInstancesListingsRequest.getReservedInstancesListingId() != null) {<NEW_LINE>request.addParameter("ReservedInstancesListingId", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (describeReservedInstancesListingsRequest.getReservedInstancesListingId())); |
1,073,210 | public void decode8x16(MBlock mBlock, Picture mb, Frame[][] refs, PartPred p0, PartPred p1) {<NEW_LINE>int mbX = mapper.getMbX(mBlock.mbIdx);<NEW_LINE>int mbY = mapper.getMbY(mBlock.mbIdx);<NEW_LINE>boolean leftAvailable = mapper.leftAvailable(mBlock.mbIdx);<NEW_LINE>boolean topAvailable = mapper.topAvailable(mBlock.mbIdx);<NEW_LINE>boolean topLeftAvailable = <MASK><NEW_LINE>boolean topRightAvailable = mapper.topRightAvailable(mBlock.mbIdx);<NEW_LINE>int address = mapper.getAddress(mBlock.mbIdx);<NEW_LINE>for (int list = 0; list < 2; list++) {<NEW_LINE>predictInter8x16(mBlock, mbb[list], refs, mbX, mbY, leftAvailable, topAvailable, topLeftAvailable, topRightAvailable, mBlock.x, list, p0, p1);<NEW_LINE>}<NEW_LINE>mergePrediction(sh, mBlock.x.mv0R(0), mBlock.x.mv1R(0), p0, 0, mbb[0].getPlaneData(0), mbb[1].getPlaneData(0), 0, 16, 8, 16, mb.getPlaneData(0), refs, poc);<NEW_LINE>mergePrediction(sh, mBlock.x.mv0R(2), mBlock.x.mv1R(2), p1, 0, mbb[0].getPlaneData(0), mbb[1].getPlaneData(0), 8, 16, 8, 16, mb.getPlaneData(0), refs, poc);<NEW_LINE>mBlock.partPreds[0] = mBlock.partPreds[2] = p0;<NEW_LINE>mBlock.partPreds[1] = mBlock.partPreds[3] = p1;<NEW_LINE>predictChromaInter(refs, mBlock.x, mbX << 3, mbY << 3, 1, mb, mBlock.partPreds);<NEW_LINE>predictChromaInter(refs, mBlock.x, mbX << 3, mbY << 3, 2, mb, mBlock.partPreds);<NEW_LINE>residualInter(mBlock, refs, leftAvailable, topAvailable, mbX, mbY, mapper.getAddress(mBlock.mbIdx));<NEW_LINE>saveMvs(di, mBlock.x, mbX, mbY);<NEW_LINE>mergeResidual(mb, mBlock.ac, mBlock.transform8x8Used ? COMP_BLOCK_8x8_LUT : COMP_BLOCK_4x4_LUT, mBlock.transform8x8Used ? COMP_POS_8x8_LUT : COMP_POS_4x4_LUT);<NEW_LINE>collectPredictors(s, mb, mbX);<NEW_LINE>di.mbTypes[address] = mBlock.curMbType;<NEW_LINE>} | mapper.topLeftAvailable(mBlock.mbIdx); |
741,193 | public void formatQuery(List<DataPointGroup> queryResults, boolean excludeTags, int sampleSize, boolean filterEmptyResults) throws FormatterException {<NEW_LINE>try {<NEW_LINE>m_jsonWriter.object();<NEW_LINE>if (sampleSize != -1)<NEW_LINE>m_jsonWriter.key("sample_size").value(sampleSize);<NEW_LINE>m_jsonWriter.key("results").array();<NEW_LINE>// This loop must call close on each group at the end.<NEW_LINE>for (DataPointGroup group : queryResults) {<NEW_LINE>if (filterEmptyResults && !group.hasNext())<NEW_LINE>// no data so we don't print this one out<NEW_LINE>continue;<NEW_LINE>final String metric = group.getName();<NEW_LINE>m_jsonWriter.object();<NEW_LINE>m_jsonWriter.key("name").value(metric);<NEW_LINE>if (!group.getGroupByResult().isEmpty()) {<NEW_LINE>m_jsonWriter.key("group_by");<NEW_LINE>m_jsonWriter.array();<NEW_LINE>boolean first = true;<NEW_LINE>for (GroupByResult groupByResult : group.getGroupByResult()) {<NEW_LINE>if (!first)<NEW_LINE>m_writer.write(",");<NEW_LINE>m_writer.<MASK><NEW_LINE>first = false;<NEW_LINE>}<NEW_LINE>m_jsonWriter.endArray();<NEW_LINE>}<NEW_LINE>if (!excludeTags) {<NEW_LINE>// todo move this to after the values are obtained so we can filter unused tags<NEW_LINE>m_jsonWriter.key("tags").object();<NEW_LINE>for (String tagName : group.getTagNames()) {<NEW_LINE>m_jsonWriter.key(tagName);<NEW_LINE>m_jsonWriter.value(group.getTagValues(tagName));<NEW_LINE>}<NEW_LINE>m_jsonWriter.endObject();<NEW_LINE>}<NEW_LINE>m_jsonWriter.key("values").array();<NEW_LINE>while (group.hasNext()) {<NEW_LINE>DataPoint dataPoint = group.next();<NEW_LINE>m_jsonWriter.array().value(dataPoint.getTimestamp());<NEW_LINE>dataPoint.writeValueToJson(m_jsonWriter);<NEW_LINE>m_jsonWriter.endArray();<NEW_LINE>}<NEW_LINE>m_jsonWriter.endArray();<NEW_LINE>m_jsonWriter.endObject();<NEW_LINE>// Don't close the group the caller will do that.<NEW_LINE>}<NEW_LINE>m_jsonWriter.endArray().endObject();<NEW_LINE>} catch (JSONException e) {<NEW_LINE>throw new FormatterException(e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new FormatterException(e);<NEW_LINE>}<NEW_LINE>} | write(groupByResult.toJson()); |
601,056 | public LogicalPlan visitTableFunction(TableFunctionRelation node, ExpressionMapping context) {<NEW_LINE>List<ColumnRefOperator> outputColumns = new ArrayList<>();<NEW_LINE>TableFunction tableFunction = node.getTableFunction();<NEW_LINE>for (int i = 0; i < tableFunction.getTableFnReturnTypes().size(); ++i) {<NEW_LINE>outputColumns.add(columnRefFactory.create(tableFunction.getDefaultColumnNames().get(i), tableFunction.getTableFnReturnTypes().get(i), true));<NEW_LINE>}<NEW_LINE>FunctionCallExpr expr = new FunctionCallExpr(tableFunction.getFunctionName(), node.getChildExpressions());<NEW_LINE>expr.setFn(tableFunction);<NEW_LINE>ScalarOperator operator = SqlToScalarOperatorTranslator.translate(expr, context);<NEW_LINE>Map<ColumnRefOperator, ScalarOperator> projectMap = new HashMap<>();<NEW_LINE>for (ScalarOperator scalarOperator : operator.getChildren()) {<NEW_LINE>if (scalarOperator instanceof ColumnRefOperator) {<NEW_LINE>projectMap.put((ColumnRefOperator) scalarOperator, scalarOperator);<NEW_LINE>} else {<NEW_LINE>ColumnRefOperator columnRefOperator = columnRefFactory.create(scalarOperator, scalarOperator.getType(), scalarOperator.isNullable());<NEW_LINE>projectMap.put(columnRefOperator, scalarOperator);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Operator root = new LogicalTableFunctionOperator(new ColumnRefSet(outputColumns), <MASK><NEW_LINE>return new LogicalPlan(new OptExprBuilder(root, Collections.emptyList(), new ExpressionMapping(new Scope(RelationId.of(node), node.getRelationFields()), outputColumns)), null, null);<NEW_LINE>} | node.getTableFunction(), projectMap); |
302,939 | // start lifecycle<NEW_LINE>@Override<NEW_LINE>protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_password);<NEW_LINE>// For set status bar<NEW_LINE>ChinaPhoneHelper.setStatusBar(this, true);<NEW_LINE>// Get this page mode<NEW_LINE>currentMode = getIntent().getIntExtra("password_mode", FAIL);<NEW_LINE>showReleaseNote = getIntent().getBooleanExtra("showReleaseNote", false);<NEW_LINE>if (currentMode == FAIL) {<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE>IV_password_number_1 = (ImageView) findViewById(R.id.IV_password_number_1);<NEW_LINE>IV_password_number_2 = (ImageView) findViewById(R.id.IV_password_number_2);<NEW_LINE>IV_password_number_3 = (ImageView) findViewById(R.id.IV_password_number_3);<NEW_LINE>IV_password_number_4 = (ImageView) findViewById(R.id.IV_password_number_4);<NEW_LINE>TV_password_message = (TextView) findViewById(R.id.TV_password_message);<NEW_LINE>TV_password_sub_message = (TextView) findViewById(R.id.TV_password_sub_message);<NEW_LINE>But_password_key_1 = (Button) findViewById(R.id.But_password_key_1);<NEW_LINE>But_password_key_2 = (Button) findViewById(R.id.But_password_key_2);<NEW_LINE>But_password_key_3 = (Button) findViewById(R.id.But_password_key_3);<NEW_LINE>But_password_key_4 = (Button) findViewById(R.id.But_password_key_4);<NEW_LINE>But_password_key_5 = (Button) findViewById(R.id.But_password_key_5);<NEW_LINE>But_password_key_6 = (Button) findViewById(R.id.But_password_key_6);<NEW_LINE>But_password_key_7 = (Button) findViewById(R.id.But_password_key_7);<NEW_LINE>But_password_key_8 = (Button) findViewById(R.id.But_password_key_8);<NEW_LINE>But_password_key_9 = (Button) findViewById(R.id.But_password_key_9);<NEW_LINE>But_password_key_cancel = (Button) findViewById(R.id.But_password_key_cancel);<NEW_LINE>But_password_key_0 = (Button) findViewById(R.id.But_password_key_0);<NEW_LINE>But_password_key_backspace = (ImageButton) <MASK><NEW_LINE>But_password_key_1.setOnClickListener(this);<NEW_LINE>But_password_key_2.setOnClickListener(this);<NEW_LINE>But_password_key_3.setOnClickListener(this);<NEW_LINE>But_password_key_4.setOnClickListener(this);<NEW_LINE>But_password_key_5.setOnClickListener(this);<NEW_LINE>But_password_key_6.setOnClickListener(this);<NEW_LINE>But_password_key_7.setOnClickListener(this);<NEW_LINE>But_password_key_8.setOnClickListener(this);<NEW_LINE>But_password_key_9.setOnClickListener(this);<NEW_LINE>But_password_key_0.setOnClickListener(this);<NEW_LINE>But_password_key_backspace.setOnClickListener(this);<NEW_LINE>But_password_key_cancel.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>clearUiPassword();<NEW_LINE>initUI();<NEW_LINE>} | findViewById(R.id.But_password_key_backspace); |
359,959 | private void renderRuntimeThreads() throws IOException {<NEW_LINE>ClassReader threadCls = classSource.get(THREAD_CLASS);<NEW_LINE>MethodReader currentThreadMethod = threadCls != null ? threadCls.getMethod(CURRENT_THREAD_METHOD) : null;<NEW_LINE>boolean threadUsed = currentThreadMethod != null && currentThreadMethod.getProgram() != null;<NEW_LINE>writer.append("function $rt_getThread()").ws().append("{").indent().softNewLine();<NEW_LINE>if (threadUsed) {<NEW_LINE>writer.append("return ").appendMethodBody(Thread.class, "currentThread", Thread.class).append("();").softNewLine();<NEW_LINE>} else {<NEW_LINE>writer.append("return null;").softNewLine();<NEW_LINE>}<NEW_LINE>writer.outdent().append("}").newLine();<NEW_LINE>writer.append("function $rt_setThread(t)").ws().append("{")<MASK><NEW_LINE>if (threadUsed) {<NEW_LINE>writer.append("return ").appendMethodBody(Thread.class, "setCurrentThread", Thread.class, void.class).append("(t);").softNewLine();<NEW_LINE>}<NEW_LINE>writer.outdent().append("}").newLine();<NEW_LINE>} | .indent().softNewLine(); |
1,164,862 | public void testRemoteAsyncCancelledTrueParameter() throws Exception {<NEW_LINE>svLogger.info("In testAsyncCancelledTrueParameter");<NEW_LINE>List<Future<String>> uncancelledFutures = new ArrayList<Future<String>>();<NEW_LINE>while (uncancelledFutures.size() < MAX_CANCEL_ATTEMPTS) {<NEW_LINE>Future<String> future = driverBean.asyncCancelled();<NEW_LINE>if (future.cancel(true)) {<NEW_LINE>assertTrue(<MASK><NEW_LINE>assertTrue("Future.isDone failed to return true", future.isDone());<NEW_LINE>try {<NEW_LINE>getWithTimeout(future);<NEW_LINE>fail("Future.get(timeout,TimeUnit) failed to throw CancellationException");<NEW_LINE>} catch (CancellationException e) {<NEW_LINE>svLogger.info("Caught expected exception: " + e);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>uncancelledFutures.add(future);<NEW_LINE>}<NEW_LINE>// Cleanup.<NEW_LINE>for (Future<String> uncancelledFuture : uncancelledFutures) {<NEW_LINE>getWithTimeout(uncancelledFuture);<NEW_LINE>}<NEW_LINE>} | "Future.isCancelled failed to return true", future.isCancelled()); |
1,821,710 | protected RelDataType deriveRowType() {<NEW_LINE>final RelDataTypeFactory typeFactory = getCluster().getTypeFactory();<NEW_LINE>List<RelDataTypeFieldImpl> columns = new LinkedList<>();<NEW_LINE>columns.add(new RelDataTypeFieldImpl("POOL_ID", 0, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("BLOCK_ID", 1, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("SPACE", 2, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("PAGE_NUMBER", 3, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("PAGE_TYPE", 4, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("FLUSH_TYPE", 5, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("FIX_COUNT", 6, typeFactory.<MASK><NEW_LINE>columns.add(new RelDataTypeFieldImpl("IS_HASHED", 7, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("NEWEST_MODIFICATION", 8, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("OLDEST_MODIFICATION", 9, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("ACCESS_TIME", 10, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("TABLE_NAME", 11, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("INDEX_NAME", 12, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("NUMBER_RECORDS", 13, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("DATA_SIZE", 14, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("COMPRESSED_SIZE", 15, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("PAGE_STATE", 16, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("IO_FIX", 17, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("IS_OLD", 18, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("FREE_PAGE_CLOCK", 19, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>return typeFactory.createStructType(columns);<NEW_LINE>} | createSqlType(SqlTypeName.BIGINT))); |
1,201,191 | public void check() throws SQLException {<NEW_LINE>MariaDBTable randomTable = s.getRandomTable();<NEW_LINE>List<MariaDBColumn> columns = randomTable.getColumns();<NEW_LINE>MariaDBExpressionGenerator gen = new MariaDBExpressionGenerator(state.getRandomly()).setColumns(columns).setCon(con).setState(state.getState());<NEW_LINE>MariaDBExpression randomWhereCondition = gen.getRandomExpression();<NEW_LINE>// getRandomExpressions(columns);<NEW_LINE>List<MariaDBExpression> groupBys = Collections.emptyList();<NEW_LINE>int optimizedCount = <MASK><NEW_LINE>int unoptimizedCount = getUnoptimizedQuery(randomTable, randomWhereCondition, groupBys);<NEW_LINE>if (optimizedCount == NOT_FOUND || unoptimizedCount == NOT_FOUND) {<NEW_LINE>throw new IgnoreMeException();<NEW_LINE>}<NEW_LINE>if (optimizedCount != unoptimizedCount) {<NEW_LINE>state.getState().getLocalState().log(optimizedQueryString + ";\n" + unoptimizedQueryString + ";");<NEW_LINE>throw new AssertionError(optimizedCount + " " + unoptimizedCount);<NEW_LINE>}<NEW_LINE>} | getOptimizedQuery(randomTable, randomWhereCondition, groupBys); |
414,191 | public void advanceStop(final String vmUuid, final boolean cleanUpEvenIfUnableToStop) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException {<NEW_LINE>final AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();<NEW_LINE>if (jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {<NEW_LINE>VmWorkJobVO placeHolder = null;<NEW_LINE>final VirtualMachine vm = _vmDao.findByUuid(vmUuid);<NEW_LINE>placeHolder = createPlaceHolderWork(vm.getId());<NEW_LINE>try {<NEW_LINE>orchestrateStop(vmUuid, cleanUpEvenIfUnableToStop);<NEW_LINE>} finally {<NEW_LINE>if (placeHolder != null) {<NEW_LINE>_workJobDao.expunge(placeHolder.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>final Outcome<VirtualMachine> outcome = stopVmThroughJobQueue(vmUuid, cleanUpEvenIfUnableToStop);<NEW_LINE>retrieveVmFromJobOutcome(outcome, vmUuid, "stopVm");<NEW_LINE>try {<NEW_LINE>retrieveResultFromJobOutcomeAndThrowExceptionIfNeeded(outcome);<NEW_LINE>} catch (ResourceUnavailableException | InsufficientCapacityException ex) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | throw new RuntimeException("Unexpected exception", ex); |
247,842 | private static void init() {<NEW_LINE>actions = new TreeMap<Long, TimeAction>();<NEW_LINE>// Instructions for a test set:<NEW_LINE>// hardcoded for a 5.5-second time window and 1-second output rate !<NEW_LINE>// First set the time, second send the event(s)<NEW_LINE>add(200, makeEvent("IBM", 100, 25), "Event E1 arrives");<NEW_LINE>add(800, makeEvent("MSFT", 5000, 9), "Event E2 arrives");<NEW_LINE>add(1000);<NEW_LINE>add(1200);<NEW_LINE>add(1500, makeEvent("IBM", 150, 24), "Event E3 arrives");<NEW_LINE>add(1500, makeEvent("YAH", 10000, 1), "Event E4 arrives");<NEW_LINE>add(2000);<NEW_LINE>add(2100, makeEvent("IBM", 155, 26), "Event E5 arrives");<NEW_LINE>add(2200);<NEW_LINE>add(2500);<NEW_LINE>add(3000);<NEW_LINE>add(3200);<NEW_LINE>add(3500, makeEvent("YAH", 11000, 2), "Event E6 arrives");<NEW_LINE>add(4000);<NEW_LINE>add(4200);<NEW_LINE>add(4300, makeEvent("IBM", 150, 22), "Event E7 arrives");<NEW_LINE>add(4900, makeEvent("YAH"<MASK><NEW_LINE>add(5000);<NEW_LINE>add(5200);<NEW_LINE>add(5700, "Event E1 leaves the time window");<NEW_LINE>add(5900, makeEvent("YAH", 10500, 1), "Event E9 arrives");<NEW_LINE>add(6000);<NEW_LINE>add(6200);<NEW_LINE>add(6300, "Event E2 leaves the time window");<NEW_LINE>add(7000, "Event E3 and E4 leave the time window");<NEW_LINE>add(7200);<NEW_LINE>} | , 11500, 3), "Event E8 arrives"); |
1,703,327 | private JSONObject buildQueries() {<NEW_LINE>List<Series> seriesList = seriesSelector.getAllSeries();<NEW_LINE>JSONObject queries = new JSONObject();<NEW_LINE>StringBuilder sql = new StringBuilder();<NEW_LINE>sql.append("SELECT ");<NEW_LINE>sql.append(xAxis.getSelectedValue());<NEW_LINE>for (Series series : seriesList) {<NEW_LINE>addSeriesSelects(series, sql);<NEW_LINE>}<NEW_LINE>sql.append(" FROM tko_perf_view_2");<NEW_LINE>String xFilterString = globalFilter.getFilterString();<NEW_LINE>if (xFilterString.equals("")) {<NEW_LINE>NotifyManager.<MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>sql.append(" WHERE ");<NEW_LINE>sql.append(xFilterString);<NEW_LINE>sql.append(" GROUP BY ");<NEW_LINE>sql.append(xAxis.getSelectedValue());<NEW_LINE>queries.put("__main__", new JSONString(sql.toString()));<NEW_LINE>for (Series series : seriesList) {<NEW_LINE>String drilldownQuery = getSeriesDrilldownQuery(series, xFilterString);<NEW_LINE>queries.put("__" + series.getName() + "__", new JSONString(drilldownQuery));<NEW_LINE>}<NEW_LINE>return queries;<NEW_LINE>} | getInstance().showError("You must enter a global filter"); |
208,607 | public Toolchain unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>Toolchain toolchain = new Toolchain();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("source", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>toolchain.setSource(ToolchainSourceJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("roleArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>toolchain.setRoleArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("stackParameters", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>toolchain.setStackParameters(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return toolchain;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
130,941 | protected void perform(RelOptRuleCall call, List<RexNode> leftFilters, List<RexNode> rightFilters, RelOptPredicateList relOptPredicateList) {<NEW_LINE>final LogicalJoin join = (LogicalJoin) call.rels[0];<NEW_LINE>LogicalView leftView = (<MASK><NEW_LINE>final LogicalView rightView = (LogicalView) call.rels[2];<NEW_LINE>if (rightView instanceof LogicalIndexScan && !(leftView instanceof LogicalIndexScan)) {<NEW_LINE>leftView = new LogicalIndexScan(leftView);<NEW_LINE>}<NEW_LINE>LogicalView newLeftView = leftView.copy(leftView.getTraitSet());<NEW_LINE>LogicalView newRightView = rightView.copy(rightView.getTraitSet());<NEW_LINE>LogicalJoin newLogicalJoin = join.copy(join.getTraitSet(), join.getCondition(), newLeftView, newRightView, join.getJoinType(), join.isSemiJoinDone());<NEW_LINE>newLeftView.pushJoin(newLogicalJoin, newRightView, leftFilters, rightFilters);<NEW_LINE>RelUtils.changeRowType(newLeftView, join.getRowType());<NEW_LINE>call.transformTo(convert(newLeftView, join.getTraitSet()));<NEW_LINE>} | LogicalView) call.rels[1]; |
166,481 | private void bindGallery(@NonNull final ViewHolder holder, int position, LocalGallery ent) {<NEW_LINE>if (holder.flag != null)<NEW_LINE>holder.flag.setVisibility(View.GONE);<NEW_LINE>ImageDownloadUtility.loadImage(context, ent.getPage(ent.getMin<MASK><NEW_LINE>holder.title.setText(ent.getTitle());<NEW_LINE>if (colCount == 1)<NEW_LINE>holder.pages.setText(context.getString(R.string.page_count_format, ent.getPageCount()));<NEW_LINE>else<NEW_LINE>holder.pages.setText(String.format(Locale.US, "%d", ent.getPageCount()));<NEW_LINE>holder.title.setOnClickListener(v -> {<NEW_LINE>Layout layout = holder.title.getLayout();<NEW_LINE>if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {<NEW_LINE>if (layout.getEllipsisCount(layout.getLineCount() - 1) > 0)<NEW_LINE>holder.title.setMaxLines(7);<NEW_LINE>else if (holder.title.getMaxLines() == 7)<NEW_LINE>holder.title.setMaxLines(3);<NEW_LINE>else<NEW_LINE>holder.layout.performClick();<NEW_LINE>} else<NEW_LINE>holder.layout.performClick();<NEW_LINE>});<NEW_LINE>int statusColor = statuses.get(ent.getId(), 0);<NEW_LINE>if (statusColor == 0) {<NEW_LINE>statusColor = Queries.StatusMangaTable.getStatus(ent.getId()).color;<NEW_LINE>statuses.put(ent.getId(), statusColor);<NEW_LINE>}<NEW_LINE>holder.title.setBackgroundColor(statusColor);<NEW_LINE>} | ()), holder.imgView); |
124,280 | public /*new DependentColumnFilter(Bytes.toBytes("family"), Bytes.toBytes("qualifier"));<NEW_LINE>* public DependentColumnFilter(final byte [] family, final byte[] qualifier,<NEW_LINE>final boolean dropDependentColumn, final CompareOperator valueCompareOp,<NEW_LINE>final ByteArrayComparable valueComparator)*/<NEW_LINE>Filter doDependentColumnFilter(Object[] val) {<NEW_LINE>// System.out.println("DependentColumnFilter = " + val.length);<NEW_LINE>if (((val[1] = ImUtils.checkValidDataType(param.getSub(1), ctx, "String")) == null) || ((val[2] = ImUtils.checkValidDataType(param.getSub(2), ctx, "String")) == null)) {<NEW_LINE>throw new RQException("Filter " + val[0] + "Param family qualifier");<NEW_LINE>}<NEW_LINE>if (val.length == 3) {<NEW_LINE>return new DependentColumnFilter(((String) val[1]).getBytes(), ((String) val[2]).getBytes());<NEW_LINE>} else if (val.length > 3) {<NEW_LINE>if (((val[3] = ImUtils.checkValidDataType(param.getSub(3), ctx, "bool")) == null)) {<NEW_LINE>throw new RQException("Filter " + val[0] + "Param family qualifier true/false");<NEW_LINE>}<NEW_LINE>if (val.length == 4) {<NEW_LINE>// System.out.println("DependentColumnFilter = " + val[3]);<NEW_LINE>return new DependentColumnFilter(((String) val[1]).getBytes(), ((String) val[2]).getBytes(), <MASK><NEW_LINE>} else if (val.length == 6) {<NEW_LINE>if (((val[4] = ImUtils.checkValidDataType(param.getSub(4), ctx, "String")) == null) || ((val[5] = ImUtils.checkValidDataType(param.getSub(5), ctx, "Compator")) == null)) {<NEW_LINE>throw new RQException("Filter " + val[0] + "Param family qualifier");<NEW_LINE>}<NEW_LINE>return new DependentColumnFilter(((String) val[1]).getBytes(), ((String) val[2]).getBytes(), (boolean) val[3], ImUtils.fromSymbol((String) val[4]), (ByteArrayComparable) val[5]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | (boolean) val[3]); |
162,663 | public Mono<Long> authorize() {<NEW_LINE>if (hasDisposed.get()) {<NEW_LINE>return Mono.error(new AzureException("Cannot authorize with CBS node when this token manager has been disposed of."));<NEW_LINE>}<NEW_LINE>return cbsNode.flatMap(cbsNode -> cbsNode.authorize(tokenAudience, scopes)).map(expiresOn -> {<NEW_LINE>final Duration between = Duration.between(OffsetDateTime.now(ZoneOffset.UTC), expiresOn);<NEW_LINE>// We want to refresh the token when 90% of the time before expiry has elapsed.<NEW_LINE>final long refreshSeconds = (long) Math.floor(between.getSeconds() * 0.9);<NEW_LINE>// This converts it to milliseconds<NEW_LINE>final long refreshIntervalMS = refreshSeconds * 1000;<NEW_LINE>// If this is the first time authorize is called, the task will not have been scheduled yet.<NEW_LINE>if (!hasScheduled.getAndSet(true)) {<NEW_LINE>LOGGER.atInfo().addKeyValue("scopes"<MASK><NEW_LINE>final Duration firstInterval = Duration.ofMillis(refreshIntervalMS);<NEW_LINE>lastRefreshInterval.set(firstInterval);<NEW_LINE>authorizationResults.emitNext(AmqpResponseCode.ACCEPTED, (signalType, emitResult) -> {<NEW_LINE>addSignalTypeAndResult(LOGGER.atVerbose(), signalType, emitResult).log("Could not emit ACCEPTED.");<NEW_LINE>return false;<NEW_LINE>});<NEW_LINE>subscription = scheduleRefreshTokenTask(firstInterval);<NEW_LINE>}<NEW_LINE>return refreshIntervalMS;<NEW_LINE>});<NEW_LINE>} | , scopes).log("Scheduling refresh token task."); |
964,510 | final GetExtensionResult executeGetExtension(GetExtensionRequest getExtensionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getExtensionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetExtensionRequest> request = null;<NEW_LINE>Response<GetExtensionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetExtensionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getExtensionRequest));<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, "GameSparks");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetExtension");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetExtensionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetExtensionResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.