Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26997

    I am getting null pointer exception.once see my code
    Note:I am using Ubuntu os in my system

    [language=java:24zmmorm]public String convert(String patid,int pdfcnt,int needhead,String dischuser) throws FileNotFoundException, IOException, DocumentException, DaoException, Exception {
    Converter1 converter = new Converter1();
    List ls=dao.executeQuery(“select admin.getusernm(i.userid) usernm,u.unitnm,u.unitid from ip.ipinfo i,ip.unithdr u where u.unitid=i.unit and patid='”+patid+”'”);
    Map mp=null;String docnm=””,docid=””,docregno=””;String fonts=””,length=””;
    if(ls.size()>0){
    mp=(Map)ls.get(0);
    usernm=mp.get(“USERNM”).toString();
    docnm=mp.get(“UNITNM”).toString();
    docid=mp.get(“UNITID”).toString();
    }
    mp=null;
    List lst=dao.executeQuery(“select nvl(drregno,0) drregno from admin.doctorinfo d,ip.unitmaster u where u.doctorid=d.docid and u.unitid='”+docid+”'”);
    if(lst.size()>0){
    mp=(Map)lst.get(0);
    docregno=”0″;
    }
    String path = dao.gettomcatserverPath1() + “webapps/wordimages/disch” +patid+ “.pdf”;
    List list1 = dao.executeQuery(“select wordole from ip.dischargetemplate where patid='”+patid+”'”);
    String htmlFileName =((Map)list1.get(0)).get(“WORDOLE”).toString();
    htmlFileName=htmlFileName.replace(“$DOCNM”,docnm).replace(“$DOCREGNO”, docregno);
    File pdfFile = new File(path);
    converter.runConverter(htmlFileName,pdfFile);

    return “1”;
    }
    private String runConverter(String urlstring, File output) throws IOException {

    if (urlstring.length() > 0) {
    if (!urlstring.startsWith(“http://”) && !urlstring.startsWith(“file:”)) {
    urlstring = “http://” + urlstring;
    }

    java.io.FileOutputStream fos = new java.io.FileOutputStream(output);

    if ( proxyHost != null && proxyHost.length() != 0 && proxyPort != 0 ) {
    System.getProperties().setProperty(“proxySet”, “true”);
    System.getProperties().setProperty(“proxyHost”, proxyHost);
    System.getProperties().setProperty(“proxyPort”, “” + proxyPort);
    }

    PD4ML pd4ml = new PD4ML();

    try {
    pd4ml.setPageSize( landscapeValue ? pd4ml.changePageOrientation( format ): format );
    } catch (Exception e) {
    e.printStackTrace();
    }

    if ( unitsValue.equals(“mm”) ) {
    pd4ml.setPageInsetsMM( new Insets(topValue, leftValue,
    bottomValue, rightValue) );
    } else {
    pd4ml.setPageInsets( new Insets(topValue, leftValue,
    bottomValue, rightValue) );
    }

    pd4ml.setHtmlWidth( userSpaceWidth );

    pd4ml.render( urlstring, fos );
    }
    return “1”;
    }

    }[/language:24zmmorm]

    #29679

    It would help a lot if you published an exception stack trace and the source HTML, you passed to PD4ML (hopefully there is no sensitive data in it)

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘General questions / FAQ’ is closed to new topics and replies.