You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2021/01/12 12:26:28 UTC

[Bug 65075] New: My program works well on my operating system. But when I test it on another system, sometimes the output Word file is not generated

https://bz.apache.org/bugzilla/show_bug.cgi?id=65075

            Bug ID: 65075
           Summary: My program works well on my operating system. But when
                    I test it on another system, sometimes the output Word
                    file is not generated
           Product: POI
           Version: 4.1.2-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: abdollah.sh71@gmail.com
  Target Milestone: ---

Created attachment 37701
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37701&action=edit
The libraries I used in the project

Hi friends I have a big problem I wrote a program in Java with javafx and
apache poi and got the output file using launch4j. My program works well on my
operating system. But when I test it on another system, sometimes the output
Word file is not generated.

I noticed that when I send the information of a row from the table to the new
controller and I want to create a Word file in the new controller, the Word
file is not created. Of course, there is no problem in my system and it does
not run on other systems. I used the try-catch command around the document
created with apache poi and got the IllegalArgumentException error. My codes
are as follows First we send the information of one of the rows of the table to
the destination controller as below

@FXML
    void onNewAmrieEnteghaliItemClick(ActionEvent event) {
        try{
            TablePosition pos =
soldierTable.getSelectionModel().getSelectedCells().get(0);
            int row = pos.getRow();

            FXMLLoader loader = new
FXMLLoader(getClass().getResource("GetAmrieEnteghal.fxml"));
            loader.setControllerFactory(new Callback<Class<?>, Object>() {
                public Object call(Class<?> controllerClass) {
                    if (controllerClass == GetAmrieEnteghalController.class) {
                        GetAmrieEnteghalController ctrl = new
GetAmrieEnteghalController();
                        ctrl.setP(
                                code_meliCol.getCellData(row)
                        );
                        return ctrl ;
                    } else {
                        try {
                            return controllerClass.newInstance();
                        } catch (Exception exc) {
                            throw new RuntimeException(exc); // just bail
                        }
                    }
                }
            });
            Parent root = loader.load();
            Stage stage = new Stage();
            stage.getIcons().add(APPLICATION_ICON);
            Scene scene = new Scene(root);

            stage.setScene(scene);
            stage.show();
        }catch(Exception e){
            e.printStackTrace();
            noSelectedSoldier();
        }
    }
In GetAmrieEnteghalController we give the selected row information to the
database and receive other record information and then place it in the object
created with apache poi as below

package javafxapplication3;

import com.jfoenix.controls.JFXTextField;
import java.net.URL;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.stage.Stage;
import javafxapplication3.Models.MyAlert;
import javafxapplication3.Reports.AmrieEnteghal;

public class GetAmrieEnteghalController implements Initializable {
    private String s_code_meli;
    public void setP(String code_meli){
        s_code_meli = code_meli;
    }
    @FXML
    private JFXTextField be;

    @FXML
    private JFXTextField girande;

    @FXML
    private JFXTextField sh_nameh;

    @FXML
    private JFXTextField t_kasr_az_amar;


    @FXML
    void onGetFormBtnClick(ActionEvent event) {
        String daraje = null, name= null, pedar= null, t_ezam= null, sh_amrie=
null, t_amrie= null, t_enteghal= null;
        if(SQLiteDB.setConnection()){
            if(SQLiteDB.selectQuery("select * from soldiers where code_meli =
'"+s_code_meli+"';")){
                ResultSet res = SQLiteDB.getResultSet();
                try {
                    while(res.next()){
                        daraje = res.getString("daraje");
                        name = res.getString("name");
                        pedar = res.getString("pedar");
                        t_ezam = res.getString("t_e");
                        sh_amrie = res.getString("sh_amrie_enteghal");
                        t_amrie = res.getString("t_amrie_enteghal");
                        t_enteghal = res.getString("t_enteghal");

                    }
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }
            }
        }
        try{
            AmrieEnteghal form = new AmrieEnteghal(daraje, name, pedar,
s_code_meli, t_ezam, sh_nameh.getText(), be.getText(), girande.getText(),
sh_amrie, t_amrie, t_enteghal, t_kasr_az_amar.getText());
            form.create();
        }catch(Exception e){
            e.printStackTrace();
        }
        SQLiteDB.Disconnect();
    }  

}
I put the AmrieEnteghal object in try-catch and got the following error on
other systems with different offices
java.lang.illegalargumentexception file "docs/AmrieEnteghal.docx" does not
exist

Where do you think the problem is? Please help me. Could there be a problem
with jre? Please forgive me for poor English

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65075] My program works well on my operating system. But when I test it on another system, sometimes the output Word file is not generated

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65075

Sayi <sa...@163.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Sayi <sa...@163.com> ---
Hi,
I think you should focus on whether it's a POI bug, rather than giving too much
irrelevant code.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65075] My program works well on my operating system. But when I test it on another system, sometimes the output Word file is not generated

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65075

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WORKSFORME
             Status|NEW                         |RESOLVED

--- Comment #2 from Dominik Stadler <do...@gmx.at> ---
As far as I can see this looks very much like some local problem. If it works
on one machine and not on another it is very likely to be caused by some local
difference in your environment.

If you can narrow down the problem to an actual problem with Apache POI, then
please try to provide some way of properly reproducing the problem, i.e. a
sample or test-case which can be executed without your application-specific
code being involved and then reopen this bug with the additional information.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org