如何解决 FTP get excel 文件崩溃?

How to solve FTP get excel file crash?

我尝试通过 FTP 服务器获取 excel 文件。我检查了我的应用程序已连接到服务器。然后弹出 "xls linked" 然后应用程序立即崩溃的吐司。我试过文件类型的问题是ASCII还是二进制。但这不是问题。输入流不为空。但是我不确定我是否从 excel 获取数据。我该如何解决?

FTPClient ftpClient = new FTPClient();
        try{
            Mac = "D123";
            ftpClient.connect("Url", port);
            ftpClient.login(user, pwd);

            ftpClient.setFileType(FTPClient.ASCII_FILE_TYPE);
            ftpClient.enterLocalPassiveMode();
            InputStream inStream = ftpClient.retrieveFileStream("emimapping.xls");


            if(inStream != null){
                Toast.makeText(homepage.this, "xls linked", Toast.LENGTH_SHORT).show();
            }else Toast.makeText(homepage.this, "xls not link", Toast.LENGTH_SHORT).show();

            Workbook wb = Workbook.getWorkbook(inStream);
            if(wb != null){
                Toast.makeText(homepage.this, "workbook success", Toast.LENGTH_SHORT).show();
            }else Toast.makeText(homepage.this, "workbook is null", Toast.LENGTH_SHORT).show();
            Sheet s = wb.getSheet(0);
            int row = s.getRows();
            int col = s.getColumns();

            for(int i = 0; i < row + 1; i++){
                for(int c = 0; c < col + 1; c++){
                    Cell z = s.getCell(c, i);
                    String content = z.getContents();
                    if(content == Mac){
                        String factory;
                        String line;
                        String station;
                        String custom;
                        factory = s.getCell(c + 1, i ).getContents();
                        line = s.getCell(c + 2, i).getContents();
                        station = s.getCell(c + 3, i).getContents();
                        custom = s.getCell(c + 4, i).getContents();

                        showsite.setText(factory + line + station + custom);

                        cookieManager.setCookie(Url, "eMIBoxPlantCode=" + "KS3;");
                        cookieManager.setCookie(Url, "eMIBoxLineName=" + "I2FA31ASSYA_MFG;" );
                        cookieManager.setCookie(Url, "eMIBoxSeq=" + "2");
                        cookieManager.setCookie(Url, "eMIBoxCustNo=" + "A31");
                        cookieSyncManager.sync();
                        cookieManager.setAcceptThirdPartyCookies(webview, true);
                        String cookie = cookieManager.getCookie(Url);
                        showsite.setText(cookie);
                        webview.loadUrl(Url);
                        setDesktopMode(webview, true);
                    }
                }
            }
            wb.close();
            ftpClient.disconnect();
        }
        catch (Exception e){e.printStackTrace();} 

我明白了,我应该将 content == Mac 更改为 Objects.equals(content, Mac),它会起作用。