classload.getResource("/")没有返回null

当我的项目中添加了
alipay-sdk-java20150407220053.jar
这个jar包时,
使用类加载器的getResource("/")方法里,
竟然可以得到路径,当我去掉这个jar包时
就是返回的null,网上的资料都说这样时只会返回null的;
抱歉没有C币了
图片说明

2个回答

原因已找到,是因为这个jar包里面有一个没有名字的文件夹引起的图片说明

本来就是这样,没有包返回null

Notebookdong
Notebookdong 当我不加入alipay的包时输出的是null,加入了这个包时返回就不是,原因是因为这个jar包里面有一个没有名字的文件夹引起的
大约 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
ClassLoad.getResource的问题。
String file="file:/E:/my project/iReporter/implementation/iReporter/web/WEB-INF/test.txt";rnURL url=classLoad.getResource(file);rnInputStream input=classLoad.getResourceAsStream(file);rn问题是调用上面的结果可以成功的返回url,而input却为null.rn
没有主键的表查询返回为null
ele_mon_extrema 没有主键rnrnEleMonExtrema.hbm.xmlrnrnrnrnrnrn rn 历史月极值rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnEleMonExtremaId.javarnpublic class EleMonExtremaId implements java.io.Serializable rn private String stano;rn private Byte vmon;rn public EleMonExtremaId() rn rn public EleMonExtremaId(String stano, Byte vmon) rn this.stano = stano;rn this.vmon = vmon;rn rn public String getStano() rn return this.stano;rn rnrn public void setStano(String stano) rn this.stano = stano;rn rn public Byte getVmon() rn return this.vmon;rn rn public void setVmon(Byte vmon) rn this.vmon = vmon;rn rn public boolean equals(Object other) rn if ((this == other))rn return true;rn if ((other == null))rn return false;rn if (!(other instanceof EleMonExtremaId))rn return false;rn EleMonExtremaId castOther = (EleMonExtremaId) other;rnrn return ((this.getStano() == castOther.getStano()) || (this.getStano() != nullrn && castOther.getStano() != null && this.getStano().equals(rn castOther.getStano())))rn && ((this.getVmon() == castOther.getVmon()) || (this.getVmon() != nullrn && castOther.getVmon() != null && this.getVmon()rn .equals(castOther.getVmon())));rn rn public int hashCode() rn int result = 17;rn result = 37 * resultrn + (getStano() == null ? 0 : this.getStano().hashCode());rn result = 37 * resultrn + (getVmon() == null ? 0 : this.getVmon().hashCode()); rn return result;rn rnrnrnrnrnrnrnrnrnrnrn
函数形参数中,用double还是const double &,这是一个问题。
rt
malloc返回null 急!!
#includern#includern#includernrntypedef struct studentrnrnstruct student *Next;rnchar Name[10];rnlong ID; //学号rnint Class;rnenum sexsM,WSex;rnstruct Daternrnint Year;rnint Month;rnint Day;rnBirthday;rnchar Phonenum[12];rnstruct scorernrnint Chinese;rnint Math;rnint English;rnfloat Average;rnScores;rnstud;rntypedef stud* studpt;rnrnstudpt Insert(studpt T)rnrnstudpt Tmp=NULL,Add=NULL;rnchar select;rnAdd=malloc(sizeof(stud)); //就这里出错!!一直返回null?什么原因啊?rnif(Add==NULL);rnrnprintf("Create memory space error!\n");rnreturn T;rnrnAdd->Next=NULL;rndornrnselect=InputImf(Add);rnwhile(select=='N'||select=='n');rnif(select=='e'||select=='E')rnrnfree(Add);rnprintf("Insert gave up!\n");rnreturn T;rnrnif(select!='y'||select!='Y')rnrnprintf("Wrong input! Exit!\n");rnfree(Add);rnreturn T;rnrnTmp=T;rnif(T->ID>Add->ID)rnrnTmp=Add;rnAdd->Next=T;rnrnelsernrnwhile(T->Next)rnrnif(T->Next->ID=Add->ID)rnrnAdd->Next=T->Next;rnT=Add;rnbreak;rnrnT=T->Next;rnrnif(Add->Next==NULL)rnT->Next=Add;rnrnprintf("Insert success!\n");rnreturn Tmp;rnrnrnvoid main ()rnrn int functionnum =0;rnstudpt T = NULL,p=NULL,head=NULL;rnT=Insert( T);rn head=T;p=T->Next;rnwhile(p)rnrnT=p->Next;rnfree(p);rnp=T->Next;rnrnif(head!=NULL)rnfree(head);rnrn
为什么Assembly.GetType()返回null?
我有一个程序片断rn string className = profilePath + ".PetShopProfileProvider";rn Assembly tmp = Assembly.Load(profilePath);rn System.Type type = tmp.GetType(className);rn跟踪调试tmp不为空,说明load程序集成功,可是后面的tmp.GetType(className)却总是返回null,明明className类是存在的啊,哪位高人指点一下啊?
为什么OpenMutex返回NULL?
我自己照书上写了个线程程序,创建3个线程,每个线程的代码基本一样,只是一些命名和显示的坐标参数不一样。ThreadProc也是共用的一个,其中每个线程都会OpenMutex一下各自mutex对象,判断一下返回值是否为空,结果就第一个线程的返回值不为空,剩下2个都返回空。但是换一台电脑执行,却没问题。是不是跟CPU个数有关啊?rnrn代码我就不贴了,话说这CSDN上打字真的很艰难,感觉卡得要死。远没有在贴吧发帖打字来得流畅啊。
AVIStreamGetFrameOpen总是返回NULL
我用二进制打开AVI文件以后发现AVI视频的图像是MJPG格式的,现在我想用API函数来播放这个AVI文件,写好的代码播放没压缩的AVI是可以的,但是播放这个视频图像是MJPG格式时就出了问题,跟踪以后发现是AVIStreamGetFrameOpen总是返回NULL下面是我的代码rn PAVIFILE pfile; //avi文件打开对象rn AVIFILEINFO pfi; //文件信息rn AVISTREAMINFO aviStrInfo;rn PAVISTREAM pavi; //流信息rn PGETFRAME pgf; //帧信息rn AVIFileInit();rn AVIFileOpen(&pfile,path,OF_READ | OF_SHARE_EXCLUSIVE,NULL);rn AVIFileInfo(pfile,&pfi,sizeof(AVIFILEINFO));rn AVIFileGetStream(pfile,&pavi,streamtypeVIDEO,0);rn[color=#FF0000] pgf = AVIStreamGetFrameOpen(pavi, NULL);//总是返回NULL[/color]rn if(NULL == pgf)rn rn AVIStreamRelease(pavi);rn return NULL;rn rn lp=(BYTE *)AVIStreamGetFrame(pgf,shownum);//提取第m_nowshow帧 由于前面返回NULL,接下来的代码就不运行rn if(NULL == lp)rn rn AVIStreamGetFrameClose(pgf);rn AVIStreamRelease(pavi);rn return NULL;rn rn请高手指点一下,不知道的也请帮顶一下,谢谢啦~~果有描述的不清楚的地方请尽管指出来,我尽力再说详细些~rn
CComboBoxEx SetImageList 返回NULL
CImageList *pImageList=new CImageList;rn pImageList->Create(16, 16, ILC_COLORDDB|ILC_MASK, 0, 1);rn HBITMAP hBitMap;rn CBitmap *pBitMap;rn hBitMap=LoadALLPIC("res\\image044.jpg");rn pBitMap=new CBitmap;rn pBitMap->Attach(hBitMap);rn pImageList->Add(pBitMap,RGB(0,0,0));rn //delete pBitMap;rn CImageList* a=m_ExBox.SetImageList(pImageList);rna==NULL,这是怎么回事,rnpImageList->Create(16, 16, ILC_COLORDDB|ILC_MASK, 0, 1);rn这个Create函数应该如何设置,是不是这个函数的问题导致的,rn我的图片是jpg的,多少色的我也不清楚,怎么知道是多少色的呢?rn
GetCapture总返回NULL
问题如[url=http://topic.csdn.net/u/20081015/22/0d70dace-e38e-4537-bc2f-a288702dc937.html?23340]http://topic.csdn.net/u/20081015/22/0d70dace-e38e-4537-bc2f-a288702dc937.html?23340[/url]rnrn但是后面的回答没有回答到点上,仍然不能解决问题。不知道为什么LZ觉得“已解决”。我的疑问是:rnrn我知道GetCapture是怎么工作的,但问题是,鼠标在窗口A,它的事件就应该被窗口A捕获,对不对?那么在窗口A中点击时,应该返回的是窗口A对不对?那为什么返回是NULL?rn我今天刚好遇到了这个问题,非常郁闷。先SetCapture一次,没有问题,在任何地方都能正常返回窗口A;但如果不SetCapture,在任何地方都返回NULL!至少在窗口A中应该返回窗口A对吧?
FindResource返回NULL
我在主程序添加一个窗体(例如Clogin LoginDlg ),然后想利用LoginDlg.DoModal()去显示这个窗。当利用主程序中的成员函数去调用LoginDlg.DoModal()。是可以显示LoginDlg窗体的。但我的主程序里有个回调函数。我想在该回调函数里利用LoginDlg.DoModal()去显示LoginDlg窗体,却显示不出来。我跟踪到DoModal()函数中去发现,DoModal()里面的HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);返回的是NULL。所以显示不出来。这将如何解决,谢谢!
select @@identity返回null
用的微软企业库rn三层架构 最后调用DAL里的SaveUser方法 返回不了@@identity rnrn[color=#FF0000]可是我把完全相同的代码重新复制到一个新的项目(同一解决方案里),为了方便测试用的winform项目。然后再执行就返回出结果了 为什么在网站项目里他就null呢[/color]rnrn[code=C#]rnrn public int SaveUsers(Users users)rn rn using (IDbConnection conn = db.CreateConnection())rn rn conn.Open();rn IDbTransaction trans = conn.BeginTransaction();rn string sql = string.Format("insert into [Users](username,Password,Tel,Address,level,alipay,reg_leave) values ('0','1','2','3','4','5','6');select @@identity", users.UserName, users.PassWord, users.Tel, users.Address, "1", users.Alipay, users.RegLeave);rn return Convert.ToInt32(db.ExecuteScalar(CommandType.Text, sql));rn rn rn[/code]
fopen返回NULL
以下是代码rn求解为什么会fopen返回NULL;rn#include rn#include rn#include rn#include rn#include rnrn#define TURE 1rnrn#define LOCAL_SERVER_PORT 5866rn#define MAX_MSG 1024rnrnint main(void)rnrn int n, fd;rn socklen_t cli_addr_len;rn char buf[MAX_MSG] = 0;rn unsigned long int npak=0;rn struct sockaddr_in servaddr, cliaddr;rn FILE *fp;rn int KZ=0;rn int sendbufsize,recvbufsize;rn int size=4;rnrn printf("n%20 printf or 1 printf or no printf(2/1/0)?");//多少个包打印一次rn scanf("%d", &KZ);rn printf("stat:\n");rn if((fp=fopen("udp.dat", "wb")) == NULL)rn rn printf("error - open file.");rn return 0;rn rn if((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)rn rn printf("socket error!\n");rn exit(0);rn rnrn servaddr.sin_family = AF_INET;rn servaddr.sin_addr.s_addr = htonl(INADDR_ANY);rn servaddr.sin_port = htons(LOCAL_SERVER_PORT);rn bind(fd, (struct sockaddr *)&servaddr, sizeof(servaddr));rnrn //设置系统缓冲区大小rn size = sizeof(int);rn recvbufsize = 0;rn if(getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *)&recvbufsize, &size) == 0)rn printf("recvbufsize = %d\n", recvbufsize);rn recvbufsize = 128*1024;rn if(setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *)&recvbufsize, sizeof(int)) == 0 )rn printf("recvbufsize = %d\n", recvbufsize);rn if(getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *)&recvbufsize, &size) == 0)rn printf("recvbufsize = %d\n", recvbufsize);rnrnrn while(TURE)rn rn cli_addr_len = sizeof(cliaddr);rn n =recvfrom(fd, buf,MAX_MSG, 0, (struct sockaddr *)&cliaddr, &cli_addr_len);//接收数据rn npak++;rn if((KZ==2) && !(npak%20))rn printf("%d\n", npak);rn else if(KZ == 1)rn printf("%d\n", npak);rn fwrite(buf, MAX_MSG, 1, fp);//写硬盘,每一个包一写rn rn fclose(fp);rn return 0;rn
AjaxPro执行返回null
.csrn[code=C#]rnpublic static int flag = 0;rn protected void Page_Load(object sender, EventArgs e)rn rn AjaxPro.Utility.RegisterTypeForAjax(typeof(admin_admin_News));rn if (!IsPostBack)rn rn BindNewsClassData();rn SetBind("");rn rn rn [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]rn public int News_Orders()rn rn if(flag == 0)rn rn flag = 1;rn SetBind("P_Name desc,");rn rn elsern rn flag = 0;rn SetBind("P_Name asc,");rn rn return flag;rn rn[/code]rnrn.aspxrn[code=HTML]function sufun()rnrn alert(admin_admin_News.News_Orders().value);rn alert("222");rn [/code]rn执行后弹出null然后又弹出222rn怎么办?
使用gethostbyname返回NULL
我使用gethostbyname来获得IP地址,但是总是返回NULL,请问怎么回事?rn补充,我已经设置了DNS,并且能够成功ping 域名
读取通讯录返回NULL
Cursor cursor=c.getContentResolver().query(Contacts.People.CONTENT_URI,null,null,null,null);rn while(cursor.moveToNext())rn nameFieldColumnIndex = cursor.getColumnIndexOrThrow(Contacts.People.NAME);rn name = cursor.getString(nameFieldColumnIndex);rn numberFieldColumnIndex = cursor.getColumnIndexOrThrow(Contacts.People.NUMBER);rn number1 = cursor.getString(numberFieldColumnIndex); rn //System.out.println(name); rn // System.out.println(number1);rn if(number1==null)rn Toast.makeText(c, name+"请求跟踪", Toast.LENGTH_LONG).show(); rn System.out.println("reach");rn rn rn rn 通讯录里放了两个人:shen 5556;dergin 1234 以上代码运行number1为null 名字打印出来为shen,dergin,[b]为什么没号码?
this.locationManager.getLastKnownLocation(provider);返回null
[code=java]rnthis.locationManager=(LocationManager)this.getSystemService(Context.LOCATION_SERVICE);rn List pStrings=this.locationManager.getProviders(true);rn if (pStrings.contains(LocationManager.GPS_PROVIDER)) rn provider=LocationManager.GPS_PROVIDER;rn rn else if (pStrings.contains(LocationManager.NETWORK_PROVIDER)) rn provider=LocationManager.NETWORK_PROVIDER;rn rn else rn Toast.makeText(this, "no gps", Toast.LENGTH_SHORT).show();rn return;rn rn location=this.locationManager.getLastKnownLocation(provider);rn[/code]rn手机只设置了gps定位,用gps的provider,总是返回null,权限设置了如下三个:rn rn rn rn但是同样只设置GPS定位,用陌陌,大众点评什么的都可以定位到附近,这是为什么?代码哪里有问题?rn同样代码,改成用network获取就可以得到location
ImageIo.read() 返回null
具体代码如下:nimgStr是一个base64字符串npublic static String decoderQRCodeForBase64(String imgStr) throws Exception n if (imgStr == null) n return "";n nn BASE64Decoder decoder = new BASE64Decoder();n byte[] b = decoder.decodeBuffer(imgStr);n for (int i = 0; i < b.length; ++i) n if (b[i] < 0) // 调整异常数据n b[i] += 256;n n nn InputStream input = new ByteArrayInputStream(b);nn String content = decoderQRCode(input);nn return content;nn n n n public static String decoderQRCode(InputStream input) throws Exception n BufferedImage bufImg = null;n String content = null;nn bufImg = ImageIO.read(input);n QRCodeDecoder decoder = new QRCodeDecoder();n content = new String(decoder.decode(new TwoDimensionCodeImage(bufImg)),n "utf-8");nn return content;n n n 在bufImg = ImageIO.read(input);这里读不出来,返回的是null,为什么呢,求大神解答,小白在线等。
getActivity()返回null的解决问题
如果从最近使用的应用里面点击我们的应用,系统会恢复之前被回收的Activity,这个时候FragmentActivity在oncreate里面也会做Fragment的恢复,但是此时恢复出的Fragment,在调用getActivity的时候会返回null。 解决方法: 如果该Context需要在Activity被销毁后还存在, 则使用getActivity().getApplicatio
LoadImage总是返回NULL
HBITMAP hBit = (HBITMAP)::LoadImage((HINSTANCE)GetModuleHandle(NULL), _T("C:\\CLOSED.BMP"), IMAGE_BITMAP, NULL, NULL, 0);rnrn返回NULL,GetLastError()返回1814(找不到映像文件中指定的资源名)rnrnHBITMAP hBit = SHLoadDIBitmap(_T("C:\\CLOSED.BMP"));rn返回NULL。GetLastError()返回3(找不到路径)rn可是确实存在这个文件啊
datatable.getchanges()为啥返回null
具体情况:界面中设计一个datagridview,手动添加列,将列1和列2绑定某个字段,列1和列2的类型为复选框类型。设置选中为Y,不选中为N。然后在代码中给该datagridview绑定一个datatable。绑定修改列1和列2的值。通过断点可以看到datatable的值已经改变。但是datatable.getchanges()返回却是null。这是怎么个情况?
document.getElementById 返回null,为什么?
[size=18px]定义一个标签:rnrn用JS:var g_input = document.getElementById(guess_input);rn为什么g_input=null???rn求助高手[/size]
struts2 ajax返回null
刚接触ajax和json,遇到点小问题,半天都没解决,希望大侠们支援哪。。。rn感激万分~~rnajax调用action顺利执行了,result里有了内容,但页面弹框显示为null或者直接不显示rn[code=Java]rnimport org.json.JSONObject;rn//result、username的setter、getter方法rnpublic String showUser()rn List list = userDAO.findByUsername("king");rn System.out.println("userame"+userame);rn rn JSONObject obj=new JSONObject();rn try rn obj.put("users", list);rn result=obj.toString();rn System.out.println("result: "+result);rn //显示:result: "users":["userpassword":"king","username":"king","userid":1]rn catch (JSONException e) rn e.printStackTrace();rn rn return Action.NONE;rn //return SUCCESS;//换成这句js不能弹窗 rn rn[/code]rnAction成功调用,username接收正常,rnstruts2.1.6:rn[code=XML]rnrn rn rn rn rn rn rn[/code]rnrnjsp页面js:rn[code=JScript]rn rn[/code]
GetDlgItem返回NULL
int WINAPI WinMain( HINSTANCE hInstance,rn HINSTANCE hPrevInstance,rn LPWSTR lpCmdLine,rn int nCmdShow)rnrn InitCommonControls();rn ImmDisableIME(0);rn DialogBox(hInstance,MAKEINTRESOURCE(IDD_WIFIDIALOG),NULL,(DLGPROC)WifiDlgProc);rn return 1;rnrnrnLRESULT CALLBACK WifiDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)rnrn int myid;rn DWORD dwStyle;rn CListCtrl *m_WifiList;rn/* if (myedit == NULL)rn rn MessageBox(hDlg,TEXT("list error"),NULL,MB_OK);rn */rn switch(message)rn rn case WM_INITDIALOG:rn rn m_WifiList = (CListCtrl*)GetDlgItem(hDlg,IDC_LIST1);rn (CListCtrl*)GetDlgItem(hDlg,IDC_LIST1)->EnableWindow(TRUE);rn int sx, sy;rn sx = GetSystemMetrics(SM_CXSCREEN);rn sy = GetSystemMetrics(SM_CYSCREEN);rn SetWindowPos(hDlg, 0, 0, 0, sx, sy-23, SWP_NOZORDER);rn rn dwStyle = m_WifiList)->GetExtendedStyle();rn dwStyle |= LVS_EX_CHECKBOXES;rn dwStyle |= LVS_EX_ONECLICKACTIVATE;rn dwStyle |= LVS_EX_SUBITEMIMAGES;rn m_WifiList->SetExtendedStyle(dwStyle);rn return TRUE;rn rn case WM_COMMAND:rn rn myid = LOWORD(wParam);rn switch(myid)rn rn case IDOK:rn EndDialog(hDlg,IDOK);rn return FALSE;rn case IDCANCEL:rn EndDialog(hDlg,IDCANCEL);rn return FALSE;rn rn rn default:rn return FALSE;rn rn
Attribute.GetCustomAttribute() 返回为null
[code=csharp]rnnamespace LookUpWhatsNewrnrn internal class WhatsNewCheckerrn rn private static readonly StringBuilder outPutText = new StringBuilder();rn private static DateTime backDateTo = new DateTime(2010,2,1);rnrn static void Main(string[] args)rn rn Assembly theAssembly = Assembly.Load("VectorClass");rn Attribute supportsAttibute = Attribute.GetCustomAttribute(theAssembly, typeof(LastModifiedAttribute));// supportsAttibute 为空! rn Conso.Read();rn rn rnrnrnnamespace WhatNewAttributesrnrn [AttributeUsage(AttributeTargets .Class |AttributeTargets.Method ,AllowMultiple =true ,Inherited =false )]rn public class LastModifiedAttribute:Attribute rn rn private readonly DateTime dateModified;rn private readonly string changes;rn public LastModifiedAttribute(string dateModified, string changes)rn rn this.dateModified = DateTime.Parse(dateModified);rn this.changes = changes;rn rn public DateTime DateModifiedrn rn getrn rn return this.dateModified;rn rn rn public string Changesrn rn getrn rn return this.changes;rn rn rn public string Issues get; set; rn rn [AttributeUsage(AttributeTargets.Assembly)]rn public class SupportWhatsNewAttribute : Attributern rn rnrnrnnamespace VectorClassrnrn [LastModifiedAttribute("14,Feb,2010", "IEnumerable interface implemented so vector can now be treated as a Collection")]rn [LastModifiedAttribute("10,Feb,2010", "IFormattable interface implemented so vector now responds to format specifiers N and VE")]rn public class Vector:IEnumerable ,IFormattablern rn public double x, y, z;rn public Vector(double x,double y,double z)rn rn this.x = x;rn this.y = y;rn this.z = z;rn rnrn [LastModifiedAttribute("10,Feb,2010", "Method added in order to formating support")]rn public string ToString(string format, IFormatProvider formatProvider)rn rn if (format == null)rn rn return ToString();rn rnrn switch (format)rn rn case "N":rn return string.Format("(0,1,2)", x, y, z);rn case "VE":rn return string.Format("0i+1j+2k", x, y, z);rn default:rn throw new ArgumentException("No 0 format !", format);rn rn rnrn public string ToString(string format)rn rn return ToString(format, null);rn rnrn public IEnumerator GetEnumerator()rn rn yield return x;rn yield return y;rn yield return z;rn rn [LastModifiedAttribute("14,Feb,2010", "Class create as part of collection support for Vector")]rn private class VectorIEnumerator : IEnumeratorrn rnrn public object Currentrn rn get throw new NotImplementedException(); rn rnrn public bool MoveNext()rn rn throw new NotImplementedException();rn rnrn public void Reset()rn rn throw new NotImplementedException();rn rn rn rn[/code]
为什么spriteFrameByName返回NULL
在使用spriteFrameByName得到的sprite frame来构animation的时候,得到一个NULL指针rnrn在使用前已经在一个layer init里去加载了.plist文件(bullet.plist是已经打包好的一些.png文件的配置文件)rnrnCCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("bullet.plist")rn但是在CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bullet_1.png")的时候出问题了,得到一个NULL指针.rnrn查看了bullet.plist文件,里面有bullet_1.png等文件信息, 麻烦哪位能帮忙解答一下这种情况是什么原因?rnrnbullet_1.pngrn rn framern 2,135,65,131rn offsetrn 0,1rn rotatedrn rn sourceColorRectrn 0,0,65,131rn sourceSizern 65,133rn
preg_replace 返回 null
代买如下:rn$p='/(?
GetProp()总返回NULL
代码如下,CMmywnd是我封装的窗口类,MY_WND_PROP_NAME在头文件里定义为_T("name")rnrnLRESULT CALLBACK CMywnd::WndProc(HWND hWnd, UINT nMsg,WPARAM wp,LPARAM lp)rnrnLRESULT lResult=0;rnBOOL bCallDefault=TRUE;rnCMywnd *pWnd=(CMywnd*)GetProp(hWnd,MY_WND_PROP_NAME);rnif(pWnd==NULL)rnrnif(nMsg!=WM_CREATE)rnrnreturn DefWindowProc(hWnd,nMsg,wp,lp);rnrnelsernrnLPCREATESTRUCT pSt=(LPCREATESTRUCT)lp;rnpWnd=(CMywnd*)pSt->lpCreateParams;rnSetProp(hWnd,MY_WND_PROP_NAME,pWnd);//这个操作似乎没用,pWnd总是NULLrnrnrnif(!pWnd->PreProcessMsg(hWnd,nMsg,wp,lp,&lResult))rnreturn lResult;rnint wmId;rnswitch(nMsg)rnrncase WM_COMMAND:rnwmId = LOWORD(wp);rnswitch(wmId)rnrncase ID_CONSOLE_SHUTUP:rnrnbreak;rnrnbreak;rncase WM_CREATE:rnrnpWnd->m_hWnd=hWnd;rnlResult=pWnd->OnCreat(hWnd);rnbCallDefault=FALSE;rnbreak;rnrncase WM_DESTROY:rnbCallDefault=pWnd->OnCommand(LOWORD(wp));rnbreak;rncase WM_CLOSE:rnpWnd->Destroy();rnbCallDefault=FALSE;rnbreak;rndefault:rnbreak;rnrnif(bCallDefault)rnreturn DefWindowProc(hWnd,nMsg,wp,lp);rnelsernreturn lResult;rn
返回NULL还是抛出异常
在使用工厂模式编程的时候,往往要返回一个对象,rn那么这个对象没有能成功生成的时候,我们是返回NULL还是抛出异常.rn我只是听一位同事说抛出异常rn两者的优缺,不知到有没有更深的见解,洗耳恭听中rnrnrnrnrnrnhttp://51home.ku.net
ExtractIconEx怎么返回NULL?
HICON hIcon;rnCString strIconPath;rnstrIconPath = _T("C:\\program files\\FlashGet\\flashget.exe");rnExtractIconEx(strIconPath,128,&hIcon,NULL,1);rnrn我用提图标软件就可以提出来。可是上面的代码却不行。rnrnhIcon为NULL.rn这是为什么呢?rn
资源加载返回null的问题
今天项目当中某个模块需要从配置文件读取数据,因为是其他人写好的代码(以为没有问题)始终加载不了配置,在使用类加载资源时返回null,查了多遍也没有发现问题。 百度后得到结果: 1,用Class.getResourceAsStream() 时,路径应该是以"/"开头的,如: Hello.class.getResourceAsStream("/config/config.xml"); 2,
findViewById返回Null
遇到个难题了,findViewById返回Null。rn查网一般原因有几种:rn1.findViewById在setContentView(R.layout.main);之前rn2.在另一个view的元素应该用view.findViewById来拿rn3.clean一下工程,让ID重新生成rnrn但是我都试过了问题没有解决。rn下面我贴一下代码:rn布局xmlrn[code=XML]rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rnrnActivityrn[code=Java]rnpublic void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main);rn rn inflater = LayoutInflater.from(MainActivity.this);rn initTitleBar();rn initFilterDialog();rn initMainList();rn rn......rnpublic void initFilterDialog()rn //初始化变量rn final View dialogView = inflater.inflate(R.layout.filter, null);rn keywordEditText = (EditText) dialogView.findViewById(R.id.keywordEditText);rn scopeSpinner = (Spinner) dialogView.findViewById(R.id.scopeSpinner);rn lawnoEditText = (EditText) dialogView.findViewById(R.id.lawnoEditText);rn validSpinner = (Spinner) dialogView.findViewById(R.id.validSpinner);rn areaSpinner = (Spinner) dialogView.findViewById(R.id.areaSpinner);rn categorySpinner = (Spinner) dialogView.findViewById(R.id.categorySpinner);rn pubunitEditText = (EditText) dialogView.findViewById(R.id.pubunitEditText);rn searchButton = (Button) dialogView.findViewById(R.id.filterSearchBtn);rn searchButton.setOnClickListener(new OnClickEvent());rn resetButton = (Button) dialogView.findViewById(R.id.filterResetBtn);rn resetButton.setOnClickListener(new OnClickEvent());rn cancelButton = (Button) dialogView.findViewById(R.id.filterCancelBtn);rn cancelButton.setOnClickListener(new OnClickEvent());rn pubdateEditText = (EditText) dialogView.findViewById(R.id.pubdateEditText);rn pubdateEditText.setOnClickListener(new OnClickEvent()); //错误在这!!!rn pubdatetoEditText = (EditText) dialogView.findViewById(R.id.pubdatetoEditText);rn pubdatetoEditText.setOnClickListener(new OnClickEvent());rn final Calendar c = Calendar.getInstance(); rn datePickerDialog = new DatePickerDialog(MainActivity.this,new DatePickerDialog.OnDateSetListener() rn public void onDateSet(DatePicker view, int year, int monthOfYear,rn int dayOfMonth) rn datePickerDialogTarget.setText(year+""+monthOfYear+""+dayOfMonth);rn rn ,c.get(Calendar.YEAR),c.get(Calendar.MONTH),c.get(Calendar.DAY_OF_MONTH));rn// datePickerDialog.setButton("设置", null);rn //创建面板rn AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);rn builder.setIcon(R.drawable.m_filter);rn builder.setTitle(R.string.filter);rn builder.setView(dialogView);rn filterDialog=builder.create();rn rn[/code]rn————————————————————————————————————————————————rn空指针错误发生在pubdateEditText.setOnClickListener(new OnClickEvent());rnpubdateEditText为null。rn奇怪的是pubdateEditText以上的元素全部拿得到,就是pubdateEditText拿不到。rn后来我屏蔽rnpubdateEditText = (EditText) dialogView.findViewById(R.id.pubdateEditText);rnpubdateEditText.setOnClickListener(new OnClickEvent());rn结果pubdatetoEditText.setOnClickListener(new OnClickEvent());的pubdatetoEditText也报空指针。rn————————————————————————————————————————————————rn这个问题奇怪的地方就是常见的三种问题都被排除,多数元素拿得到只后面这两个拿不到。rn大家帮我看看问题出在哪,谢谢!
ftpclient storeFileStream 返回null
[code=Java] public void doAudits(ImeiTXTVO[] imeis) throws Exception rn FTPClient ftpClient=new FTPClient();rn ftpClient.setControlEncoding("GBK"); rn ftpClient.connect(host);rn int replycode=ftpClient.getReplyCode();rn if(!FTPReply.isPositiveCompletion(replycode)) rn ftpClient.disconnect();rn throw new Exception("FTP server refused connection."); rn rn try rn log.info("登陆FTP:"+host);rn ftpClient.login(username, password);rn ftpClient.changeWorkingDirectory(ftpFileDir);rn //ftpClient.setDataTimeout(10000);rn ftpClient.setFileType(ftpClient.BINARY_FILE_TYPE);rn OutputStream fout ;rnrn for(int i=0;i>>>>>>>" + fin.available());rn while((count = fin.read(buff)) != -1) rn gzout.write(buff,0,count); rn rn fin.close();rn gzout.flush();rn gzout.close();rn rn rn FileInputStream gzin = new FileInputStream(f);rn //System.out.println("2>>>>>>>>" + gzin.available());rn System.out.println(">>>>>>" + ftp_file);rn fout = ftpClient.storeFileStream(ftp_file); rn System.out.println(">>>>>>" + fout); rnrn byte[] b = new byte[1024]; rn int num; rn while ((num = gzin.read(b)) != -1) rn rn fout.write(b,0,num); rn rn rn rn rn fout.flush(); rn fout.close();rn gzin.close(); rn rn boolean flag = ftpClient.rename("temp_" + file_title , file_title);rn rn rn imeiTxtDao.updateForAudit(imeis[i]);rn rn rn System.out.println("登出FTP:"+host);rn //throw new RuntimeException("上传ftp出错");rn catch(Exception e)rn e.printStackTrace();rn throw new RuntimeException("上传ftp出错"+e.toString());rn finallyrn rn ftpClient.logout();rn if(ftpClient.isConnected())rn ftpClient.disconnect();rn rn log.info("登出FTP:"+host);rn System.out.println("登出FTP:"+host);rn rn rn [/code]rnrn为什么第二次得到的fout为NULL啊。
Ajaxpro2 返回null
后台代码:rnrn [AjaxPro.AjaxMethod]rn public string getMidSort(string id) rn rn tryrn rn this.tbxgoods.Text = id;//注释就正常了rn return id;rn rn catch (Exception e)rn rn return "00000";rn rn rn rnrn前台JS:rn rnrnrn请问为什么CallBack里得到的值都是00000
为什么getResource("/"),返回null
如rn[code=Java]public Testrn public static test() rn String classpath = Test.class.getClass().getResources("/");rn rn[/code]rnrnrn返回为null
XmlDocument的getElementById()返回null
初学C#,今天遇到了一个问题,请高手指点rnrn我用一个XmlDocument对象加载了一个xml文件,然后用createElement()方法生成了一些新结点放到里面,rn但是奇怪的事情发生了rnrn用getElementById()取原来文件中有的元素时,能取到rn用getElementById()取动态新生成的元素时,返回nullrnrnXml文件格式如下:rn[code=XML]rnrn rn rn rn rn rn rn rn rn rn]>rnrnrn rn rnrn[/code]rnrn这里是对它的操作rn[code=C#]rn XmlElement element = doc.CreateElement("ITEM", doc.NamespaceURI);rn rn element.SetAttribute("id", id);rn element.SetAttribute("name", name);rn element.SetAttribute("text", name);rnrn parent.AppendChild(element);rnrn doc.getElementById(id); //这里返回nullrn[/code]
GetModuleHandle总是返回NULL
我自己建立了一个进程,在GetModuleHandle前已经运行了该进程,rn然后GetModuleHandle(进程名),为何总是返回NULL呢?不解。。。。rn错误代码为126rn希望有朋友能帮忙解答一下,谢谢
Direct3D LockRect 返回NULL
通过Direct3D来进行视频播放,发现经过几次的Create 和 Release之后,从IDirect3DSurface9->LockRect返回的D3DLOCKED_RECT类型数据中,pBits为NULL Pitch 为0,请问这是什么原因呢?求大牛指导
返回NULL值的记录
表prnrnid 字段1 字段2rn1 a ……rn2 b …… rn3 c ……rn4 null ……rnrnselect * from a where 字段1<>'c'rnrn结果只返回第1、2条记录,如何让第4条null值的记录也返回。rnrn要求不要改数据。
getClass().getClassLoader() 返回 null
如上,我总是得到空值,哪位高手帮我讲一下? 我要得到本地的地址, 如hello/myPicture.jpg,那么hello/myPicture.jpg应该放到什么地方???
getGraphics()为什么返回null?
JButton btn = new JButton("Hell");rnGraphics g = btn.getGraphics(); // g = nullrn// 为什么?
相关热词 c#检测非法字符 c#双屏截图 c#中怎么关闭线程 c# 显示服务器上的图片 api嵌入窗口 c# c# 控制网页 c# encrypt c#微信网页版登录 c# login 居中 c# 考试软件