JAXB - XMLGregorianCalendar toString has E notation

Hi!
I'm currently working on a project that uses JAXB for handling XML.
I ran into some problem with reading/writing of DateTime values.
For example:
The input xml contains 2006-10-20T00:00:00.0000000+08:00
In unmarshalling, JAXB doesn't have any issue loading this value.
The issue comes in marshalling the object, the DateTime value becomes
2006-10-20T00:00:00E-7+08:00. (with E notation)
The marshalled value is no longer in a valid DateTime format and will report a schema validation error when unmarshalled+validation.
This only happens for millisecond value with 6 leading decimal digits that are all 0.
It looks like that XMLGregorianCalendar.toString() is using the BigDecimal.toString() instead of BigDecimal.toPlainString()
I'm using jdk1.5.0_07 btw.
Any idea on how to handle/fix this? I'm not sure if this is a bug or I'm just missing on something.
Thanks in advance!
Neil Almodiel

Already reported this to jaxp issue tracker:
https://jaxp.dev.java.net/issues/show_bug.cgi?id=12

Similar Messages

  • JTextField1.toString() has no "text="

    Instances of JButton, JLabel and JTextField all have a getText() method. However, the following produces strings containing the text for JButton and JLabel, but not for JTextField (see below). Why would that be? There are occasions when it would be useful to check what the text was, for example when using event.getComponent().toString(), but it is not there for JTextField.
    System.out.println("" + jButton1.toString());
    System.out.println("" + jLabel1.toString());
    System.out.println("" + jTextField1.toString());
    javax.swing.JButton[,12,446,98x26,alignmentX=0.0,alignmentY=0.5,border=
    javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@e2eec8,flags=
    296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,
    disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,
    left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,
    rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,
    text=jButtonAAA,defaultCapable=true]
    javax.swing.JLabel[,12,478,58x16,alignmentX=0.0,alignmentY=0.0,border=,
    flags=8388608,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,
    disabledIcon=,horizontalAlignment=LEADING,horizontalTextPosition=
    TRAILING,iconTextGap=4,labelFor=,text=jLabelBBB,verticalAlignment=CENTER,
    verticalTextPosition=CENTER]
    javax.swing.JTextField[,12,500,83x20,layout=javax.swing.plaf.basic.
    BasicTextUI$UpdateHandler,alignmentX=0.0,alignmentY=0.0,border=javax.
    swing.plaf.BorderUIResource$CompoundBorderUIResource@aa9835,flags=296,
    maximumSize=,minimumSize=,preferredSize=,caretColor=javax.swing.plaf.
    ColorUIResource[r=51,g=51,b=51],disabledTextColor=javax.swing.plaf.
    ColorUIResource[r=184,g=207,b=229],editable=true,margin=javax.swing.plaf.
    InsetsUIResource[top=0,left=0,bottom=0,right=0],selectedTextColor=javax.
    swing.plaf.ColorUIResource[r=51,g=51,b=51],selectionColor=javax.swing.
    plaf.ColorUIResource[r=184,g=207,b=229],columns=0,columnWidth=0,command=,
    horizontalAlignment=LEADING]

    I'm not sure I understand "commonly permanent". All
    three can be easily changed (and often are changed).This is not true in my experience. Button text is and should be
    relatively static. The same is true of labels. I respectfully submit
    that if this is not the case, you have UI design issues you need to
    address.
    The getText() method is not available in the example
    I showed (evt.getComponent()) which I am trying to
    use to identify which component from within a custom
    bean an event is coming from. It works for JButton
    and JLabel but not for JTextField. Probably there is
    a more elegant way of doing this, but I haven't
    figured it out.If you're trying to identify a component based on the text it
    contains, you need to rethink your design.
    If jTextField1.toString() doesn't show the "text="
    field, then it really isn't converting all of
    jTextField1 to a string.The API makes no such promise. The API promises it will return
    "a string representation of the object." There is no guarantee of
    completeness.

  • Probably Simple XML toString

    I've been trying to convert an xml document to a string, but I'm having a problem converting. I'm reading the XML from a file.
    Document document = builder.parse(new File(filename));
    And I'm sure that works. I can parse the result. But then I try to return what I've read using:
    return (document.toString());
    Every attempt I've made at using toString() has failed; even when I just try to write it out. What's the trick?

    I don't think that is right way of doing it, try it out this way:
    Document document;
    TransformerFactory tFactory =
                    TransformerFactory.newInstance();
                            Transformer transformer = tFactory.newTransformer();
                DOMSource source = new DOMSource(document);
                StringWriter sw=new StringWriter();
                StreamResult result = new StreamResult(sw);
                transformer.transform(source, result);
    String xmlString=sw.toString();Message was edited by:
    java_queen

  • ToString() and equals() HELP!

    Hi, this is my prompt:
    Create an abstract class named Vacation that contains data fields (instance variables)
    ; a string variable; destination and a double variable; budget. Use an overloaded constructor, to allow client to set beginning values for destination and budget. That means the constructor takes two parameters, and calls two mutator methods one allowing the client to set new destination value for the vacation, and the next one to allow the client to set the new budget for the vacation. Furthermore this class contains accessor methods, one for returning the name of the destination of the vacation, and the other for returning the budget of the vacation. The class also holds two more methods, one is a toString( ), to return a string representation of the vacation, and an equals( ) method to compare two Vacation objects for the same vacation field value. Finally, the class has an abstract method that computes how much the vacation is over or under budget. That means returning by how much the vacation is over or under budget.
    I've got this so far:
    public abstract class Vacation
        public String destination;
        public double budget;
        public Vacation()
            destination = "";
            budget = 0;
        public Vacation(String destination, double budget)
            this.destination = destination;
            this.budget = budget;
        public String getDestination()
            return destination;
        public void setDestination(String destination)
            this.destination = destination;
        public double getBudget()
            return budget;
        public void setBudget(double budget)
            this.budget = budget;
        public String toString()
            return destination;
    }could anyone tell me how to write a toString()/equals() method?

    Is this correct??? the original code is on the first
    post...
    also, i'm not sure if my toString() has all the
    return values. I'm kind of confused by the wording of
    the instructions and I don't know what a "string
    representation of a vacation" quite means.It means whatever you want it to mean. You've decided it means the value of the destination field. You did the same in your attempt at overriding the equals method from the Object class, so you're consistent (that's good). But the equals method has the signature public boolean equals(Object o), the parameter type is Object, not String - so you'll need to change that and cast the parameter to be of type String (if that's what you really want - but I would think you'd want to be comparing Vacation objects, not String objects for equality). And I would think (but it's completely up to you) that you'd work the "budget" field's value into these methods somewhere (as suggested in a previous post) but again, it's completely up to you - I think that once you change the equals method signature you'll have satisfied the letter of the requirements.
            public boolean equals(String
    destination)
    if(this.destination.equals(destination))
    return true;
    else
    return false;
    code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Sdoutl.jar WKT bug

    Hi, using the WKT class, we ran into the following issue where if you call WKT.toJGeometry() it chokes on scientific notation like this: POLYGON ((-8.2907617E8 4.2403891E8, -8.2907617E8 4.2403891E8, -8.2907617E8 4.2403891E8, -8.2907617E8 4.2403891E8, -8.2907617E8 4.2403891E8))
    <p>
    As you can see, the wkt string has scientific notation in it. This is slightly odd, since we created the wkt byte[] from the WKT class itself by using WKT.fromJGeometry()
    <p>
    This means the round-trip between WKT and JGeometry does not appear to work.
    <p>
    This is easily reproducible with the following code:
    <p>
    JGeometry jGeometry = new JGeometry(-829076170, 424038910, -829076170, 424038910, 8307);
    WKT wkt = new WKT();
    byte[] bytes = wkt.fromJGeometry(jGeometry);
    for(byte b : bytes) { System.out.print((char)b); }
    JGeometry roundTrip = wkt.toJGeometry(bytes);  // <- THROWS EXCEPTION<p>
    The stack trace is:
    <p>
    java.lang.RuntimeException: -3
         at oracle.spatial.util.WKT$WKTInputStream.readDouble(WKT.java:137)
         at oracle.spatial.util.WKBasis.readDouble(WKBasis.java:1311)
         at oracle.spatial.util.WKBasis.toJGeometry_WKB_XXXPOLYGON(WKBasis.java:1270)
         at oracle.spatial.util.WKBasis.toJGeometry_WKB_POLYGON(WKBasis.java:1218)
         at oracle.spatial.util.WKBasis.toJGeometry(WKBasis.java:937)
         at oracle.spatial.util.WKBasis.toJGeometry(WKBasis.java:894)

    While this still seems to be a bug in the WKT class, the coordinates we were using were in an int format, and we were not properly transposing them to degrees. They needed a division by 10^7, so when we do that, this problem goes away for us...however, even if the coordinates as listed are not seemingly valid earth coordinates for SRID 8307, it still seems like the WKT parser should be able to properly handle java's toString on Doubles with scientific notation.

  • How to get the original query string in an event receiver when dialogs are enabled

    I have scenario where I am adding a document to a document library which has an external data column on it. My goal for this column is to have it automatically populated with an appropriate value based on original query string to the page. The general
    idea is that I am on a custom page that has various webparts on it including a view of my document library that is context sensative based on the query string, and I want to use that context sensitivity not just to filter the list but also when adding documents.
    I have been searching around for solutions to this problem all day and have gotten this far:
    I have an event receiver attached to my document library that handles the ItemAdded event syncronously (as such I have the new list item available to me). In that event receiver I am able to set the column values as required. Where I am stuck is on getting
    the value from the query string that I need to actually set as the column value.
    Based on:
    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/8cfcb299-9a55-4139-86ec-0b53b2922a54 and several similar articles/posts I have been able to get the original source Url with the query string I want via the following
    code in my event receiver:
    private HttpContext context;
    public EventReceiver1()
    context = HttpContext.Current;
    public override void ItemAdded(SPItemEventProperties properties)
    var originalQueryString = context.Request.QueryString["Source"];
    // Parse the query string and use the value ...
    The problem is that this solution breaks down if the dialogs are turned on under the advanced settings for the list. The reason the solution fails is because the "Source" query string parameter goes away and is replaced by "IsDlg" set to a value of "1".
    Does anyone know how to get past this hurdle? Any help would be greatly appreciated.

    Hi Stuart,
    The reason I'm looking for "Source" in the query string is because that is something I found to be reliable when the Dialogs are turned off. I've dug around pretty deep in the Request object to see if anything had the data I was looking for and unfortunately
    it doesn't appear to be there. The
    context.Request.QUeryString.ToString()
    returns a rather simple one of:
    List=%7b43ECDCB0-8440-4652-B067-AA20481779D7%7d&RootFolder=&IsDlg=1
    and the
    context.Request.UrlReferrer.Query.ToString()
    has the same value.
    I suspect this is due to the dual step process that takes place in adding an item to a document library where the first modal popup (which I suspect likely has the information I need) gives you the opportunity to browse to your file and then the second
    dialog (maybe this is getting brought up as a result of another request which is now referring back to the original request that brought up the first dialog?) where you edit your properties.
    Thanks for the try though, if you've got anything else I'd love to hear it.

  • How to show only all children of selected node in JTree??

    Dear friends:
    I have Two Panels, PA and PB,
    PA has a Jtree as code below, and PB listens to PA,
    I hope to do following,
    If I select a node called A in PA, then Node A's all children such as A1, A2, A3 will be displayed in PB, but not display A1, A2, A3's children such as A3 has C1, C2, C3, C4 & C5, until I select A3 then PB will display only all A3's children: C1, C2, C3, C4 & C5;
    i.e, only populate each ONE level of children of Node A or any node I select, not its grandchildren and its grand-grand children;
    Please help how to do it??
    I tried amny times, failed.
    Thanks
    [1]. PA panel code:
    package com.atest;
         import java.awt.BorderLayout;
         import java.awt.event.MouseAdapter;
         import java.awt.event.MouseEvent;
         import java.util.Enumeration;
         import java.awt.Dimension;
         import javax.swing.JFrame;
         import javax.swing.JPanel;
         import javax.swing.JScrollPane;
         import javax.swing.JTextField;
         import javax.swing.JTree;
         import javax.swing.tree.DefaultMutableTreeNode;
         import javax.swing.tree.TreeModel;
         import javax.swing.tree.TreePath;
         public class DefaultMutableTreeMain extends JPanel {
         protected DefaultMutableTreeNode    top = new DefaultMutableTreeNode("Options");
         protected DefaultMutableTreeNode      selectedNode = null;
         protected final JTree tree;
         protected final JTextField jtf;
        protected Enumeration      vEnum = null;
         private      TreeModel                m;
         protected  DefaultMutableTreeNode      getDefaultMutableTreeNode()  {
              //textArea.getText();
                   return selectedNode;
         protected  DefaultMutableTreeNode setDefaultMutableTreeNode(DefaultMutableTreeNode tt)  {
              //textArea.getText();
                   selectedNode = tt;
                   return selectedNode;
         protected  TreeModel getJTModel()  {
              //textArea.getText();
                   return m;
         protected  TreeModel setJTModel(TreeModel ta)  {
                   m = ta;
                   return m;
           public DefaultMutableTreeMain() {
             setSize(300,300);
             setLayout(new BorderLayout());
             DefaultMutableTreeNode a = new DefaultMutableTreeNode("A");
             top.add(a);
             DefaultMutableTreeNode a1 = new DefaultMutableTreeNode("A1");
             a.add(a1);
             DefaultMutableTreeNode a2 = new DefaultMutableTreeNode("A2");
             a.add(a2);
             DefaultMutableTreeNode a3 = new DefaultMutableTreeNode("A3");
             a.add(a3);
             DefaultMutableTreeNode b = new DefaultMutableTreeNode("B");
             top.add(b);
             DefaultMutableTreeNode b1 = new DefaultMutableTreeNode("B1");
             b.add(b1);
             DefaultMutableTreeNode b2 = new DefaultMutableTreeNode("B2");
             b.add(b2);
             DefaultMutableTreeNode b3 = new DefaultMutableTreeNode("B3");
             b.add(b3);
             DefaultMutableTreeNode c = new DefaultMutableTreeNode("C");
             a3.add(c);
             DefaultMutableTreeNode c1 = new DefaultMutableTreeNode("C1");
             c.add(c1);
             DefaultMutableTreeNode c2 = new DefaultMutableTreeNode("C2");
             c.add(c2);
             DefaultMutableTreeNode c3 = new DefaultMutableTreeNode("C3");
             c.add(c3);
             DefaultMutableTreeNode c4 = new DefaultMutableTreeNode("C4");
             c.add(c4);
             DefaultMutableTreeNode c5 = new DefaultMutableTreeNode("C5");
             c.add(c5);
             tree = new JTree(top);
             JScrollPane jsp = new JScrollPane(tree);
             jsp.setPreferredSize(new Dimension(400,300));
             add(jsp, BorderLayout.CENTER);
             jtf = new JTextField("", 20);
             add(jtf, BorderLayout.SOUTH);
               tree.addMouseListener(new MouseAdapter() {
               public void mouseClicked(MouseEvent me) {
                  TreePath   path = tree.getSelectionPath();
                  DefaultMutableTreeNode      selectedNode = (DefaultMutableTreeNode)path.getLastPathComponent();
                 TreePath tp = tree.getPathForLocation(me.getX(), me.getY());
                 setDefaultMutableTreeNode(selectedNode);
                     System.out.println("Current node selected is (tp.toString()=" + tp.toString());
                     System.out.println("Current node selected is getDefaultMutableTreeNode()=" + getDefaultMutableTreeNode());
                 if (tp != null){
                     jtf.setText(tp.toString());
                      System.out.println("It Has Children as selectedNode.getChildCount()= " + selectedNode.getChildCount());
                            Enumeration vEnum = selectedNode.children();
                                int i = 0;
                                while(vEnum.hasMoreElements()){
                                    System.out.println("2 selectedNode = " +  path.toString() + "  has " + i++ + " Children in vEnum.nextElement(" + i + ") = " + vEnum.nextElement());
                 else
                   jtf.setText("");
           public static void main(String[] args) {
             JFrame frame = new JFrame();
             frame.getContentPane().add(new DefaultMutableTreeMain());
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             frame.setSize(400, 400);
             frame.setVisible(true);
         }[2]. PB Panel code
    package com.atest;
    import java.awt.BorderLayout;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.JPanel;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.tree.*;
    import javax.swing.JButton;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.TreePath;
    public class DefaultMutableTreeSub extends JPanel implements java.io.Serializable{
      private JButton removeButton;
      private JButton addButton;
      JTree tree;
      private TreeModel      m;
      protected TreeDragSource ds;
      protected TreeDropTarget dt;
    protected  TreeModel getJTModel()  {
              //textArea.getText();
                   return m;
    protected  TreeModel setJTModel(TreeModel ta)  {
                   m = ta;
                   return m;
    protected DefaultTreeModel model;
    protected DefaultMutableTreeNode rootNode;
    DefaultMutableTreeMain dmm = null;
    JPanel inputPanel  = new JPanel();
      public JPanel SLTreeDNDEditableDynamic(DefaultMutableTreeMain tdnd ) {
        //super("Rearrangeable Tree");
        setSize(400,450);
        dmm = tdnd;
             setLayout(new BorderLayout());
             inputPanel.setLayout(new BorderLayout());
             JPanel outputPanel = new JPanel();
             System.out.println("Sub selectedNode tdnd= " + tdnd);
             tdnd.tree.addTreeSelectionListener(new TreeSelectionListener(){
                  public void valueChanged(TreeSelectionEvent evt){
                  TreePath[] paths = evt.getPaths();
                  TreePath   path = dmm.tree.getSelectionPath();
                  DefaultMutableTreeNode      selectedNode = (DefaultMutableTreeNode)path.getLastPathComponent();
                 DefaultMutableTreeNode itemNode = dmm.getDefaultMutableTreeNode();
                     System.out.println("Sub node selected is dmm.getDefaultMutableTreeNode()=" + dmm.getDefaultMutableTreeNode());
                  model = new DefaultTreeModel(itemNode);
                  tree = new JTree(model);
                  System.out.println("Sub selectedNode paths= " + paths);
                  System.out.println("Sub selectedNode path= " + path);
                  System.out.println("Sub selectedNode = " + selectedNode);
                  System.out.println("Sub itemNode = " + itemNode);
                  tree.putClientProperty("JTree.lineStyle", "Angled");
                  tree.setRootVisible(true);
                   inputPanel.add(new JScrollPane(tree),BorderLayout.CENTER);
             return inputPanel;
         public DefaultMutableTreeSub() {
              super();
    }thanks
    sunny

    Thanks so much, I use your code and import followig:
    import java.util.ArrayList;
    import java.awt.List;
    but
    private static List<Object> getChildNodes(JTree j) {
         Object parent = j.getLastSelectedPathComponent();
         int childNodeCount = j.getModel().getChildCount(parent);
         List<Object> results = new ArrayList()<Object>;
         for (i = 0; i < childNodeCount; i++) {
              results.add(parent, i);
         return results;
    here List<Object> and ArrayList()<Object> show red,
    Is my JDK version problem??
    my one is JKD
    C:\temp\swing>java -version
    java version "1.4.2_08"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
    Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)
    Error as follows:
    C:\temp\swing>javac DefaultMutableTreeSub.java
    DefaultMutableTreeSub.java:38: <identifier> expected
    private static List<Object> getChildNodes(JTree j) {
    ^
    1 error
    any idea??
    Thanks

  • Reader 10.0 Printing Problem - Font changing while printing

    Dear all,
    can anybody help me on my printing problem with Adobe Reader 10.0 ?
    While printing a pdf I cannot do anything else, it is not possible to touch the mouse
    because when I do this, the font is changing while printing to something like grecian.
    Can somebody help me on this ?
    Reader 9 did not cause this problem.
    Thanx and best Regards, Travelplan24

    I have the same problem, but I didn't realize it could be set off by my working on another task. It is also triggered when the pdf has scientific notation, or a very extreme change in font and font size. E.g., text in boxes, algorithms, etc. seem to trigger the problem.
    I have reinstalled my print driver (several times, latest on Sunday), and reinstalled Adobe Reader (now 10.0.1) but the problem remains.
    Printer:
    HP Officejet 6500 (E709n Series) wireless, now on USB.
    Document properties: Most recent font conversion - yesterday:
    Producer: Distiller 4.0.2 for Mac
    PDF version: 1.3 (Acrobat 4.x)
    Fonts: Helvetica-Neue, Type 1, Encoding: ANSI and Roman
    The font is not converting into Greek. E.g. "Problem-Solving Process" became "Qspcrfm . Tpnwjoh!Qspdftt"' with the kerning overlapping characters.
    The font 'conversion' has happened many, many times on a wide variety of pdf files in the past 6 months. Never had the problem before. I had downloaded new Reader, and purchased the new printer -- I do not know which change created the problem.
    I will cease doing anything when I print as a temporary workaround, but that is not a good solution.
    I sure hope you can figure out what the bug is. Thanks in advance.

  • "File Repository Server error" when trying to commit a new CrystalEnterprise.Program instance to the InfoStore

    I've run into an issue where saving a new CrystalEnterprise.Program instance is throwing an ambiguous exception with no other information than a generic HRESULT code and the even less useful error message "File Repository Server error". I've debugged the code using the COMException managed debugging assistant and Reflector to get to the callsite of the COM object, but there is nothing there to indicate what the actual File Repository error is attributed to. Logging for the InputFileRepository service in the CMS was been set to HIGH, but nothing shows there as a result of my code executing.
    The call to myInfoStore.Commit(...) is where the COMException is thrown.
        protected void CreateProgramObject(InfoStore infoStore)
            using(PluginManager pluginManager = infoStore.PluginManager)
                using(InfoObjects newCollection = infoStore.NewInfoObjectCollection())
                    using(PluginInfo programPlugin = pluginManager.GetPluginInfo("CrystalEnterprise.Program"))
                        using(Program tempProg = (Program)newCollection.Add(programPlugin))
                            const string USER_FOLDER_QUERY =
                                "Select SI_ID From CI_INFOOBJECTS Where SI_NAME = '[email protected]'";
                            using(InfoObjects folders = infoStore.Query(USER_FOLDER_QUERY))
                                if(folders.Count < 1)
                                    Response.Write("No user folder was found!");
                                    return;
                                using(InfoObject userReportFolder = folders[1])
                                    tempProg.Title = "Scheduled File";
                                    tempProg.Description = "My new program";
                                    tempProg.ParentID = userReportFolder.ID;
                                    tempProg.ProgramType = CeProgramType.ceScript;
                                    tempProg.Files.Add(@"E:\sample.bat");
                                    try
                                        infoStore.Commit(newCollection);
                                    catch(SystemException snx)
                                       Trace.Write(snx.ToString());
    Has anyone run into this issue and found a resolution?

    Thank you for the reply. I changed the file path on the BOE Server to match the path I'm using in the Files.Add(...) call. At least now I get a different error message, but it's still not enough to resolve the issue. The message is "File Repository Server error : File system operation for D:\Scripts\test.bat on File Repository Server failed.  If the problem persists, please contact your system administrator for event log information." I verified the service account the SIA service runs under can access that path, but still no luck.
    Using a UNC path resulted in the original "File Repository Server error" message in the Exception.

  • JTree - node text doesn't fit when shown with icon

    When I start off my JTree with a long string text for the node (without any icon...used setLeafIcon( null )... it displays fine. But during the execution of hte program an icon may appear next to a particular node - but when this happens, the icon displays fine and the text of the node is cut off (you just see a couple letters followed by the usual "...").
    Any ideas?

    Thanks for the reply. I am not sure how to use that for what I'm doing...basically I am writing an AIM clone. And when a user sets an away message, I want an icon to appear next to their name, otherwise the icon is set to null. Here is the code I have right now for my tree cell renderer class (the tree class is a basic tree):
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.tree.*;
    import javax.swing.text.*;
    import java.util.*;
    import java.io.*;
    class MyTreeCellRenderer extends DefaultTreeCellRenderer {
         * Handle to the ClientTree.
        ClientTree clientTreeObj;
         * Constructor.
        public MyTreeCellRenderer( ClientTree ct ) {
            clientTreeObj = ct;
         * Gets the cell renderer for the current object
         * in the tree.
        public Component getTreeCellRendererComponent(
            JTree tree,
            Object value,
            boolean sel,
            boolean expanded,
            boolean leaf,
            int row,
            boolean hasFocus) {
        super.getTreeCellRendererComponent(
            tree, value, sel,
            expanded, leaf, row,
            hasFocus);
        // if we are at the root, take away the icons and set
        // the appropriate font.
        if (!leaf) {
            setClosedIcon( null );
            setOpenIcon( null );
            setToolTipText( null );
            setFont( new Font( "SansSerif", Font.BOLD, 14 ) );
        // we are at a leaf, so set the tooltip to be the username and
        // set the appropriate font.
        else {
            // make sure we are not at the "Users" node
            if ( !value.toString().equals( "Users" ) ) {
                // if the client has an away message, set the icon to a note icon
                if ( clientTreeObj.getJCC().getClientAwayMessage( value.toString() ).length() > 0 ) {
                    System.out.println( value.toString() + ": has a message..." );
                    setLeafIcon( new ImageIcon( "C:/JavaChat/JavaClient/images/message.jpg" ) );
                    ((DefaultTreeModel)tree.getModel()).nodeChanged((DefaultMutableTreeNode)tree.getPathForRow(row).getLastPathComponent() );
                    //tree.fireTreeExpanded( tree.getPathForRow( row ) );
                else {
                    setLeafIcon( null );
                    //tree.fireTreeExpanded( tree.getPathForRow( row ) );
                // get the connection time for the selected user
                // I TOOK OUT THE CODE TO CALCULATE THE TIME BECAUSE IT IS UNIMPORTANT AND LONG :)
                // set the tooltiptext to include the username and the online time
                String tooltip = " " + value.toString() + '\n' + "   Online time:" + '\t';
                    // days
                    if ( days > 0 ) {
                        if ( days == 1 )
                            tooltip += days + " day, ";
                        else
                            tooltip += days + " days, ";
                    // hours
                    if ( hours > 0 ) {
                        if ( hours == 1 )
                            tooltip += hours + " hour, ";
                        else
                            tooltip += hours + " hours, ";
                    // minutes (we always print at least 1)
                    if ( minutes > 1 )
                        tooltip += minutes + " minutes ";
                    else
                        tooltip += minutes + " minute ";
                    setToolTipText( tooltip );
                    setFont( new Font( "SansSerif", Font.PLAIN, 14 ) );
            return this;
        } // end getTreeCellRendererComponent
    } // end class MyRenderer

  • Using Icloud with Outlook 2007 and windows 7, I cannot get my calendar to list the scheduled appointments as it used to do before I cloud.  The to do bar just shows no upcoming appointments when my calendar is filled with them.  How do I fix this

    Since using ICloud with Office 2007 and Windows 7, the to-do-list will not show any appointments.  If has the notation that no appointments are available?  My calendar is full of appointments.  How do I correct this?

    I don't have a password on my phone. After attaching the phone to the Windows 7 computer, my DCIM folder is always empty. Here's the solution:  While the phone is plugged in to the computer, pick it up and select the Photos application. A dialog box appears and asks if you trust this computer. Obviously, select the "Trust" option. Then the photos will download. If you have a password on your phone, I'm guessing you have to enter it before you open the photo application.

  • Urgent java problems

    Ok here's my situation... I'm having to catch up in my software development class at university, missed a few lessons so now I'm finding it incredibly difficult.
    I'm working through a bluej book 'Objects First with Java' and as much as I'd like to sit and work each question out, it is taking me far too long and I'm not gonna manage so this will probably be the first post of many.
    So here's where I am
    (pg. 110, ex. 4.28)
    It's a simple auction program that lets you create a bidder, a lot(something to bid on), an auction and of course the ability to bid.
    What I'm being asked...
    Add a close method to the Auction class. This should iterate over the collection of lots and print out details of all the lots. You can use either a for-each loop or a while loop. Any lot that has had at least one bid for it is considered to be sold. For lots that have been sold, the details should include the name of the successful bidder, and the value of the winning bid. For lots that have not been sold, print a message that indicates this fact.
    import java.util.ArrayList;
    import java.util.Iterator;
    * A simple model of an auction.
    * The auction maintains a list of lots of arbitrary length.
    * @author David J. Barnes and Michael Kolling.
    * @version 2008.03.30
    public class Auction
        // The list of Lots in this auction.
        private ArrayList<Lot> lots;
        // The number that will be given to the next lot entered
        // into this auction.
        private int nextLotNumber;
         * Create a new auction.
        public Auction()
            lots = new ArrayList<Lot>();
            nextLotNumber = 1;
         * Enter a new lot into the auction.
         * @param description A description of the lot.
        public void enterLot(String description)
            lots.add(new Lot(nextLotNumber, description));
            nextLotNumber++;
         * Show the full list of lots in this auction.
        public void showLots()
            for(Lot lot : lots) {
                System.out.println(lot.toString());
         * Bid for a lot.
         * A message indicating whether the bid is successful or not
         * is printed.
         * @param number The lot number being bid for.
         * @param bidder The person bidding for the lot.
         * @param value  The value of the bid.
        public void bidFor(int lotNumber, Person bidder, long value)
            Lot selectedLot = getLot(lotNumber);
            if(selectedLot != null) {
                boolean successful = selectedLot.bidFor(new Bid(bidder, value));
                if(successful) {
                    System.out.println("The bid for lot number " +
                                       lotNumber + " was successful.");
                else {
                    // Report which bid is higher.
                    Bid highestBid = selectedLot.getHighestBid();
                    System.out.println("Lot number: " + lotNumber +
                                       " already has a bid of: " +
                                       highestBid.getValue());
         * Return the lot with the given number. Return null
         * if a lot with this number does not exist.
         * @param lotNumber The number of the lot to return.
        public Lot getLot(int lotNumber)
            if((lotNumber >= 1) && (lotNumber < nextLotNumber)) {
                // The number seems to be reasonable.
                Lot selectedLot = lots.get(lotNumber - 1);
                // Include a confidence check to be sure we have the
                // right lot.
                if(selectedLot.getNumber() != lotNumber) {
                    System.out.println("Internal error: Lot number " +
                                       selectedLot.getNumber() +
                                       " was returned instead of " +
                                       lotNumber);
                    // Don't return an invalid lot.
                    selectedLot = null;
                return selectedLot;
            else {
                System.out.println("Lot number: " + lotNumber +
                                   " does not exist.");
                return null;
        public void close(){
            Iterator<Lot> it = lots.iterator();
            for(Lot lot : lots){
            if(lots.contains(null)){
                System.out.println(lot.toString() + " has not been sold.");
    }I know my 'close' method is a bit shoddy and doesn't utilise the iterator yet but I tested it and it compiled ok but nothing happened :/
    Is the for-each loop a wise move? Ideas would be greatly appreciated! I tried a while loop first but wasn't really getting anywhere. One of my many problems in this is that I don't really understand where the methods I'm calling from are coming from either, I really don't have a good base understanding of the language :( for instance lots.toString() where does the .toString come from, thats an arraylist method then yeah?
    I am feeling that the book is going pretty fast, some questions are fairly simple then suddenly I feel like it's never even taught me enough to even work a question out on my own - obviously just starting out at programming though so it may be completely obvious but if you don't know it you don't know it :/
    Anyway folks I hope you can help as, like I said, it's pretty important to me and I don't know how the forum works but if I'm the one that will have the power to award the points for an answer then I will deal them out appropriately.
    Cheers
    Edited by: jpjenkins on Nov 14, 2008 2:00 AM

    jpjenkins wrote:
    Wow what a nice introduction to the forum.
    My time management skills are good, thanks for the advice though. We must have a different notion of what the word "good" means...
    But how can I be 'all high an mighty' It sounded like you were doing us a favor by handing out some forum/duke points/stars while you are the one looking for help.
    when I said I don't know how the forum works, sounds like you've got a complex man, was just trying to let peeps know I was going to be fair.Wow, your assessment of my psychic state is impressive! By studying your two posts here, I conclude you're a lazy twit.
    I do apologise however, I wrote this after 3 hours of studying and my stress must have transferred into the post.Then study some more!
    To the point: "I tested it and it compiled ok but nothing happened :/ " - I just wanted to know where I had gone wrong in the close method as I expected it to print out a lot that doesn't have a bid on it.
    I have worked through the book at a steady pace, I simply don't have the luxury to sit and work out where I had gone wrong in each question, sorry if I misled you into thinking I expected you to do it for me, these aren't necessary questions for me to do, they're just giving me a good grounding for my project which has to be handed in on the 5th of December. Trying to speed my workrate up by getting advice on my shoddy code.
    Hope someone can helpI still don't see a specific question.

  • How do I copy over "Created By" & "Modified By" field values to a new library, using PowerShell?

    I have a site that was migrated from SP 2007 to 2013, using a docave tool...this works fine and everything seems to be okay. However I now have to move documents from one Library to a new one, along with all associated metadata. I have a PowerShell script
    I am using to do this and it is working...for the most part...except for copying the authoring metadata. So when I run this PowerShell script, I get my "Created By" and "Modified By" fields updated with the "WindowsAccount" user
    account that performed the migration. This is what is confusing to me...after the migration, when I look at my Library, these fields are displayed correctly. Meaning I have documents that were created by John Smith, and modified by Jane Smith, showing up with
    the right metadata in the library after migration...but when I run my script to copy the documents to a new library, the output is not John Smith or Jane Smith but the "windowsAccount" user that performed the migration. Here is what my script looks
    like, in trying to get the right values to show.
    $sWeb = Get-SPWeb $SourceWebURL
    $sList = $sWeb.Lists | ? {$_.Title -eq $SourceLibraryTitle}
    $dWeb = Get-SPWeb $DestinationWebURL
    $dList = $dWeb.Lists | ? {$_.title -like $DestinationLibraryTitle}
    $AllFolders = $sList.Folders
    $RootFolder = $sList.RootFolder
    $RootItems = $RootFolder.files
    foreach($RootItem in $RootItems){
    $sBytes = $RootItem.OpenBinary()
    $dFile = $dList.RootFolder.Files.Add($RootItem.Name, $sBytes, $true)
    $AllFields = $RootItem.Item.Fields | ? {!($_.sealed)}
    $User = $sWeb.EnsureUser($RootItem.Author)
    $UserField = New-Object Microsoft.SharePoint.SPFieldUserValue($sWeb,$User.ID,$User.LoginName)
    write-host "User's Name: "$UserField.User.Name.ToString()
    Has anyone experienced something like this before? If so, what is causing this and how can I get my script to start displaying the right data for "Created By" and "Modified By"?
    Thanks,

    This is the expected behavior. Both "Created By" (internal name Author) and "Modified By" (internal name Editor) will be set to the user running the script. In order to update theses fields in the destination item with the values present
    in source item, the script needs to be modified. Read the values of these fields in source and update them in destination using SplistItem.SystemUpdate() method, like:
    $Author = $sWeb.EnsureUser($RootItem.Author) $Editor = $sWeb.EnsureUser($RootItem.Editor) $destinationItem["Author"] = $Author$destinationItem["Editor"] = $Editor$destinationItem.SytemUpdate()
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • How to read "Customixed Information" in UME using WebDynpro Java APIs

    Dear All
    In our Portal UME we have defined 3 custom fields that appear in the "Customized Information"
    tab in the standard Portal "Identity Mangagement" application ie:
    krb5principalname :
    How can I retrieve the custom fields and values using WebDynpro APIs?
    I have the following basic code to retrieve the standard user session information, but
    do not know how to extend it to extract the values of the custom fields.
    Full points will be awarded to whoever answers question with suggestion that works.
    Many thanks in advance
    Mike

    Hi Mike,
    Following code is for just one custom attribute <custom attribute>
                                  String namespaces[] = umeUser.getAttributeNamespaces();
                                  String ns = null;
                                  for (int i = 0; i < namespaces.length; i++) {
                                       if (i > 0)
                                            ns = namespaces[ i ];
                                       String attrNames[] = umeUser.getAttributeNames(ns);
                                       if (ns != null){                                   
                                   if(ns.equals("<name-space>")){     
                                       for (int j = 0; j < attrNames.length; j++) {
                                            if(attrNames[j].equals("<custom attribute>")){                                        
                                                 Object attr[] = umeUser.getAttribute(ns, attrNames[j]);
                                                 for (int k = 0; k < attr.length; k++){
                                                      if(!(null == attr[k])|| !(attr[k].toString().length() == 0)){                                                  
                                                           //attr[k].toString() has the custom attribute value
                                                      break;
                                            }else
                                                 continue;               
                                   }else
                                       continue;
    Where <name-space> is the same value you set in config tool or on portal UME configuration.
    Config Tool: Global Service Configuration>services->com.sap.security.core.ume.service>ume.virtual_groups.user_attribute.namespace
    Portal
    System Administration>System Configuration>UME configuration> User Admin UI tab>
    Custom attributes of the user profile
    Administrator-Managed Custom Attributes: add ;<name-space>:<custom-attribute>
    Hope this helps

  • SimpleDateFormat

    I have a quick question about SimpleDateFormat. Here's a bit of code:
    Calendar cal = Calendar.getInstance();
    java.util.Date date = cal.getTime();
    String myDate = DateFormat.getDateInstance().format(date);
    SimpleDateFormat goformat = new SimpleDateFormat("MMM d, yyyy");
    // I am catching this Exception, but left it off here
    java.util.Date Date1 = goformat.parse(myDate);
    System.out.println(myDate);
    System.out.println(Date1);This is the output I am getting:
    Jun 21, 2005 // I have the date on my computer in this format
    Tue Jun 21 00:00:00 CDT 2005
    Why isn't Date1 the same? Should I change myDate into numbers, i.e. 6/21/2005, and then parse it?
    Thanks

    They are the same. You specified a certain formatting for the String in your SimpleDateFormat initializer. Then, you printed that exact formatting. Date.toString() has its own formatting. You can verify this by trying:
    static final public void main(final String[] args) {
            try {
                 Date date = new Date();
                 Calendar calendar = Calendar.getInstance();
                 calendar.setTime(date);
                 SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd kk:mm:ss zzz yyyy");
                 System.out.println(formatter.format(date));
                 System.out.println(date.toString());
             catch (Throwable e) {     
                 e.printStackTrace();
        }- Saish

Maybe you are looking for

  • Using additional jars in portal (jregex1.2_01.jar ) and use of javabeans

    Hi I want to use code that parses regular expressions with java and to that end I would like to use jregex1.2_01.jar (if there is a native jar file in oracle that does the same, that woule be good, but I could not find anything that refers to regex o

  • SRW2024 rebooting every 50 days

    HELLO WORLD We have two SRW2024 which has a strange behavior. both of them rebooting exactly every 50 days.we face everytime a short outage of the network traffic. Model Name   SRW2024  Hardware Version   00.03.00  Boot Version   1.0.1  Firmware Vers

  • Avi to flv converter?

    Hi, I've been trolling the internet for a 100% free video converter, not something that's freeware/shareware but requires a license. I have a big need to convert my avi's and mp4's into flv so that they don't eat up as much of my sites bandwidth a mo

  • (Finding and) deleting virtual copies

    Hi. Somehow I have managed to create virtual copies of 1000 or so photos. This happened (I believe) while trying to clean up a collection folder. So what I want to do now, is to sort out - and isolate? - the virtual copies created accidently. I tried

  • Image map problem in Firefox 2.0.0.9

    I have created a page in Dreamweaver with an image that has an image map with six links. It works correctly in IE, Safari, and Opera, but Firefox 2.0.0.9 has an issue. When I click on the top link, I get the second url. When I click on the second, I