• 切莫忘记try catch


    interFaceMessagePost msg = (interFaceMessagePost)list[i];
                        string url =msg.UrlPost +"?"+msg.UrlParameter;
                        URL=url;
                        ForderFormId=msg.ForderformID;

                        //新的编码之后的url
                        string _tempExpesion="";
                        //发出票成功消息
                        Regex ticket=new Regex("tickets=(.*)");
                        bool isHaveTicket=ticket.Match(url).Success;
                        if(isHaveTicket)
                        {
                            if(ticket.Match(url).Groups!=null && ticket.Match(url).Groups.Count>0)
                            {
                                _tempExpesion=ticket.Match(url).Groups[1].Value;
                                url=url.Replace(_tempExpesion,System.Web.HttpUtility.UrlEncode(_tempExpesion));
                            }
                        }
                        else
                        {

                            Regex refundDetail=new Regex("RefundDeatils=(.*)");
                            bool isHaveRefund=refundDetail.Match(url).Success;
                            if(isHaveRefund)
                            {
                                if(refundDetail.Match(url).Groups!=null && refundDetail.Match(url).Groups.Count>0)
                                {
                                    _tempExpesion=refundDetail.Match(url).Groups[1].Value;
                                    url=url.Replace(_tempExpesion,System.Web.HttpUtility.UrlEncode(_tempExpesion));
                                }
                            }
                        }

    没有加try catch导致出错之后程序卡死

  • 相关阅读:
    Array之foreach
    gulp之gulp-uglify模块的大坑-------------默认不支持IE8
    Only the original thread that created a view hierarchy can touch its views
    android 组件隐藏
    android 字体加粗
    android studio 创建图标
    Can't create handler inside thread that has not called Looper.prepare()
    Failed to connect to /127.0.0.1:8080
    socket failed: EACCES
    android 无法import
  • 原文地址:https://www.cnblogs.com/bangejingting/p/2595289.html
Copyright © 2020-2023  润新知