StackOverflowError printStackTrace not working?

Hi,
I need to dump out the stack information when StackOverflowError is detected for debugging purpose.
However, I realized that JRE 14.2_05 does not provide the stack trace information anymore.
It works with JRE 14.1_02. Is this a bug in JRE 1.4.2? any work around to enable the printStackTrace?
The test sample code is as below
public void func(){
func();
When I use JRE 1.4.1 it will print out the stack and pin point where the problem is. However with JRE 1.4.2 only StackOverflowError is output. No stack information is provided anymore. It will be very hard to figure out where the problem code is.
Thanks,

This bug was introduced in 1.4.2 and fixed in 1.5. Unfortunately Sun does not seem to have the manpower to fix things in 1.4.2, all effort is going into 1.5.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4872096
any work around to enable the printStackTrace?The stacktrace is swallowed if native code blows the stack. You could disable compilation to native code altogether with "-Xint" while you're debugging.

Similar Messages

  • .jar file is not working properly :developed in NETBEANS

    Hi Gurus,
    i am using NETBEANS IDE 7.2.
    i am developing a project that interacts with databases 10g and COM ports of machine , these all processes are performed by .bat file which i am trying to run from jFramform , code works perfectly .bat file is also called perfectly when i run the project using F6 from the NETBEANS, for testing i placed some dialogue boxes on the form to test it ,
    but when i run executable .jar  file , form run successfully and dialogue box works perfectly but .bat file is not called by executable .jar file.
    this is how i call the .bat file...
      String filePath = "D:/pms/Libraries/portlib.bat";  
            try { 
              Process p = Runtime.getRuntime().exec(filePath); 
            } catch (Exception e) { 
                e.printStackTrace(); 
    and below is the contents of portlib.bat file
    java -jar "D:\SMS\SMS\dist\SMS.jar" 
    you must probably ask why i am calling a .jar file using .bat file .
    reason is that this .jar project sends message using GSM mobile , System.exit(); is compulsory to complete a job and then do the next one ,
    if i use the same file to execute this job it makes exit to entire the application (hope you can understand my logic).
    that's why i use extra .jar file in .bat file , when single job is completed .bat exits itself and new command is given.
    Problem is that code is working perfectly in NETBEANS when i run the project but when i run .jar then .bat file is not working  ,
    thanks.

    Thanks Sir ,
    You need to first test an example that works like the one in the article.
    There are plenty of other examples on the web - find one you like:
    http://javapapers.com/core-java/os-processes-using-java-processbuilder/
    I tried this one.
      try {
                ProcessBuilder dirProcess = new ProcessBuilder("D:/SMS/SMS/Send_message.bat");
                 File commands = new File("D:/SMS/SMS/Send_message.bat");
                 File dirOut = new File("C:/process/out.txt");
                 File dirErr = new File("C:/process/err.txt");
               dirProcess.redirectInput(commands);
                 dirProcess.redirectOutput(dirOut);
               dirProcess.redirectError(dirErr);
                 dirProcess.start();
            } catch (IOException ex) {
                Logger.getLogger(mainform.class.getName()).log(Level.SEVERE, null, ex);
    as instructed in the article i compiled  both the projects at same version or sources and libraries which is 1.7
    here is my version details
    C:\>javac -version
    javac 1.7.0_07
    C:\>java -version
    java version "1.7.0_07"
    Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
    Java HotSpot(TM) Client VM (build 23.3-b01, mixed mode, sharing)
    inside the NETBEANS IDE c:\process\err.txt  remains empty and code works perfectly , but when I run executable .jar file( by double clicking on that file in dist directry) then c:\process\err.txt becomes full with this error text and there is no response from calling D:\SMS\SMS\send_message.bat
    here is the error text
    java.lang.UnsupportedClassVersionError: sms/SMSMAIN (Unsupported major.minor version 51.0)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Exception in thread "main"
    here is /SMS/SMS
    unknown source ?

  • Not equal is not working

    hi
    i write code in co extension below if (!weight.equals(weight_perc)) is not working how ever if("Core Objective".equals(Coreobjective)) is working here weight & weight_perc both are integers and Core objectives are string.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject vo =(OAViewObject)am.findViewObject("ObjectivesVO");
    if ("Apply".equals(pageContext.getParameter(EVENT_PARAM)))
    String person_id = (new Integer(pageContext.getEmployeeId())).toString();
    pageContext.writeDiagnostics(this,"person_id: "+person_id,OAFwkConstants.STATEMENT);
    String s1 = pageContext.getDecryptedParameter("pObjectiveId");
    pageContext.writeDiagnostics(this,"s1 "+s1,OAFwkConstants.STATEMENT);
    String weight_perc =pageContext.getParameter("Weighting");
    pageContext.writeDiagnostics(this,"weight_perc: "+weight_perc,OAFwkConstants.STATEMENT);
    String objective= pageContext.getParameter("ObjectiveName");
    pageContext.writeDiagnostics(this,"Objective_Name: "+objective,OAFwkConstants.STATEMENT);
    String Coreobjective = objective.substring(0,14);
    pageContext.writeDiagnostics(this,"Coreobjective: "+Coreobjective,OAFwkConstants.STATEMENT);
    String query="select weighting_percent from per_objectives where objective_id ='"+s1+"'";
    String weight = null;
    try
    pageContext.writeDiagnostics(this,"Enters into try block",OAFwkConstants.STATEMENT);
    PreparedStatement ps= am.getOADBTransaction().getJdbcConnection().prepareStatement(query);
    ResultSet rs=ps.executeQuery();
    pageContext.writeDiagnostics(this,"Excute the quiery",OAFwkConstants.STATEMENT);
    while(rs.next())
    weight =rs.getString(1);
    pageContext.writeDiagnostics(this,"weight: "+weight,OAFwkConstants.STATEMENT);
    catch(Exception e)
    e.printStackTrace();
    if("Core Objective".equals(Coreobjective))
    if (!weight.equals(weight_perc))
    pageContext.writeDiagnostics(this,"ENTERS INTO EQUAL CONDITION: ",OAFwkConstants.STATEMENT);
         MessageToken[] errTokens = { new MessageToken("VOLDWEIGHTAGE", weight)};
    throw new OAException("XX_PG", "XXBPTY_COREOBJ_WEIGHT_NOCHANGE", errTokens);
    plz help me.
    Regars,
    sharif.

    Before you do equals check, you should check if any of the value is null or not.
    Both the values are numbers, but you are getting them into strings. So you have to do string compare.
    Or it's easier to get them as numbers and use logical operators as suggested by other fellow experts to compare.
    If you still want to go for Strings here is what you need to do(may be bit cautions here)
    if ((str1!=null || !"".equals(str1))&& (str2!=null || !"".equals(str2)) && str1.equals(str2)){
    Yes both of them are same
    else{
    They are different.
    Regards,
    Peddi.

  • Bean is not worked  in the jsff page

    Hi
    JDeveloper Studio Edition Version 11.1.2.2.0
    I Have a bean for run a jasperreport
    package Reports;
    import javax.faces.event.ActionEvent;
    import sp11.model.apm.clubImpl;
    import java.io.ByteArrayOutputStream;
    import java.io.InputStream;
    import java.math.BigDecimal;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.util.HashMap;
    import java.util.Map;
    import javax.faces.context.FacesContext;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServletResponse;
    import net.sf.jasperreports.engine.JasperExportManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum;
    import net.sf.jasperreports.engine.util.JRLoader;
    import net.sf.jasperreports.view.JasperViewer;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.binding.BindingContainer;
    import oracle.jbo.client.Configuration;
    public class CardFrontBean {
    public CardFrontBean() {
    public String runReportAction(){
    DCIteratorBinding rleIter = (DCIteratorBinding)getBindings().get("RealentityIterator");
    String RleId = rleIter.getCurrentRow().getAttribute("RleId").toString();
    BigDecimal ID = new BigDecimal(RleId);
    Map parameter = new HashMap();
    parameter.put("ID", ID);// where ID is a jasper report parameter
    try
    runReport("card_front.jasper", parameter);
    catch (Exception e)
    return null;
    public BindingContainer getBindings(){
    return BindingContext.getCurrent().getCurrentBindingsEntry();
    public ServletContext getContext(){
    return (ServletContext)getFacesContext().getExternalContext().getContext();
    public HttpServletResponse getResponse(){
    return (HttpServletResponse)getFacesContext().getExternalContext().getResponse();
    public static FacesContext getFacesContext(){
    return FacesContext.getCurrentInstance();
    public void runReport(String repPath, java.util.Map param) throws Exception {
    Connection conn = null;
    try
    HttpServletResponse response = getResponse();
    ServletOutputStream out = response.getOutputStream();
    response.setHeader("Cache-Control", "attachment;filename=\"CardFront.pdf\"");
    response.setContentType("application/pdf");
    ServletContext context = getContext();
    InputStream fs = context.getResourceAsStream("/ReportsFolder/" + repPath);
    JasperReport template = (JasperReport) JRLoader.loadObject(fs);
    template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
    PreparedStatement statement = null;
    String amDef = "sp11.model.apm.club";
    String config = "clubLocal";
    clubImpl am = (clubImpl)Configuration.createRootApplicationModule(amDef,config);
    statement = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0);
    conn = statement.getConnection();
    JasperPrint print = JasperFillManager.fillReport(template, param, conn);
    //JasperViewer.viewReport(print, false);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    JasperExportManager.exportReportToPdfStream(print, baos);
    out.write(baos.toByteArray());
    out.flush();
    out.close();
    FacesContext.getCurrentInstance().responseComplete();
    catch (Exception jex)
    jex.printStackTrace();
    finally
    close(conn);
    public void close(Connection con){
    if (con != null)
    try
    con.close();
    catch (Exception e)
    and a commandButton in the .jsff page
    <af:commandButton id="Realentitycardfront"
    textAndAccessKey="#{nls['REALENTITY_CARDFRONT']}"
    shortDesc="#{nls['REALENTITY_CARDFRONT_HINT']}"
    action="#{CardFront.runReportAction}"/>
    my .jsff page is in a bounded task flow with Use Page Fragments = true
    when i click the button. ........>nothing
    what is the matter
    i read in a post that it is not work in jsff page with page fragmentation
    please help me
    thanks

    One problem is that you write into the output stream from an action method and don't know what's already in the output stream. Once there is one byte written to hte stream (which you can't know from inside the action method) the pdf stream does not behave as you think it would.
    Next thing is that you use createRootApplicationModule but never release it. This will get you out of resources error eventually.
    A better approach would be to put this code in a servlet and stream the report from there. In the servlet you have control over the output stream.
    Check my blog http://tompeez.wordpress.com/2011/12/16/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-3/ where I show how to serve images from a servlet which can even use the application module pool from the application (no need to use createRootApplicationModule at all). All you have to do is to exchange the part where I get and stream the image data to your needs.
    Timo

  • Applet does not work with a proxy server.URgent

    Hi,
    I have an asp page being hosted from a IIS server.
    The asp page has an applet which gets data from a server side component which is hosted as a service on the server side.For connection to the server I am using URLConnection object and trying to connect over a TCP connection.
    The problem occurs when I use an proxy in the middle.
    I have changed the browser settings to include the proxy.
    The following is the error I recieve:
    Full :http://172.25.11.63:4590/
    <-------------------------------->
    OPening input stream
    in Run ::::
    ERROR: Created data socket but can't open stream on
    it.172.25.11.63:4590//
    172.25.11.63:4590//
    java.io.FileNotFoundException: 172.25.11.63:4590//
         at com/ms/net/wininet/http/HttpInputStream.connect
         at com/ms/net/wininet/http/HttpInputStream.<init>
         at com/ms/net/wininet/http/HttpURLConnection.createInputStream
         at com/ms/net/wininet/WininetURLConnection.getInputStream
         at TalkClientApplet.rendezvous
         at TalkClientApplet.actionPerformed1
         at TalkClientApplet.start
         at com/ms/applet/AppletPanel.securedCall0
         at com/ms/applet/AppletPanel.securedCall
         at com/ms/applet/AppletPanel.processSentEvent
         at com/ms/applet/AppletPanel.run
         at java/lang/Thread.run
    ...Disconnecting.
    Following is my code.
    url = new URL("http://" + host +":"+i);
    urlconnection = url.openConnection();
    urlconnection.setDoOutput(true);
    urlconnection.setDoInput(true);
    System.out.println("Successfully opened the URL connection at " + "http://" + host + ":" + i );
              System.out.println ("Protocol: " + url.getProtocol());
              System.out.println ("Host :" + url.getHost());     
              System.out.println ("Port :" + url.getPort());
              System.out.println ("File :" + url.getFile() );
              System.out.println ("Full :" + url.toExternalForm());
              System.out.println ("<-------------------------------->");
    os = new BufferedWriter(new OutputStreamWriter(urlconnection.getOutputStream()));
    System.out.println("OPening input stream ");
    // is = new DataInputStream(urlconnection.getInputStream());
         System.out.println(urlconnection.getInputStream());
    is = new DataInputStream(urlconnection.getInputStream());
    The exact place where I get the error is whn i call URLConnection.openInputStream().
    Usually this error comes with a malformed URL.But the same code words without a proxy.Also I am not making any changes to my code in both scenarios that is with or without proxy.
    Please help.This is urgent and a showstopper

    Thanks for your nice solution, but unfortunatelly it does not work with lines longer than 100 chars with Netscape. It works fine with IE and appletviewer too.
    Example:
    I use this code:
    try {
                URL url = new URL(protocol,hostName,portNumber,URLstring);
                InputStream in = url.openStream();
                BufferedInputStream bis = new BufferedInputStream(in);
                StringBuffer input = new StringBuffer(60);
                int c;
                while ((c = bis.read()) != -1){
                    System.out.print((char)c);
                    input.append((char)c);
                bis.close();
                dataFromServer = input.toString();
            catch(Exception ex) {
                ex.printStackTrace();
            }I use input file test.html with exactly 100 chars ('a')
    Netscape Java Console:
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadataFromServer : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaI use input file test.html with exactly 101 chars ('a')
    Netscape Java Console:
    ?JL?yyxk?cedataFromServer : ?

  • Writing to file not working, might be 1.4 problem

    Hi:
    I am trying to writing the content of a JTextArea onto a file. The content is pretty big, has newlines. I have been struggling with this in 1.4 and it just doesn't write to the file I specified. In 1.3, it works great. Here is the rough code:
    public void loadDisplayFrame()
         JMenuItem save = new JMenuItem("Save");
         //Save Action Listener
         save.addActionListener(new ActionListener()
            public void actionPerformed(ActionEvent ae)
               String filePath;
               //Save the  gsgl sample file
               if(filePath!=null && filePath.length()>0)
                  try
                  int state = saveChooser.showSaveDialog(null);
                  File f;
                  f = saveChooser.getSelectedFile();
                  if(f!=null && state==JFileChooser.APPROVE_OPTION)
                        savedName = f.getPath();
                        if(!savedName.endsWith(".gsgl"))
                           JOptionPane.showMessageDialog(null, "Invalid file name", "error", JOptionPane.ERROR_MESSAGE);
                        }else
                           processSaving();
                        }catch(Exception e)
                            e.printStackTrace();
                    }else
                        JOptionPane.showMessageDialog(null, "Please load a file first", "error",
                            JOptionPane.ERROR_MESSAGE);
              myMenu.add(save);
              JMenuBar displayMenu = new JMenuBar();
              displayMenu.add(myMenu);
      public void processSaving()
             try
                 System.out.println("Saved Name is " + savedName);
               PrintWriter out
               = new PrintWriter(new BufferedWriter(new FileWriter(savedName)));
               //name of TextArea is <display>
               String saveCode = display.getText();
              System.out.println(saveCode);                 
                 out.print(saveCode);
              out.close();
            }catch(Exception e)
              System.out.println("Exception in writing" + e.toString());
         Anyone knows what is going on? I am hoping to use 1.4 for my project. But this thing is not working. Any way around it? Thanx

    Try putting in this line before your close:
    out.flush();
    PrintWriter buffers the data and won't send it until you exit or enough data gets into the buffer to cause a flush. I assume that you are getting a zero byte file. You can also construct a PrintWriter with a boolean to indicate if it should auto flush the buffer.
    Hope that it helps.
    Paul

  • Code is not working

    below is my code. It is not working. When i click launch on wireless toolkit suddenly this line, java.io.IOException, appears in output panel on netbeans 6.5. Nothing is launched on wireless toolkit. Please help
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class GameMIDlet extends MIDlet {
    private Display display;
    public void startApp() {
    try {
    display = Display.getDisplay(this);
    SimpleGameCanvas gameCanvas = new SimpleGameCanvas();
    gameCanvas.start();
    display.setCurrent(gameCanvas);
    } catch (Exception ex) {
    System.out.println(ex);
    public Display getDisplay() {
    return display;
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
    exit();
    public void exit() {
    System.gc();
    destroyApp(false);
    notifyDestroyed();
    import javax.microedition.lcdui.*;
    import javax.microedition.lcdui.game.*;
    public class SimpleGameCanvas extends GameCanvas implements Runnable {
    private boolean isPlay; // Game Loop runs when isPlay is true
    private long delay; // To give thread consistency
    private int currentX, currentY; // To hold current position of the 'X'
    private int width; // To hold screen width
    private int height; // To hold screen height
    // Sprites to be used
    private Sprite sprite;
    private Sprite nonTransparentSprite;
    // Constructor and initialization
    public SimpleGameCanvas() throws Exception {
    super(true);
    width = getWidth();
    height = getHeight();
    currentX = width / 2;
    currentY = height / 2;
    delay = 20;
    // Load Images to Sprites
    Image image = Image.createImage("couple.gif");
    sprite = new Sprite(image, 32, 32);
    Image imageTemp = Image.createImage("couple.gif");
    nonTransparentSprite = new Sprite(imageTemp, 32, 32);
    // Automatically start thread for game loop
    public void start() {
    isPlay = true;
    Thread t = new Thread(this);
    t.start();
    public void stop() {
    isPlay = false;
    // Main Game Loop
    public void run() {
    Graphics g = getGraphics();
    while (isPlay == true) {
    input();
    drawScreen(g);
    try {
    Thread.sleep(delay);
    } catch (InterruptedException ie) {
    // Method to Handle User Inputs
    private void input() {
    int keyStates = getKeyStates();
    sprite.setFrame(0);
    // Left
    if ((keyStates & LEFT_PRESSED) != 0) {
    currentX = Math.max(0, currentX - 1);
    sprite.setFrame(1);
    // Right
    if ((keyStates & RIGHT_PRESSED) != 0) {
    if (currentX + 5 < width) {
    currentX = Math.min(width, currentX + 1);
    sprite.setFrame(3);
    // Up
    if ((keyStates & UP_PRESSED) != 0) {
    currentY = Math.max(0, currentY - 1);
    sprite.setFrame(2);
    // Down
    if ((keyStates & DOWN_PRESSED) != 0) {
    if (currentY + 10 < height) {
    currentY = Math.min(height, currentY + 1);
    sprite.setFrame(4);
    // Method to Display Graphics
    private void drawScreen(Graphics g) {
    g.setColor(0xFF0000);
    g.fillRect(0, 0, getWidth(), getHeight());
    g.setColor(0x0000ff);
    // display sprites
    sprite.setPosition(currentX, currentY);
    sprite.paint(g);
    nonTransparentSprite.paint(g);
    flushGraphics();
    }

    I have used e.printStackTrace() .. and below is the result
    java.lang.IllegalArgumentException
         at javax.microedition.lcdui.game.Sprite.<init>(+41)
    Uncaught exception java/lang/NullPointerException.
         at SimpleGameCanvas.<init>(+67)
         at GameMIDlet.startApp(+15)
         at javax.microedition.midlet.MIDletProxy.startApp(+7)
         at com.sun.midp.midlet.Scheduler.schedule(+270)
         at com.sun.midp.main.Main.runLocalClass(+28)
         at com.sun.midp.main.Main.main(+80)

  • This.print(pp) with interactive type silent or automatic does not work  after upgrade acrobat reader 9 to acrobat reader 11

    After an upgrade of acrobat reader 9 to acrobat reader 11 the automatic printing of a pdf. The pdf is opened, but the print does not happen. With acrobat reader 9 it works. But with acrobat reader 11 the printing does not happen.
    I discovered when you specify pp.constants.interactionLevel.full it works on acrobat reader 11. But when you specify pp.constants.interactionLevel.silent or pp.constants.interactionLevel.automatic it does not work on acrobat reader 11. But with the full option we have a dialog  print box
    we do not want.
    In our jsp we load a pdf document and create a message handler to detect the print events of a pdf document that is in an <object> tag.
    In the pdf document we add
    package be.post.lpo.util;
    import org.apache.commons.lang.StringEscapeUtils;
    import org.apache.commons.lang.StringUtils;
    public class AcrobatJavascriptUtil {  
        public String getPostMessageToHostContainer(String messageName, String messageBody){
            return "var aMessage=['"+messageName+ "', '"+ messageBody+"'];this.hostContainer.postMessage(aMessage);";
        public String getAutoPrintJavaScript(String interactiveType, String printerName,String duplexType) {    
            String interactiveTypeCommand = "";
            if (StringUtils.isNotBlank(interactiveType)){
                interactiveTypeCommand = "pp.interactive = " + interactiveType + ";";
            String duplexTypeCommand = "";
            if (StringUtils.isNotBlank(duplexType)){
                duplexTypeCommand = "pp.DuplexType = " + duplexType + ";";
            return "" + // //
                    "var pp = this.getPrintParams();" + // //
                    // Nointeraction at all dialog, progress, cancel) //
                    interactiveTypeCommand + //
                    // Always print to a printer (not to a file) //
                    "pp.printerName = \"" + StringEscapeUtils.escapeJavaScript(printerName) + "\";" + //
                    // Never print to a file. //
                    "pp.fileName = \"\";" + //
                    // Print images using 600 DPI. This option MUST be set or some barcodes cannot //
                    // be scanned anymore. //
                    "pp.bitmapDPI = 600;" + //
                    // Do not perform any page scaling //
                    "pp.pageHandling = pp.constants.handling.none;" + //
                    // Always print all pages //
                    "pp.pageSubset = pp.constants.subsets.all;" + //
                    // Do not autocenter //
                    "pp.flags |= pp.constants.flagValues.suppressCenter;" + //
                    // Do not autorotate //
                    "pp.flags |= pp.constants.flagValues.suppressRotate;" + //
                    // Disable setPageSize i.e. do not choose paper tray by PDF page size //
                    "pp.flags &= ~pp.constants.flagValues.setPageSize;" + //
                    // Emit the document contents. Document comments are not printed //
                    "pp.printContent = pp.constants.printContents.doc;" + //
                    // printing duplex mode to simplex, duplex long edge, or duplex short edge feed //
                    duplexTypeCommand +
                    // Print pages in the normal order. //
                    "pp.reversePages = false;" + //
                    // Do the actual printing //
                    "this.print(pp);";
    snippets for java code that adds
    package be.post.lpo.util;
    import org.apache.commons.lang.StringUtils;
    import com.lowagie.text.Document;
    import com.lowagie.text.DocumentException;
    import com.lowagie.text.pdf.PdfAction;
    import com.lowagie.text.pdf.PdfDestination;
    import com.lowagie.text.pdf.PdfImportedPage;
    import com.lowagie.text.pdf.PdfName;
    import com.lowagie.text.pdf.PdfReader;
    import com.lowagie.text.pdf.PdfWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    public class PdfMergerUtil{
        private static final PdfName DID_PRINT = PdfName.DP;
        private static final PdfName WILL_PRINT = PdfName.WP;
        private List<PdfActionJavaScriptHolder> actionJavaScripts = new ArrayList<PdfActionJavaScriptHolder>();
        private class PdfActionJavaScriptHolder{
            private final PdfName actionType;
            private final String javaScript;
            public PdfActionJavaScriptHolder(PdfName actionType, String javaScript) {
                super();
                this.actionType = actionType;
                this.javaScript = javaScript;
            public PdfName getActionType(){
                return this.actionType;
            public String getJavaScript(){
                return this.javaScript;
        public void writePdfs(OutputStream outputStream, List<InputStream> documents, String documentLevelJavaScript) throws Exception {
            Document document = new Document();
            try {          
              // Create a writer for the outputstream
              PdfWriter writer = PdfWriter.getInstance(document, outputStream);
              document.open();      
              // Create Readers for the pdfs.
              Iterator<PdfReader> iteratorPDFReader = getPdfReaders(documents.iterator());
              writePdfReaders(document, writer, iteratorPDFReader);
              if (StringUtils.isNotBlank(documentLevelJavaScript)){
                  writer.addJavaScript(documentLevelJavaScript);
              addAdditionalActions(writer);
              outputStream.flush();      
            } catch (Exception e) {
                e.printStackTrace();
                throw e;
            } finally {
                if (document.isOpen()){
                    document.close();
                try {
                    if (outputStream != null){
                        outputStream.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    throw ioe;
        public void addAdditionalDidPrintAction(String javaScript){
            actionJavaScripts.add(new PdfActionJavaScriptHolder(DID_PRINT, javaScript));   
        public void addAdditionalWillPrintAction(String javaScript){
            actionJavaScripts.add(new PdfActionJavaScriptHolder(WILL_PRINT, javaScript));   
        private void writePdfReaders(Document document, PdfWriter writer,
                Iterator<PdfReader> iteratorPDFReader) {
            int pageOfCurrentReaderPDF = 0;      
              // Loop through the PDF files and add to the output.
              while (iteratorPDFReader.hasNext()) {
                PdfReader pdfReader = iteratorPDFReader.next();
                // Create a new page in the target for each source page.
                while (pageOfCurrentReaderPDF < pdfReader.getNumberOfPages()) {
                  document.newPage();
                  pageOfCurrentReaderPDF++;          
                  PdfImportedPage page = writer.getImportedPage(pdfReader, pageOfCurrentReaderPDF);
                  writer.getDirectContent().addTemplate(page, 0, 0);          
                pageOfCurrentReaderPDF = 0;
        private void addAdditionalActions(PdfWriter writer) throws DocumentException{
            if (actionJavaScripts.size() != 0 ){
                PdfAction action = PdfAction.gotoLocalPage(1, new PdfDestination(PdfDestination.FIT), writer);
                writer.setOpenAction(action);
                for (PdfActionJavaScriptHolder pdfAction : actionJavaScripts ){
                    if (StringUtils.isNotBlank(pdfAction.getJavaScript())){
                        action = PdfAction.javaScript(pdfAction.getJavaScript(), writer);
                        writer.setAdditionalAction(pdfAction.getActionType(), action);
        private Iterator<PdfReader> getPdfReaders(Iterator<InputStream> iteratorPDFs) throws IOException {
            List<PdfReader> readers = new ArrayList<PdfReader>();
              while (iteratorPDFs.hasNext()) {
                InputStream pdf = iteratorPDFs.next();
                PdfReader pdfReader = new PdfReader(pdf);
                readers.add(pdfReader);        
            return readers.iterator();
    JSP code
    <script type="text/javascript" src="<bean:message key="scripts.js.internal.jquery" bundle="app"/>"></script>
        <script language="javascript">
        function goToDidPrintUrl(){
            var url = "<%=didPrintUrl%>";
            window.location.assign(url);
        function createMessageHandler() {
            var PDFObject = document.getElementById("myPdf");
            PDFObject.messageHandler = {
                onMessage: function(msg) {
                     if (msg[0] == "WILL_PRINT"){      
                        $("#printingTransitFeedBackMessage").text('<%=willPrintMessage%>');                   
                     if(msg[0] == "DID_PRINT"){
                        $("#printingTransitFeedBackMessage").text('<%=didPrintMessage%>');               
                        setTimeout('goToDidPrintUrl()',4000);
                onError: function(error, msg) {
                    alert(error.message);
        </script>
    </head>
    <body onLoad="createMessageHandler();">
    <div id="printingTransitFeedbackArea">
      <div class="info" id="printingTransitFeedBackMessage"><%=documentOpenMessage%></div>
    </div>
    <object id="myPdf" type="application/pdf" width="100%" height="100%"  data="<%=toBePrintedUrl%>">
    </object>
    </body>

    From the JS API Reference of the print method:
    Non-interactive printing can only be executed during batch, console, and menu
    events.
    Outside of batch, console, and menu events, the values of bUI and of interactive are ignored
    and a print dialog box will always be presented.

  • External command is not working in File Receiver Adapter

    Hi,
       I have tried to copy the file which is mentioned in my File Adapter (Receiver) to 3 different folders thru OS command. The purpose is to save time. I have created one CC for Source(File) and one CC for target(File). After the target file is created, I want to copy this file in 3 folders. For this I have written one batch file in my system.
    File Name: copy1.bat
    @ECHO OFF
    COPY %1 C:\TEST1\arch_t1
    COPY %1 C:\TEST2\arch_t2 
    COPY %1 C:\TEST3\arch_t3
    DEL %1
    The command which I entered in the Receiver CC (File Adatper is)
    Run Operating System Command After Message Processing
    Command Line: C:\FILES\copy1.bat %F %f
    Timeout(secs): 60
    Terminate Program After Timeout - Check box is selected.
    But, this external command is not working. (because the target files are not created in those directories C:\TEST1, C:\TEST2, C:\TEST3)
       I did this scenario by refering the Michael'w weblog:
    /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
       In this blog, he has also given how to troubleshoot external command. I tried this also. It is not working.
        I use Windows XP OS. XI 3.0 SP 18.
       Friends, Could you kindly tell why this external command is not working? What could be the problem?
    Thanks in advance.
    Kind Regards,
    Jeg P.

    Hi, Jeg.
    As the note says, please check the java Runtime.exec behavior
    with the proper user.
    If in doubt, check if the command can be successfully run through
    the Java Runtime.exec(...) API. Also note that the command is run
    as user "<sid>adm" (Unix) / "SAPService<SID>" (Windows).
    So, Could you check the following(very dirty one!) Java in your
    XI server and check if it works? For simulating %F, create a test
    file C:\FILES\test.txt whatever the content is.
    import java.util.*;
    import java.io.*;
    public class ExecJava {
      public static void main(String args[]) {
        try {           
          Runtime rt = Runtime.getRuntime();
          Process proc = rt.exec("C:/FILES/copy1.bat C:
    FILES
    test.txt");
        } catch (Exception e) {
          e.printStackTrace();
    Good Luck.
    Sejoon

  • Adapter Module not working in Sender Communication Channel working in recie

    Hi
    I have written one adapter module. IF i give that Adapter Module in Sender Communication channel its not working. If i give that in Reciever Communication Channel its working. If i mention in both the channels then its working in sender communication channel also.But in only sender communication channel its not working in only reciever communication channel its working Can any one tell me why its happening
    Thanks & Regards
    Ravi Shankar B
    Message was edited by:
            RaviShankar B
    Message was edited by:
            RaviShankar B
    Message was edited by:
            RaviShankar B

    hi
    if its problem with my code why its working if i give the adapter module in both the communication channels?If i give in only sender communication channel the module is not invoking. its not showing any auditlogs.Can any one please help me
    OUTBOUND is for sender
    INBOUND is for reciever right.?
    the following code i have written
    public ModuleData process(
              ModuleContext moduleContext,
              ModuleData inputModuleData)
              throws ModuleException {
              String SIGNATURE =
                   "process(ModuleContext moduleContext, ModuleData inputModuleData)";
              Object obj = null;
              Message msg = null;
              String filename = null;
              AuditMessageKey amk = null;
              try {
                   obj = inputModuleData.getPrincipalData();
                   msg = (Message) obj;
                   System.out.println("&&&&&&&&&&&&&&&&&" + msg);
                   if (msg.getMessageDirection().equals(MessageDirection.OUTBOUND)){
                        amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.OUTBOUND);
                        Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,">>>>>>>>>>>>>>> etHostName: Module called"+ i++);
                   }else{
                        File filename1 = new File("
    10.7.1.43
    XI
    source","text.txt");
                        filename1.createNewFile();
                        amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
                        Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,">>>>>>>>>>>>>>> etHostName: Module called"+ i++);
                   System.out.println("**************" + amk + "***********");
              } catch (Exception e) {
                   Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,">>>>>>>>>>>>>>> GetHostName: Error Module called");
                   e.printStackTrace(System.err);
                   ModuleException me = new ModuleException(e);
                   throw me;
              // Read the channel ID, channel and the module configuration
              try {
                   Hashtable mp = (Hashtable)inputModuleData.getSupplementalData("module.parameters");
                   if(mp != null){
                        filename = (String)mp.get("FileName");
                        Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,"Host >>>  Element Name is set to {0}"+filename );
                   }else{               
                        Audit.addAuditLogEntry(amk,AuditLogStatus.WARNING,"HostElementName parameter is not set. Default used: HostName.");
                        filename = "FileName";
              } catch (Exception e) {
                   e.printStackTrace(System.err);
                   Audit.addAuditLogEntry(amk,AuditLogStatus.ERROR,"Cannot read the module context and configuration data");
                   ModuleException me = new ModuleException(e);
                   throw me;
              try {
                   XMLPayload xmlpayload = msg.getDocument();
                   DocumentBuilderFactory factory;
                   factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   Document document =
                        builder.parse((InputStream) xmlpayload.getInputStream());
                   Element rootNode = document.getDocumentElement();
                   if (rootNode != null) {
                        Element childElement = document.createElement("filename");
                        childElement.appendChild(document.createTextNode(filename));
                        rootNode.appendChild(childElement);
                   // Transforming the DOM object to Stream object.
                   TransformerFactory tfactory = TransformerFactory.newInstance();
                   Transformer transformer = tfactory.newTransformer();
                   Source src = new DOMSource(document);
                   ByteArrayOutputStream myBytes = new ByteArrayOutputStream();
                   Result dest = new StreamResult(myBytes);
                   transformer.transform(src, dest);
                   byte[] docContent = myBytes.toByteArray();
                   if (docContent != null) {
                        xmlpayload.setContent(docContent);
                        inputModuleData.setPrincipalData(msg);
              } catch (Exception e) {
                   e.printStackTrace(System.err);
                   Audit.addAuditLogEntry(amk,AuditLogStatus.ERROR,"Cannot read the module context and configuration data");
                   ModuleException me = new ModuleException(e);
                   throw me;
              return inputModuleData;
    Best Regards
    Ravi Shankar B
    Message was edited by:
            RaviShankar B
    Message was edited by:
            RaviShankar B

  • Filter not working for session timeout

    Hi all,
    I am working on a struts application in portal. I want to logout of the application when a user does not perform any action, for say 30 mins. For this, i am using a filter and defined the filter as follows in web.xml.
    <filter>
    <filter-name>PageFilter</filter-name>
    <filter-class>SessionFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>PageFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    Also i gave the timeout in web.xml as follows.
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    And i had the filter servlet as follows.
    public class SessionTimeoutFilter implements Filter
    public SessionFilter()
    public void init(FilterConfig conf) throws ServletException {
    public void destroy()
    // Create a new instance of SessionFilter
    private static int firstRequest = 0;
    public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain)
    throws IOException,ServletException
    HttpServletRequest hreq = (HttpServletRequest)request;
    HttpServletResponse hres = (HttpServletResponse)response;
    HttpSession session = hreq.getSession();
    try{
    if (session.isNew()) {
    if(firstRequest == 0){
    firstRequest++;
    else {
    hres.sendRedirect("http://www.google.com");
    firstRequest = 0;
    return;
    }catch(Exception e){
    e.printStackTrace();
    chain.doFilter(request,response);
    When trying to execute this one i am getting a portlet 500 internal error. I am not sure where i went wrong. Can anyone give me a suggestion for this to work in a portal.?
    Thx in advance....

    Hi,
    Thx for ur reply, Here i am using firstRequest as a counter variable. when the session is new and firstRequest is 1, it means that the session has expired and new session started and this is where i am redirecting to another page. The problem is, i think is mainly because of the sendRedirect i am using there in the code. I think sendRedirect will not work in portal, because when i test this application locally , it is working fine. But when i deploy it in portal, i am getting the error. Can you suggest me an alternative for sendredirect in portal.Even i tried with forward but no use.
    Thx....

  • Apache Abdera deployment is not working in Weblogc9.1

    Hi
    I am accessing Atom feed from one url(www.example.com.rss.xml). I wrote one servlet and deployed it in weblogic9.1 and Tomcat5.5.
    Weblogic deployement is not working. but tomcat deployment is working properly.
    My Code is :
    public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException
              try
                   Abdera abdera = new Abdera();
                   Client client = new CommonsClient(abdera);
                   RequestOptions options = client.getDefaultRequestOptions();
                   System.out.println("checkFeedModification method RequestOptions options after");
                   Calendar calendar = Calendar.getInstance();
                   options.setIfModifiedSince(calendar.getTime());
                   options.setNoCache(true);
                   System.out.println("Feed URL is : http://xxx.xxxx.xxx/feed/xxxx/v1");     
                   ClientResponse response = client.get(" http://xxx.xxxx.xxx/feed/xxxx/v1", options);
                   Parser parser = Abdera.getNewParser();     
                   Document<Feed> doc = parser.parse(response.getInputStream());
                   PrintWriter out = res.getWriter();
                   out.println(doc.getRoot().toString());
    }catch(Exception e)
                   e.printStackTrace();
    My Classpath jar files are :
    D:\abdera.0.2.2-incubating\abdera.client.0.2.2-incubating.jar;D:\abdera.0.2.2-incubating\abdera.core.0.2.2-incubating.jar;D:\abdera.0.2.2-incubating\abdera.extensions.0.2.2-incubating.jar;D:\abdera.0.2.2-incubating\abdera.parser.0.2.2-incubating.jar;D:\abdera.0.2.2-incubating\abdera.protocol.0.2.2-incubating.jar;D:\abdera.0.2.2-incubating\abdera.security.0.2.2-incubating.jar;D:\abdera.0.2.2-incubating\abdera.server.0.2.2-incubating.jar;D:\abdera.0.2.2-incubating\lib\axiom-api-1.2.1.jar;D:\abdera.0.2.2-incubating\lib\axiom-impl-1.2.1.jar;D:\abdera.0.2.2-incubating\lib\bcprov-jdk15-134.jar;D:\abdera.0.2.2-incubating\lib\commons-codec-1.3.jar;D:\abdera.0.2.2-incubating\lib\commons-httpclient-3.0.1.jar;D:\abdera.0.2.2-incubating\lib\commons-logging-1.0.4.jar;D:\abdera.0.2.2-incubating\lib\geronimo-activation_1.0.2_spec-1.1.jar;D:\abdera.0.2.2-incubating\lib\jaxen-1.1-beta-7.jar;D:\abdera.0.2.2-incubating\lib\json-1.0.jar;D:\abdera.0.2.2-incubating\lib\log4j-1.2.12.jar;D:\abdera.0.2.2-incubating\lib\stax-api-1.0.jar;D:\abdera.0.2.2-incubating\lib\xmlsec-1.3.0.jar;D:\abdera.0.2.2-incubating\lib\stax-1.2.0.jar
    Could you please suggest me where iam doing wrong?
    Thanks.
    Edited by srinukanta at 04/17/2007 6:21 AM
    Edited by srinukanta at 04/17/2007 6:24 AM

    Hi Prakash,
    The "Run standalone web module from workspace" doesn't publish the application to the server (instead the app is deployed to a temp location).
    This is mainly to help test the app during the development stages. If your app is complete and would like to publish to the server then you might want to try the following option
    - In Server View, double click on the configuration to launch Overview
    - Select "Copy stand-alone web module into separate deployment folder"
    - Save the configuration
    - Start the server
    The application would be deployed to the server as a WAR file.

  • FIle download not working in page fragment

    Hi All,
    I have to download a file . I am using Dynamic tab shell and in one pf my page fragement link to download a file is avaliable...
    I did a POC on jspx and its working fine but when i try to use the same code in my jsff (page frament ) its not working any idea that do i have to do anything specific to acheive the same..
    Thanks
    Shubhangi

    Shubhangi/Timo,
    was this resolved? I am having the same issue. File download works fine in a jspx page but the same code is not working when file download is used as part of a page fragment.
    I have a table column that has the filename as commandlink with a managed bean code as below.
    public oracle.binding.BindingContainer getBindings() {
    return BindingContext.getCurrent().getCurrentBindingsEntry();
    public void downloadFile(ActionEvent actionEvent) {
    FacesContext fctx = FacesContext.getCurrentInstance();
    // myDocumentLocation specified in web.xml
    String DOCUMENTS_LOCATION =
    fctx.getExternalContext().getInitParameter("myDocumentLocation");
    if (DOCUMENTS_LOCATION == null) {
    // DOCUMENTS_LOCATION = "C:\\Documents and Settings\\xxloc\\";
    Application app = fctx.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = fctx.getELContext();
    ValueExpression valueExp =
    elFactory.createValueExpression(elContext, "#{row.OrderFileName}",
    Object.class);
    String s1 = (String)valueExp.getValue(elContext);
    System.out.println(s1);
    String filename = s1 ;
    File srcdoc =
    new File(DOCUMENTS_LOCATION + filename);
    if (srcdoc.exists()) {
    FileInputStream fis;
    System.out.println("exists");
    byte[] b;
    HttpServletResponse response =
    (HttpServletResponse)fctx.getExternalContext().getResponse();
    response.setContentType("application/x-download");
    response.setHeader("Content-Disposition",
    "attachment; filename=" + filename);
    response.setBufferSize(1024);
    // response.setContentLength((new Long(srcdoc.length())).intValue());
    OutputStream out = null;
    try {
    out = response.getOutputStream();
    } catch (IOException e) {
    e.printStackTrace();
    try {
    fis = new FileInputStream(srcdoc);
    int n;
    n = fis.available();
    while (n > 0) {
    b = new byte[n];
    System.out.println("b" +b);
    int result = fis.read(b);
    out.write(b, 0, b.length);
    if (result == -1)
    break;
    } catch (IOException e) {
    System.out.println("in file error");
    e.printStackTrace();
    try {
    out.flush();
    out.close();
    } catch (IOException e) {
    e.printStackTrace();
    fctx.responseComplete();
    It would be great if someone could guide me with this issue.
    Thanks,
    RAS

  • Drag & Drop of a file not working in Ubuntu & other linux

    Hi All,
    I am working on a project,in which it has the requirement of dragging the files
    from a JList present inside a JFrame to the desktop.
    First I tried to get a solution using dnd API but could not. Then i googled and i got an application which is
    working perfectly in both Windows and MAC Operating systems, after I made few minor changes to suit my requirements.
    Below is the URL of that application:
    http://stackoverflow.com/questions/1204580/swing-application-drag-drop-to-the-desktop-folder
    The problem is the same application when I executed on Ubuntu, its not working at all. I tried all available options but could not trace out the exact reason.
    Can anybody help me to overcome this issue?
    Thanks in advance

    Hi,
    With the information you provided and through some information found on google i coded an application. This application is able to do the drag and drop of an item from the Desktop to Java application on Linux Platform, but i am unble to do the viceversa by this application.
    I am including the application and the URL of the information i got.
    [URL Of Information Found|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4899516]
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.datatransfer.Transferable;
    import java.awt.datatransfer.UnsupportedFlavorException;
    import java.awt.dnd.DropTarget;
    import java.awt.dnd.DropTargetDragEvent;
    import java.awt.dnd.DropTargetDropEvent;
    import java.awt.dnd.DropTargetEvent;
    import java.awt.dnd.DropTargetListener;
    import java.io.File;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.DefaultListModel;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    import javax.swing.TransferHandler;
    import javax.swing.WindowConstants;
    public class DnDFrame extends JFrame implements DropTargetListener {
         private DefaultListModel listModel = new DefaultListModel();
         private DropTarget dropTarget;
         private JLabel jLabel1;
         private JScrollPane jScrollPane1;
         private JList list;
         List<File> files;
         /** Creates new form DnDFrame */
         public DnDFrame() {
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              initComponents();
              dropTarget = new DropTarget(list, this);
              list.setModel(listModel);
              list.setDragEnabled(true);
              list.setTransferHandler(new FileTransferHandler());
         @SuppressWarnings("unchecked")
         private void initComponents() {
              GridBagConstraints gridBagConstraints;
              jLabel1 = new JLabel();
              jScrollPane1 = new JScrollPane();
              list = new JList();
              setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              getContentPane().setLayout(new GridBagLayout());
              jLabel1.setText("Files:");
              gridBagConstraints = new GridBagConstraints();
              gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
              gridBagConstraints.anchor = GridBagConstraints.WEST;
              getContentPane().add(jLabel1, gridBagConstraints);
              jScrollPane1.setViewportView(list);
              gridBagConstraints = new GridBagConstraints();
              gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
              gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
              getContentPane().add(jScrollPane1, gridBagConstraints);
              pack();
         public void dragEnter(DropTargetDragEvent arg0) {
         public void dragOver(DropTargetDragEvent arg0) {
         public void dropActionChanged(DropTargetDragEvent arg0) {
         public void dragExit(DropTargetEvent arg0) {
         public void drop(DropTargetDropEvent evt) {
              System.out.println(evt);
              int action = evt.getDropAction();
              evt.acceptDrop(action);
              try {
                   Transferable data = evt.getTransferable();
                   DataFlavor uriListFlavor = null;
                   try {
                        uriListFlavor = new DataFlavor("text/uri-list;class=java.lang.String");
                   } catch (ClassNotFoundException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                   System.out.println("data.isDataFlavorSupported(DataFlavor.javaFileListFlavor: " +
                             data.isDataFlavorSupported(DataFlavor.javaFileListFlavor) );
                   if (data.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                        files = (List<File>) data.getTransferData(DataFlavor.javaFileListFlavor);
                        for (File file : files) {
                             listModel.addElement(file);
                   }else if (data.isDataFlavorSupported(uriListFlavor)) {
                        String data1 = (String)data.getTransferData(uriListFlavor);
                        files = (List<File>) textURIListToFileList(data1);
                        for (File file : files) {
                             listModel.addElement(file);
                        System.out.println(textURIListToFileList(data1));
              } catch (UnsupportedFlavorException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
              } finally {
                   evt.dropComplete(true);
         private static java.util.List textURIListToFileList(String data) {
              java.util.List list = new java.util.ArrayList(1);
              for (java.util.StringTokenizer st = new java.util.StringTokenizer(data,"\r\n");
              st.hasMoreTokens();) {
                   String s = st.nextToken();
                   if (s.startsWith("#")) {
                        continue;
                   try {
                        java.net.URI uri = new java.net.URI(s);
                        java.io.File file = new java.io.File(uri);
                        list.add(file);
                   } catch (java.net.URISyntaxException e) {
                   } catch (IllegalArgumentException e) {
              return list;
         private class FileTransferHandler extends TransferHandler {
              @Override
              protected Transferable createTransferable(JComponent c) {
                   JList list = (JList) c;
                   List<File> files = new ArrayList<File>();
                   for (Object obj: list.getSelectedValues()) {
                        files.add((File)obj);
                   return new FileTransferable(files);
              @Override
              public int getSourceActions(JComponent c) {
                   return COPY;
         static {
              try {
                   uriListFlavor = new
                   DataFlavor("text/uri-list;class=java.lang.String");
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
         private class FileTransferable implements Transferable {
              private List<File> files;
              public FileTransferable(List<File> files) {
                   this.files = files;
              public DataFlavor[] getTransferDataFlavors() {
                   return new DataFlavor[]{DataFlavor.javaFileListFlavor,uriListFlavor};
              public boolean isDataFlavorSupported(DataFlavor flavor) {
                   if(flavor.equals(DataFlavor.javaFileListFlavor) || flavor.equals(uriListFlavor))
                        return true;
                   else
                        return false;
              public Object getTransferData(DataFlavor flavor) throws
              UnsupportedFlavorException, java.io.IOException {
                      if (isDataFlavorSupported(flavor) && flavor.equals(DataFlavor.javaFileListFlavor)) {
                        return files;
                   }else if (isDataFlavorSupported(flavor) && flavor.equals(uriListFlavor)) {
                        java.io.File file = new java.io.File("file.txt");
                        String data = file.toURI() + "\r\n";
                        return data;
                   }else {
                        throw new UnsupportedFlavorException(flavor);
         private static DataFlavor uriListFlavor;
         static {
              try {
                   uriListFlavor = new
                   DataFlavor("text/uri-list;class=java.lang.String");
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
         public static void dumpProperty(String name) {
              System.out.println(name + " \t" + System.getProperty(name) );
         public static void main(String[] args) {
              String[] props = {
                        "java.version",
                        "java.vm.version",
                        "java.vendor",
                        "os.name",
              "os.version"};
              for (String prop : props) {
                   dumpProperty(prop);
              Runnable r = new Runnable() {
                   public void run() {
                        DnDFrame f = new DnDFrame();
                        f.setVisible(true);
              SwingUtilities.invokeLater(r);
    }Please Suggest me in this.

  • Commit not working with actionBinding

    I am having a bit of a problem, i am trying to change a value from an iterator (this part work fine) but can't commit this value for some reason but i get no error.
    I click on the button that will change the value of the selected row in the table.
    First sysout return the right value.
    second sysout return "N" which is good.
    third sysout return "Y" which is what i want to do.
    I do have a commit action in my page definition.
    I tried addind a button that will commit but no success here.
    Any help ?
    public String disableSelectedProject(){
    RowKeySet selectedRowKeys = table1.getSelectionState();
    //Store original rowKey
    Object oldRowKey = table1.getRowKey();
    if (selectedRowKeys != null)
    Iterator iter = selectedRowKeys.getKeySet().iterator();
    if (iter != null && iter.hasNext())
    Object rowKey = iter.next();
    System.out.println(rowKey.toString());
    //set the current row in the ADF binding to the same row
    DCIteratorBinding dcib = (DCIteratorBinding)bindings.get("ProjectList1Iterator");
    dcib.setCurrentRowWithKeyValue(rowKey.toString());
    Row rowData = dcib.getCurrentRow();
    System.out.println( rowData.getAttribute(ProjectListRowImpl.ISDELETED));
    //set the field flag to Deleted
    rowData.setAttribute(ProjectListRowImpl.ISDELETED, "Y");
    System.out.println( rowData.getAttribute(ProjectListRowImpl.ISDELETED));
    //commit the transaction - for iterators Not working for this case.
    JUCtrlActionBinding actionBinding = (JUCtrlActionBinding)bindings.get("Commit");
    actionBinding.execute();
    //refresh list
    DCIteratorBinding iterator = (DCIteratorBinding)bindings.get("ProjectList1Iterator");
    iterator.executeQuery();
    //Restore the original rowKey
    table1.setRowKey(oldRowKey);
    return "";
    Thank you

    hi Charles
    ... I am using Jdev 10.1.3.1.1 and use Application Dev framework documentation. But i did not start at the beggining of the project so i was able to looked at the code already there. ...You might want to review documentation sections:
    - "8 Implementing Business Services with Application Modules "
    at http://download.oracle.com/docs/cd/B32110_01/web.1013/b25947/bcservices.htm
    - "24 Testing and Debugging Web Applications "
    at http://download.oracle.com/docs/cd/B32110_01/web.1013/b25947/web_testdebug.htm
    You also might want to try to add more System.out.println() statements to see which statements get executed and which don't, and combine that with some try-catch statements (maybe for the whole method) like this
      try
        ; // some statements
      catch(Throwable th)
        th.printStackTrace();
        throw new RuntimeException("statements failed, th = " + th, th);
      }success
    Jan

Maybe you are looking for