idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,782,456 | public static int readLengthEncodedInteger(MySQLMessage mm) {<NEW_LINE>int result = 0;<NEW_LINE>byte b = mm.read();<NEW_LINE>int b1 = b & 0xff;<NEW_LINE>if (b1 < 0xfb) {<NEW_LINE>result = b1 & 0xff;<NEW_LINE>} else if (b1 == 0xfc) {<NEW_LINE>byte b2 = mm.read();<NEW_LINE>byte b3 = mm.read();<NEW_LINE>result = ((b3 & 0xff) << 8) | (b2 & 0xff);<NEW_LINE>} else if (b1 == 0xfd) {<NEW_LINE>byte b2 = mm.read();<NEW_LINE>byte b3 = mm.read();<NEW_LINE>byte b4 = mm.read();<NEW_LINE>result = ((b4 & 0xff) << 16) | ((b3 & 0xff) << <MASK><NEW_LINE>} else if (b1 == 0xfe) {<NEW_LINE>byte b2 = mm.read();<NEW_LINE>byte b3 = mm.read();<NEW_LINE>byte b4 = mm.read();<NEW_LINE>byte b5 = mm.read();<NEW_LINE>byte b6 = mm.read();<NEW_LINE>byte b7 = mm.read();<NEW_LINE>byte b8 = mm.read();<NEW_LINE>byte b9 = mm.read();<NEW_LINE>result = ((b9 & 0xff) << 56) | ((b8 & 0xff) << 48) | ((b7 & 0xff) << 40) | ((b6 & 0xff) << 32) | ((b5 & 0xff) << 24) | ((b4 & 0xff) << 16) | ((b3 & 0xff) << 8) | (b2 & 0xff);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | 8) | (b2 & 0xff); |
1,573,119 | public String[] parse(final String[] args) {<NEW_LINE>parsed = new HashMap<String, String>(options.size());<NEW_LINE>ArrayList<String> unparsed = null;<NEW_LINE>for (int i = 0; i < args.length; i++) {<NEW_LINE>final String arg = args[i];<NEW_LINE>String[] opt = options.get(arg);<NEW_LINE>if (opt != null) {<NEW_LINE>// Perfect match: got --foo<NEW_LINE>if (opt[0] != null) {<NEW_LINE>// This option requires an argument.<NEW_LINE>if (++i < args.length) {<NEW_LINE>parsed.put(arg, args[i]);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Missing argument for " + arg);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>parsed.put(arg, null);<NEW_LINE>}<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Is it a --foo=blah?<NEW_LINE>final int equal = arg.indexOf('=', 1);<NEW_LINE>if (equal > 0) {<NEW_LINE>// Looks like so.<NEW_LINE>final String name = arg.substring(0, equal);<NEW_LINE>opt = options.get(name);<NEW_LINE>if (opt != null) {<NEW_LINE>parsed.put(name, arg.substring(equal + 1, arg.length()));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Not a flag.<NEW_LINE>if (unparsed == null) {<NEW_LINE>unparsed = new ArrayList<String>(args.length - i);<NEW_LINE>}<NEW_LINE>if (!arg.isEmpty() && arg.charAt(0) == '-') {<NEW_LINE>if (arg.length() == 2 && arg.charAt(1) == '-') {<NEW_LINE>// `--'<NEW_LINE>for (i++; i < args.length; i++) {<NEW_LINE>unparsed<MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("Unrecognized option " + arg);<NEW_LINE>}<NEW_LINE>unparsed.add(arg);<NEW_LINE>}<NEW_LINE>if (unparsed != null) {<NEW_LINE>return unparsed.toArray(new String[unparsed.size()]);<NEW_LINE>} else {<NEW_LINE>return new String[0];<NEW_LINE>}<NEW_LINE>} | .add(args[i]); |
1,211,680 | protected void channelRead0(ChannelHandlerContext ctx, HttpRequest msg) {<NEW_LINE>FullHttpResponse response;<NEW_LINE>if (!ALLOWED_METHODS.contains(msg.method())) {<NEW_LINE>response = new DefaultFullHttpResponse(HTTP_1_1, METHOD_NOT_ALLOWED);<NEW_LINE>} else if (Strings.isNullOrEmpty(msg.headers().get(HOST))) {<NEW_LINE>response = new DefaultFullHttpResponse(HTTP_1_1, BAD_REQUEST);<NEW_LINE>} else {<NEW_LINE>// All HTTP/1.1 request must contain a Host header with the format "host:[port]".<NEW_LINE>// See https://tools.ietf.org/html/rfc2616#section-14.23<NEW_LINE>String host = Splitter.on(':').split(msg.headers().get(HOST)).iterator().next();<NEW_LINE>if (host.equals(HEALTH_CHECK_HOST)) {<NEW_LINE>// The health check request should always be sent to the HTTP port.<NEW_LINE>response = isHttps ? new DefaultFullHttpResponse(HTTP_1_1, FORBIDDEN) : new DefaultFullHttpResponse(HTTP_1_1, OK);<NEW_LINE>} else {<NEW_LINE>// HTTP -> HTTPS is a 301 redirect, whereas HTTPS -> web WHOIS site is 302 redirect.<NEW_LINE>response = new DefaultFullHttpResponse(HTTP_1_1, isHttps ? FOUND : MOVED_PERMANENTLY);<NEW_LINE>String redirectUrl = String.format("https://%s/", isHttps ? redirectHost : host);<NEW_LINE>response.headers().set(LOCATION, redirectUrl);<NEW_LINE>// Add HSTS header to HTTPS response.<NEW_LINE>if (isHttps) {<NEW_LINE>response.headers().set(HSTS_HEADER_NAME, String.format("max-age=%d"<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Common headers that need to be set on any response.<NEW_LINE>response.headers().set(CONTENT_TYPE, TEXT_PLAIN).setInt(CONTENT_LENGTH, response.content().readableBytes());<NEW_LINE>// Close the connection if keep-alive is not set in the request.<NEW_LINE>if (!HttpUtil.isKeepAlive(msg)) {<NEW_LINE>ChannelFuture unusedFuture = ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);<NEW_LINE>} else {<NEW_LINE>response.headers().set(CONNECTION, KEEP_ALIVE);<NEW_LINE>ChannelFuture unusedFuture = ctx.writeAndFlush(response);<NEW_LINE>}<NEW_LINE>} | , HSTS_MAX_AGE.getSeconds())); |
1,817,899 | protected Field createEntityField(InputParameter parameter) {<NEW_LINE>MetaClass metaClass = metadata.getClassNN(parameter.getEntityClass());<NEW_LINE>Action lookupAction = actions.create(LookupAction.ID);<NEW_LINE>Action clearAction = actions.create(ClearAction.ID);<NEW_LINE>if (persistenceManagerService.useLookupScreen(metaClass.getName())) {<NEW_LINE>PickerField pickerField = uiComponents.create(PickerField.NAME);<NEW_LINE>pickerField.setMetaClass(metadata.getClass(parameter.getEntityClass()));<NEW_LINE>pickerField.addAction(lookupAction);<NEW_LINE>pickerField.addAction(clearAction);<NEW_LINE>pickerField.setWidthFull();<NEW_LINE>return pickerField;<NEW_LINE>} else {<NEW_LINE>LookupPickerField lookupPickerField = uiComponents.create(LookupPickerField.NAME);<NEW_LINE>lookupPickerField.addAction(lookupAction);<NEW_LINE>lookupPickerField.addAction(clearAction);<NEW_LINE>lookupPickerField.setWidthFull();<NEW_LINE>CollectionContainer container = dataComponents.<MASK><NEW_LINE>CollectionLoader loader = dataComponents.createCollectionLoader();<NEW_LINE>loader.setQuery("select e from " + metaClass.getName() + " e");<NEW_LINE>loader.setView(View.MINIMAL);<NEW_LINE>loader.setContainer(container);<NEW_LINE>loader.load();<NEW_LINE>lookupPickerField.setOptions(new ContainerOptions(container));<NEW_LINE>return lookupPickerField;<NEW_LINE>}<NEW_LINE>} | createCollectionContainer(parameter.getEntityClass()); |
1,767,798 | public Value emitParameterLoad(ParameterNode paramNode, int index) {<NEW_LINE>Logger.traceBuildLIR(Logger.BACKEND.SPIRV, "emitParameterLoad: stamp=%s", paramNode.stamp(NodeView.DEFAULT));<NEW_LINE>LIRKind lirKind = generator.getLIRKind(paramNode.stamp(NodeView.DEFAULT));<NEW_LINE>SPIRVKind spirvKind = (SPIRVKind) lirKind.getPlatformKind();<NEW_LINE>SPIRVTargetDescription target = (SPIRVTargetDescription) generator.target();<NEW_LINE>Variable result = (spirvKind.isVector()) ? generator.newVariable(LIRKind.value(target.getSPIRVKind(JavaKind.Object))) : generator.newVariable(lirKind);<NEW_LINE>if (TornadoOptions.OPTIMIZE_LOAD_STORE_SPIRV) {<NEW_LINE>emitParameterLoadWithNoStore(result, index);<NEW_LINE>} else {<NEW_LINE>emitParameterLoad(result, index);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (spirvKind.isVector()) {<NEW_LINE>result = emitLoadParameterForVectorType(result, lirKind);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | parameterToVariable.put(paramNode, result); |
1,619,957 | public static DescribeBlackholeStatusResponse unmarshall(DescribeBlackholeStatusResponse describeBlackholeStatusResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeBlackholeStatusResponse.setRequestId(_ctx.stringValue("DescribeBlackholeStatusResponse.RequestId"));<NEW_LINE>List<BlackholeStatusItem> blackholeStatus = new ArrayList<BlackholeStatusItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeBlackholeStatusResponse.BlackholeStatus.Length"); i++) {<NEW_LINE>BlackholeStatusItem blackholeStatusItem = new BlackholeStatusItem();<NEW_LINE>blackholeStatusItem.setStartTime(_ctx.longValue("DescribeBlackholeStatusResponse.BlackholeStatus[" + i + "].StartTime"));<NEW_LINE>blackholeStatusItem.setEndTime(_ctx.longValue<MASK><NEW_LINE>blackholeStatusItem.setIp(_ctx.stringValue("DescribeBlackholeStatusResponse.BlackholeStatus[" + i + "].Ip"));<NEW_LINE>blackholeStatusItem.setBlackStatus(_ctx.stringValue("DescribeBlackholeStatusResponse.BlackholeStatus[" + i + "].BlackStatus"));<NEW_LINE>blackholeStatus.add(blackholeStatusItem);<NEW_LINE>}<NEW_LINE>describeBlackholeStatusResponse.setBlackholeStatus(blackholeStatus);<NEW_LINE>return describeBlackholeStatusResponse;<NEW_LINE>} | ("DescribeBlackholeStatusResponse.BlackholeStatus[" + i + "].EndTime")); |
1,740,104 | public void visitToken(DetailAST ast) {<NEW_LINE>final DetailAST leftCurly = findLeftCurly(ast);<NEW_LINE>if (leftCurly != null) {<NEW_LINE>if (option == BlockOption.STATEMENT) {<NEW_LINE>final boolean emptyBlock;<NEW_LINE>if (leftCurly.getType() == TokenTypes.LCURLY) {<NEW_LINE>final DetailAST nextSibling = leftCurly.getNextSibling();<NEW_LINE>emptyBlock = nextSibling.getType() != TokenTypes.CASE_GROUP && nextSibling<MASK><NEW_LINE>} else {<NEW_LINE>emptyBlock = leftCurly.getChildCount() <= 1;<NEW_LINE>}<NEW_LINE>if (emptyBlock) {<NEW_LINE>log(leftCurly, MSG_KEY_BLOCK_NO_STATEMENT, ast.getText());<NEW_LINE>}<NEW_LINE>} else if (!hasText(leftCurly)) {<NEW_LINE>log(leftCurly, MSG_KEY_BLOCK_EMPTY, ast.getText());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getType() != TokenTypes.SWITCH_RULE; |
720,662 | public void createPlaylist(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>request = wrapRequest(request, true);<NEW_LINE>String username = securityService.getCurrentUsername(request);<NEW_LINE>Integer playlistId = getIntParameter(request, "playlistId");<NEW_LINE>String name = request.getParameter("name");<NEW_LINE>if (playlistId == null && name == null) {<NEW_LINE>error(request, response, ErrorCode.MISSING_PARAMETER, "Playlist ID or name must be specified.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>org.airsonic.player.domain.Playlist playlist;<NEW_LINE>if (playlistId != null) {<NEW_LINE>playlist = playlistService.getPlaylist(playlistId);<NEW_LINE>if (playlist == null) {<NEW_LINE>error(request, response, <MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!playlistService.isWriteAllowed(playlist, username)) {<NEW_LINE>error(request, response, ErrorCode.NOT_AUTHORIZED, "Permission denied for playlist " + playlistId);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>playlist = new org.airsonic.player.domain.Playlist();<NEW_LINE>Instant now = Instant.now();<NEW_LINE>playlist.setName(name);<NEW_LINE>playlist.setCreated(now);<NEW_LINE>playlist.setChanged(now);<NEW_LINE>playlist.setShared(false);<NEW_LINE>playlist.setUsername(username);<NEW_LINE>playlistService.createPlaylist(playlist);<NEW_LINE>}<NEW_LINE>List<MediaFile> songs = new ArrayList<MediaFile>();<NEW_LINE>for (int id : getIntParameters(request, "songId")) {<NEW_LINE>MediaFile song = mediaFileService.getMediaFile(id);<NEW_LINE>if (song != null) {<NEW_LINE>songs.add(song);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>playlistService.setFilesInPlaylist(playlist.getId(), songs);<NEW_LINE>writeEmptyResponse(request, response);<NEW_LINE>} | ErrorCode.NOT_FOUND, "Playlist not found: " + playlistId); |
1,256,451 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>java.awt.GridBagConstraints gridBagConstraints;<NEW_LINE>jLabelName = new javax.swing.JLabel();<NEW_LINE>jTextFieldName = new javax.swing.JTextField();<NEW_LINE>jLabelJarFiles = <MASK><NEW_LINE>jScrollPane1 = new javax.swing.JScrollPane();<NEW_LINE>jListArtifacts = new javax.swing.JList();<NEW_LINE>setLayout(new java.awt.GridBagLayout());<NEW_LINE>jLabelName.setLabelFor(jTextFieldName);<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(jLabelName, org.openide.util.NbBundle.getMessage(AntArtifactChooser.class, "LBL_AACH_ProjectName_JLabel"));<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;<NEW_LINE>gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(0, 12, 2, 0);<NEW_LINE>add(jLabelName, gridBagConstraints);<NEW_LINE>jTextFieldName.setEditable(false);<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;<NEW_LINE>gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;<NEW_LINE>gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;<NEW_LINE>gridBagConstraints.weightx = 1.0;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 0);<NEW_LINE>add(jTextFieldName, gridBagConstraints);<NEW_LINE>// NOI18N<NEW_LINE>jTextFieldName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AntArtifactChooser.class, "LBL_AACH_ProjectName_JLabel"));<NEW_LINE>jLabelJarFiles.setLabelFor(jListArtifacts);<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(jLabelJarFiles, org.openide.util.NbBundle.getMessage(AntArtifactChooser.class, "LBL_AACH_ProjectJarFiles_JLabel"));<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;<NEW_LINE>gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(0, 12, 2, 0);<NEW_LINE>add(jLabelJarFiles, gridBagConstraints);<NEW_LINE>jScrollPane1.setViewportView(jListArtifacts);<NEW_LINE>// NOI18N<NEW_LINE>jListArtifacts.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AntArtifactChooser.class, "LBL_AACH_ProjectJarFiles_JLabel"));<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;<NEW_LINE>gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;<NEW_LINE>gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;<NEW_LINE>gridBagConstraints.weightx = 1.0;<NEW_LINE>gridBagConstraints.weighty = 1.0;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);<NEW_LINE>add(jScrollPane1, gridBagConstraints);<NEW_LINE>} | new javax.swing.JLabel(); |
713,847 | public List<PluginSummaryBean> listPlugins() throws StorageException {<NEW_LINE>beginTx();<NEW_LINE>try {<NEW_LINE>EntityManager entityManager = getActiveEntityManager();<NEW_LINE>String sql = "SELECT p.id, p.artifact_id, p.group_id, p.version, p.classifier, p.type, p.name, p.description, p.created_by, p.created_on" + " FROM plugins p" + " WHERE p.deleted IS NULL OR p.deleted = 0" + " ORDER BY p.name ASC";<NEW_LINE>Query query = entityManager.createNativeQuery(sql);<NEW_LINE>List<Object[]> rows = query.getResultList();<NEW_LINE>List<PluginSummaryBean> plugins = new ArrayList<>(rows.size());<NEW_LINE>for (Object[] row : rows) {<NEW_LINE>PluginSummaryBean plugin = new PluginSummaryBean();<NEW_LINE>plugin.setId(((Number) row[0]).longValue());<NEW_LINE>plugin.setArtifactId(String.valueOf(row[1]));<NEW_LINE>plugin.setGroupId(String.valueOf(row[2]));<NEW_LINE>plugin.setVersion(String.valueOf(row[3]));<NEW_LINE>plugin.setClassifier((String) row[4]);<NEW_LINE>plugin.setType((String) row[5]);<NEW_LINE>plugin.setName(String.valueOf(row[6]));<NEW_LINE>plugin.setDescription(String.valueOf(row[7]));<NEW_LINE>plugin.setCreatedBy(String.valueOf(row[8]));<NEW_LINE>plugin.setCreatedOn((Date) row[9]);<NEW_LINE>plugins.add(plugin);<NEW_LINE>}<NEW_LINE>return plugins;<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.error(<MASK><NEW_LINE>throw new StorageException(t);<NEW_LINE>} finally {<NEW_LINE>rollbackTx();<NEW_LINE>}<NEW_LINE>} | t.getMessage(), t); |
542,499 | public Response<Void> deleteByIdWithResponse(String id, Context context) {<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 accountName = Utils.getValueFromIdByName(id, "mediaServices");<NEW_LINE>if (accountName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'mediaServices'.", id)));<NEW_LINE>}<NEW_LINE>String streamingPolicyName = Utils.getValueFromIdByName(id, "streamingPolicies");<NEW_LINE>if (streamingPolicyName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'streamingPolicies'.", id)));<NEW_LINE>}<NEW_LINE>return this.deleteWithResponse(<MASK><NEW_LINE>} | resourceGroupName, accountName, streamingPolicyName, context); |
465,027 | public void loadAdditinalData(long stime, long etime, final boolean reverse) {<NEW_LINE>collectObj();<NEW_LINE>Iterator<Integer> serverIds = serverObjMap.keySet().iterator();<NEW_LINE>final TreeSet<XLogData> tempSet = new TreeSet<XLogData>(new XLogDataComparator());<NEW_LINE>int limit = PManager.getInstance().getInt(PreferenceConstants.P_XLOG_IGNORE_TIME);<NEW_LINE>final int max = getMaxCount();<NEW_LINE>while (serverIds.hasNext()) {<NEW_LINE>final int serverId = serverIds.next();<NEW_LINE>TcpProxy tcp = TcpProxy.getTcpProxy(serverId);<NEW_LINE>try {<NEW_LINE>MapPack param = new MapPack();<NEW_LINE>param.put("date", DateUtil.yyyymmdd(stime));<NEW_LINE>param.put("stime", stime);<NEW_LINE><MASK><NEW_LINE>param.put("objHash", serverObjMap.get(serverId));<NEW_LINE>param.put("reverse", new BooleanValue(reverse));<NEW_LINE>if (limit > 0) {<NEW_LINE>param.put("limit", limit);<NEW_LINE>}<NEW_LINE>if (max > 0) {<NEW_LINE>param.put("max", max);<NEW_LINE>}<NEW_LINE>twdata.setMax(max);<NEW_LINE>tcp.process(RequestCmd.TRANX_LOAD_TIME_GROUP, param, new INetReader() {<NEW_LINE><NEW_LINE>public void process(DataInputX in) throws IOException {<NEW_LINE>Pack p = in.readPack();<NEW_LINE>XLogPack x = XLogUtil.toXLogPack(p);<NEW_LINE>if (tempSet.size() < max) {<NEW_LINE>tempSet.add(new XLogData(x, serverId));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Throwable t) {<NEW_LINE>ConsoleProxy.errorSafe(t.toString());<NEW_LINE>} finally {<NEW_LINE>TcpProxy.putTcpProxy(tcp);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (reverse) {<NEW_LINE>Iterator<XLogData> itr = tempSet.descendingIterator();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>XLogData d = itr.next();<NEW_LINE>twdata.putFirst(d.p.txid, d);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Iterator<XLogData> itr = tempSet.iterator();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>XLogData d = itr.next();<NEW_LINE>twdata.putLast(d.p.txid, d);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | param.put("etime", etime); |
186,120 | private <T> BindingImpl<TypeLiteral<T>> createTypeLiteralBinding(Key<TypeLiteral<T>> key, Errors errors) throws ErrorsException {<NEW_LINE>Type typeLiteralType = key.getTypeLiteral().getType();<NEW_LINE>if (!(typeLiteralType instanceof ParameterizedType)) {<NEW_LINE>throw errors.cannotInjectRawTypeLiteral().toException();<NEW_LINE>}<NEW_LINE>ParameterizedType parameterizedType = (ParameterizedType) typeLiteralType;<NEW_LINE>Type innerType = parameterizedType.getActualTypeArguments()[0];<NEW_LINE>// this is unfortunate. We don't support building TypeLiterals for type variable like 'T'. If<NEW_LINE>// this proves problematic, we can probably fix TypeLiteral to support type variables<NEW_LINE>if (!(innerType instanceof Class) && !(innerType instanceof GenericArrayType) && !(innerType instanceof ParameterizedType)) {<NEW_LINE>throw errors.<MASK><NEW_LINE>}<NEW_LINE>// by definition, innerType == T, so this is safe<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>TypeLiteral<T> value = (TypeLiteral<T>) TypeLiteral.get(innerType);<NEW_LINE>InternalFactory<TypeLiteral<T>> factory = new ConstantFactory<>(Initializables.of(value));<NEW_LINE>return new InstanceBindingImpl<>(this, key, SourceProvider.UNKNOWN_SOURCE, factory, emptySet(), value);<NEW_LINE>} | cannotInjectTypeLiteralOf(innerType).toException(); |
105,181 | public CommandResult parse(@NotNull String commandString) {<NEW_LINE>commandString = commandString.trim();<NEW_LINE>// Verify if the result is cached<NEW_LINE>{<NEW_LINE>final CommandResult cachedResult = cache.getIfPresent(commandString);<NEW_LINE>if (cachedResult != null) {<NEW_LINE>return cachedResult;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Split space<NEW_LINE>final String[] parts = commandString.split(StringUtils.SPACE);<NEW_LINE>final String commandName = parts[0];<NEW_LINE>final CommandQueryResult commandQueryResult = CommandParser.findCommand(this, commandString);<NEW_LINE>// Check if the command exists<NEW_LINE>if (commandQueryResult == null) {<NEW_LINE>return CommandResult.of(<MASK><NEW_LINE>}<NEW_LINE>CommandResult result = new CommandResult();<NEW_LINE>result.input = commandString;<NEW_LINE>// Find the used syntax and fill CommandResult#type and CommandResult#parsedCommand<NEW_LINE>findParsedCommand(commandQueryResult, commandName, commandString, result);<NEW_LINE>// Cache result<NEW_LINE>this.cache.put(commandString, result);<NEW_LINE>return result;<NEW_LINE>} | CommandResult.Type.UNKNOWN, commandName); |
940,053 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>List<UUID> perms = new ArrayList<>();<NEW_LINE>filter.add(TargetController.YOU.getControllerPredicate());<NEW_LINE>for (UUID playerId : game.getOpponents(source.getControllerId())) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null) {<NEW_LINE>TargetPermanent target = new TargetPermanent(1, 1, filter, true);<NEW_LINE>if (target.canChoose(player.getId(), source, game)) {<NEW_LINE>player.chooseTarget(Outcome.Sacrifice, target, source, game);<NEW_LINE>perms.addAll(target.getTargets());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (UUID permID : perms) {<NEW_LINE>Permanent <MASK><NEW_LINE>if (permanent != null) {<NEW_LINE>permanent.sacrifice(source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (UUID playerId : game.getOpponents(source.getControllerId())) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null) {<NEW_LINE>player.discardOne(false, false, source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filterCard);<NEW_LINE>if (target.canChoose(source.getControllerId(), source, game) && controller.choose(Outcome.ReturnToHand, target, source, game)) {<NEW_LINE>Card card = game.getCard(target.getFirstTarget());<NEW_LINE>if (card == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>controller.moveCards(card, Zone.HAND, source, game);<NEW_LINE>}<NEW_LINE>controller.drawCards(1, source, game);<NEW_LINE>return true;<NEW_LINE>} | permanent = game.getPermanent(permID); |
1,621,499 | public void attach(EventType parentEventType, ViewForgeEnv viewForgeEnv) throws ViewParameterException {<NEW_LINE>ExprNode[] validated = ViewForgeSupport.validate("Trend spotter view", parentEventType, viewParameters, false, viewForgeEnv);<NEW_LINE>String message = "Trend spotter view accepts a single integer or double value";<NEW_LINE>if (validated.length != 1) {<NEW_LINE>throw new ViewParameterException(message);<NEW_LINE>}<NEW_LINE>EPType resultEPType = validated[0].getForge().getEvaluationType();<NEW_LINE>if (!JavaClassHelper.isTypeInteger(resultEPType) && !JavaClassHelper.isTypeDouble(resultEPType)) {<NEW_LINE>throw new ViewParameterException(message);<NEW_LINE>}<NEW_LINE>parameter = validated[0];<NEW_LINE>LinkedHashMap<String, Object> eventTypeMap = new LinkedHashMap<>();<NEW_LINE>eventTypeMap.put("trendcount", <MASK><NEW_LINE>eventType = DerivedViewTypeUtil.newType("trendview", eventTypeMap, viewForgeEnv);<NEW_LINE>} | EPTypePremade.LONGBOXED.getEPType()); |
1,426,191 | private static Map<String, Object> convertBeans(List<Map<String, Object>> contextBeans) {<NEW_LINE>Map<String, Object> convertedContexts = contextBeans.stream().map((context) -> {<NEW_LINE>String contextName = (String) context.get("context");<NEW_LINE>String parentId = (<MASK><NEW_LINE>// SB 1.x /beans child application context has<NEW_LINE>// itself as parent as well. In order to avoid contexts<NEW_LINE>// with same name we simple append .child in that case.<NEW_LINE>if (contextName.equals(parentId)) {<NEW_LINE>contextName = contextName + ".child";<NEW_LINE>}<NEW_LINE>List<Map<String, Object>> legacyBeans = (List<Map<String, Object>>) context.get("beans");<NEW_LINE>Map<String, Object> convertedBeans = legacyBeans.stream().collect(toMap((bean) -> (String) bean.get("bean"), identity()));<NEW_LINE>Map<String, Object> convertedContext = new LinkedHashMap<>();<NEW_LINE>convertedContext.put("contextName", contextName);<NEW_LINE>convertedContext.put("parentId", parentId);<NEW_LINE>convertedContext.put("beans", convertedBeans);<NEW_LINE>return convertedContext;<NEW_LINE>}).collect(toMap((context) -> (String) context.get("contextName"), identity()));<NEW_LINE>return singletonMap("contexts", convertedContexts);<NEW_LINE>} | String) context.get("parent"); |
1,019,017 | public void flatMap(Tuple2<Long, Object> value, Collector<Tuple2<Long, Object>> out) throws Exception {<NEW_LINE>if (value.f0 == Long.MAX_VALUE) {<NEW_LINE>out.collect(Tuple2.of((long) -(int) value.f1, false));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Tuple2<Integer, double[]> val = buffer.get(value.f0);<NEW_LINE>Tuple2<Integer, double[]> t2 = (Tuple2<Integer, double[]>) value.f1;<NEW_LINE>if (val == null) {<NEW_LINE>val = Tuple2.of(1, t2.f1);<NEW_LINE>buffer.put(value.f0, val);<NEW_LINE>} else {<NEW_LINE>val.f0++;<NEW_LINE>for (int i = 0; i < val.f1.length; ++i) {<NEW_LINE>val.f1[i] += t2.f1[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (val.f0.equals(t2.f0)) {<NEW_LINE>int k <MASK><NEW_LINE>double[] ret = new double[k + 1];<NEW_LINE>ret[k] = val.f1[2 * k];<NEW_LINE>for (int i = 0; i < k; ++i) {<NEW_LINE>ret[k] += 0.5 * (val.f1[i] * val.f1[i] - val.f1[k + i]);<NEW_LINE>}<NEW_LINE>System.arraycopy(val.f1, 0, ret, 0, k);<NEW_LINE>out.collect(Tuple2.of(value.f0, ret));<NEW_LINE>buffer.remove(value.f0);<NEW_LINE>}<NEW_LINE>} | = val.f1.length / 2; |
1,335,307 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>if (((bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>output.writeMessage(1, getResourceAttributes());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>output.writeMessage(2, getNonResourceAttributes());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 3, user_);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < groups_.size(); i++) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 4, groups_.getRaw(i));<NEW_LINE>}<NEW_LINE>com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(output, internalGetExtra(), ExtraDefaultEntryHolder.defaultEntry, 5);<NEW_LINE>if (((bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.<MASK><NEW_LINE>}<NEW_LINE>unknownFields.writeTo(output);<NEW_LINE>} | writeString(output, 6, uid_); |
1,853,000 | public void add(IntVar[] vars, IntIterableRangeSet[] ranges) {<NEW_LINE>if (XParameters.INTERVAL_TREE) {<NEW_LINE>SignedClause cl = new SignedClause(vars, ranges);<NEW_LINE>attach(new Watcher(cl.<MASK><NEW_LINE>attach(new Watcher(cl.pos[1], cl));<NEW_LINE>if (model.getSolver().getEngine().isInitialized()) {<NEW_LINE>this.learnts.add(cl);<NEW_LINE>last = cl;<NEW_LINE>last.activity = clauseInc;<NEW_LINE>last.rawActivity = 1;<NEW_LINE>if (XParameters.PRINT_CLAUSE)<NEW_LINE>model.getSolver().log().white().printf("learn: %s\n", cl);<NEW_LINE>} else {<NEW_LINE>if (XParameters.PRINT_CLAUSE)<NEW_LINE>model.getSolver().log().white().printf("add: %s\n", cl);<NEW_LINE>this.clauses.add(cl);<NEW_LINE>}<NEW_LINE>mSolver.getEngine().dynamicAddition(true, cl);<NEW_LINE>} else {<NEW_LINE>PropSignedClause cl = PropSignedClause.makeFromIn(vars, ranges);<NEW_LINE>if (XParameters.PRINT_CLAUSE)<NEW_LINE>model.getSolver().log().white().printf("learn: %s\n", cl);<NEW_LINE>new Constraint("SC", cl).post();<NEW_LINE>}<NEW_LINE>} | pos[0], cl)); |
1,485,186 | public Collection<PlotItem> arrange(VisualizerContext context) {<NEW_LINE>List<PlotItem> layout = new ArrayList<>(1 + dmax);<NEW_LINE>List<VisualizationTask> tasks = context.getVisTasks(this);<NEW_LINE>if (!tasks.isEmpty()) {<NEW_LINE>final double xoff = (dmax > 1) ? .1 : 0.;<NEW_LINE>final double hheight = .5;<NEW_LINE>final double lheight = .1;<NEW_LINE>PlotItem master = new PlotItem(dmax + xoff, hheight + lheight, null);<NEW_LINE>ScalesResult scales = ScalesResult.getScalesResult(rel);<NEW_LINE>for (int d1 = 0; d1 < dmax; d1++) {<NEW_LINE>Projection1D proj = new Simple1D(this, scales.getScales(), d1);<NEW_LINE>final PlotItem it = new PlotItem(d1 + xoff, <MASK><NEW_LINE>it.tasks = tasks;<NEW_LINE>master.subitems.add(it);<NEW_LINE>}<NEW_LINE>layout.add(master);<NEW_LINE>// Add labels<NEW_LINE>for (int d1 = 0; d1 < dmax; d1++) {<NEW_LINE>PlotItem it = new PlotItem(d1 + xoff, 0, 1., lheight, null);<NEW_LINE>LabelVisualization lbl = new LabelVisualization(RelationUtil.getColumnLabel(rel, d1));<NEW_LINE>//<NEW_LINE>it.tasks.//<NEW_LINE>add(new VisualizationTask(lbl, "", null, null).requestSize(1, lheight).with(RenderFlag.NO_DETAIL));<NEW_LINE>master.subitems.add(it);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return layout;<NEW_LINE>} | lheight, 1., hheight, proj); |
877,244 | public com.amazonaws.services.databasemigrationservice.model.InvalidCertificateException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.databasemigrationservice.model.InvalidCertificateException invalidCertificateException = new com.amazonaws.services.<MASK><NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return invalidCertificateException;<NEW_LINE>} | databasemigrationservice.model.InvalidCertificateException(null); |
910,807 | public static String determineClasspathSeleniumVersion() {<NEW_LINE>Set<String> seleniumVersions = new HashSet<>();<NEW_LINE>try {<NEW_LINE>ClassLoader classLoader = Thread.currentThread().getContextClassLoader();<NEW_LINE>Enumeration<URL> manifests = classLoader.getResources("META-INF/MANIFEST.MF");<NEW_LINE>while (manifests.hasMoreElements()) {<NEW_LINE>URL manifestURL = manifests.nextElement();<NEW_LINE>try (InputStream is = manifestURL.openStream()) {<NEW_LINE>Manifest manifest = new Manifest();<NEW_LINE>manifest.read(is);<NEW_LINE>String seleniumVersion = getSeleniumVersionFromManifest(manifest);<NEW_LINE>if (seleniumVersion != null) {<NEW_LINE>seleniumVersions.add(seleniumVersion);<NEW_LINE>LOGGER.info("Selenium API version {} detected on classpath", seleniumVersion);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.debug("Failed to determine Selenium-Version from selenium-api JAR Manifest", e);<NEW_LINE>}<NEW_LINE>if (seleniumVersions.size() == 0) {<NEW_LINE>LOGGER.warn("Failed to determine Selenium version from classpath - will use default version of {}", DEFAULT_SELENIUM_VERSION);<NEW_LINE>return DEFAULT_SELENIUM_VERSION;<NEW_LINE>}<NEW_LINE>String foundVersion = seleniumVersions<MASK><NEW_LINE>if (seleniumVersions.size() > 1) {<NEW_LINE>LOGGER.warn("Multiple versions of Selenium API found on classpath - will select {}, but this may not be reliable", foundVersion);<NEW_LINE>}<NEW_LINE>return foundVersion;<NEW_LINE>} | .iterator().next(); |
460,518 | public static Suggest fromXContent(XContentParser parser) throws IOException {<NEW_LINE>ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser);<NEW_LINE>List<Suggestion<? extends Entry<? extends Option>>> <MASK><NEW_LINE>while ((parser.nextToken()) != XContentParser.Token.END_OBJECT) {<NEW_LINE>ensureExpectedToken(XContentParser.Token.FIELD_NAME, parser.currentToken(), parser);<NEW_LINE>String currentField = parser.currentName();<NEW_LINE>ensureExpectedToken(XContentParser.Token.START_ARRAY, parser.nextToken(), parser);<NEW_LINE>Suggestion<? extends Entry<? extends Option>> suggestion = Suggestion.fromXContent(parser);<NEW_LINE>if (suggestion != null) {<NEW_LINE>suggestions.add(suggestion);<NEW_LINE>} else {<NEW_LINE>throw new ParsingException(parser.getTokenLocation(), String.format(Locale.ROOT, "Could not parse suggestion keyed as [%s]", currentField));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new Suggest(suggestions);<NEW_LINE>} | suggestions = new ArrayList<>(); |
73,713 | private static Pair<String, String> offsetROR(final long offset, final ITranslationEnvironment environment, final List<ReilInstruction> instructions, final String registerNodeValue1, final String registerNodeValue2, final String immediateNodeValue) {<NEW_LINE>final <MASK><NEW_LINE>final String index = environment.getNextVariableString();<NEW_LINE>final String tmpVar = environment.getNextVariableString();<NEW_LINE>final String tmpVar1 = environment.getNextVariableString();<NEW_LINE>final String tmpVar2 = environment.getNextVariableString();<NEW_LINE>final String tmpVar3 = environment.getNextVariableString();<NEW_LINE>long baseOffset = offset;<NEW_LINE>instructions.add(ReilHelpers.createBsh(baseOffset++, dw, registerNodeValue2, dw, "-" + Integer.decode(immediateNodeValue), dw, tmpVar1));<NEW_LINE>instructions.add(ReilHelpers.createBsh(baseOffset++, dw, registerNodeValue2, dw, String.valueOf(32 - Integer.decode(immediateNodeValue)), dw, tmpVar2));<NEW_LINE>instructions.add(ReilHelpers.createOr(baseOffset++, dw, tmpVar1, dw, tmpVar2, dw, tmpVar3));<NEW_LINE>instructions.add(ReilHelpers.createAnd(baseOffset++, dw, tmpVar3, dw, dWordBitMask, dw, index));<NEW_LINE>instructions.add(ReilHelpers.createAdd(baseOffset++, dw, registerNodeValue1, dw, index, dw, tmpVar));<NEW_LINE>instructions.add(ReilHelpers.createAnd(baseOffset++, dw, tmpVar, dw, dWordBitMask, dw, address));<NEW_LINE>return new Pair<String, String>(address, registerNodeValue1);<NEW_LINE>} | String address = environment.getNextVariableString(); |
47,150 | public void handle(PacketWrapper wrapper) throws Exception {<NEW_LINE>String channel = wrapper.get(Type.STRING, 0);<NEW_LINE>if (channel.equals("minecraft:trader_list") || channel.equals("trader_list")) {<NEW_LINE>// Passthrough Window ID<NEW_LINE>wrapper.passthrough(Type.INT);<NEW_LINE>int size = <MASK><NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>// Input Item<NEW_LINE>wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));<NEW_LINE>// Output Item<NEW_LINE>wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));<NEW_LINE>// Has second item<NEW_LINE>boolean secondItem = wrapper.passthrough(Type.BOOLEAN);<NEW_LINE>if (secondItem) {<NEW_LINE>wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));<NEW_LINE>}<NEW_LINE>// Trade disabled<NEW_LINE>wrapper.passthrough(Type.BOOLEAN);<NEW_LINE>// Number of tools uses<NEW_LINE>wrapper.passthrough(Type.INT);<NEW_LINE>// Maximum number of trade uses<NEW_LINE>wrapper.passthrough(Type.INT);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | wrapper.passthrough(Type.UNSIGNED_BYTE); |
652,210 | private void loadFromDB() throws Exception {<NEW_LINE>Query query = new Query(HugeType.VERTEX);<NEW_LINE>query.capacity(this.verticesCapacityHalf * 2L);<NEW_LINE>query.limit(Query.NO_LIMIT);<NEW_LINE>Iterator<Vertex> vertices = this.graph.vertices(query);<NEW_LINE>// switch concurrent loading here<NEW_LINE>boolean concurrent = true;<NEW_LINE>if (concurrent) {<NEW_LINE>try (LoadTraverser traverser = new LoadTraverser()) {<NEW_LINE>traverser.load(vertices);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Iterator<Edge> adjEdges;<NEW_LINE>Id lastId = IdGenerator.ZERO;<NEW_LINE>while (vertices.hasNext()) {<NEW_LINE>Id vertex = (Id) vertices.next().id();<NEW_LINE>if (vertex.compareTo(lastId) < 0) {<NEW_LINE>throw new HugeException("The ramtable feature is not " + "supported by %s backend", this.graph.backend());<NEW_LINE>}<NEW_LINE>ensureNumberId(vertex);<NEW_LINE>lastId = vertex;<NEW_LINE>adjEdges = this.graph.adjacentEdges(vertex);<NEW_LINE>if (adjEdges.hasNext()) {<NEW_LINE>HugeEdge edge = <MASK><NEW_LINE>this.addEdge(true, edge);<NEW_LINE>}<NEW_LINE>while (adjEdges.hasNext()) {<NEW_LINE>HugeEdge edge = (HugeEdge) adjEdges.next();<NEW_LINE>this.addEdge(false, edge);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (HugeEdge) adjEdges.next(); |
1,141,667 | protected void deleteResource(IPackageFragmentRoot root, IClasspathEntry rootEntry) throws JavaModelException {<NEW_LINE>final char[][] exclusionPatterns = ((ClasspathEntry) rootEntry).fullExclusionPatternChars();<NEW_LINE>IResource rootResource = ((JavaElement) root).resource();<NEW_LINE>if (rootEntry.getEntryKind() != IClasspathEntry.CPE_SOURCE || exclusionPatterns == null) {<NEW_LINE>try {<NEW_LINE>rootResource.delete(this.updateResourceFlags, this.progressMonitor);<NEW_LINE>} catch (CoreException e) {<NEW_LINE>throw new JavaModelException(e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>final IPath<MASK><NEW_LINE>IResourceProxyVisitor visitor = new IResourceProxyVisitor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean visit(IResourceProxy proxy) throws CoreException {<NEW_LINE>if (proxy.getType() == IResource.FOLDER) {<NEW_LINE>IPath path = proxy.requestFullPath();<NEW_LINE>if (prefixesOneOf(path, nestedFolders)) {<NEW_LINE>// equals if nested source folder<NEW_LINE>return !equalsOneOf(path, nestedFolders);<NEW_LINE>} else {<NEW_LINE>// subtree doesn't contain any nested source folders<NEW_LINE>proxy.requestResource().delete(DeletePackageFragmentRootOperation.this.updateResourceFlags, DeletePackageFragmentRootOperation.this.progressMonitor);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>proxy.requestResource().delete(DeletePackageFragmentRootOperation.this.updateResourceFlags, DeletePackageFragmentRootOperation.this.progressMonitor);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>try {<NEW_LINE>rootResource.accept(visitor, IResource.NONE);<NEW_LINE>} catch (CoreException e) {<NEW_LINE>throw new JavaModelException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);<NEW_LINE>} | [] nestedFolders = getNestedFolders(root); |
1,556,998 | public void loadSettings(DBWHandlerConfiguration configuration) {<NEW_LINE>if (isCertificatesSupported()) {<NEW_LINE>if (caCertPath != null) {<NEW_LINE>caCertPath.setText(CommonUtils.notEmpty(configuration.getStringProperty(SSLHandlerTrustStoreImpl.PROP_SSL_CA_CERT)));<NEW_LINE>}<NEW_LINE>clientCertPath.setText(CommonUtils.notEmpty(configuration.getStringProperty(SSLHandlerTrustStoreImpl.PROP_SSL_CLIENT_CERT)));<NEW_LINE>clientKeyPath.setText(CommonUtils.notEmpty(configuration.<MASK><NEW_LINE>}<NEW_LINE>if (isKeystoreSupported()) {<NEW_LINE>keyStorePath.setText(CommonUtils.notEmpty(configuration.getStringProperty(SSLHandlerTrustStoreImpl.PROP_SSL_KEYSTORE)));<NEW_LINE>keyStorePassword.setText(CommonUtils.notEmpty(configuration.getPassword()));<NEW_LINE>}<NEW_LINE>final SSLConfigurationMethod method;<NEW_LINE>if (isCertificatesSupported() && isKeystoreSupported()) {<NEW_LINE>method = CommonUtils.valueOf(SSLConfigurationMethod.class, configuration.getStringProperty(SSLHandlerTrustStoreImpl.PROP_SSL_METHOD), SSLConfigurationMethod.CERTIFICATES);<NEW_LINE>if (method == SSLConfigurationMethod.CERTIFICATES) {<NEW_LINE>certRadioButton.setSelection(true);<NEW_LINE>} else {<NEW_LINE>keyStoreRadioButton.setSelection(true);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>method = isCertificatesSupported() ? SSLConfigurationMethod.CERTIFICATES : SSLConfigurationMethod.KEYSTORE;<NEW_LINE>}<NEW_LINE>showMethodControls(method);<NEW_LINE>} | getStringProperty(SSLHandlerTrustStoreImpl.PROP_SSL_CLIENT_KEY))); |
765,896 | public void invoke(Request request, Response response) throws IOException, ServletException {<NEW_LINE>log.trace("*********************** SAML ************");<NEW_LINE>CatalinaHttpFacade facade = new CatalinaHttpFacade(response, request);<NEW_LINE>SamlDeployment deployment = deploymentContext.resolveDeployment(facade);<NEW_LINE>if (request.getRequestURI().substring(request.getContextPath().length()).endsWith("/saml")) {<NEW_LINE>if (deployment != null && deployment.isConfigured()) {<NEW_LINE>SamlSessionStore tokenStore = getSessionStore(request, facade, deployment);<NEW_LINE>SamlAuthenticator authenticator = new <MASK><NEW_LINE>executeAuthenticator(request, response, facade, deployment, authenticator);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// sets request UserPrincipal if logged in. we do this so that the UserPrincipal is available on unsecured, unconstrainted URLs<NEW_LINE>getSessionStore(request, facade, deployment).isLoggedIn();<NEW_LINE>super.invoke(request, response);<NEW_LINE>} finally {<NEW_LINE>}<NEW_LINE>} | CatalinaSamlEndpoint(facade, deployment, tokenStore); |
630,668 | public static void vertical7(Kernel1D_S32 kernel, GrayS16 input, GrayI16 output, int skip) {<NEW_LINE>final short[] dataSrc = input.data;<NEW_LINE>final short[] dataDst = output.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int k5 = kernel.data[4];<NEW_LINE>final int k6 = kernel.data[5];<NEW_LINE>final int k7 = kernel.data[6];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int width = input.width;<NEW_LINE>final int heightEnd = UtilDownConvolve.computeMaxSide(input.height, skip, radius);<NEW_LINE>final int offsetY = UtilDownConvolve.computeOffset(skip, radius);<NEW_LINE>for (int y = offsetY; y <= heightEnd; y += skip) {<NEW_LINE>int indexDst = output.startIndex + (y / skip) * output.stride;<NEW_LINE>int i = input.startIndex + (y - radius) * input.stride;<NEW_LINE>final int iEnd = i + width;<NEW_LINE>for (; i < iEnd; i++) {<NEW_LINE>int indexSrc = i;<NEW_LINE>int total = (dataSrc[indexSrc]) * k1;<NEW_LINE>indexSrc += input.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k2;<NEW_LINE>indexSrc += input.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k3;<NEW_LINE>indexSrc += input.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k4;<NEW_LINE>indexSrc += input.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k5;<NEW_LINE>indexSrc += input.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k6;<NEW_LINE>indexSrc += input.stride;<NEW_LINE>total += <MASK><NEW_LINE>dataDst[indexDst++] = (short) total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (dataSrc[indexSrc]) * k7; |
819,066 | protected void halt(final AbstractRunningQuery q) {<NEW_LINE>boolean interrupted = false;<NEW_LINE>lock.lock();<NEW_LINE>try {<NEW_LINE>// notify listener(s)<NEW_LINE>try {<NEW_LINE>fireEvent(q);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (InnerCause.isInnerCause(t, InterruptedException.class)) {<NEW_LINE>// Defer impact until outside of this critical section.<NEW_LINE>interrupted = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// insert/touch the LRU of recently finished queries.<NEW_LINE>doneQueries.put(q.getQueryId(<MASK><NEW_LINE>// remove from the set of running queries.<NEW_LINE>runningQueries.remove(q.getQueryId(), q);<NEW_LINE>if (runningQueries.isEmpty()) {<NEW_LINE>// Signal that no queries are running.<NEW_LINE>nothingRunning.signalAll();<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>lock.unlock();<NEW_LINE>}<NEW_LINE>if (interrupted)<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>} | ), q.getFuture()); |
425,623 | public void reset() {<NEW_LINE>suspendEvents = true;<NEW_LINE>try {<NEW_LINE>if (legacy instanceof JTextComponent) {<NEW_LINE>((JTextComponent) legacy).setText(enh.getAsText());<NEW_LINE>} else if (legacy instanceof JComboBox) {<NEW_LINE>if (((JComboBox) legacy).isEditable()) {<NEW_LINE>if (((JComboBox) legacy).getEditor().getEditorComponent().isShowing()) {<NEW_LINE>((JComboBox) legacy).getEditor().<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>((JComboBox) legacy).setSelectedItem(enh.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>// What we are doing here is dangerous and may fail depending on<NEW_LINE>// the implementation of the legacy editor, so log the exception<NEW_LINE>// but don't notify the user<NEW_LINE>// NOI18N<NEW_LINE>Logger.getLogger(WrapperInplaceEditor.class.getName()).log(Level.WARNING, "Failure resetting legacy editor", e);<NEW_LINE>} finally {<NEW_LINE>suspendEvents = false;<NEW_LINE>}<NEW_LINE>} | setItem(enh.getValue()); |
192,736 | private void addTilesForExternalServices(Map<String, Object> properties) {<NEW_LINE>for (String key : properties.keySet()) {<NEW_LINE>if (key.endsWith(LINK_NAME)) {<NEW_LINE>if (key.length() > LINK_NAME.length()) {<NEW_LINE>// get prefix from link name<NEW_LINE>String linkname = key.substring(0, key.length(<MASK><NEW_LINE>String name = (String) properties.getOrDefault(linkname + LINK_NAME, "");<NEW_LINE>String url = (String) properties.getOrDefault(linkname + LINK_URL, "");<NEW_LINE>String imageUrl = (String) properties.getOrDefault(linkname + LINK_IMAGEURL, "");<NEW_LINE>if (!name.isEmpty() && !url.isEmpty()) {<NEW_LINE>TileBuilder builder = new ExternalServiceTile.TileBuilder().withName(name).withUrl(url);<NEW_LINE>if (!imageUrl.isEmpty()) {<NEW_LINE>builder = builder.withImageUrl(imageUrl);<NEW_LINE>}<NEW_LINE>Tile newTile = builder.build();<NEW_LINE>addTile(newTile);<NEW_LINE>logger.debug("Tile added: {}", newTile);<NEW_LINE>} else {<NEW_LINE>logger.warn("Ignore invalid tile '{}': {}", linkname, name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ) - LINK_NAME.length()); |
848,198 | private static Object readUnmodifiableMapFrom(Input input, Schema<?> schema, Object owner, IdStrategy strategy, boolean graph, Object map, boolean sm) throws IOException {<NEW_LINE>if (graph) {<NEW_LINE>// update the actual reference.<NEW_LINE>((GraphInput) input).updateLast(map, owner);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>Object m = input.mergeObject(wrapper, strategy.POLYMORPHIC_MAP_SCHEMA);<NEW_LINE>if (!graph || !((GraphInput) input).isCurrentMessageReference())<NEW_LINE>m = wrapper.value;<NEW_LINE>try {<NEW_LINE>fUnmodifiableMap_m.set(map, m);<NEW_LINE>if (sm)<NEW_LINE>fUnmodifiableSortedMap_sm.set(map, m);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | final Wrapper wrapper = new Wrapper(); |
1,423,067 | private boolean isProductContainedAtLevelInProductInstance(int m_product_id, int level, DefaultMutableTreeNode rootProductInstance) {<NEW_LINE>log.fine("In isProductContainedAtLevelInProductInstance");<NEW_LINE>log.fine("looking for m_product_id: " + m_product_id + " at level: " + level);<NEW_LINE>log.fine(<MASK><NEW_LINE>log.fine("rootProductInstance.getNumNodesFromRoot: " + getNumNodesFromRoot(rootProductInstance));<NEW_LINE>boolean retValue = false;<NEW_LINE>Enumeration children = rootProductInstance.breadthFirstEnumeration();<NEW_LINE>if (children != null) {<NEW_LINE>while (children.hasMoreElements()) {<NEW_LINE>DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement();<NEW_LINE>nodeUserObject m_nodeUserObject = (nodeUserObject) child.getUserObject();<NEW_LINE>log.fine("node: " + child + " product instance m_product_id: " + m_nodeUserObject.M_Product.get_ID() + " at level: " + child.getLevel());<NEW_LINE>if (child.getLevel() == level && m_nodeUserObject.M_Product.get_ID() == m_product_id) {<NEW_LINE>retValue = true;<NEW_LINE>return retValue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return retValue;<NEW_LINE>} | "rootProductInstance.getDepth: " + rootProductInstance.getDepth()); |
103,652 | public void appendInterfaceInfo(HystrixCommandMetrics metrics) {<NEW_LINE>InterfaceInfo interfaceInfo = new InterfaceInfo();<NEW_LINE>int windowTime = metrics.getProperties().metricsRollingStatisticalWindowInMilliseconds().get() / CONVERSION;<NEW_LINE>long successCount = metrics.getRollingCount(HystrixEventType.SUCCESS);<NEW_LINE>long failureCount = <MASK><NEW_LINE>long semRejectCount = metrics.getRollingCount(HystrixEventType.SEMAPHORE_REJECTED);<NEW_LINE>long threadRejectCount = metrics.getRollingCount(HystrixEventType.THREAD_POOL_REJECTED);<NEW_LINE>long timeoutCount = metrics.getRollingCount(HystrixEventType.TIMEOUT);<NEW_LINE>long shortCircuitedCount = metrics.getRollingCount(HystrixEventType.SHORT_CIRCUITED);<NEW_LINE>long rollingErrorTotal = failureCount + semRejectCount + threadRejectCount + timeoutCount;<NEW_LINE>long rollingTotal = successCount + rollingErrorTotal;<NEW_LINE>if (rollingTotal == 0) {<NEW_LINE>interfaceInfo.setRate(DEFAULT_SUCCESS_RATE);<NEW_LINE>interfaceInfo.setFailureRate(0d);<NEW_LINE>} else {<NEW_LINE>double failurePercentage = (double) rollingErrorTotal / rollingTotal;<NEW_LINE>interfaceInfo.setRate(DEFAULT_SUCCESS_RATE - failurePercentage);<NEW_LINE>interfaceInfo.setFailureRate(failurePercentage);<NEW_LINE>}<NEW_LINE>int latency = metrics.getTotalTimeMean();<NEW_LINE>int latency995 = metrics.getTotalTimePercentile(PERCENTAGE_995);<NEW_LINE>int latency99 = metrics.getTotalTimePercentile(PERCENTAGE_99);<NEW_LINE>int latency90 = metrics.getTotalTimePercentile(PERCENTAGE_90);<NEW_LINE>int latency75 = metrics.getTotalTimePercentile(PERCENTAGE_75);<NEW_LINE>int latency50 = metrics.getTotalTimePercentile(PERCENTAGE_50);<NEW_LINE>int latency25 = metrics.getTotalTimePercentile(PERCENTAGE_25);<NEW_LINE>int latency5 = metrics.getTotalTimePercentile(PERCENTAGE_5);<NEW_LINE>interfaceInfo.setName(metrics.getCommandKey().name());<NEW_LINE>interfaceInfo.setCircuitBreakerOpen(isOpen(metrics));<NEW_LINE>interfaceInfo.setShortCircuited(shortCircuitedCount);<NEW_LINE>interfaceInfo.setFailureRate(failureCount);<NEW_LINE>interfaceInfo.setSemaphoreRejected(semRejectCount);<NEW_LINE>interfaceInfo.setThreadPoolRejected(threadRejectCount);<NEW_LINE>interfaceInfo.setCountTimeout(timeoutCount);<NEW_LINE>interfaceInfo.setDesc(metrics.getCommandKey().name());<NEW_LINE>interfaceInfo.setLatency(latency);<NEW_LINE>interfaceInfo.setL995(latency995);<NEW_LINE>interfaceInfo.setL99(latency99);<NEW_LINE>interfaceInfo.setL90(latency90);<NEW_LINE>interfaceInfo.setL75(latency75);<NEW_LINE>interfaceInfo.setL50(latency50);<NEW_LINE>interfaceInfo.setL25(latency25);<NEW_LINE>interfaceInfo.setL5(latency5);<NEW_LINE>interfaceInfo.setTotal(rollingTotal);<NEW_LINE>double qpsVal = ((double) rollingTotal) / windowTime;<NEW_LINE>BigDecimal b = new BigDecimal(qpsVal);<NEW_LINE>BigDecimal qps = b.setScale(SCALE_VAL, RoundingMode.HALF_DOWN);<NEW_LINE>interfaceInfo.setQps(qps.doubleValue());<NEW_LINE>interfaces.add(interfaceInfo);<NEW_LINE>} | metrics.getRollingCount(HystrixEventType.FAILURE); |
731,375 | static Stream<String> splitNameservers(String ns) {<NEW_LINE>Matcher matcher = FORMAT_BRACKETS.matcher(ns);<NEW_LINE>if (!matcher.matches()) {<NEW_LINE>checkArgument(!ns.contains("[") && !ns.contains("]"), "Could not parse square brackets in %s", ns);<NEW_LINE>return ImmutableList.of(ns).stream();<NEW_LINE>}<NEW_LINE>ImmutableList.Builder<String> nameservers = new ImmutableList.Builder<>();<NEW_LINE>int start = parseInt(matcher.group(2));<NEW_LINE>int end = parseInt<MASK><NEW_LINE>checkArgument(start <= end, "Number range [%s-%s] is invalid", start, end);<NEW_LINE>for (int i = start; i <= end; i++) {<NEW_LINE>nameservers.add(String.format("%s%d%s", matcher.group(1), i, matcher.group(4)));<NEW_LINE>}<NEW_LINE>return nameservers.build().stream();<NEW_LINE>} | (matcher.group(3)); |
1,135,204 | public void visit(ReturnStatement node) {<NEW_LINE>Expression expression = node.getExpression();<NEW_LINE>if (expression instanceof Variable) {<NEW_LINE>OccurencesSupport occurencesSupport = model.getOccurencesSupport(expression.getStartOffset() + 1);<NEW_LINE>Occurence occurence = occurencesSupport.getOccurence();<NEW_LINE>if (occurence != null) {<NEW_LINE>// search for array<NEW_LINE>Collection<? extends PhpElement<MASK><NEW_LINE>PhpElement variableDeclaration = ModelUtils.getFirst(gotoDeclarations);<NEW_LINE>if (variableDeclaration != null) {<NEW_LINE>ASTNode[] nodeHierarchyAtOffset = Utils.getNodeHierarchyAtOffset(actionDeclaration, variableDeclaration.getOffset());<NEW_LINE>for (ASTNode parentNode : nodeHierarchyAtOffset) {<NEW_LINE>if (parentNode instanceof Assignment) {<NEW_LINE>Assignment assignment = (Assignment) parentNode;<NEW_LINE>Expression rightHandSide = assignment.getRightHandSide();<NEW_LINE>if (rightHandSide instanceof ArrayCreation) {<NEW_LINE>// $model = array('form' => $form);<NEW_LINE>process((ArrayCreation) rightHandSide);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// find all array accesses ($model['form'] = new MyForm())<NEW_LINE>String varName = CodeUtils.extractVariableName((Variable) expression);<NEW_LINE>process(arrayAssigments.get(varName));<NEW_LINE>}<NEW_LINE>} | > gotoDeclarations = occurence.gotoDeclarations(); |
876,789 | public static BinaryPartAbstractImage createImagePart(OpcPackage opcPackage, Part sourcePart, File imageFile) throws Exception {<NEW_LINE>final byte[] locByte = new byte[1];<NEW_LINE>// We are in the case that image is not load (no byte Array) so isLoad is false<NEW_LINE>ImageInfo info = ensureFormatIsSupported(imageFile, locByte, false);<NEW_LINE><MASK><NEW_LINE>// Ensure the relationships part exists<NEW_LINE>if (sourcePart.getRelationshipsPart() == null) {<NEW_LINE>RelationshipsPart.createRelationshipsPartForPart(sourcePart);<NEW_LINE>}<NEW_LINE>String proposedRelId = sourcePart.getRelationshipsPart().getNextId();<NEW_LINE>String ext = info.getMimeType().substring(info.getMimeType().indexOf("/") + 1);<NEW_LINE>BinaryPartAbstractImage imagePart = (BinaryPartAbstractImage) ctm.newPartForContentType(info.getMimeType(), createImageName(opcPackage, sourcePart, proposedRelId, ext), null);<NEW_LINE>log.debug("created part " + imagePart.getClass().getName() + " with name " + imagePart.getPartName().toString());<NEW_LINE>FileInputStream fis = new FileInputStream(imageFile);<NEW_LINE>imagePart.setBinaryData(fis);<NEW_LINE>imagePart.rels.add(sourcePart.addTargetPart(imagePart, proposedRelId));<NEW_LINE>imagePart.setImageInfo(info);<NEW_LINE>return imagePart;<NEW_LINE>} | ContentTypeManager ctm = opcPackage.getContentTypeManager(); |
1,639,616 | private void buildCrossReferences(LibraryInfo libraryInfo, Map<String, Type> typesByName) {<NEW_LINE>for (TypeInfo typeInfo : libraryInfo.getTypeList()) {<NEW_LINE>Type type = typesByName.get(libraryInfo.getTypeMap(typeInfo.getTypeId()));<NEW_LINE>String superClassName = libraryInfo.<MASK><NEW_LINE>Type superClass = typesByName.get(superClassName);<NEW_LINE>if (superClass == null) {<NEW_LINE>externalTypeReferences.add(superClassName);<NEW_LINE>} else {<NEW_LINE>superClass.addImmediateSubtype(type);<NEW_LINE>type.setSuperClass(superClass);<NEW_LINE>}<NEW_LINE>for (int implementsId : typeInfo.getImplementsTypeList()) {<NEW_LINE>Type superInterface = typesByName.get(libraryInfo.getTypeMap(implementsId));<NEW_LINE>if (superInterface == null) {<NEW_LINE>externalTypeReferences.add(libraryInfo.getTypeMap(implementsId));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>superInterface.addImmediateSubtype(type);<NEW_LINE>type.addSuperInterface(superInterface);<NEW_LINE>}<NEW_LINE>for (MemberInfo memberInfo : typeInfo.getMemberList()) {<NEW_LINE>Member member = type.getMemberByName(memberInfo.getName());<NEW_LINE>for (int referencedId : memberInfo.getReferencedTypesList()) {<NEW_LINE>Type referencedType = typesByName.get(libraryInfo.getTypeMap(referencedId));<NEW_LINE>if (referencedType == null) {<NEW_LINE>externalTypeReferences.add(libraryInfo.getTypeMap(referencedId));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>member.addReferencedType(referencedType);<NEW_LINE>}<NEW_LINE>for (MethodInvocation methodInvocation : memberInfo.getInvokedMethodsList()) {<NEW_LINE>Type enclosingType = typesByName.get(libraryInfo.getTypeMap(methodInvocation.getEnclosingType()));<NEW_LINE>if (enclosingType == null) {<NEW_LINE>externalTypeReferences.add(libraryInfo.getTypeMap(methodInvocation.getEnclosingType()));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Member referencedMember = enclosingType.getMemberByName(methodInvocation.getMethod());<NEW_LINE>if (referencedMember == null) {<NEW_LINE>unknownMethodReferences.add(enclosingType.getName() + "." + methodInvocation.getMethod());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>member.addReferencedMember(referencedMember);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getTypeMap(typeInfo.getExtendsType()); |
381,109 | final DeleteDistributionResult executeDeleteDistribution(DeleteDistributionRequest deleteDistributionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteDistributionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteDistributionRequest> request = null;<NEW_LINE>Response<DeleteDistributionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteDistributionRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lightsail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteDistribution");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteDistributionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteDistributionResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(deleteDistributionRequest)); |
662,120 | public void finalizeZipFileWithoutValidations(ZipModel zipModel, OutputStream outputStream, Charset charset) throws IOException {<NEW_LINE>if (zipModel == null || outputStream == null) {<NEW_LINE>throw new ZipException("input parameters is null, cannot finalize zip file without validations");<NEW_LINE>}<NEW_LINE>try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {<NEW_LINE>long offsetCentralDir = zipModel.getEndOfCentralDirectoryRecord().getOffsetOfStartOfCentralDirectory();<NEW_LINE>writeCentralDirectory(<MASK><NEW_LINE>int sizeOfCentralDir = byteArrayOutputStream.size();<NEW_LINE>if (zipModel.isZip64Format() || offsetCentralDir >= InternalZipConstants.ZIP_64_SIZE_LIMIT || zipModel.getCentralDirectory().getFileHeaders().size() >= InternalZipConstants.ZIP_64_NUMBER_OF_ENTRIES_LIMIT) {<NEW_LINE>if (zipModel.getZip64EndOfCentralDirectoryRecord() == null) {<NEW_LINE>zipModel.setZip64EndOfCentralDirectoryRecord(new Zip64EndOfCentralDirectoryRecord());<NEW_LINE>}<NEW_LINE>if (zipModel.getZip64EndOfCentralDirectoryLocator() == null) {<NEW_LINE>zipModel.setZip64EndOfCentralDirectoryLocator(new Zip64EndOfCentralDirectoryLocator());<NEW_LINE>}<NEW_LINE>zipModel.getZip64EndOfCentralDirectoryLocator().setOffsetZip64EndOfCentralDirectoryRecord(offsetCentralDir + sizeOfCentralDir);<NEW_LINE>Zip64EndOfCentralDirectoryRecord zip64EndOfCentralDirectoryRecord = buildZip64EndOfCentralDirectoryRecord(zipModel, sizeOfCentralDir, offsetCentralDir);<NEW_LINE>zipModel.setZip64EndOfCentralDirectoryRecord(zip64EndOfCentralDirectoryRecord);<NEW_LINE>writeZip64EndOfCentralDirectoryRecord(zip64EndOfCentralDirectoryRecord, byteArrayOutputStream, rawIO);<NEW_LINE>writeZip64EndOfCentralDirectoryLocator(zipModel.getZip64EndOfCentralDirectoryLocator(), byteArrayOutputStream, rawIO);<NEW_LINE>}<NEW_LINE>writeEndOfCentralDirectoryRecord(zipModel, sizeOfCentralDir, offsetCentralDir, byteArrayOutputStream, rawIO, charset);<NEW_LINE>writeZipHeaderBytes(zipModel, outputStream, byteArrayOutputStream.toByteArray(), charset);<NEW_LINE>}<NEW_LINE>} | zipModel, byteArrayOutputStream, rawIO, charset); |
1,598,576 | public static DrawTextRegion createFromString(String string) {<NEW_LINE>String[] sp = string.split(",");<NEW_LINE>int c = 0;<NEW_LINE>int x = Integer.parseInt(sp[c++]);<NEW_LINE>int y = Integer.parseInt(sp[c++]);<NEW_LINE>int width = Integer.parseInt(sp[c++]);<NEW_LINE>int height = Integer.<MASK><NEW_LINE>int mode = Integer.parseInt(sp[c++]);<NEW_LINE>int baseLineOffset = Integer.parseInt(sp[c++]);<NEW_LINE>boolean singleLine = Boolean.parseBoolean(sp[c++]);<NEW_LINE>boolean toUpperCase = Boolean.parseBoolean(sp[c++]);<NEW_LINE>int alignmentX = Integer.parseInt(sp[c++]);<NEW_LINE>int alignmentY = Integer.parseInt(sp[c++]);<NEW_LINE>int fontSize = Integer.parseInt(sp[c++]);<NEW_LINE>float scale = java.lang.Float.parseFloat(sp[c++]);<NEW_LINE>String text = string.substring(string.indexOf('\"') + 1, string.lastIndexOf('\"'));<NEW_LINE>return new DrawTextRegion(x, y, width, height, mode, baseLineOffset, text, singleLine, toUpperCase, alignmentX, alignmentY, fontSize, scale);<NEW_LINE>} | parseInt(sp[c++]); |
489,980 | private void run(String[] args) throws UnsupportedAudioFileException, IOException, IllegalArgumentException, LineUnavailableException {<NEW_LINE>PitchEstimationAlgorithm algo = PitchEstimationAlgorithm.FFT_YIN;<NEW_LINE>String inputFile = args[0];<NEW_LINE>String outputFile = null;<NEW_LINE>String combinedFile = null;<NEW_LINE>if (args.length == 3 && args[0].equalsIgnoreCase("--detector")) {<NEW_LINE>algo = PitchEstimationAlgorithm.valueOf(args[1].toUpperCase());<NEW_LINE>inputFile = args[2];<NEW_LINE>} else if (args.length == 3 && args[0].equalsIgnoreCase("--output")) {<NEW_LINE>outputFile = args[1];<NEW_LINE>inputFile = args[2];<NEW_LINE>} else if (args.length == 5 && args[0].equalsIgnoreCase("--detector") && args[2].equalsIgnoreCase("--output")) {<NEW_LINE>algo = PitchEstimationAlgorithm.valueOf(args[1].toUpperCase());<NEW_LINE>outputFile = args[3];<NEW_LINE>inputFile = args[4];<NEW_LINE>} else if (args.length == 7 && args[0].equalsIgnoreCase("--detector") && args[2].equalsIgnoreCase("--output") && args[4].equalsIgnoreCase("--combined")) {<NEW_LINE>algo = PitchEstimationAlgorithm.valueOf(args[1].toUpperCase());<NEW_LINE>outputFile = args[3];<NEW_LINE>combinedFile = args[5];<NEW_LINE>inputFile = args[6];<NEW_LINE>} else if (args.length != 1) {<NEW_LINE>printError();<NEW_LINE>SharedCommandLineUtilities.printLine();<NEW_LINE>System.err.println("Current error:");<NEW_LINE>System.err.println("\tThe command expects the options in the specified order, the current command is not parsed correctly!");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File audioFile = new File(inputFile);<NEW_LINE>AudioFormat format = AudioSystem.getAudioFileFormat(audioFile).getFormat();<NEW_LINE>float samplerate = format.getSampleRate();<NEW_LINE>int size = 1024;<NEW_LINE>int overlap = 0;<NEW_LINE>PitchResyntheziser prs = new PitchResyntheziser(samplerate);<NEW_LINE>AudioDispatcher dispatcher = AudioDispatcherFactory.<MASK><NEW_LINE>dispatcher.addAudioProcessor(new PitchProcessor(algo, samplerate, size, prs));<NEW_LINE>if (outputFile != null) {<NEW_LINE>dispatcher.addAudioProcessor(new WaveformWriter(format, outputFile));<NEW_LINE>} else {<NEW_LINE>dispatcher.addAudioProcessor(new AudioPlayer(format));<NEW_LINE>}<NEW_LINE>dispatcher.addAudioProcessor(new AudioProcessor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void processingFinished() {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean process(AudioEvent audioEvent) {<NEW_LINE>System.err.print(String.format("%3.0f %%", audioEvent.getProgress() * 100));<NEW_LINE>System.err.print(String.format("\b\b\b\b\b", audioEvent.getProgress()));<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>dispatcher.run();<NEW_LINE>if (combinedFile != null) {<NEW_LINE>combineTwoMonoAudioFilesInTwoChannels(inputFile, outputFile, combinedFile);<NEW_LINE>}<NEW_LINE>} | fromFile(audioFile, size, overlap); |
879,047 | public List<DiscoveryIncomingMessage> call() throws IOException {<NEW_LINE>final DatagramSocket socket = new DatagramSocket(0, address);<NEW_LINE>List<DiscoveryIncomingMessage> ret = new ArrayList<DiscoveryIncomingMessage>();<NEW_LINE>try {<NEW_LINE>socket.setSoTimeout(timeout);<NEW_LINE>logHandler.debug(address + "--> Sending");<NEW_LINE>socket.send(outPacket);<NEW_LINE>} catch (IOException exp) {<NEW_LINE>throw new CouldntSendDiscoveryPacketException(address, "Can't send discovery UDP packet from " + address + ": " + exp.getMessage(), exp);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>try {<NEW_LINE>do {<NEW_LINE>byte[] buf <MASK><NEW_LINE>DatagramPacket in = new DatagramPacket(buf, buf.length);<NEW_LINE>socket.receive(in);<NEW_LINE>logHandler.debug(address + "--> Received answer from " + in.getAddress());<NEW_LINE>addIncomingMessage(ret, in);<NEW_LINE>} while (// Leave loop with a SocketTimeoutException in receive()<NEW_LINE>true);<NEW_LINE>} catch (SocketTimeoutException exp) {<NEW_LINE>logHandler.debug(address + "--> Timeout");<NEW_LINE>// Expected until no responses are returned anymore<NEW_LINE>} catch (IOException exp) {<NEW_LINE>throw new IOException("Cannot receive broadcast answer on " + address + ": " + exp.getMessage(), exp);<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} finally {<NEW_LINE>socket.close();<NEW_LINE>}<NEW_LINE>} | = new byte[AbstractDiscoveryMessage.MAX_MSG_SIZE]; |
1,719,094 | // rejectIt<NEW_LINE>@Override<NEW_LINE>public String completeIt() {<NEW_LINE>// Re-Check<NEW_LINE>if (!m_justPrepared) {<NEW_LINE>String status = prepareIt();<NEW_LINE>if (!IDocument.STATUS_InProgress.equals(status))<NEW_LINE>return status;<NEW_LINE>}<NEW_LINE>m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);<NEW_LINE>if (m_processMsg != null)<NEW_LINE>return IDocument.STATUS_Invalid;<NEW_LINE>// Implicit Approval<NEW_LINE>if (!isApproved())<NEW_LINE>approveIt();<NEW_LINE>log.debug("Completed: {}", this);<NEW_LINE>//<NEW_LINE>MMovement move = new MMovement(getCtx(), getM_Movement_ID(), get_TrxName());<NEW_LINE>MMovementLineConfirm[] lines = getLines(false);<NEW_LINE>for (MMovementLineConfirm line : lines) {<NEW_LINE>MMovementLineConfirm confirm = line;<NEW_LINE>confirm.set_TrxName(get_TrxName());<NEW_LINE>if (!confirm.processLine()) {<NEW_LINE>m_processMsg = "ShipLine not saved - " + confirm;<NEW_LINE>return IDocument.STATUS_Invalid;<NEW_LINE>}<NEW_LINE>if (confirm.isFullyConfirmed()) {<NEW_LINE>confirm.setProcessed(true);<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>if (createDifferenceDoc(move, confirm)) {<NEW_LINE>confirm.setProcessed(true);<NEW_LINE>confirm.save(get_TrxName());<NEW_LINE>} else {<NEW_LINE>log.error("completeIt - Scrapped=" + confirm.getScrappedQty() + " - Difference=" + confirm.getDifferenceQty());<NEW_LINE>m_processMsg = "Differnce Doc not created";<NEW_LINE>return IDocument.STATUS_Invalid;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// for all lines<NEW_LINE>if (m_inventoryInfo != null) {<NEW_LINE>m_processMsg = " @M_Inventory_ID@: " + m_inventoryInfo;<NEW_LINE>addDescription(Msg.translate(getCtx(), "M_Inventory_ID") + ": " + m_inventoryInfo);<NEW_LINE>}<NEW_LINE>// User Validation<NEW_LINE>String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);<NEW_LINE>if (valid != null) {<NEW_LINE>m_processMsg = valid;<NEW_LINE>return IDocument.STATUS_Invalid;<NEW_LINE>}<NEW_LINE>setProcessed(true);<NEW_LINE>setDocAction(DOCACTION_Close);<NEW_LINE>return IDocument.STATUS_Completed;<NEW_LINE>} | confirm.save(get_TrxName()); |
71,205 | private void internalPaintComponent(Graphics2D g) {<NEW_LINE>AntialiasingManager.activateAntialiasing(g);<NEW_LINE>// Paint a roll over fade out.<NEW_LINE>FadeTracker fadeTracker = FadeTracker.getInstance();<NEW_LINE>float visibility = this.getModel().isRollover() ? 1.0f : 0.0f;<NEW_LINE>if (fadeTracker.isTracked(this, FadeKind.ROLLOVER)) {<NEW_LINE>visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER);<NEW_LINE>}<NEW_LINE>visibility /= 2;<NEW_LINE>if (visibility != 0.0f) {<NEW_LINE>g.setColor(new Color(borderColor[0], borderColor[1], borderColor[2], visibility));<NEW_LINE>if (bgImage != null)<NEW_LINE>g.fillRoundRect((this.getWidth() - bgImage.getWidth(null)) / 2, (this.getHeight() - bgImage.getHeight(null)) / 2, bgImage.getWidth(null) - 1, bgImage.getHeight(null) - 1, 20, 20);<NEW_LINE>else<NEW_LINE>g.fillRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, 20, 20);<NEW_LINE>}<NEW_LINE>if (bgImage != null) {<NEW_LINE>g.drawImage(bgImage, (this.getWidth() - bgImage.getWidth(null)) / 2, (this.getHeight() - bgImage.getHeight(null)) / 2, null);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>g.fillRoundRect(1, 1, this.getWidth() - 2, this.getHeight() - 2, 20, 20);<NEW_LINE>}<NEW_LINE>} | g.setColor(getBackground()); |
843,828 | public EntityRef build() {<NEW_LINE>if (id.isPresent() && !entityManager.registerId(id.get())) {<NEW_LINE>return EntityRef.NULL;<NEW_LINE>}<NEW_LINE>long finalId = id.orElse(entityManager.createEntity());<NEW_LINE>components.values().forEach(c -> entityManager.getComponentStore().put(finalId, c));<NEW_LINE><MASK><NEW_LINE>EntityRef entity = entityManager.getEntity(finalId);<NEW_LINE>if (sendLifecycleEvents && entityManager.getEventSystem() != null) {<NEW_LINE>// TODO: don't send OnAddedComponent when the entity is being re-loaded from storage<NEW_LINE>entity.send(OnAddedComponent.newInstance());<NEW_LINE>entity.send(OnActivatedComponent.newInstance());<NEW_LINE>}<NEW_LINE>// Retrieve the components again in case they were modified by the previous events<NEW_LINE>for (Component component : entityManager.iterateComponents(entity.getId())) {<NEW_LINE>entityManager.notifyComponentAdded(entity, component.getClass());<NEW_LINE>}<NEW_LINE>entity.setScope(scope.orElse(getEntityInfo().scope));<NEW_LINE>return entity;<NEW_LINE>} | entityManager.assignToPool(finalId, pool); |
54,679 | private void initialise(AttributeSet attrs) {<NEW_LINE>TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapDropDown);<NEW_LINE>try {<NEW_LINE>this.roundedCorners = a.getBoolean(<MASK><NEW_LINE>this.showOutline = a.getBoolean(R.styleable.BootstrapDropDown_showOutline, false);<NEW_LINE>int directionOrdinal = a.getInt(R.styleable.BootstrapDropDown_bootstrapExpandDirection, -1);<NEW_LINE>int dataOrdinal = a.getResourceId(R.styleable.BootstrapDropDown_dropdownResource, -1);<NEW_LINE>int sizeOrdinal = a.getInt(R.styleable.BootstrapDropDown_bootstrapSize, -1);<NEW_LINE>expandDirection = ExpandDirection.fromAttributeValue(directionOrdinal);<NEW_LINE>bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();<NEW_LINE>itemHeight = a.getDimensionPixelSize(R.styleable.BootstrapDropDown_itemHeight, (int) DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_item_height));<NEW_LINE>if (isInEditMode()) {<NEW_LINE>dropdownData = new String[] { "Android Studio", "Layout Preview", "Is Always", "Breaking" };<NEW_LINE>} else {<NEW_LINE>dropdownData = getContext().getResources().getStringArray(dataOrdinal);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>a.recycle();<NEW_LINE>}<NEW_LINE>baselineStrokeWidth = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_edge_width);<NEW_LINE>baselineCornerRadius = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_corner_radius);<NEW_LINE>baselineFontSize = DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_dropdown_default_font_size);<NEW_LINE>baselineDropDownViewFontSize = DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_dropdown_default_item_font_size);<NEW_LINE>baselineItemLeftPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_item_left_padding);<NEW_LINE>baselineItemRightPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_item_right_padding);<NEW_LINE>baselineVertPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_vert_padding);<NEW_LINE>baselineHoriPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_hori_padding);<NEW_LINE>if (isInEditMode()) {<NEW_LINE>// take a sensible guess<NEW_LINE>screenWidth = SCREEN_WIDTH_GUESS;<NEW_LINE>} else {<NEW_LINE>DisplayMetrics metrics = new DisplayMetrics();<NEW_LINE>((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);<NEW_LINE>screenWidth = metrics.widthPixels;<NEW_LINE>}<NEW_LINE>createDropDown();<NEW_LINE>updateDropDownState();<NEW_LINE>} | R.styleable.BootstrapDropDown_roundedCorners, false); |
889,804 | private static DescribeModelResponse createModelResponse(ModelManager modelManager, String modelName, Model model) {<NEW_LINE>DescribeModelResponse resp = new DescribeModelResponse();<NEW_LINE>resp.setModelName(modelName);<NEW_LINE>resp.setModelUrl(model.getModelUrl());<NEW_LINE>resp.setBatchSize(model.getBatchSize());<NEW_LINE>resp.setMaxBatchDelay(model.getMaxBatchDelay());<NEW_LINE>resp.setMaxWorkers(model.getMaxWorkers());<NEW_LINE>resp.setMinWorkers(model.getMinWorkers());<NEW_LINE>resp.setLoadedAtStartup(modelManager.getStartupModels().contains(modelName));<NEW_LINE>Manifest manifest = model.getModelArchive().getManifest();<NEW_LINE>resp.setModelVersion(manifest.<MASK><NEW_LINE>resp.setRuntime(manifest.getRuntime().getValue());<NEW_LINE>List<WorkerThread> workers = modelManager.getWorkers(model.getModelVersionName());<NEW_LINE>for (WorkerThread worker : workers) {<NEW_LINE>String workerId = worker.getWorkerId();<NEW_LINE>long startTime = worker.getStartTime();<NEW_LINE>boolean isRunning = worker.isRunning();<NEW_LINE>int gpuId = worker.getGpuId();<NEW_LINE>long memory = worker.getMemory();<NEW_LINE>int pid = worker.getPid();<NEW_LINE>String gpuUsage = worker.getGpuUsage();<NEW_LINE>resp.addWorker(workerId, startTime, isRunning, gpuId, memory, pid, gpuUsage);<NEW_LINE>}<NEW_LINE>return resp;<NEW_LINE>} | getModel().getModelVersion()); |
1,618,006 | protected void removeCache(String cacheRegion, Serializable key) {<NEW_LINE>String cacheName = cacheRegion;<NEW_LINE>// TODO 6.1 ehcache 3 Make sure this is adding correctly<NEW_LINE>if (key.getClass().getName().equals("org.hibernate.cache.internal.CacheKeyImplementation")) {<NEW_LINE>// Since CacheKeyImplementation is a protected Class we can't cast it nor can we access the entityOrRoleName property<NEW_LINE>// therefore, to match how this worked in pre Hibernate 5, we split the toString since it's comprised of the fields we need<NEW_LINE>String[] keyPieces = key.toString().split("#");<NEW_LINE>cacheName = keyPieces[0];<NEW_LINE>key = keyPieces[1];<NEW_LINE>}<NEW_LINE>String nameKey = <MASK><NEW_LINE>if (cacheMemberNamesByEntity.containsKey(nameKey)) {<NEW_LINE>String[] members = new String[cacheMemberNamesByEntity.get(nameKey).size()];<NEW_LINE>members = cacheMemberNamesByEntity.get(nameKey).toArray(members);<NEW_LINE>for (String myMember : members) {<NEW_LINE>String itemKey = createItemKey(cacheRegion, myMember, nameKey);<NEW_LINE>removeKeys.add(itemKey);<NEW_LINE>}<NEW_LINE>cacheMemberNamesByEntity.remove(nameKey);<NEW_LINE>}<NEW_LINE>} | createNameKey(cacheRegion, cacheName, key); |
591,314 | final CreateSchemaResult executeCreateSchema(CreateSchemaRequest createSchemaRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createSchemaRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateSchemaRequest> request = null;<NEW_LINE>Response<CreateSchemaResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateSchemaRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createSchemaRequest));<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, "schemas");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateSchema");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateSchemaResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateSchemaResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
360,759 | public T loadCheckpoint() {<NEW_LINE>final File checkpointFile = checkpointFile();<NEW_LINE>final File backupFile = backupFile();<NEW_LINE>if (!checkpointFile.exists() && !backupFile.exists()) {<NEW_LINE>LOG.warn("Checkpoint file and backup file does not exist, return null for now");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final byte[] data = Files.toByteArray(checkpointFile);<NEW_LINE>if (data != null && data.length == 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return serde.fromBytes(data);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOG.error("Load checkpoint file failed. Try load backup checkpoint file instead.", e);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return serde.fromBytes<MASK><NEW_LINE>} catch (IOException e) {<NEW_LINE>LOG.error("Load backup checkpoint file failed.", e);<NEW_LINE>}<NEW_LINE>throw new RuntimeException("Load checkpoint failed. filename=" + filename);<NEW_LINE>} | (Files.toByteArray(backupFile)); |
1,418,503 | private void appendNode(Node root, String[] featureCols, StringBuilder sbd) {<NEW_LINE>if (root.isLeaf()) {<NEW_LINE>if (!isRegressionTree) {<NEW_LINE>double max = 0.0;<NEW_LINE>int maxIndex = -1;<NEW_LINE>for (int j = 0; j < root.getCounter().getDistributions().length; ++j) {<NEW_LINE>if (max < root.getCounter().getDistributions()[j]) {<NEW_LINE>max = root.getCounter().getDistributions()[j];<NEW_LINE>maxIndex = j;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Preconditions.checkArgument(maxIndex >= 0, "Can not find the probability: {}", JsonConverter.toJson(root.getCounter().getDistributions()));<NEW_LINE>sbd.append(dataConverter.labels[maxIndex]);<NEW_LINE>} else {<NEW_LINE>sbd.append(printEightDecimal(root.getCounter().<MASK><NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (root.getCategoricalSplit() != null) {<NEW_LINE>boolean first = true;<NEW_LINE>for (int index : root.getCategoricalSplit()) {<NEW_LINE>if (index < 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>StringBuilder subSbd = new StringBuilder();<NEW_LINE>if (first) {<NEW_LINE>subSbd.append(" CASE WHEN ");<NEW_LINE>} else {<NEW_LINE>subSbd.append(" WHEN ");<NEW_LINE>}<NEW_LINE>first = false;<NEW_LINE>subSbd.append(featureCols[root.getFeatureIndex()]);<NEW_LINE>subSbd.append(" = ");<NEW_LINE>subSbd.append(multiStringIndexerModelData.getToken(featureCols[root.getFeatureIndex()], (long) index));<NEW_LINE>subSbd.append(" THEN ");<NEW_LINE>appendNode(root.getNextNodes()[index], featureCols, subSbd);<NEW_LINE>sbd.append(subSbd);<NEW_LINE>}<NEW_LINE>sbd.append(" END");<NEW_LINE>} else {<NEW_LINE>StringBuilder subSbd = new StringBuilder();<NEW_LINE>subSbd.append("CASE WHEN ");<NEW_LINE>subSbd.append(featureCols[root.getFeatureIndex()]);<NEW_LINE>subSbd.append(" <= ");<NEW_LINE>subSbd.append(printEightDecimal(root.getContinuousSplit()));<NEW_LINE>subSbd.append(" THEN ");<NEW_LINE>appendNode(root.getNextNodes()[0], featureCols, subSbd);<NEW_LINE>sbd.append(subSbd);<NEW_LINE>subSbd = new StringBuilder();<NEW_LINE>subSbd.append(" WHEN ");<NEW_LINE>subSbd.append(featureCols[root.getFeatureIndex()]);<NEW_LINE>subSbd.append(" > ");<NEW_LINE>subSbd.append(printEightDecimal(root.getContinuousSplit()));<NEW_LINE>subSbd.append(" THEN ");<NEW_LINE>appendNode(root.getNextNodes()[1], featureCols, subSbd);<NEW_LINE>sbd.append(subSbd);<NEW_LINE>sbd.append(" END");<NEW_LINE>}<NEW_LINE>} | getDistributions()[0])); |
1,266,405 | final CreateCostCategoryDefinitionResult executeCreateCostCategoryDefinition(CreateCostCategoryDefinitionRequest createCostCategoryDefinitionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createCostCategoryDefinitionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateCostCategoryDefinitionRequest> request = null;<NEW_LINE>Response<CreateCostCategoryDefinitionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateCostCategoryDefinitionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createCostCategoryDefinitionRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Cost Explorer");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateCostCategoryDefinition");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateCostCategoryDefinitionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateCostCategoryDefinitionResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
675,497 | protected HikariDataSource createDataSource() {<NEW_LINE>// get the configured datasources<NEW_LINE>dataSourceMap = Config.getInstance().getJsonMapConfig(DATASOURCE);<NEW_LINE>// get the requested datasource<NEW_LINE>Map<String, Object> mainParams = (Map<String, Object>) dataSourceMap.get(getDsName());<NEW_LINE>Map<String, String> configParams = (Map<String, String>) mainParams.get("parameters");<NEW_LINE>// create the DataSource<NEW_LINE>ds = new HikariDataSource();<NEW_LINE>ds.setJdbcUrl((String<MASK><NEW_LINE>ds.setUsername((String) mainParams.get("username"));<NEW_LINE>// use encrypted password<NEW_LINE>String password = (String) mainParams.get(DB_PASSWORD);<NEW_LINE>ds.setPassword(password);<NEW_LINE>// set datasource paramters<NEW_LINE>ds.setMaximumPoolSize((Integer) mainParams.get("maximumPoolSize"));<NEW_LINE>ds.setConnectionTimeout((Integer) mainParams.get("connectionTimeout"));<NEW_LINE>// add datasource specific connection parameters<NEW_LINE>if (configParams != null)<NEW_LINE>configParams.forEach((k, v) -> ds.addDataSourceProperty(k, v));<NEW_LINE>return ds;<NEW_LINE>} | ) mainParams.get("jdbcUrl")); |
715,999 | public static void apply(PPrBase source, PPrBase destination) {<NEW_LINE>// PPrBase as a Base class isn't instantiated<NEW_LINE>if (!isEmpty((PPrBase) source)) {<NEW_LINE>destination.setPStyle(apply(source.getPStyle(), destination.getPStyle()));<NEW_LINE>destination.setKeepNext(apply(source.getKeepNext(), destination.getKeepNext()));<NEW_LINE>destination.setKeepLines(apply(source.getKeepLines(), destination.getKeepLines()));<NEW_LINE>destination.setPageBreakBefore(apply(source.getPageBreakBefore(), destination.getPageBreakBefore()));<NEW_LINE>destination.setFramePr(apply(source.getFramePr(), destination.getFramePr()));<NEW_LINE>destination.setWidowControl(apply(source.getWidowControl(), destination.getWidowControl()));<NEW_LINE>destination.setNumPr(apply(source.getNumPr(), destination.getNumPr()));<NEW_LINE>destination.setSuppressLineNumbers(apply(source.getSuppressLineNumbers(), destination.getSuppressLineNumbers()));<NEW_LINE>destination.setPBdr(apply(source.getPBdr(), destination.getPBdr()));<NEW_LINE>destination.setShd(apply(source.getShd(), destination.getShd()));<NEW_LINE>destination.setTabs(apply(source.getTabs(), destination.getTabs()));<NEW_LINE>destination.setSuppressAutoHyphens(apply(source.getSuppressAutoHyphens(), destination.getSuppressAutoHyphens()));<NEW_LINE>destination.setKinsoku(apply(source.getKinsoku(), destination.getKinsoku()));<NEW_LINE>destination.setWordWrap(apply(source.getWordWrap(), destination.getWordWrap()));<NEW_LINE>destination.setOverflowPunct(apply(source.getOverflowPunct(), destination.getOverflowPunct()));<NEW_LINE>destination.setTopLinePunct(apply(source.getTopLinePunct(), destination.getTopLinePunct()));<NEW_LINE>destination.setAutoSpaceDE(apply(source.getAutoSpaceDE(), destination.getAutoSpaceDE()));<NEW_LINE>destination.setAutoSpaceDN(apply(source.getAutoSpaceDN(), destination.getAutoSpaceDN()));<NEW_LINE>destination.setBidi(apply(source.getBidi(), destination.getBidi()));<NEW_LINE>destination.setAdjustRightInd(apply(source.getAdjustRightInd(), destination.getAdjustRightInd()));<NEW_LINE>destination.setSnapToGrid(apply(source.getSnapToGrid(), destination.getSnapToGrid()));<NEW_LINE>destination.setSpacing(apply(source.getSpacing(), destination.getSpacing()));<NEW_LINE>destination.setInd(apply(source.getInd(), destination.getInd()));<NEW_LINE>destination.setContextualSpacing(apply(source.getContextualSpacing(), destination.getContextualSpacing()));<NEW_LINE>destination.setMirrorIndents(apply(source.getMirrorIndents(), destination.getMirrorIndents()));<NEW_LINE>destination.setSuppressOverlap(apply(source.getSuppressOverlap(), destination.getSuppressOverlap()));<NEW_LINE>destination.setJc(apply(source.getJc()<MASK><NEW_LINE>destination.setTextDirection(apply(source.getTextDirection(), destination.getTextDirection()));<NEW_LINE>destination.setTextAlignment(apply(source.getTextAlignment(), destination.getTextAlignment()));<NEW_LINE>destination.setTextboxTightWrap(apply(source.getTextboxTightWrap(), destination.getTextboxTightWrap()));<NEW_LINE>destination.setOutlineLvl(apply(source.getOutlineLvl(), destination.getOutlineLvl()));<NEW_LINE>destination.setCnfStyle(apply(source.getCnfStyle(), destination.getCnfStyle()));<NEW_LINE>}<NEW_LINE>} | , destination.getJc())); |
1,070,962 | public void deleteByIdWithResponse(String id, Context context) {<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 accountName = Utils.getValueFromIdByName(id, "mediaServices");<NEW_LINE>if (accountName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'mediaServices'.", id)));<NEW_LINE>}<NEW_LINE>String assetName = Utils.getValueFromIdByName(id, "assets");<NEW_LINE>if (assetName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'assets'.", id)));<NEW_LINE>}<NEW_LINE>String trackName = Utils.getValueFromIdByName(id, "tracks");<NEW_LINE>if (trackName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.<MASK><NEW_LINE>}<NEW_LINE>this.delete(resourceGroupName, accountName, assetName, trackName, context);<NEW_LINE>} | format("The resource ID '%s' is not valid. Missing path segment 'tracks'.", id))); |
1,324,130 | public ConsumptionConfiguration unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ConsumptionConfiguration consumptionConfiguration = new ConsumptionConfiguration();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("RenewType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>consumptionConfiguration.setRenewType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ProvisionalConfiguration", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>consumptionConfiguration.setProvisionalConfiguration(ProvisionalConfigurationJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("BorrowConfiguration", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>consumptionConfiguration.setBorrowConfiguration(BorrowConfigurationJsonUnmarshaller.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 consumptionConfiguration;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
367,087 | private OperationResult applyCommand(long index, long sequence, long timestamp, PrimitiveOperation operation, RaftSession session) {<NEW_LINE><MASK><NEW_LINE>Commit<byte[]> commit = new DefaultCommit<>(index, operation.id(), operation.value(), session, timestamp);<NEW_LINE>OperationResult result;<NEW_LINE>try {<NEW_LINE>currentSession = session;<NEW_LINE>// Execute the state machine operation and get the result.<NEW_LINE>byte[] output = service.apply(commit);<NEW_LINE>// Store the result for linearizability and complete the command.<NEW_LINE>result = OperationResult.succeeded(index, eventIndex, output);<NEW_LINE>} catch (Exception e) {<NEW_LINE>// If an exception occurs during execution of the command, store the exception.<NEW_LINE>result = OperationResult.failed(index, eventIndex, e);<NEW_LINE>} finally {<NEW_LINE>currentSession = null;<NEW_LINE>}<NEW_LINE>// Once the operation has been applied to the state machine, commit events published by the command.<NEW_LINE>// The state machine context will build a composite future for events published to all sessions.<NEW_LINE>commit();<NEW_LINE>// Register the result in the session to ensure retries receive the same output for the command.<NEW_LINE>session.registerResult(sequence, result);<NEW_LINE>// Update the session timestamp and command sequence number.<NEW_LINE>session.setCommandSequence(sequence);<NEW_LINE>// Complete the command.<NEW_LINE>return result;<NEW_LINE>} | long eventIndex = session.getEventIndex(); |
121,292 | /*<NEW_LINE>* Creates Document instance from domain.xml<NEW_LINE>* @param domainScriptFilePath Path to domain.xml<NEW_LINE>*/<NEW_LINE>private Document loadDomainScriptFile(String domainScriptFilePath) {<NEW_LINE>InputStreamReader reader = null;<NEW_LINE>try {<NEW_LINE>DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();<NEW_LINE>dbFactory.setValidating(false);<NEW_LINE>DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();<NEW_LINE>dBuilder<MASK><NEW_LINE>reader = new FileReader(new File(domainScriptFilePath));<NEW_LINE>InputSource source = new InputSource(reader);<NEW_LINE>return dBuilder.parse(source);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.log(Level.WARNING, "Unable to parse domain config file {0}", domainScriptFilePath);<NEW_LINE>return null;<NEW_LINE>} finally {<NEW_LINE>if (reader != null) {<NEW_LINE>try {<NEW_LINE>reader.close();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>LOGGER.log(Level.INFO, "Cannot close reader for {0}: {1}", new String[] { domainScriptFilePath, ex.getLocalizedMessage() });<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .setEntityResolver(new InnerResolver()); |
1,057,058 | public static void addPolicyManagementCertificateAsync() {<NEW_LINE>String endpoint = System.getenv("ATTESTATION_ISOLATED_URL");<NEW_LINE>AttestationAdministrationClientBuilder attestationBuilder = new AttestationAdministrationClientBuilder();<NEW_LINE>AttestationAdministrationAsyncClient client = attestationBuilder.endpoint(endpoint).credential(new DefaultAzureCredentialBuilder().build()).buildAsyncClient();<NEW_LINE>X509Certificate certificateToAdd = SampleCollateral.getSigningCertificate();<NEW_LINE>PrivateKey isolatedKey = SampleCollateral.getIsolatedSigningKey();<NEW_LINE><MASK><NEW_LINE>// Note: It is not an error to add the same certificate twice. The second addition is ignored.<NEW_LINE>System.out.printf("Adding new certificate %s\n", certificateToAdd.getSubjectDN().toString());<NEW_LINE>client.addPolicyManagementCertificate(new PolicyManagementCertificateOptions(certificateToAdd, new AttestationSigningKey(isolatedCertificate, isolatedKey))).subscribe(modificationResult -> {<NEW_LINE>System.out.printf("Updated policy certificate, certificate add result: %s\n", modificationResult.getCertificateResolution());<NEW_LINE>System.out.printf("Added certificate thumbprint: %s\n", modificationResult.getCertificateThumbprint());<NEW_LINE>});<NEW_LINE>// Dump the list of policy certificates.<NEW_LINE>listPolicyCertificates();<NEW_LINE>} | X509Certificate isolatedCertificate = SampleCollateral.getIsolatedSigningCertificate(); |
1,625,966 | final DeleteStateMachineResult executeDeleteStateMachine(DeleteStateMachineRequest deleteStateMachineRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteStateMachineRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteStateMachineRequest> request = null;<NEW_LINE>Response<DeleteStateMachineResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteStateMachineRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteStateMachineRequest));<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, "SFN");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteStateMachine");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteStateMachineResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteStateMachineResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,093,514 | public int compareTo(Node o) {<NEW_LINE>double normH1 = a1 * (1 - h1 / n);<NEW_LINE>double normH2 = a2 * h2 / MAX_DIST;<NEW_LINE>double normH3 = a3 * h3 / MAX_DIST_H3;<NEW_LINE>double otherNormH1 = a1 * (<MASK><NEW_LINE>double otherNormH2 = a2 * o.h2 / MAX_DIST;<NEW_LINE>double otherNormH3 = a3 * o.h3 / MAX_DIST_H3;<NEW_LINE>double s1 = normH1 + normH2 + normH3;<NEW_LINE>double s2 = otherNormH1 + otherNormH2 + otherNormH3;<NEW_LINE>// If I have less => better<NEW_LINE>if (s1 < s2)<NEW_LINE>return -1;<NEW_LINE>if (s1 > s2)<NEW_LINE>return 1;<NEW_LINE>return 0;<NEW_LINE>} | 1 - o.h1 / n); |
1,236,790 | private void updateSelection(boolean notifyListener) {<NEW_LINE>OsmandSettings settings = getSettings();<NEW_LINE>MapMarkersMode mode = settings.MAP_MARKERS_MODE.get();<NEW_LINE>boolean distIndEnabled = settings.MARKERS_DISTANCE_INDICATION_ENABLED.get();<NEW_LINE>int count = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get();<NEW_LINE>int topBarIconId = count == 1 ? R.drawable.ic_action_device_topbar : R.drawable.ic_action_device_topbar_two;<NEW_LINE>int widgetIconId = count == 1 ? R.drawable.ic_action_device_widget : R.drawable.ic_action_device_widget_two;<NEW_LINE>updateIcon(R.id.top_bar_icon, topBarIconId, mode.isToolbar() && distIndEnabled);<NEW_LINE>updateIcon(R.id.widget_icon, widgetIconId, <MASK><NEW_LINE>updateMarkerModeRow(R.id.top_bar_row, R.id.top_bar_radio_button, mode.isToolbar(), distIndEnabled);<NEW_LINE>updateMarkerModeRow(R.id.widget_row, R.id.widget_radio_button, mode.isWidgets(), distIndEnabled);<NEW_LINE>if (notifyListener) {<NEW_LINE>notifyListener();<NEW_LINE>}<NEW_LINE>updateHelpImage();<NEW_LINE>} | mode.isWidgets() && distIndEnabled); |
906,800 | private LogicalSchema rebuildWithPseudoAndKeyColsInValue(final boolean windowedKey, final int pseudoColumnVersion, final boolean forPullOrScalablePushQuery) {<NEW_LINE>final Map<Namespace, List<Column>> byNamespace = byNamespace();<NEW_LINE>final List<Column> key = byNamespace.get(Namespace.KEY);<NEW_LINE>final List<Column> headers = byNamespace.get(HEADERS);<NEW_LINE>final ImmutableList.Builder<Column<MASK><NEW_LINE>final List<Column> keyColumns = keyColumns(byNamespace);<NEW_LINE>final List<Column> nonPseudoAndKeyCols = nonPseudoHeaderAndKeyColsAsValueCols(byNamespace, pseudoColumnVersion);<NEW_LINE>builder.addAll(keyColumns);<NEW_LINE>builder.addAll(nonPseudoAndKeyCols);<NEW_LINE>builder.addAll(headers);<NEW_LINE>int valueIndex = nonPseudoAndKeyCols.size();<NEW_LINE>for (final Column c : headers) {<NEW_LINE>builder.add(Column.of(c.name(), c.type(), VALUE, valueIndex++));<NEW_LINE>}<NEW_LINE>final List<Pair<ColumnName, SqlType>> pseudoColumns = new ArrayList<>();<NEW_LINE>if (pseudoColumnVersion >= ROWTIME_PSEUDOCOLUMN_VERSION) {<NEW_LINE>pseudoColumns.add(Pair.of(ROWTIME_NAME, ROWTIME_TYPE));<NEW_LINE>}<NEW_LINE>if (pseudoColumnVersion >= ROWPARTITION_ROWOFFSET_PSEUDOCOLUMN_VERSION) {<NEW_LINE>pseudoColumns.add(Pair.of(ROWPARTITION_NAME, ROWPARTITION_TYPE));<NEW_LINE>pseudoColumns.add(Pair.of(ROWOFFSET_NAME, ROWOFFSET_TYPE));<NEW_LINE>}<NEW_LINE>// if query is pull or scalable push, need to check if column is disallowed<NEW_LINE>if (forPullOrScalablePushQuery) {<NEW_LINE>for (Pair<ColumnName, SqlType> pair : pseudoColumns) {<NEW_LINE>if (!SystemColumns.isDisallowedInPullOrScalablePushQueries(pair.left, pseudoColumnVersion)) {<NEW_LINE>builder.add(Column.of(pair.left, pair.right, VALUE, valueIndex++));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (Pair<ColumnName, SqlType> pair : pseudoColumns) {<NEW_LINE>builder.add(Column.of(pair.left, pair.right, VALUE, valueIndex++));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (final Column c : key) {<NEW_LINE>builder.add(Column.of(c.name(), c.type(), VALUE, valueIndex++));<NEW_LINE>}<NEW_LINE>if (windowedKey) {<NEW_LINE>builder.add(Column.of(WINDOWSTART_NAME, WINDOWBOUND_TYPE, VALUE, valueIndex++));<NEW_LINE>builder.add(Column.of(WINDOWEND_NAME, WINDOWBOUND_TYPE, VALUE, valueIndex));<NEW_LINE>}<NEW_LINE>return new LogicalSchema(builder.build());<NEW_LINE>} | > builder = ImmutableList.builder(); |
472,786 | public com.amazonaws.services.iotfleethub.model.LimitExceededException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.iotfleethub.model.LimitExceededException limitExceededException = new com.amazonaws.services.iotfleethub.model.LimitExceededException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return limitExceededException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,166,460 | public void dump(Appendable out, String indent) throws IOException {<NEW_LINE>List<String> keys;<NEW_LINE>List<SelectorUpdate> updates;<NEW_LINE>Selector selector = _selector;<NEW_LINE>if (selector != null && selector.isOpen()) {<NEW_LINE>DumpKeys dump = new DumpKeys();<NEW_LINE>String updatesAt = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now());<NEW_LINE>try (AutoLock l = _lock.lock()) {<NEW_LINE>updates = new ArrayList<>(_updates);<NEW_LINE>_updates.addFirst(dump);<NEW_LINE>_selecting = false;<NEW_LINE>}<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("wakeup on dump {}", this);<NEW_LINE>selector.wakeup();<NEW_LINE>keys = dump.get(5, TimeUnit.SECONDS);<NEW_LINE>String keysAt = DateTimeFormatter.ISO_OFFSET_DATE_TIME.<MASK><NEW_LINE>if (keys == null)<NEW_LINE>keys = Collections.singletonList("No dump keys retrieved");<NEW_LINE>dumpObjects(out, indent, new DumpableCollection("updates @ " + updatesAt, updates), new DumpableCollection("keys @ " + keysAt, keys));<NEW_LINE>} else {<NEW_LINE>dumpObjects(out, indent);<NEW_LINE>}<NEW_LINE>} | format(ZonedDateTime.now()); |
953,291 | public void merge(ConfigurationChanges diffs, CompressionRules prevRules, CompressionRules rules, String parentDN) throws NamingException {<NEW_LINE>for (CompressionRule prevRule : prevRules) {<NEW_LINE>String cn = prevRule.getCommonName();<NEW_LINE>if (rules == null || rules.findByCommonName(cn) == null) {<NEW_LINE>String dn = LdapUtils.<MASK><NEW_LINE>config.destroySubcontext(dn);<NEW_LINE>ConfigurationChanges.addModifiedObject(diffs, dn, ConfigurationChanges.ChangeType.D);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (CompressionRule rule : rules) {<NEW_LINE>String cn = rule.getCommonName();<NEW_LINE>String dn = LdapUtils.dnOf("cn", cn, parentDN);<NEW_LINE>CompressionRule prevRule = prevRules != null ? prevRules.findByCommonName(cn) : null;<NEW_LINE>if (prevRule == null) {<NEW_LINE>ConfigurationChanges.ModifiedObject ldapObj = ConfigurationChanges.addModifiedObject(diffs, dn, ConfigurationChanges.ChangeType.C);<NEW_LINE>config.createSubcontext(dn, storeTo(rule, new BasicAttributes(true)));<NEW_LINE>} else {<NEW_LINE>ConfigurationChanges.ModifiedObject ldapObj = ConfigurationChanges.addModifiedObject(diffs, dn, ConfigurationChanges.ChangeType.U);<NEW_LINE>config.modifyAttributes(dn, storeDiffs(ldapObj, prevRule, rule, new ArrayList<ModificationItem>()));<NEW_LINE>ConfigurationChanges.removeLastIfEmpty(diffs, ldapObj);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | dnOf("cn", cn, parentDN); |
1,080,746 | private Map<String, Object> folderMap(Folder f) throws DotDataException, DotSecurityException {<NEW_LINE>UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();<NEW_LINE>HostAPI hostAPI = APILocator.getHostAPI();<NEW_LINE>Map<String, Object> folderMap = new HashMap<String, Object>();<NEW_LINE><MASK><NEW_LINE>folderMap.put("name", f.getName());<NEW_LINE>folderMap.put("id", f.getInode());<NEW_LINE>folderMap.put("inode", f.getInode());<NEW_LINE>folderMap.put("defaultFileType", f.getDefaultFileType());<NEW_LINE>String currentPath = hostAPI.findParentHost(f, userWebAPI.getSystemUser(), false).getHostname();<NEW_LINE>String fullPath = currentPath + ":/" + f.getName();<NEW_LINE>String absolutePath = "/" + f.getName();<NEW_LINE>folderMap.put("fullPath", fullPath);<NEW_LINE>folderMap.put("absolutePath", absolutePath);<NEW_LINE>return folderMap;<NEW_LINE>} | folderMap.put("type", "folder"); |
702,692 | private void generatePlannedOutputIcons() {<NEW_LINE>for (String s : plannedOutput) {<NEW_LINE>IFlexibleRecipe<ItemStack> recipe = <MASK><NEW_LINE>if (recipe != null) {<NEW_LINE>CraftingResult<ItemStack> result = recipe.craft(this, true);<NEW_LINE>if (result != null && result.usedItems != null && result.usedItems.size() > 0) {<NEW_LINE>plannedOutputIcons.put(s, result);<NEW_LINE>} else if (recipe instanceof IFlexibleRecipeViewable) {<NEW_LINE>// !! HACK !! TODO !! HACK !!<NEW_LINE>Object out = ((IFlexibleRecipeViewable) recipe).getOutput();<NEW_LINE>if (out instanceof ItemStack) {<NEW_LINE>result = new CraftingResult<>();<NEW_LINE>result.crafted = (ItemStack) out;<NEW_LINE>result.recipe = recipe;<NEW_LINE>plannedOutputIcons.put(s, result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>plannedOutput.remove(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String s : plannedOutputIcons.keySet().toArray(new String[plannedOutputIcons.size()])) {<NEW_LINE>if (!(plannedOutput.contains(s))) {<NEW_LINE>plannedOutputIcons.remove(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | AssemblyRecipeManager.INSTANCE.getRecipe(s); |
365,621 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player player = game.getPlayer(source.getControllerId());<NEW_LINE>if (player == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6));<NEW_LINE>TargetCardInLibrary target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_CREATURE);<NEW_LINE>player.choose(outcome, cards, target, game);<NEW_LINE>Card card = cards.get(target.getFirstTarget(), game);<NEW_LINE>if (card != null) {<NEW_LINE>player.revealCards(source, new CardsImpl(card), game);<NEW_LINE>player.moveCards(card, Zone.HAND, source, game);<NEW_LINE>cards.remove(card);<NEW_LINE>if (card.isLegendary()) {<NEW_LINE>player.gainLife(3, game, source);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>player.putCardsOnBottomOfLibrary(<MASK><NEW_LINE>return true;<NEW_LINE>} | cards, game, source, false); |
1,323,022 | private void readReplicaVersions() {<NEW_LINE>InternalPartitionServiceImpl partitionService = getService();<NEW_LINE>OperationService operationService <MASK><NEW_LINE>PartitionReplicaVersionManager versionManager = partitionService.getPartitionReplicaVersionManager();<NEW_LINE>UrgentPartitionRunnable<Void> gatherReplicaVersionsRunnable = new UrgentPartitionRunnable<>(partitionId(), () -> {<NEW_LINE>for (ServiceNamespace ns : namespaces) {<NEW_LINE>// make a copy because<NEW_LINE>// getPartitionReplicaVersions<NEW_LINE>// returns references to the internal<NEW_LINE>// replica versions data structures<NEW_LINE>// that may change under our feet<NEW_LINE>long[] versions = Arrays.copyOf(versionManager.getPartitionReplicaVersions(partitionId(), ns), IPartition.MAX_BACKUP_COUNT);<NEW_LINE>replicaVersions.put(BiTuple.of(partitionId(), ns), versions);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>operationService.execute(gatherReplicaVersionsRunnable);<NEW_LINE>gatherReplicaVersionsRunnable.future.joinInternal();<NEW_LINE>} | = getNodeEngine().getOperationService(); |
1,037,612 | <T> T runWithoutExternalEvents(final File repository, String commandName, Callable<T> callable) throws Exception {<NEW_LINE>assert repository != null;<NEW_LINE>try {<NEW_LINE>if (repository != null) {<NEW_LINE><MASK><NEW_LINE>commandLogger.lockedInternally(repository, commandName);<NEW_LINE>}<NEW_LINE>return callable.call();<NEW_LINE>} finally {<NEW_LINE>if (repository != null) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.FINER, "Refreshing index timestamp after: {0} on {1}", new Object[] { commandName, repository.getAbsolutePath() });<NEW_LINE>if (EventQueue.isDispatchThread()) {<NEW_LINE>Git.getInstance().getRequestProcessor().post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>gitFolderEventsHandler.refreshIndexFileTimestamp(repository);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>gitFolderEventsHandler.refreshIndexFileTimestamp(repository);<NEW_LINE>}<NEW_LINE>commandLogger.unlockedInternally(repository);<NEW_LINE>gitFolderEventsHandler.enableEvents(repository, true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | gitFolderEventsHandler.enableEvents(repository, false); |
155,083 | private void createGeneratedResources(Project project, CollectionDesc.Builder builder) throws IOException, CompileExceptionError {<NEW_LINE>for (EmbeddedInstanceDesc desc : builder.getEmbeddedInstancesList()) {<NEW_LINE>byte[] data = desc.getData().getBytes();<NEW_LINE>long hash = MurmurHash.hash64(data, data.length);<NEW_LINE>IResource genResource = project.getGeneratedResource(hash, "go");<NEW_LINE>if (genResource == null) {<NEW_LINE>genResource = project.createGeneratedResource(hash, "go");<NEW_LINE>// TODO: This is a hack derived from the same problem with embedded gameobjects from collections (see CollectionBuilder.create)!<NEW_LINE>// If the file isn't created here <EmbeddedComponent>#create<NEW_LINE>// can't access generated resource data (embedded component desc)<NEW_LINE>genResource.setContent(data);<NEW_LINE><MASK><NEW_LINE>productsOfThisTask.add(hash);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (CollectionInstanceDesc c : builder.getCollectionInstancesList()) {<NEW_LINE>IResource collectionResource = this.project.getResource(c.getCollection());<NEW_LINE>CollectionDesc.Builder subCollectionBuilder = CollectionDesc.newBuilder();<NEW_LINE>ProtoUtil.merge(collectionResource, subCollectionBuilder);<NEW_LINE>createGeneratedResources(project, subCollectionBuilder);<NEW_LINE>}<NEW_LINE>} | uniqueResources.put(hash, genResource); |
504,521 | private List<ESRTransaction> iterateTransactionDetails(@NonNull final ReportEntry2 ntry, @NonNull final EntryDetails1 ntryDtl) {<NEW_LINE>final List<ESRTransaction> transactions = new ArrayList<>();<NEW_LINE>int countQRR = 0;<NEW_LINE>for (final EntryTransaction2 txDtl : ntryDtl.getTxDtls()) {<NEW_LINE>final ESRTransactionBuilder trxBuilder = ESRTransaction.builder();<NEW_LINE>new ReferenceStringHelper().extractAndSetEsrReference(txDtl, trxBuilder);<NEW_LINE>new ReferenceStringHelper(<MASK><NEW_LINE>verifyTransactionCurrency(txDtl, trxBuilder);<NEW_LINE>extractAmountAndType(ntry, txDtl, trxBuilder);<NEW_LINE>final ESRTransaction esrTransaction = trxBuilder.accountingDate(asTimestamp(ntry.getBookgDt())).paymentDate(asTimestamp(ntry.getValDt())).esrParticipantNo(ntry.getNtryRef()).transactionKey(mkTrxKey(txDtl)).build();<NEW_LINE>transactions.add(esrTransaction);<NEW_LINE>if (ESRType.TYPE_QRR.equals(esrTransaction.getType())) {<NEW_LINE>countQRR++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (countQRR != 0 && countQRR != transactions.size()) {<NEW_LINE>throw new AdempiereException(ESRDataImporterCamt54.MSG_MULTIPLE_TRANSACTIONS_TYPES);<NEW_LINE>}<NEW_LINE>return transactions;<NEW_LINE>} | ).extractAndSetType(txDtl, trxBuilder); |
531,704 | protected BlockingQueueConsumer createBlockingQueueConsumer() {<NEW_LINE>BlockingQueueConsumer consumer;<NEW_LINE>String[] queues = getQueueNames();<NEW_LINE>// There's no point prefetching less than the tx size, otherwise the consumer will stall because the broker<NEW_LINE>// didn't get an ack for delivered messages<NEW_LINE>int actualPrefetchCount = getPrefetchCount() > this.batchSize ? getPrefetchCount() : this.batchSize;<NEW_LINE>consumer = new BlockingQueueConsumer(getConnectionFactory(), getMessagePropertiesConverter(), this.cancellationLock, getAcknowledgeMode(), isChannelTransacted(), actualPrefetchCount, isDefaultRequeueRejected(), getConsumerArguments(), isNoLocal(), isExclusive(), queues);<NEW_LINE>consumer.setGlobalQos(isGlobalQos());<NEW_LINE>consumer.setMissingQueuePublisher(this::publishMissingQueueEvent);<NEW_LINE>if (this.declarationRetries != null) {<NEW_LINE>consumer.setDeclarationRetries(this.declarationRetries);<NEW_LINE>}<NEW_LINE>if (getFailedDeclarationRetryInterval() > 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (this.retryDeclarationInterval != null) {<NEW_LINE>consumer.setRetryDeclarationInterval(this.retryDeclarationInterval);<NEW_LINE>}<NEW_LINE>ConsumerTagStrategy consumerTagStrategy = getConsumerTagStrategy();<NEW_LINE>if (consumerTagStrategy != null) {<NEW_LINE>consumer.setTagStrategy(consumerTagStrategy);<NEW_LINE>}<NEW_LINE>consumer.setBackOffExecution(getRecoveryBackOff().start());<NEW_LINE>consumer.setShutdownTimeout(getShutdownTimeout());<NEW_LINE>consumer.setApplicationEventPublisher(getApplicationEventPublisher());<NEW_LINE>return consumer;<NEW_LINE>} | consumer.setFailedDeclarationRetryInterval(getFailedDeclarationRetryInterval()); |
269,299 | public void exceptionRaised(Throwable throwable) {<NEW_LINE>assert isCurrent();<NEW_LINE>final Ruby runtime = getRuntime();<NEW_LINE>if (throwable instanceof Error || throwable instanceof MainExitException) {<NEW_LINE>exitingException = throwable;<NEW_LINE>Helpers.throwException(throwable);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// if unrescuable (internal exceptions) just re-raise and let it be handled by thread handler<NEW_LINE>if (throwable instanceof Unrescuable) {<NEW_LINE>Helpers.throwException(throwable);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final IRubyObject rubyException;<NEW_LINE>if (throwable instanceof RaiseException) {<NEW_LINE>RaiseException exception = (RaiseException) throwable;<NEW_LINE>rubyException = exception.getException();<NEW_LINE>} else {<NEW_LINE>rubyException = JavaUtil.convertJavaToUsableRubyObject(runtime, throwable);<NEW_LINE>}<NEW_LINE>boolean report;<NEW_LINE>if (runtime.getSystemExit().isInstance(rubyException)) {<NEW_LINE>runtime.getThreadService().<MASK><NEW_LINE>} else if ((report = reportOnException) || abortOnException(runtime)) {<NEW_LINE>if (report) {<NEW_LINE>printReportExceptionWarning();<NEW_LINE>runtime.printError(throwable);<NEW_LINE>}<NEW_LINE>if (abortOnException(runtime)) {<NEW_LINE>runtime.getThreadService().getMainThread().raise(rubyException);<NEW_LINE>}<NEW_LINE>} else if (runtime.isDebug()) {<NEW_LINE>runtime.printError(throwable);<NEW_LINE>}<NEW_LINE>exitingException = throwable;<NEW_LINE>} | getMainThread().raise(rubyException); |
319,105 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "p0,p1".split(",");<NEW_LINE>env.compileDeploy("@name('flow') create dataflow MyDataFlow " + "Emitter -> outstream<MyOAEventType> {name:'src1'}" + "DefaultSupportCaptureOp(outstream) {}");<NEW_LINE>DefaultSupportCaptureOp<Object> captureOp = new DefaultSupportCaptureOp<Object>();<NEW_LINE>EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions();<NEW_LINE>options.operatorProvider(new DefaultSupportGraphOpProvider(captureOp));<NEW_LINE>EPDataFlowInstance instance = env.runtime().getDataFlowService().instantiate(env.deploymentId("flow"), "MyDataFlow", options);<NEW_LINE>EPDataFlowInstanceCaptive captiveStart = instance.startCaptive();<NEW_LINE>assertEquals(0, captiveStart.getRunnables().size());<NEW_LINE>assertEquals(1, captiveStart.getEmitters().size());<NEW_LINE>EPDataFlowEmitterOperator emitter = captiveStart.getEmitters().get("src1");<NEW_LINE>assertEquals(EPDataFlowState.RUNNING, instance.getState());<NEW_LINE>emitter.submit(new Object[] { "E1", 10 });<NEW_LINE>EPAssertionUtil.assertPropsPerRow(captureOp.getCurrent(), fields, new Object[][] { { "E1", 10 } });<NEW_LINE>emitter.submit(new Object[] { "E2", 20 });<NEW_LINE>EPAssertionUtil.assertPropsPerRow(captureOp.getCurrent(), fields, new Object[][] { { "E1", 10 }, { "E2", 20 } });<NEW_LINE>emitter.submitSignal(new EPDataFlowSignalFinalMarker() {<NEW_LINE>});<NEW_LINE>EPAssertionUtil.assertPropsPerRow(captureOp.getCurrent(), fields, new Object[0][]);<NEW_LINE>EPAssertionUtil.assertPropsPerRow(captureOp.getAndReset().get(0).toArray(), fields, new Object[][] { { "E1", 10 }, { "E2", 20 } });<NEW_LINE>emitter.submit(new Object[] { "E3", 30 });<NEW_LINE>EPAssertionUtil.assertPropsPerRow(captureOp.getCurrent(), fields, new Object[][] <MASK><NEW_LINE>// stays running until cancelled (no transition to complete)<NEW_LINE>assertEquals(EPDataFlowState.RUNNING, instance.getState());<NEW_LINE>instance.cancel();<NEW_LINE>assertEquals(EPDataFlowState.CANCELLED, instance.getState());<NEW_LINE>env.undeployAll();<NEW_LINE>// test doc sample<NEW_LINE>String epl = "@name('flow') create dataflow HelloWorldDataFlow\n" + " create schema SampleSchema(text string),\t// sample type\t\t\n" + "\t\n" + " Emitter -> helloworld.stream<SampleSchema> { name: 'myemitter' }\n" + " LogSink(helloworld.stream) {}";<NEW_LINE>env.compileDeploy(epl);<NEW_LINE>env.runtime().getDataFlowService().instantiate(env.deploymentId("flow"), "HelloWorldDataFlow");<NEW_LINE>env.undeployAll();<NEW_LINE>} | { { "E3", 30 } }); |
1,310,917 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String stmtOrigText = "@name('split') @public on SupportBean " + "insert into AStream34 select theString||'_1' as theString where intPrimitive=10 " + "insert into BStream34 select theString||'_2' as theString where intPrimitive=20 " + "insert into CStream34 select theString||'_3' as theString where intPrimitive<0 " + "insert into DStream34 select theString||'_4' as theString";<NEW_LINE>env.compileDeploy(stmtOrigText, path).addListener("split");<NEW_LINE>env.compileDeploy("@name('s0') select * from AStream34", path).addListener("s0");<NEW_LINE>env.compileDeploy("@name('s1') select * from BStream34", path).addListener("s1");<NEW_LINE>env.compileDeploy("@name('s2') select * from CStream34"<MASK><NEW_LINE>env.compileDeploy("@name('s3') select * from DStream34", path).addListener("s3");<NEW_LINE>sendSupportBean(env, "E5", -999);<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.assertListenerNotInvoked("s1");<NEW_LINE>env.assertEqualsNew("s2", "theString", "E5_3");<NEW_LINE>env.assertListenerNotInvoked("s3");<NEW_LINE>env.assertListenerNotInvoked("split");<NEW_LINE>sendSupportBean(env, "E6", 9999);<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.assertListenerNotInvoked("s1");<NEW_LINE>env.assertListenerNotInvoked("s2");<NEW_LINE>env.assertEqualsNew("s3", "theString", "E6_4");<NEW_LINE>env.assertListenerNotInvoked("split");<NEW_LINE>sendSupportBean(env, "E7", 20);<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.assertEqualsNew("s1", "theString", "E7_2");<NEW_LINE>env.assertListenerNotInvoked("s2");<NEW_LINE>env.assertListenerNotInvoked("s3");<NEW_LINE>env.assertListenerNotInvoked("split");<NEW_LINE>sendSupportBean(env, "E8", 10);<NEW_LINE>env.assertEqualsNew("s0", "theString", "E8_1");<NEW_LINE>env.assertListenerNotInvoked("s1");<NEW_LINE>env.assertListenerNotInvoked("s2");<NEW_LINE>env.assertListenerNotInvoked("s3");<NEW_LINE>env.assertListenerNotInvoked("split");<NEW_LINE>env.undeployAll();<NEW_LINE>} | , path).addListener("s2"); |
1,187,633 | public com.amazonaws.services.iotthingsgraph.model.ResourceAlreadyExistsException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.iotthingsgraph.model.ResourceAlreadyExistsException resourceAlreadyExistsException = new com.amazonaws.services.iotthingsgraph.model.ResourceAlreadyExistsException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return resourceAlreadyExistsException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
79,378 | private void initComponents() {<NEW_LINE>jbCopy = new JButton(res.getString("DViewCertificateFingerprint.jbCopy.text"));<NEW_LINE>PlatformUtil.setMnemonic(jbCopy, res.getString("DViewCertificateFingerprint.jbCopy.mnemonic").charAt(0));<NEW_LINE>jbCopy.setToolTipText(res.getString("DViewCertificateFingerprint.jbCopy.tooltip"));<NEW_LINE>jbCopy.addActionListener(evt -> {<NEW_LINE>try {<NEW_LINE>CursorUtil.setCursorBusy(DViewCertificateFingerprint.this);<NEW_LINE>copyPressed();<NEW_LINE>} finally {<NEW_LINE>CursorUtil.setCursorFree(DViewCertificateFingerprint.this);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>jbOK = new JButton(res.getString("DViewCertificateFingerprint.jbOK.text"));<NEW_LINE>jbOK.addActionListener(evt -> okPressed());<NEW_LINE>jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, null, jbCopy);<NEW_LINE>jpFingerprint = <MASK><NEW_LINE>jpFingerprint.setBorder(new EmptyBorder(5, 5, 5, 5));<NEW_LINE>jtaFingerprint = new JTextArea();<NEW_LINE>jtaFingerprint.setFont(new Font(Font.MONOSPACED, Font.PLAIN, LnfUtil.getDefaultFontSize()));<NEW_LINE>jtaFingerprint.setEditable(false);<NEW_LINE>jtaFingerprint.setTabSize(4);<NEW_LINE>jtaFingerprint.setLineWrap(true);<NEW_LINE>// JGoodies - keep uneditable color same as editable<NEW_LINE>jtaFingerprint.putClientProperty("JTextArea.infoBackground", Boolean.TRUE);<NEW_LINE>jtaFingerprint.setToolTipText(MessageFormat.format(res.getString("DViewCertificateFingerprint.jtaFingerprint.tooltip"), fingerprintAlg.friendly()));<NEW_LINE>jspPolicy = PlatformUtil.createScrollPane(jtaFingerprint, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);<NEW_LINE>jspPolicy.setPreferredSize(new Dimension(280, 125));<NEW_LINE>jpFingerprint.add(jspPolicy, BorderLayout.CENTER);<NEW_LINE>getContentPane().add(jpFingerprint, BorderLayout.CENTER);<NEW_LINE>getContentPane().add(jpButtons, BorderLayout.SOUTH);<NEW_LINE>setTitle(MessageFormat.format(res.getString("DViewCertificateFingerprint.Title"), fingerprintAlg.friendly()));<NEW_LINE>setResizable(true);<NEW_LINE>addWindowListener(new WindowAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void windowClosing(WindowEvent evt) {<NEW_LINE>closeDialog();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>getRootPane().setDefaultButton(jbOK);<NEW_LINE>pack();<NEW_LINE>SwingUtilities.invokeLater(() -> jbOK.requestFocus());<NEW_LINE>populateFingerprint();<NEW_LINE>} | new JPanel(new BorderLayout()); |
1,292,470 | public static ZonedDateTime actionZDTPlusMinusTimePeriod(ZonedDateTime zdt, int factor, TimePeriod tp) {<NEW_LINE>if (tp == null) {<NEW_LINE>return zdt;<NEW_LINE>}<NEW_LINE>if (tp.getYears() != null) {<NEW_LINE>zdt = zdt.plus(factor * tp.getYears(), ChronoUnit.YEARS);<NEW_LINE>}<NEW_LINE>if (tp.getMonths() != null) {<NEW_LINE>zdt = zdt.plus(factor * tp.getMonths(), ChronoUnit.MONTHS);<NEW_LINE>}<NEW_LINE>if (tp.getWeeks() != null) {<NEW_LINE>zdt = zdt.plus(factor * tp.getWeeks(), ChronoUnit.WEEKS);<NEW_LINE>}<NEW_LINE>if (tp.getDays() != null) {<NEW_LINE>zdt = zdt.plus(factor * tp.getDays(), ChronoUnit.DAYS);<NEW_LINE>}<NEW_LINE>if (tp.getHours() != null) {<NEW_LINE>zdt = zdt.plus(factor * tp.getHours(), ChronoUnit.HOURS);<NEW_LINE>}<NEW_LINE>if (tp.getMinutes() != null) {<NEW_LINE>zdt = zdt.plus(factor * tp.<MASK><NEW_LINE>}<NEW_LINE>if (tp.getSeconds() != null) {<NEW_LINE>zdt = zdt.plus(factor * tp.getSeconds(), ChronoUnit.SECONDS);<NEW_LINE>}<NEW_LINE>if (tp.getMilliseconds() != null) {<NEW_LINE>zdt = zdt.plus(factor * tp.getMilliseconds(), ChronoUnit.MILLIS);<NEW_LINE>}<NEW_LINE>return zdt;<NEW_LINE>} | getMinutes(), ChronoUnit.MINUTES); |
973,358 | public String decodeToPayload(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf) throws InterruptedException, ZabbixErrorProtocolException {<NEW_LINE>int readable = byteBuf.readableBytes();<NEW_LINE><MASK><NEW_LINE>if (readable < HEADER_LEN) {<NEW_LINE>byteBuf.readerIndex(baseIndex);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Read header<NEW_LINE>ByteBuf headerBuf = byteBuf.readSlice(HEADER_LEN);<NEW_LINE>if (headerBuf.getByte(0) != PROTOCOL[0] || headerBuf.getByte(1) != PROTOCOL[1] || headerBuf.getByte(2) != PROTOCOL[2] || headerBuf.getByte(3) != PROTOCOL[3]) {<NEW_LINE>throw new ZabbixErrorProtocolException("header is not right");<NEW_LINE>}<NEW_LINE>// Only support communications protocol<NEW_LINE>if (headerBuf.getByte(4) != 1) {<NEW_LINE>throw new ZabbixErrorProtocolException("header flags only support communications protocol");<NEW_LINE>}<NEW_LINE>// Check payload<NEW_LINE>int dataLength = headerBuf.getByte(5) & 0xFF | (headerBuf.getByte(6) & 0xFF) << 8 | (headerBuf.getByte(7) & 0xFF) << 16 | (headerBuf.getByte(8) & 0xFF) << 24;<NEW_LINE>int totalLength = HEADER_LEN + dataLength + 4;<NEW_LINE>// If not receive all data, reset buffer and re-decode after content receive finish<NEW_LINE>if (readable < totalLength) {<NEW_LINE>byteBuf.readerIndex(baseIndex);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (dataLength <= 0) {<NEW_LINE>throw new ZabbixErrorProtocolException("content could not be empty");<NEW_LINE>}<NEW_LINE>// Skip protocol extensions<NEW_LINE>byteBuf.skipBytes(4);<NEW_LINE>// Reading content<NEW_LINE>ByteBuf payload = byteBuf.readSlice(dataLength);<NEW_LINE>return payload.toString(Charsets.UTF_8);<NEW_LINE>} | int baseIndex = byteBuf.readerIndex(); |
854,907 | public void gera(NoDeclaracaoVetor vetor, PrintWriter saida, VisitanteASA visitor, int nivelEscopo, boolean podeInicializar) throws ExcecaoVisitaASA {<NEW_LINE>String nome = vetor.getNome();<NEW_LINE>String tipo = Utils.getNomeTipoJava(vetor.getTipoDado());<NEW_LINE>saida.<MASK><NEW_LINE>if (podeInicializar || vetor.constante()) {<NEW_LINE>if (vetor.temInicializacao()) {<NEW_LINE>saida.append(" = ");<NEW_LINE>vetor.getInicializacao().aceitar(visitor);<NEW_LINE>} else {<NEW_LINE>NoExpressao tamanho = vetor.getTamanho();<NEW_LINE>if (tamanho != null) {<NEW_LINE>saida.format(" = new %s[", tipo);<NEW_LINE>tamanho.aceitar(visitor);<NEW_LINE>saida.append("]");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | format("%s %s[]", tipo, nome); |
1,124,867 | public static int rob(int[] nums) {<NEW_LINE>int len = nums.length;<NEW_LINE>if (len == 0)<NEW_LINE>return 0;<NEW_LINE>if (len == 1)<NEW_LINE>return nums[0];<NEW_LINE>if (len == 2)<NEW_LINE>return Math.max(nums[0], nums[1]);<NEW_LINE>int[] memo = new int[len];<NEW_LINE>memo[0] = nums[0];<NEW_LINE>memo[1] = Math.max(nums[<MASK><NEW_LINE>System.out.println("Memo before robbing: " + Arrays.toString(memo) + "\n");<NEW_LINE>for (int i = 2; i < len; i++) {<NEW_LINE>System.out.println("Visiting house no. " + (i + 1));<NEW_LINE>int choice1 = nums[i] + memo[i - 2];<NEW_LINE>int choice2 = memo[i - 1];<NEW_LINE>System.out.println("choice 1 (rob this house and 2nd before) : " + choice1);<NEW_LINE>System.out.println("choice 2 (max of previous two houses) : " + choice2);<NEW_LINE>memo[i] = Math.max(choice1, choice2);<NEW_LINE>System.out.println("Memo after robbing: " + Arrays.toString(memo) + "\n");<NEW_LINE>}<NEW_LINE>return memo[len - 1];<NEW_LINE>} | 0], nums[1]); |
840,539 | public final void accept(Context<?> ctx) {<NEW_LINE>// [#4292] Some dialects accept constant expressions in GROUP BY<NEW_LINE>// Note that dialects may consider constants as indexed field<NEW_LINE>// references, as in the ORDER BY clause!<NEW_LINE>if (EMULATE_EMPTY_GROUP_BY_CONSTANT.contains(ctx.dialect()))<NEW_LINE>ctx.sql('0');<NEW_LINE>else // [#4447] CUBRID can't handle subqueries in GROUP BY<NEW_LINE>if (ctx.family() == CUBRID)<NEW_LINE>ctx.sql("1 + 0");<NEW_LINE>else // [#4292] Some dialects don't support empty GROUP BY () clauses<NEW_LINE>if (EMULATE_EMPTY_GROUP_BY_OTHER.contains(ctx.dialect()))<NEW_LINE>ctx.sql('(').visit(DSL.select(one(<MASK><NEW_LINE>else<NEW_LINE>// Few dialects support the SQL standard "grand total" (i.e. empty grouping set)<NEW_LINE>ctx.sql("()");<NEW_LINE>} | ))).sql(')'); |
967,221 | final GetSpotPlacementScoresResult executeGetSpotPlacementScores(GetSpotPlacementScoresRequest getSpotPlacementScoresRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getSpotPlacementScoresRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetSpotPlacementScoresRequest> request = null;<NEW_LINE>Response<GetSpotPlacementScoresResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetSpotPlacementScoresRequestMarshaller().marshall(super.beforeMarshalling(getSpotPlacementScoresRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetSpotPlacementScores");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetSpotPlacementScoresResult> responseHandler = new StaxResponseHandler<GetSpotPlacementScoresResult>(new GetSpotPlacementScoresResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
792,705 | protected void appendComponentSlot(XStringBuilder xsb, JsonStringBuilder jsb, SofaTracerSpan span) {<NEW_LINE>Map<String, String> tagWithStr = span.getTagsWithStr();<NEW_LINE>Map<String, Number> tagWithNum = span.getTagsWithNumber();<NEW_LINE>// protocol<NEW_LINE>xsb.append(tagWithStr.get(CommonSpanTags.PROTOCOL));<NEW_LINE>// service<NEW_LINE>xsb.append(tagWithStr.get(CommonSpanTags.SERVICE));<NEW_LINE>// method<NEW_LINE>xsb.append(tagWithStr.get(CommonSpanTags.METHOD));<NEW_LINE>// invoke type<NEW_LINE>xsb.append(tagWithStr.get(CommonSpanTags.INVOKE_TYPE));<NEW_LINE>// remote host<NEW_LINE>xsb.append(tagWithStr<MASK><NEW_LINE>// remote port<NEW_LINE>xsb.append(tagWithStr.get(CommonSpanTags.REMOTE_PORT));<NEW_LINE>// local port<NEW_LINE>xsb.append(tagWithStr.get(CommonSpanTags.LOCAL_HOST));<NEW_LINE>// client.serialize.time<NEW_LINE>xsb.append(tagWithNum.get(AttachmentKeyConstants.CLIENT_SERIALIZE_TIME) + "");<NEW_LINE>// client.deserialize.time<NEW_LINE>xsb.append(tagWithNum.get(AttachmentKeyConstants.CLIENT_DESERIALIZE_TIME) + "");<NEW_LINE>// client.serialize.size<NEW_LINE>Number reqSizeNum = tagWithNum.get(AttachmentKeyConstants.CLIENT_SERIALIZE_SIZE);<NEW_LINE>xsb.append(reqSizeNum == null ? 0 : reqSizeNum.longValue());<NEW_LINE>// client.deserialize.size<NEW_LINE>Number respSizeNum = tagWithNum.get(AttachmentKeyConstants.CLIENT_DESERIALIZE_SIZE);<NEW_LINE>xsb.append(respSizeNum == null ? 0 : respSizeNum.longValue());<NEW_LINE>// error message<NEW_LINE>xsb.append(StringUtils.isBlank(tagWithStr.get(Tags.ERROR.getKey())) ? "" : tagWithStr.get(Tags.ERROR.getKey()));<NEW_LINE>} | .get(CommonSpanTags.REMOTE_HOST)); |
1,337,631 | // add a structure from a specified path<NEW_LINE>private void addFromFile(J9DDRStructureStore store) throws IOException, StructureMismatchError {<NEW_LINE>String directoryName = opts.get("-d");<NEW_LINE>String structureName = opts.get("-f");<NEW_LINE>String <MASK><NEW_LINE>String supersetName = opts.get("-s");<NEW_LINE>if (keyString == null) {<NEW_LINE>File structurePath = new File(structureName);<NEW_LINE>File[] structureFiles;<NEW_LINE>if (structurePath.isDirectory()) {<NEW_LINE>structureFiles = structurePath.listFiles();<NEW_LINE>} else {<NEW_LINE>structureFiles = new File[] { structurePath };<NEW_LINE>structurePath = structurePath.getParentFile();<NEW_LINE>}<NEW_LINE>for (File file : structureFiles) {<NEW_LINE>if (file.exists()) {<NEW_LINE>store.add(null, file.getPath(), false);<NEW_LINE>store.updateSuperset();<NEW_LINE>System.out.println("Added " + file.getName() + " to superset " + supersetName + " in " + directoryName);<NEW_LINE>} else {<NEW_LINE>System.out.println("WARNING : The specified structure file " + file.getName() + " does not exist and was ignored");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>StructureKey key = new StructureKey(keyString);<NEW_LINE>store.add(key, structureName, true);<NEW_LINE>store.updateSuperset();<NEW_LINE>System.out.println(String.format("Added %s to %s/%s as %s", structureName, directoryName, store.getSuperSetFileName(), keyString));<NEW_LINE>}<NEW_LINE>} | keyString = opts.get("-k"); |
867,032 | public static ManifestInfo merge(final ManifestInfo manifestInfo1, final ManifestInfo manifestInfo2) {<NEW_LINE>final ManifestInfoBuilder builder = new ManifestInfoBuilder();<NEW_LINE>builder.objectType = UtilMethods.isSet(manifestInfo2.objectType) ? manifestInfo2.objectType : manifestInfo1.objectType;<NEW_LINE>builder.id = UtilMethods.isSet(manifestInfo2.id) ? manifestInfo2.id : manifestInfo1.id;<NEW_LINE>builder.title = UtilMethods.isSet(manifestInfo2.title) ? manifestInfo2.title : manifestInfo1.title;<NEW_LINE>builder.siteId = UtilMethods.isSet(manifestInfo2.siteId) <MASK><NEW_LINE>builder.folderId = UtilMethods.isSet(manifestInfo2.folderId) ? manifestInfo2.folderId : manifestInfo1.folderId;<NEW_LINE>builder.folderPath = UtilMethods.isSet(manifestInfo2.folderPath) ? manifestInfo2.folderPath : manifestInfo1.folderPath;<NEW_LINE>builder.inode = UtilMethods.isSet(manifestInfo2.inode) ? manifestInfo2.inode : manifestInfo1.inode;<NEW_LINE>return builder.build();<NEW_LINE>} | ? manifestInfo2.siteId : manifestInfo1.siteId; |
757,491 | public BaseOptionModifier deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {<NEW_LINE>if (!jsonElement.isJsonPrimitive()) {<NEW_LINE>JsonObject jsonObject = jsonElement.getAsJsonObject();<NEW_LINE>if (1 == jsonObject.entrySet().size()) {<NEW_LINE>BaseOptionModifier baseOptionModifier = new BaseOptionModifier();<NEW_LINE>if (jsonObject.has("override")) {<NEW_LINE>baseOptionModifier.setType(BaseOptionModifier.ModifierType.OVERRIDE);<NEW_LINE>JsonElement jsonOverrideElement = jsonObject.getAsJsonPrimitive("override");<NEW_LINE>BaseOption baseOptionOverride = context.deserialize(jsonOverrideElement, BaseOption.class);<NEW_LINE>baseOptionModifier.setOverride(baseOptionOverride);<NEW_LINE>return baseOptionModifier;<NEW_LINE>} else if (jsonObject.has("add")) {<NEW_LINE>JsonPrimitive jsonAddPrimitive = jsonObject.getAsJsonPrimitive("add");<NEW_LINE>if (jsonAddPrimitive.isNumber()) {<NEW_LINE>baseOptionModifier.<MASK><NEW_LINE>baseOptionModifier.setAdd(jsonAddPrimitive.getAsInt());<NEW_LINE>}<NEW_LINE>return baseOptionModifier;<NEW_LINE>} else if (jsonObject.has("multiply")) {<NEW_LINE>JsonPrimitive jsonAddPrimitive = jsonObject.getAsJsonPrimitive("multiply");<NEW_LINE>if (jsonAddPrimitive.isNumber()) {<NEW_LINE>baseOptionModifier.setType(BaseOptionModifier.ModifierType.MULTIPLY);<NEW_LINE>baseOptionModifier.setMultiply(jsonAddPrimitive.getAsFloat());<NEW_LINE>}<NEW_LINE>return baseOptionModifier;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new JsonParseException("Unexpected BaseOptionModifier JSON value");<NEW_LINE>} | setType(BaseOptionModifier.ModifierType.ADD); |
1,255,336 | public <T> T send(final HttpRequest<T> request) {<NEW_LINE>HttpURLConnection connection = null;<NEW_LINE>InputStream inputStream = null;<NEW_LINE>try {<NEW_LINE>URL url = new URL(request.getUrl());<NEW_LINE>final String basicAuth;<NEW_LINE>if (url.getUserInfo() != null) {<NEW_LINE>basicAuth = getBasicAuthFromUserInfo(url);<NEW_LINE>// remove username:password from url so it does not appear in exception messages<NEW_LINE>url = new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getFile());<NEW_LINE>} else {<NEW_LINE>basicAuth = null;<NEW_LINE>}<NEW_LINE>connection = (HttpURLConnection) url.openConnection();<NEW_LINE>if (basicAuth != null) {<NEW_LINE>connection.setRequestProperty("Authorization", basicAuth);<NEW_LINE>}<NEW_LINE>connection.setDoOutput(true);<NEW_LINE>connection.setRequestMethod(request.getMethod());<NEW_LINE>connection.setConnectTimeout((int) TimeUnit.SECONDS.toMillis(CONNECT_TIMEOUT_SEC));<NEW_LINE>connection.setReadTimeout((int) TimeUnit.SECONDS.toMillis(READ_TIMEOUT_SEC));<NEW_LINE>if (request.getHeaders() != null) {<NEW_LINE>for (Map.Entry<String, String> header : request.getHeaders().entrySet()) {<NEW_LINE>connection.setRequestProperty(header.getKey(), header.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (request.getOutputStreamHandler() != null) {<NEW_LINE>request.getOutputStreamHandler().withHttpURLConnection(connection.getOutputStream());<NEW_LINE>}<NEW_LINE>inputStream = connection.getInputStream();<NEW_LINE>return request.getResponseHandler().handleResponse(request, inputStream, connection.getResponseCode(), null);<NEW_LINE>} catch (IOException e) {<NEW_LINE>if (connection != null) {<NEW_LINE>inputStream = connection.getErrorStream();<NEW_LINE>try {<NEW_LINE>return request.getResponseHandler().handleResponse(request, inputStream, getResponseCodeIfPossible(connection), e);<NEW_LINE>} catch (IOException e1) {<NEW_LINE>logger.warn("Error sending {} request to url {}: {}", request.getMethod(), request.getSafeUrl(), e.getMessage(), e);<NEW_LINE>logger.warn("Error handling error response for {} request to url {}: {}", request.getMethod(), request.getSafeUrl(), <MASK><NEW_LINE>try {<NEW_LINE>logger.trace(new String(IOUtils.readToBytes(inputStream), "UTF-8"));<NEW_LINE>} catch (IOException e2) {<NEW_LINE>logger.trace("Could not read error stream: {}", e2.getMessage(), e2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.warn("Error sending {} request to url {}: {}", request.getMethod(), request.getSafeUrl(), e.getMessage(), e);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} finally {<NEW_LINE>IOUtils.closeQuietly(inputStream);<NEW_LINE>}<NEW_LINE>} | e1.getMessage(), e1); |
7,845 | protected List<? extends JComponent> createPreviewElements() {<NEW_LINE>final JToggleButton basic = new JToggleButton("", true);<NEW_LINE>basic.putClientProperty(StyleId.STYLE_PROPERTY, getStyleId());<NEW_LINE>UILanguageManager.registerComponent(basic, getExampleLanguageKey("plain.text.basic"));<NEW_LINE>final JToggleButton group1 = new JToggleButton("", true);<NEW_LINE>group1.putClientProperty(StyleId.STYLE_PROPERTY, getStyleId());<NEW_LINE>UILanguageManager.registerComponent(group1, getExampleLanguageKey("plain.text.group1"));<NEW_LINE>final JToggleButton group2 = new JToggleButton();<NEW_LINE>group2.putClientProperty(StyleId.STYLE_PROPERTY, getStyleId());<NEW_LINE>UILanguageManager.registerComponent(group2, getExampleLanguageKey("plain.text.group2"));<NEW_LINE>final JToggleButton group3 = new JToggleButton();<NEW_LINE>group3.putClientProperty(StyleId.STYLE_PROPERTY, getStyleId());<NEW_LINE>UILanguageManager.registerComponent(group3, getExampleLanguageKey("plain.text.group3"));<NEW_LINE>final JToggleButton icon = new JToggleButton(WebLookAndFeel.getIcon(16));<NEW_LINE>icon.putClientProperty(StyleId.STYLE_PROPERTY, getStyleId());<NEW_LINE>UILanguageManager.registerComponent<MASK><NEW_LINE>return CollectionUtils.asList(basic, new GroupPane(group1, group2, group3), icon);<NEW_LINE>} | (icon, getExampleLanguageKey("plain.text.icon")); |
995,358 | private void createTableViewer(Composite composite) {<NEW_LINE>tableViewer = new TableViewer(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);<NEW_LINE>tableColumnLayout = new TableColumnLayout();<NEW_LINE>composite.setLayout(tableColumnLayout);<NEW_LINE>createColumns();<NEW_LINE>final Table table = tableViewer.getTable();<NEW_LINE>table.setHeaderVisible(true);<NEW_LINE>table.setLinesVisible(true);<NEW_LINE>tableViewer.addDoubleClickListener(new IDoubleClickListener() {<NEW_LINE><NEW_LINE>public void doubleClick(DoubleClickEvent evt) {<NEW_LINE>StructuredSelection sel = (StructuredSelection) evt.getSelection();<NEW_LINE><MASK><NEW_LINE>if (o instanceof BatchPack) {<NEW_LINE>BatchPack pack = (BatchPack) o;<NEW_LINE>Display display = ObjectBatchHistoryView.this.getViewSite().getShell().getDisplay();<NEW_LINE>new OpenBatchDetailJob(display, pack, serverId).schedule();<NEW_LINE>} else {<NEW_LINE>System.out.println(o);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>tableViewer.setContentProvider(new ArrayContentProvider());<NEW_LINE>tableViewer.setComparator(new ColumnLabelSorter(tableViewer));<NEW_LINE>GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);<NEW_LINE>tableViewer.getControl().setLayoutData(gridData);<NEW_LINE>} | Object o = sel.getFirstElement(); |
334,351 | public void mapReferenceClock(ArrayList<String> args, int scalar) {<NEW_LINE>try {<NEW_LINE>mPacketHandler.sendByte(mCommandsProto.WAVEGEN);<NEW_LINE>mPacketHandler.sendByte(mCommandsProto.MAP_REFERENCE);<NEW_LINE>int channel = 0;<NEW_LINE>if (args.contains("SQR1"))<NEW_LINE>channel |= 1;<NEW_LINE>if (args.contains("SQR2"))<NEW_LINE>channel |= 2;<NEW_LINE>if (args.contains("SQR3"))<NEW_LINE>channel |= 4;<NEW_LINE>if (args.contains("SQR4"))<NEW_LINE>channel |= 8;<NEW_LINE>if (args.contains("WAVEGEN"))<NEW_LINE>channel |= 16;<NEW_LINE>mPacketHandler.sendByte(channel);<NEW_LINE>mPacketHandler.sendByte(scalar);<NEW_LINE>if (args.contains("WAVEGEN")) {<NEW_LINE>this.DDS_CLOCK = (int<MASK><NEW_LINE>}<NEW_LINE>mPacketHandler.getAcknowledgement();<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | ) 128e6 / (1 << scalar); |
1,215,754 | protected boolean acceptResult(Util.FSTPath<Pair<Long, BytesRef>> path) {<NEW_LINE>BytesRef output = path.output.output2;<NEW_LINE>int payloadSepIndex;<NEW_LINE>if (path.payload != -1) {<NEW_LINE>payloadSepIndex = path.payload;<NEW_LINE>spare.copyUTF8Bytes(output.bytes, output.offset, payloadSepIndex);<NEW_LINE>} else {<NEW_LINE>assert collector.doSkipDuplicates() == false;<NEW_LINE>payloadSepIndex = parseSurfaceForm(output, payloadSep, spare);<NEW_LINE>}<NEW_LINE>scratchInput.reset(output.bytes, output.offset + payloadSepIndex + 1, output.length - payloadSepIndex - 1);<NEW_LINE>int docID = scratchInput.readVInt();<NEW_LINE>if (!scorer.accept(docID, acceptDocs)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (collector.doSkipDuplicates()) {<NEW_LINE>// now record that we've seen this surface form:<NEW_LINE>char[] key = new char[spare.length()];<NEW_LINE>System.arraycopy(spare.chars(), 0, key, 0, spare.length());<NEW_LINE>if (collector.seenSurfaceForms.contains(key)) {<NEW_LINE>// we already collected a higher scoring document with this key, in this segment:<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>float score = scorer.score((float) decode(path.output.output1), path.boost);<NEW_LINE>collector.collect(docID, spare.toCharsRef(), path.context, score);<NEW_LINE>return true;<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | collector.seenSurfaceForms.add(key); |
456,846 | public void updateConfiguration(WatchedUpdateResult watchedUpdateResult) {<NEW_LINE>Map<String, Object<MASK><NEW_LINE>if (adds != null) {<NEW_LINE>for (String add : adds.keySet()) {<NEW_LINE>if (add.startsWith(CONFIG_CSE_PREFIX)) {<NEW_LINE>String key = CONFIG_SERVICECOMB_PREFIX + add.substring(add.indexOf(".") + 1);<NEW_LINE>injectConfig.addProperty(key, adds.get(add));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Map<String, Object> deletes = watchedUpdateResult.getDeleted();<NEW_LINE>if (deletes != null) {<NEW_LINE>for (String delete : deletes.keySet()) {<NEW_LINE>if (delete.startsWith(CONFIG_CSE_PREFIX)) {<NEW_LINE>injectConfig.clearProperty(CONFIG_SERVICECOMB_PREFIX + delete.substring(delete.indexOf(".") + 1));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Map<String, Object> changes = watchedUpdateResult.getChanged();<NEW_LINE>if (changes != null) {<NEW_LINE>for (String change : changes.keySet()) {<NEW_LINE>if (change.startsWith(CONFIG_CSE_PREFIX)) {<NEW_LINE>String key = CONFIG_SERVICECOMB_PREFIX + change.substring(change.indexOf(".") + 1);<NEW_LINE>injectConfig.setProperty(key, changes.get(change));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>EventManager.post(new DynamicConfigurationChangedEvent(watchedUpdateResult));<NEW_LINE>} | > adds = watchedUpdateResult.getAdded(); |
295,770 | private Optional<ConfiguredStatement<CreateAsSelect>> forCreateAsStatement(final ConfiguredStatement<CreateAsSelect> statement) {<NEW_LINE>final CreateAsSelect csStmt = statement.getStatement();<NEW_LINE>final CreateSourceAsProperties properties = csStmt.getProperties();<NEW_LINE>// Don't need to inject schema if no key schema id and value schema id<NEW_LINE>if (!properties.getKeySchemaId().isPresent() && !properties.getValueSchemaId().isPresent()) {<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>final CreateSourceCommand createSourceCommand;<NEW_LINE>try {<NEW_LINE>final ServiceContext sandboxServiceContext = SandboxedServiceContext.create(serviceContext);<NEW_LINE>createSourceCommand = (CreateSourceCommand) executionContext.createSandbox(sandboxServiceContext).plan(sandboxServiceContext, statement).getDdlCommand().get();<NEW_LINE>} catch (final Exception e) {<NEW_LINE>throw new KsqlStatementException("Could not determine output schema for query due to error: " + e.getMessage(), <MASK><NEW_LINE>}<NEW_LINE>final Optional<SchemaAndId> keySchema = getCreateAsKeySchema(statement, createSourceCommand);<NEW_LINE>final Optional<SchemaAndId> valueSchema = getCreateAsValueSchema(statement, createSourceCommand);<NEW_LINE>final CreateAsSelect withSchema = addSchemaFieldsCas(statement, keySchema, valueSchema);<NEW_LINE>final PreparedStatement<CreateAsSelect> prepared = buildPreparedStatement(withSchema);<NEW_LINE>final ImmutableMap.Builder<String, Object> overrideBuilder = ImmutableMap.builder();<NEW_LINE>// Only store raw schema if schema id is provided by user<NEW_LINE>if (properties.getKeySchemaId().isPresent()) {<NEW_LINE>keySchema.map(schemaAndId -> overrideBuilder.put(CommonCreateConfigs.KEY_SCHEMA_ID, schemaAndId));<NEW_LINE>}<NEW_LINE>if (properties.getValueSchemaId().isPresent()) {<NEW_LINE>valueSchema.map(schemaAndId -> overrideBuilder.put(CommonCreateConfigs.VALUE_SCHEMA_ID, schemaAndId));<NEW_LINE>}<NEW_LINE>final ConfiguredStatement<CreateAsSelect> configured = ConfiguredStatement.of(prepared, statement.getSessionConfig().copyWith(overrideBuilder.build()));<NEW_LINE>return Optional.of(configured);<NEW_LINE>} | statement.getStatementText(), e); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.