Seeburger Line trimmed payloads

One of our B2B partners using a Seeburger connector is having problems processing our ebMS SOAP messages.
The messages are typical MIME encoding SOAP. The SOAP envelope and attached payload are NOT wrapped or 'pretty-printed'. They are sent as a single 'line' or stream.
It seems that within their server, these lines are being truncated to 512 bytes (and they are having parser errors as an added insult.)
Whether this is occuring in their ebMS server or in a front-end/proxy, I have no way of knowing.
They are wanting me to limit our message line length to 512 bytes... which is simply not going to happen...
No other partner has issues with this (and we have others using Seeburger)
Anyone here that's familiar with this have any thoughts?
Thanks for any ideas you can share.
- rich

The error also states something related to deprecated classes. You need to check for the used class and check its usability in javadocs.
Can you elaborate on this one...I don't understand how and where do I check for it?
Thanks,
Srini
Edited by: Srinivas Davuluri on May 18, 2009 4:34 PM

Similar Messages

  • PCC-F-02044, CMD-LINE:  Illegal or out of range value for option

    Good day,
    I very new to Pro*C and its compiler, i was tasked to recompile a program from a previous developer and got stuck with the above mentioned problem.
    The command i'm using to compile the program is: proc xxx.pc
    This returns the illegal or out of range value error
    #include <iostream>
    #include <fstream>
    #include <string>
    #include <stdio.h>
    #include <sqlda.h>
    #include <sqlcpr.h>
    #include <sqlca.h>
    #include <stddef.h>
    using namespace std;
      char myfile[60];     
      char puk [][];
      int last_col = 0;
      int last_row = 0;
      int line_nr = 0;
      string line = ""; 
    int main(int argc, char *argv[])
        if (argc != 2)
           return(1);
      ifstream myfile;
      myfile.open (argv[1],ios::in);
      if (myfile.is_open())
        while (! myfile.eof() )
        //while(getline(myfile,line))
          getline (myfile,line);
          line_nr++; //counting number of lines
          line = trim(line); //remove whitespaces
          if (line == "\r" or line.length()  == 0) {
             continue;  //ignore blank lines
           if (line_nr == 1) {        
              last_col = 1;
              last_row = 0;
              puk [last_row][last_col] = line;          
           } else if (line_nr > 1 && line.substr(1,3) != 'OOF') {          
              last_col = last_col + 1;
              puk [last_row][last_col] = line;          
           } else {     
             last_row = last_row + 1;
              puk [last_row][1] = line;                    
        myfile.close();
        line_nr = 0;
      return 0;
             Any assistance will be appreciated.
    Regards,

    My pcscfg.cfg file is set as follows:
    sys_include=(/usr/include/c++/4.1.1/iostream,/usr/include/c++/4.1.1/backward/iostream.h,/usr/include/c++/4.1.1/fstream,/usr/include/c++/4.1.1/backward/fstrea
    m.h,/usr/bin/strings,/usr/include/string.h,/usr/include/strings.h,/usr/include/stdio.h,/usr/lib/syslinux/com32/include/stdio.h,/oracle/client/9.2.0/precomp/p
    ublic/sqlda.h,/oracle/client/9.2.0/precomp/public/sqlcpr.h,/oracle/client/9.2.0/precomp/public/sqlca.h,/usr/include/linux/stddef.h,/usr/lib/gcc/x86_64-redhat
    -linux/4.1.1/include/stddef.h,/usr/lib/syslinux/com32/include/stddef.h,/usr/lib/syslinux/com32/include/bitsize/stddef.h,/usr/include,/usr/lib/gcc-lib/i386-re
    dhat-linux/2.96/include,/oracle/app/oracle/client/precomp/public,/user/include/g++-3)
    ltype=short

  • How to read a specific line of a .dat file?

    can we read a specific line of a .dat file, if so, how?
    i have this .dat files for each customer, which contain their name on the first line, their id on the second line
    and a list of items and an item id between each item.
    John Doe
    455689
    milk
    1
    orange
    9
    Here is what I am trying to do, please correct me
    //list out .dat file in dir
    File customer_dir = new File ("Customer")
    if (customer_dir.isDirectory())
    String[] listofdat=dir.list();
    for (int i=0;i<listofdat.length();i++)
    Scanner dat_read = new Scanner (new File listfodat);
    dat_read.nextLine();
    if (dat_read.nextLine().equals("455689")) <--is this okay?

    bibiancheng wrote:
    would you please explain to me what
    String[] tokens = line.trim().split("\\s*,\\s*")"\\s*,\\s*" is a regex where \\s means whitespace and the * means "any number of".
    so \\s* means that it will grab all the whitespace if there is any.
    trim() removes white space from the beginning and end of the string.
    dont put a comma in the name.
    spaces allowed: "jane doe, 12-14-09, 428438, 6, 388473, 7, 187374, 3"
    it was just a recommendation. breaking it into separate lines would be fine.

  • SOAP Adapter missing payload on receiving web service

    Hi there,
    I'm having a problem with a File to (asynchronous) SOAP Adapter scenario that is currently baffling me.
    I wonder if anyone out there has any troubleshooting ideas for this one?
    The source message is being picked up OK and I can see from Communication Channel Monitoring on the Runtime Workbench that it is allegedly being delivered to the Web Service OK.
    All the entries in the audit log point to a successful scenario and I can view the payload in the Message Content "payload" area.
    However on the web service / server side the message is completely blank. Somewhere along the line the payload has gone missing.
    I can copy and paste the payload manually into the web service test area and this is fine.
    Any ideas/suggestions as to what could be happening with this or how I might go about troubleshooting it?
    Many thanks
    Ian

    Thanks Bruno,
    It looks like you were right...
    In the end we used Wireshark - a packet sniffing  application - to check what was actually hitting the destination server. We found that the content was arriving at the server but the web service wasn't accepting the format. The creators of the web service are now investigating why and will hopefully will advide me of the format error in the message. But at least I was able to prove that the message was getting there which was the focus of this query.
    Regards
    Ian

  • How Can I replace line in text file

    I have a text file like following format
    1
    bvhhk
    g1
    2
    bvgjvh
    g1
    3
    mmm,mvb
    g2
    I want to replace 2 nd line to " prasad" and after replacing it should be following format
    1
    prasad
    g1
    2
    bvgjvh
    g1
    3
    mmm,mvb
    g2
    I try above change using following code segment and it is not work.
    static void modifyEmployeeDetails(String file_name){
    try{
         InputStreamReader reader= new InputStreamReader(System.in);
         BufferedReader buff=new BufferedReader(reader);
         FileReader read=new FileReader(file_name);
         BufferedReader buffer=new BufferedReader(read);
         FileWriter w=new FileWriter(file_name,true);
         PrintWriter write = new PrintWriter(w);
         System.out.print("Employee No : ");
         String No=buff.readLine();
    boolean eof = false;
    while (!eof) {
    String tep=buffer.readLine();
    if(tep.equals(No)){
    eof = true;
    System.out.print("Name : ");
    temp=buff.readLine();
    System.out.println("No");
    write.println(temp);
    System.out.print("Group No : ");
    temp=buff.readLine();
    write.println(temp);
    }catch(Exception e){
    System.out.println(e);
    Please correct If it is wrong and help me as soon as possible
    Thank you...............

    hi,
    I have a different approach of the solution to your problem.
    suppose you have entries in your file without any extra line feed between each two entries.
    the following program entirely reads your data into a bean list, changes a specific bean attribute and writes it to your data source.
    (you should adapt it to your needs)
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    public class FileReplace {
         public List<MyBean> readFile(BufferedReader in) throws IOException{
              String line;
              List<MyBean> beanList = new ArrayList<MyBean>();
              MyBean bean = null;
              int i=0;
              while((line=in.readLine())!=null){
                   if(line.trim().equals("***")){
                        beanList.add(bean);
                        i = 0;
                   }else{
                        switch (i) {
                        case 0:
                             bean = new MyBean();
                             bean.setAttribute1(line);
                             i++;
                             break;
                        case 1:
                             bean.setAttribute2(line);
                             i++;
                             break;
                        case 2:
                             bean.setAttribute3(line);
                             i++;
                             break;
                        default:
                             break;
              return beanList;
         public void writeToFile(List<MyBean> beanList, String outputFilePath) throws IOException{
              FileWriter out = new FileWriter(outputFilePath);
              for (int i = 0; i < beanList.size(); i++) {
                   out.write(beanList.get(i).toString());
              out.flush();
              out.close();
         public void test(){
              //BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
              String filePath = "D:/file.txt";
              try {
                   BufferedReader in = new BufferedReader(new FileReader(filePath));
                   //read data
                   List<MyBean> beanList = readFile(in);
                   // edit a bean attribute
                   beanList.get(0).setAttribute2("prasad");
                   //write beans back to file
                   writeToFile(beanList, filePath);
              } catch (FileNotFoundException e) {
                   e.printStackTrace(); //handle appropriately this exception
              } catch (IOException e) {
                   e.printStackTrace();//handle appropriately this exception
              }catch (Exception e) {
                   e.printStackTrace();//handle appropriately this exception
         class MyBean{
              String attribute1;
              String attribute2;
              String attribute3;
              public final static int ATTRS_NUMBER = 3;
              public String getAttribute1() {
                   return attribute1;
              public void setAttribute1(String attribute1) {
                   this.attribute1 = attribute1;
              public String getAttribute2() {
                   return attribute2;
              public void setAttribute2(String attribute2) {
                   this.attribute2 = attribute2;
              public String getAttribute3() {
                   return attribute3;
              public void setAttribute3(String attribute3) {
                   this.attribute3 = attribute3;
              @Override
              public String toString() {
                   return attribute1+"\n"+attribute2+"\n"+attribute3+"\n***\n";
         public static void main(String[] args) {
              FileReplace instance = new FileReplace();
              instance.test();
    }hope it helps

  • About trim() for String

    I am doing assignment to deal with the xml code,for every line I read by BufferedReader I have to trim() it,I mean to take away all the white space in this line before I do something with the xml code.but I cannot make it right.the "trim()" seems doesn't work.
    so I write some small code to test it,
    while(in.ready())
    String line = in.readLine();
    line.trim();
    System.out.println();
    but,unfortunately,I found the "trim()" mothod in String does't work,it does't do anything!
    because on the screen,it print out the excatly same thing as these code
    while(in.ready())
    String line = in.readLine();
    System.out.println();
    it did't take away the white sapce.
    can you help me?thank you very much!

    here is my xml code:
    <database>
         <product>
              <id>No.1</id>
              <name>skateboard</name>
              <type>sports</type>
              <price>$58</price>
         </product>
         <product>
              <id>No.2</id>
              <name>bicycle</name>
              <type>sports</type>
              <price>$122</price>
         </product>
    </database>
    i suppose to have it print out like:
    <database>
    <product>
    <id>No.1</id>
    <name>skateboard</name>
    <type>sports</type>
    <price>$58</price>
    </product>
    <product>
    <id>No.2</id>
    <name>bicycle</name>
    <type>sports</type>
    <price>$122</price>
    /product>
    </database>

  • Two items:  Blue line in Projects, unknown function

    There is a blue line at the top of a portion of some of the clips in one of my Projects. What does that mean?
    Also, when I position the cursor near the beginning or end of a clip and press both the option and command keys, an orange outline appears around the end of the clip and the neighboring clip is pushed away producing a space. Does anyone know what that is?

    Source:
    Message1
    <Header>
    <MessageDestination>
    <Destination>1<Destination>
    <MessageDestination>
    <MessageDestination>
    <Destination>2<Destination>
    <MessageDestination>
    <Header>
    <Payload>
    <LineItem>
    <LineItem>
    <Line>1<Line>
    <LineItem>
    <LineItem>
    <Line>2<Line>
    <LineItem>
    Payload>
    Current Output:
    MESSAGE1
    <Header>
    <MessageDestination>
    <Destination>1<Destination>
    <MessageDestination>
    <MessageDestination>
    <Destination>2<Destination>
    <MessageDestination>
    <Header>
    <Payload>
    <LineItem>
    <LineItem>
    <Line>1<Line>
    <LineItem>
    <LineItem>
    <Line>2<Line>
    <LineItem>
    Payload>
    MESSAGE2 (Only one MessageDestination Node is being created, not 2)
    <Header>
    <MessageDestination>
    <Destination>1<Destination>
    <MessageDestination>
    <Header>
    <Payload>
    <LineItem>
    <LineItem>
    <Line>1<Line>
    <LineItem>
    <LineItem>
    <Line>2<Line>
    <LineItem>
    Payload>
    The following is the required output that I need to produce (i.e. 2 MessageDestination nodes per target message):
    Required Target / Output:
    MESSAGE1
    <Header>
    <MessageDestination>
    <Destination>1<Destination>
    <MessageDestination>
    <MessageDestination>
    <Destination>2<Destination>
    <MessageDestination>
    <Header>
    <Payload>
    <LineItem>
    <LineItem>
    <Line>1<Line>
    <LineItem>
    <LineItem>
    <Line>2<Line>
    <LineItem>
    Payload>
    MESSAGE2
    <Header>
    <MessageDestination>
    <Destination>1<Destination>
    <MessageDestination>
    <MessageDestination>
    <Destination>2<Destination>
    <MessageDestination>
    <Header>
    <Payload>
    <LineItem>
    <LineItem>
    <Line>1<Line>
    <LineItem>
    <LineItem>
    <Line>2<Line>
    <LineItem>
    Payload>

  • Help with how to count the number of tokens from the first line

    Hi
    I want to count the number of tokens from the first line of text, from my incoming file and print it out.
    For example i have 12 tokens in the first line, so i want it to print out the number 12
    my code is below
    thanks
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.util.StringTokenizer.*;
    import java.sql.*;
    public class Data {
         public static void main(String[] args) {
                        String token = null;          
                        String currentToken = "";
                        Hashtable hh = new Hashtable();     
              try {
                   Vector v2 = new Vector(100);
                   Vector v = new Vector(100);
                   FileReader file = new FileReader("words.txt");
                   BufferedReader buff = new BufferedReader(file);
                   String line = buff.readLine();
                   StringTokenizer s = null;
                   boolean eof = false;
                   while  (!eof){
                        s = new StringTokenizer(line.trim(),",",true);
                        boolean lastToken = true;
                   while (s.hasMoreTokens()) {
                              token = s.nextToken();
                                  if (lastToken){
                                   if (token.equals(",")) {
                                        v.add("");
                                               lastToken = false;
                                      if (! token.equals(",")) {
                                   v.add(token);
                                  else { if (currentToken.equals(",")) {
                                        v.add("");
                                  currentToken = token;
                        if (token.equals(",")) {
                               v.add("");
                   line = buff.readLine();
                        if (line == null){     
                             eof = true;}
                   buff.close();
              }catch (FileNotFoundException fe) {     
                        System.out.println("Error - - " + fe.toString());
              }catch (NumberFormatException ne) {
                        System.out.println("Error - - " + ne.toString());
              } catch (IOException e) {
                   System.out.println("Error - - " + e.toString());
    }     2.

    I can print out the amount of tokens from each line,
    But i only want the first line to be counted, And i
    also do not want the delimeters to be counted.
    could you please give me some ideas?
    Thanks
    try
       BufferedReader br = new BufferedReader(new FileReader("item.kr"));
       while((str=br.readLine())!= null)
          itemslist.add(str);
    catch(IOException ioe)
       System.out.println("Exception Occurred!!!");
    }This snippet gets one Line from the item.kr file.
    Then i would count (By useing a diffrent String Tokenizer) to count only this line!!!

  • Search for a blank line

    how can i search for a blank line thru a java program??

    how can i search for a blank line thru a java
    program??You can use following code:
    BufferedReader reader = null;
    try{
    File file = new File("C:/temp/abc.txt");
    FileReader reader = new FileReader(file);
    BufferedReader reader = new BufferedReader(reader);
    String line = null;
    while( (line = reader.readLine()) != null ){
    if(line.trim().length() == 0){
    //Code for handling the blank line.
    } else {
    //Code for handling the line with content.
    } catch(IOExcepttion ioe) {
    ioe.printStackTrace();
    } finally{
    if(reader != null){
    try {
    reader.close();
    }catch(IOException io){
    System.out.println("Error occured while closing Reader");

  • Read-Host Multiple lines

    Hi,
     I am writing a script which waits for user input initially, actually i want user to enter multiple emailids through read-host and i want to save that in a file in specific location. Below is the code
    read-host " Enter the email ids to which you want to send alerts" > C:\mydrive\tomail.txt
    $lines=(Get-Content C:mydrive\tomail.txt)
    $newcontent = foreach ($line in $lines) { $line.Trim()} 
    $newcontent | out-file C:mydrive\tomail.txt
    What i am doing here is , i am getting the emailds and trimming it and storing in a file.
    When i execute the above script in ISE , i can use Shift enter to enter multiple email ids, however when i run the script in powershell console it doesnt work, any ideas?

    If you want something a little bit more fun:
    add-type -assembly System.Windows.Forms
    $form=New-Object System.Windows.Forms.Form
    $form.StartPosition='CenterScreen'
    $btn=New-Object System.Windows.Forms.Button
    $btn.Text='Save'
    $btn.DialogResult='Ok'
    $btn.Dock='bottom'
    $form.Controls.Add($btn)
    $btnCancel=New-Object System.Windows.Forms.Button
    $btnCAncel.Text='Cancel'
    $btnCancel.DialogResult='Cancel'
    $btnCancel.Dock='bottom'
    $form.Controls.Add($btnCancel)
    $tb=New-Object System.Windows.Forms.Textbox
    $tb.Multiline=$true
    $tb.Dock='Fill'
    $form.Controls.Add($tb)
    $form.add_load({$tb.Select()})
    if($form.ShowDialog() -eq 'Ok'){
    $tb.lines
    }else{
    Write-Host 'Cancelled' -fore red
    ¯\_(ツ)_/¯

  • To read more than one line...

    I 've this code but it can read from keyboard only one line
    (when I type enter after the first line an EOF is raised )>
    BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
          String sql = "";
          System.out.println("Enter your JDBC/SQL query: ");
          try {
             sql = buf.readLine(); Someone can help me so that I can enter more than a line ?
    Thanks a lot.

    Do you want the user to entry two queries, one per line, or do you want to allow a single query to
    be entered on two lines?
    What happens when the query is only one line long?
    What happens when the user wants to use more than two lines to enter the text?
    Suggestion: use a loop and use something simple like a blank line to signal
    end of input. It's not hard:
    import java.io.*;
    public class MultilineInputExample {
        public static void main(String[] args) throws IOException {
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            for(int i=0; i < 2; ++i) {
                System.out.println("Enter multiline input. End with a blank line");
                String input = readMultilineInput(in);
                System.out.println("input = [" + input + "]");
        //uses a blank (white space) line to signal the end
        public static String readMultilineInput(BufferedReader in) throws IOException {
            StringBuilder b = new StringBuilder();
            String line;
            boolean notDone = true;
            while (notDone && (line = in.readLine()) != null) {
                if ((notDone = !line.trim().isEmpty()))
                    b.append(line).append(' ');
            return b.toString();
    }

  • HasMoreTokens detecting and counting empty line

    Hi programmers!
    how can i count empty line in a text file which has the data?
    suppose the text file with data is as follows:
    =====================
    c 500
    c 2100
    // <== empty line
    p 550
    c 5950
    c 3000
    =====================
    I want to display "Invalid record" when that empty line comes
    I tried following to execute "IO.print("Invalid record") line
    if(str.equals(" "))  / / also/  if (str.nextToken == false) /also / if (string.hasMoreTokens())
                   IO.print("Invalid record");
             }

    If (line.equals(""))
    or
    if (line.trim().length() == 0)

  • Check java on users PC and give message

    The following code has been written with Java 1.4 and works great, but if a user has Java 1.3 they get an error message and if a user has Java 1.2 nothing happens at all. Is there a way to check if the user is using a version older than 1.4 and if so pop up a message telling them they need to download a newer version of Java?
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.List;
    import java.io.*;
    import java.util.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import org.w3c.dom.*;
    public class Sametime extends JFrame implements ActionListener {
        private int indentation = -1;
        JPanel panel = new JPanel();
        JTextArea jta = new JTextArea(
        //Instructions for user
        "For a successful buddy list migration do the following:\n"
        + "1. Save your current Sametime Buddy List to your PC.\n   "
        + "The default location should be: C:/Program Files/Lotus/Sametime Client.\n"
        + "  A. Open the Sametime Client.\n"
        + "  B. Click on People\n"
        + "  C. Click on Save List.\n"
        + "  D. Save as your first.last.dat\n"
        + "     Ex. john.doe.dat\n"
        + "NOTE: If you have AOL contacts in your Sametime buddy list they will not be migrated.\n");
        JButton browse = new JButton("Continue");
        JButton exit = new JButton("Exit");
        public Sametime() {
            super("Sametime Buddy List Migration");
            setSize(610, 245);
            Container c = this.getContentPane();
            c.add(panel);
            browse.addActionListener(this);
            exit.addActionListener(this);
            panel.add(jta);
            panel.add(browse);
            panel.add(exit);
            jta.setEditable(false);
            setLookAndFeel();
            setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        } //end Sametime
        public class DATFilter extends javax.swing.filechooser.FileFilter {
            public boolean accept(File f) {
                //if it is a directory -- we want to show it so return true.
                if (f.isDirectory())
                    return true;
                String extension = getExtension(f);//get the extension of the file
                //check to see if the extension is equal to "dat"
                if ((extension.equals("dat")))
                    return true;
                //default -- fall through. False is return on all
                //occasions except:
                //a) the file is a directory
                //b) the file's extension is what we are looking for.
                return false;
            }//end accept
            public String getDescription() {
                return "dat files";
            }//end getDescription
             * Method to get the extension of the file, in lowercase
            private String getExtension(File f) {
                String s = f.getName();
                int i = s.lastIndexOf('.');
                if (i > 0 &&  i < s.length() - 1)
                    return s.substring(i+1).toLowerCase();
                return "";
            }//end getExtension
        }//end class DATFilter
        public void actionPerformed(ActionEvent e) {
            //Default Location for JFileChooser search
            String error = "The file selected is not a .dat file!\n"
            + "Please select your recently saved .dat file and try again.";
            JFileChooser fc = new JFileChooser("/Program Files/Lotus/Sametime Client");
            fc.setFileFilter(new DATFilter());
            fc.setFileSelectionMode( JFileChooser.FILES_ONLY);
            String user = System.getProperty("user.name");// finds who the current user is
            if (e.getSource() == browse) {
                int returnVal = fc.showSaveDialog(Sametime.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    //if (fc.getSelectedFile().getName().equals(".dat")){
                    if (fc.getSelectedFile().getName().endsWith(".dat")){ // checks to see if selected file is .dat
                    }else{
                        JOptionPane.showMessageDialog(null, error, "Wrong File", JOptionPane.ERROR_MESSAGE);
                        return;
                    }//end else
                    try {
                        String[] contactArray = parseDatFile(fc.getSelectedFile());
                        Document document = createXMLDocument(contactArray);
                        saveToXMLFile(
                        document,
                        new File(
                        "C:/Documents and Settings/" + user +"/My Documents/OLCS/",// looks for directory for list
                        "contacts-list_migration.ctt"));
                    } catch (Exception exc) {
                        File f = new File("C:/Documents and Settings/" + user +"/My Documents/OLCS/");// setting directory for list if not there
                        boolean yes = true;
                        yes = f.mkdir();// creating directory
                        try {
                            String[] contactArray = parseDatFile(fc.getSelectedFile());
                            Document document = createXMLDocument(contactArray);
                            saveToXMLFile(
                            document,
                            new File(
                            "C:/Documents and Settings/" + user +"/My Documents/OLCS/",// used only if the directory didn't exist
                            "contacts-list_migration.ctt"));
                            //exc.printStackTrace();// not sure if this is needed?
                        } catch (Exception exc1) {
                            exc1.printStackTrace();
                        }//end inner catch
                    }// end catch
                }// end if
                if(returnVal==JFileChooser.CANCEL_OPTION){
                    String Warning = "You did not migrate your Sametime buddy list at this time.";
                    JOptionPane.showMessageDialog(null, Warning, "Migration Canceled", JOptionPane.WARNING_MESSAGE);
                    return;
                }else{
                    String thankyou = "Thank You for Migrating your Sametime buddy list to OLCS"
                    + "\nYour new OLCS buddy list has been saved to:"
                    + "\nC:/Documents and Settings/" + user +"/My Documents/OLCS"
                    + "\n as: Contact-List_migration.ctt"
                    + "\n\n To be able to use Contact-List_migration.ctt for Windows Messenger:"
                    + "\n1. Log into Windows Messenger."
                    + "\n2. Click on File"
                    + "\n3. Click on 'Import Contacts from a Saved File...'"
                    + "\n4. Open OLCS in My Documents"
                    + "\n5. Click on 'Contact-list_migration.ctt'"
                    + "\n6. Click Open to import the list."
                    + "\n   A window will pop up confirming that you want to add all of the contacts"
                    + "\n   Click 'yes'"
                    + "\n   Your buddy list is ready to be used.";
                    JOptionPane.showMessageDialog(null, thankyou, "Migration Completed", JOptionPane.INFORMATION_MESSAGE);//Change this when defualt directory is known.
                }//end if else statement
            } //end if
            System.exit( 0 );
            if (e.getSource() == exit) {
                System.exit( 0 );
            } //end if
        } //end actionPerformed
        String[] parseDatFile(File datFile)
        throws Exception    {
            List list = new ArrayList();
            BufferedReader br = new BufferedReader(new FileReader(datFile));
            String line;
            while ((line = br.readLine()) != null) {
                line = line.trim();
                if (line.indexOf("U") != 0)
                    continue;
                int p = line.indexOf("::");
                if (p == -1)
                    continue;
                line = line.substring(p + 2).trim();
                if (line.indexOf("AOL") == 0)
                    continue;
                p = line.indexOf(",");
                if (p != -1)
                    line = line.substring(0, p);
                line = line.trim() + "@mci.com";
                if (list.indexOf(line) == -1)
                    list.add(line);
            }//end while
            br.close();
            String[] contactArray = new String[list.size()];
            list.toArray(contactArray);
            return contactArray;
        }// end String
        // setting up the XML file
        Document createXMLDocument(String[] contactArray) throws Exception {
            DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = dBF.newDocumentBuilder();
            DOMImplementation domImpl = builder.getDOMImplementation();
            Document document = domImpl.createDocument(null, "messenger", null);
            Element root = document.getDocumentElement();
            Element svcElm = document.createElement("service");
            Element clElm = document.createElement("contactlist");
            svcElm.setAttribute("name", "Microsoft RTC Instant Messaging");
            svcElm.appendChild(clElm);
            root.appendChild(svcElm);
            for (int i = 0; i < contactArray.length; i++) {
                Element conElm = document.createElement("contact");
                Text conTxt = document.createTextNode(contactArray);
    conElm.appendChild(conTxt);
    clElm.appendChild(conElm);
    }//end for
    return document;
    }// end Document
    void saveToXMLFile(Document document, File xmlFile) throws Exception {
    OutputStream os =
    new BufferedOutputStream(new FileOutputStream(xmlFile));
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");//puts information on seperate lines
    transformer.setOutputProperty(OutputKeys.METHOD, "xml");
    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");//gives the XML file indentation
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
    DOMSource source = new DOMSource(document);
    StreamResult result = new StreamResult(os);
    transformer.transform(source, result);
    os.close();
    }//end saveToXMLFile
    public static void main(String[] args) {
    Sametime st = new Sametime();
    ImageIcon picIcon = new ImageIcon(st.getClass().getResource("/ST_Migration/images/mci.gif"));//Change when default is known!
    st.setIconImage(picIcon.getImage());
    } //end main
    private void setLookAndFeel() {
    try {
    UIManager.setLookAndFeel(
    UIManager.getSystemLookAndFeelClassName());
    SwingUtilities.updateComponentTreeUI(this);
    } catch (Exception e) {
    System.err.println("Could not use Look and Feel: " + e);
    } //end catch
    } //end void setLookAndFeel
    } //end public class Sametime

    Well, if you don't want to use Package.isCompatibleWith and the version numbers will always be of the form x.y where y is at most one digit, you can use Double.parseDouble() and then compare the numbers. Otherwise you need to write a method of your own.

  • Tricky bug!!

    Hi there, ive been using lucence for a assignment that i am doing i was wondering if some you could have a look that this piece of code that i have been working on.
    The code that i am working on this below
    package Search;
    import org.apache.lucene.analysis.Analyzer;
    import org.apache.lucene.analysis.standard.StandardAnalyzer;
    import org.apache.lucene.document.Document;
    import org.apache.lucene.index.FilterIndexReader;
    import org.apache.lucene.index.IndexReader;
    import org.apache.lucene.queryParser.QueryParser;
    import org.apache.lucene.search.Hits;
    import org.apache.lucene.search.IndexSearcher;
    import org.apache.lucene.search.Query;
    import org.apache.lucene.search.Searcher;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.ArrayList;
    /** Simple command-line based search demo. */
    public class searchHTML {
    /** Use the norms from one field for all fields. Norms are read into memory,
    * using a byte of memory per document per searched field. This can cause
    * search of large collections with a large number of fields to run out of
    * memory. If all of the fields contain only a single token, then the norms
    * are all identical, then single norm vector may be shared. */
    private static class OneNormsReader extends FilterIndexReader {
    private String field;
    public OneNormsReader(IndexReader in, String field) {
    super(in);
    this.field = field;
    public byte[] norms(String field) throws IOException {
    return in.norms(this.field);
    public searchHTML() {}
    /** Simple command-line based search demo. */
    public String querySearch(String[] args,String searchValue) throws Exception
         String result = "";
    String usage =
    "Usage: java Lucene.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-norms field]";
    if (args.length > 0 && ("-h".equals(args[0]) || "-help".equals(args[0])))
    System.out.println(usage);
    System.exit(0);
    String index = "{index-dir}";
    String field = "contents";
    String queries = null;
    int repeat = 0;
    boolean raw = false;
    String normsField = null;
    for (int i = 0; i < args.length; i++) {
    if ("-index".equals(args)) {
    index = args[i+1];
    i++;
    } else if ("-field".equals(args[i])) {
    field = args[i+1];
    i++;
    } else if ("-queries".equals(args[i])) {
    queries = args[i+1];
    i++;
    } else if ("-repeat".equals(args[i])) {
    repeat = Integer.parseInt(args[i+1]);
    i++;
    } else if ("-raw".equals(args[i])) {
    raw = true;
    } else if ("-norms".equals(args[i])) {
    normsField = args[i+1];
    i++;
    IndexReader reader = IndexReader.open(index);
    if (normsField != null)
    reader = new OneNormsReader(reader, normsField);
    Searcher searcher = new IndexSearcher(reader);
    Analyzer analyzer = new StandardAnalyzer();
    BufferedReader in = null;
    if (queries != null) {
    in = new BufferedReader(new FileReader(queries));
    } else {
    in = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
    QueryParser parser = new QueryParser(field, analyzer);
    if(true)
         if (queries == null) // prompt the user
         System.out.println("Enter query: " + searchValue);
         String line = searchValue;
         if (line == null || line.length() == -1)
              System.out.println("test");
         //break;
         line = line.trim();
         if (line.length() == 0)
              System.out.println("test2");
         //break;
         Query query = parser.parse(line);
         System.out.println("Searching for: " + query.toString(field));
         Hits hits = searcher.search(query);
         // if (repeat > 0) {                           // repeat & time as benchmark
         // Date start = new Date();
         // for (int i = 0; i < repeat; i++) {
         // hits = searcher.search(query);
         // Date end = new Date();
         // System.out.println("Time: "+(end.getTime()-start.getTime())+"ms");
         System.out.println(hits.length() + " total matching documents");
         final int HITS_PER_PAGE = hits.length();
         int end = Math.min(hits.length(), HITS_PER_PAGE);
         for (int start = 0; start < end; start++)
         //for (int i = start; i < end; i++)
         //if (raw)
              //     {                              // output raw format
         // System.out.println("doc="+hits.id(i)+" score="+hits.score(i));
         // continue;
         Document doc = hits.doc(start);
         // System.out.println(hits.length());
         for(int i = 0; i<hits.length(); i++)
              ArrayList<String> st = new ArrayList<String>();
              st.add(doc.toString());
              // System.out.println(st);
         String path = doc.get("path");
         if (path != null)
              System.out.println((start + 1) + ". " + path);
         String title = doc.get("title");
         if (title != null)
              ArrayList<String> r = new ArrayList<String>();
              r.add(result = "Title:" + doc.get("title"));
              //System.out.println(result.length());
              //result = " Title: " + doc.get("path");
         else
         result = (start+1) + ". " + "No path for this document";
         //if (queries != null) // non-interactive
         // break;
         if (hits.length() > end)
         System.out.println("more (y/n) ? ");
         line = in.readLine();
         if (line.length() == 0 || line.charAt(0) == 'n')
         break;
         reader.close();
    else
         System.out.println("finished");
    return result;
    At the mintue i am using JSP pages to display the result however, i am getting different results on the jsp page from what i am getting on the consle.
    This is the result from the jsp page
    Value Searched on:myspace
    1Title:MySpace
    2Title:MySpace
    3Title:MySpace
    4Title:MySpace
    5Title:MySpace
    6Title:MySpace
    7Title:MySpace
    8Title:MySpace
    9Title:MySpace
    10Title:MySpace
    11Title:MySpace
    12Title:MySpace
    13Title:MySpace
    14Title:MySpace
    The title MySpace is the title of the html document
    and from the console this is what i am getting : -
    3 total matching documents
    1. H:/Lucenetext/output4.html
    2. H:/Lucenetext/output8.html
    3. H:/Lucenetext/output1.html
    Ive been looking at this for a couple of weeks and was wondering if i could have a fresh pair of eyes to look at it.
    Any help would be very grateful
    Yours
    Chris

    OK
                 System.out.println("Enter query: " + searchValue); What's the point of that unless you then read some input from the user?
               if (line == null || line.length() == -1) line.length() can never be -1. This is rubbish.
              // if (repeat > 0) {                           // repeat & time as benchmark
               //  Date start = new Date();
               //  for (int i = 0; i < repeat; i++) {
                //   hits = searcher.search(query);
               //  Date end = new Date();
               //  System.out.println("Time: "+(end.getTime()-start.getTime())+"ms");
              // } Remove this junk.
               System.out.println(hits.length() + " total matching documents"); This goes to the console. A JSP doesn't have a console so you will never see it - it might be in a log file somewhere if you're lucky.
                 //for (int i = start; i < end; i++) Remove all this commented-out junk.
                   for(int i = 0; i<hits.length(); i++)
                        ArrayList<String> st = new ArrayList<String>();
                        st.add(doc.toString());
                       // System.out.println(st);
                   } As 'st' now gets thrown away this is all junk. Remove it.
                      System.out.println((start + 1) + ". " + path); See above remarks about the console.
                     if (title != null)
                          ArrayList<String> r = new ArrayList<String>();
                          r.add(result = "Title:" + doc.get("title"));
                          //System.out.println(result.length());
                          //result = "   Title: " + doc.get("path");
                     } See above. 'r' gets thrown away. Remove this junk except for the assignment to 'result'.
                   System.out.println("more (y/n) ? ");
                   line = in.readLine(); See above re console. You need to think more clearly about the difference between a console application and a JSP. A JSP writes a page of HTML.

  • How to retrieve IndividualStrings from a txt file using String Tokenizer.

    hello can any one help me to retrieve the individual strings from a txt file using string tokenizer or some thing like that.
    the data in my txt file looks like this way.
    Data1;
    abc; cder; efu; frg;
    abc1; cder2; efu3; frg4;
    Data2
    sdfabc; sdfcder; hvhefu; fgfrg;
    uhfhabc; gffjcder; yugefu; hhfufrg;
    Data3
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    i need to read the data as an individual strings and i need to pass those values to diffarent labels,the dat in Data3 i have to read those values and add to an table datamodel as 6 columns and rows depends on the data.
    i try to retrieve data using buffered reader and inputstream reader,but only the way i am retrieving data as an big string of entire line ,i tried with stringtokenizer but some how i was failed to retrive the data in a way i want,any help would be appreciated.
    Regards,

    Hmmm... looks like the file format isn't even very consistent... why the semicolon after Data1 but not after Data2 or Data3??
    Your algorithm is reading character-by-character, and most of the time it's easier to let a StringTokenizer or StreamTokenizer do the work of lexical analysis and let you focus on the parsing.
    I am also going to assume your format is very rigid. E.g. section Data1 will ALWAYS come before section Data2, which will come before section Data3, etc... and you might even make the assumption there can never be a Data4, 5, 6, etc... (this is why its nice to have some exact specification, like a grammar, so you know exactly what is and is not allowed.) I will also assume that the section names will always be the same, namely "DataX" where X is a decimal digit.
    I tend to like to use StreamTokenizer for this sort of thing, but the additional power and flexibility it gives comes at the price of a steeper learning curve (and it's a little buggy too). So I will ignore this class and focus on StringTokenizer.
    I would suggest something like this general framework:
    //make a BufferedReader up here...
    do
      String line = myBufferedReader.readLine();
      if (line!=null && line.trim().length()>0)
        line = line.trim();
        //do some processing on the line
    while (line!=null);So what processing to do inside the if statement?
    Well, you can recognize the DataX lines easily enough - just do something like a line.startsWith("Data") and check that the last char is a digit... you can even ignore the digit if you know the sections come in a certain order (simplifying assumptions can simplify the code).
    Once you figure out which section you're in, you can parse the succeeding lines appropriately. You might instantiate a StringTokenizer, i.e. StringTokenizer strtok = new StringTokenizer(line, ";, "); and then read out the tokens into some Collection, based on the section #. E.g.
    strtok = new StringTokenizer(line, ";, ");
    if (sectionNo==0)
      //read the tokens into the Labels1 collection
    else if (sectionNo==1)
      //read the tokens into the Labels2 collection
    else //sectionNo must be 2
      //create a new line in your table model and populate it with the token values...
    }I don't think the delimiters are necessary if you are using end-of-line's as delimiters (which is implicit in the fact that you are reading the text out line-by-line). So the original file format you listed looks fine (except you might want to get rid of that rogue semicolon).
    Good luck.

Maybe you are looking for