String.replaceAll strange behavior...

I have found strange behavior of String.replaceAll method:
"aaaabaaaa".replaceAll("b","a"); // working fine
"aaaabaaaa".replaceAll("b","a${"); // throws an exceptionThat could be probably a bug?
p.s. using jdk_1.6.0_12-b04

Welcome to the Sun forums.
>
"aaaabaaaa".replaceAll("b","a${"); // throws an exception
Please always copy/paste the [exact error message|http://pscode.org/javafaq.html#exact]. We do not have crystal ball, and cannot see the output on your PC.
>
That could be probably a bug? >(chuckle) It has more to do with special characters in Strings, that need to be escaped. I am not up on the fine details, but try this code.
import javax.swing.*;
class TestStringReplace {
  public static void main(String[] args) {
    String result = "aaaabaaaa".replaceAll("b","c"); // working fine
    JOptionPane.showMessageDialog(null, result);
    result = "aaaabaaaa".replaceAll("b","c\\${"); // chars escaped
    JOptionPane.showMessageDialog(null, result);
}

Similar Messages

  • Strange behavior of std::string find method in SS12

    Hi
    I faced with strange behavior of std::string.find method while compiling with Sunstudio12.
    Compiler: CC: Sun C++ 5.9 SunOS_sparc Patch 124863-14 2009/06/23
    Platform: SunOS xxxxx 5.10 Generic_141414-07 sun4u sparc SUNW,Sun-Fire-V250
    Sometimes find method does not work, especially when content of string is larger than several Kb and it is needed to find pattern from some non-zero position in the string
    For example, I have some demonstration program which tries to parse PDF file.
    It loads PDF file completely to a string and then iterately searches all ocurrences of "obj" and "endobj".
    If I compile it with GCC from Solaris - it works
    If I compile it with Sunstudio12 and standard STL - does not work
    If I compile it with Sunstudio12 and stlport - it works.
    On win32 it always works fine (by VStudio or CodeBlocks)
    Is there any limitation of standard string find method in Sunstudio12 STL ?
    See below the code of tool.
    Compilation: CC -o teststr teststr.cpp
    You can use any PDF files larger than 2kb as input to reproduce the problem.
    In this case std::string failes to find "endobj" from some position in the string,
    while this pattern is located there for sure.
    Example of output:
    CC -o teststr teststr.cpp
    teststr in.pdf Processing in.pdf
    Found object:1
    Broken PDF, endobj is not found from position1155
    #include <string>
    #include <iostream>
    #include <fstream>
    using namespace std;
    bool parsePDF (string &content, size_t &position)
        position = content.find("obj",position);
        if( position == string::npos ) {
            cout<<"End of file"<<endl;
            return false;
        position += strlen("obj");
        size_t cur_pos = position;
        position = content.find("endobj",cur_pos);
        if( position == string::npos ){
            cerr<<"Broken PDF, endobj is not found from position"<<cur_pos<<endl;;
            return false;
        position += strlen("endobj");
        return true;
    int main(int argc, char ** argv)
        if( argc < 2 ){
            cout<<"Usage:"<<argv[0]<<" [pdf files]\n";
            return -3;
        else {
            for(int i = 1;i<argc;i++) {
                ifstream pdfFile;
                pdfFile.open(argv,ios::binary);
    if( pdfFile.fail()){
    cerr<<"Error opening file:"<<argv[i]<<endl;
    continue;
    pdfFile.seekg(0,ios::end);
    int length = pdfFile.tellg();
    pdfFile.seekg(0,ios::beg);
    char *buffer = new char [length];
    if( !buffer ){
    cerr<<"Cannot allocate\n";
    continue;
    pdfFile.read(buffer,length);
    pdfFile.close();
    string content;
    content.insert(0,buffer,length);
    delete buffer;
    // the lets parse the file and find all endobj in the buffer
    cout<<"Processing "<<argv[i]<<endl;
    size_t start = 0;
    int count = 0;
    while( parsePDF(content,start) ){
    cout<<"Found object:"<<++count<<"\n";
    return 0;

    Well, there is definitely some sort of problem here, maybe in string::find, but possibly elsewhere in the library.
    Please file a bug report at [http://bugs.sun.com] and we'll have a look at it.

  • Strange behavior of textareas in BPEL Worklist (10.1.2)

    I have a very strange behavior with linebreaks in all my <textarea>s in the BPEL-Worklist-jsps: (they work fine as <INPUT>s
    Example:
    Default-text:
    line1
    I update the textarea to:
    line1
    line2
    -> hit update
    line1
    *** (second line is completly missing)
    -> hitting update again (no change in text)
    line2line1
    *** (all on one line with the new line in front)
    As Value I use:
    <%=PayloadFormGenerator.selectNodeValue(payload, "/ns0:task/ns0:payload/ns1:abstract", form.getNamespaceMap(),"string", context.getLocale())%>
    and as mentioned: It works fine for <INPUT>.
    What do I do wrong? Is this a bug?
    Daniel
    Message was edited by:
    user552073

    Had the same problem, could not get it to be consistent. I would say this is a bug, but decided to edit payloads via the database in the end...

  • Strange behavior of "Partial message encryption "  in OWSM

    Strange behavior of “Partial message encryption “  in OWSM
    If message format is like this
    <cban:transferFund xmlns:cban="http://cbank.com">
    <cban:arg0>string</cban:arg0>   
    <cban:arg1>string</cban:arg1>   
    </cban:transferFund>
    Then body element configuration in message encryption setting
    Name space  http://cbank.com
    Element arg0
    is working fine
    But my requirement is for below message
    <cban:transferFund xmlns:cban="http://cbank.com"> <!--Optional:-->    <
    <arg0>string</arg0>   
    <arg1>string</arg1 >
    </cban:transferFund>
    For this
    Name space : http://cbank.com
    Element : I tried all possible combination but none is working
    I tried these
    :arg0
    //:arg0
    //cban:arg0
    //cban//arg0
    cban:arg0
    With Regards
    Siddharth

    Had the same problem, could not get it to be consistent. I would say this is a bug, but decided to edit payloads via the database in the end...

  • Strange Behavior in modifying the values in VO

    I have a VO based on EO from a custom table. The query is something like:
    select EO.x, EO.y, (EO.x*EO.y) xy from EO
    I have displayed the values from this VO on to a table in OAF page. All the columns are messageTextInput but the third column (xy) is read-only. I have written a fireAction to execute when x or y values are changed to update the xy value accordingly.
    Code in CO:
    if ("ValueChange".equals(pageContext.getParameter(EVENT_PARAM)))
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    am.invokeMethod("UpdateXY");
    pageContext.forwardImmediately(<Same Page>, null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null, null, true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
    Code in AM:
    public void UpdateXY()
    xxVOImpl vo = getxxVO1();
    Row r = vo.first();
    while (vo.hasNext())
    r = vo.next();
    Object X = r.getAttribute("X");
    String X_string = X.toString();
    float X_value = Float.parseFloat(X_string);
    Object Y = r.getAttribute("Y");
    String Y_string = Y.toString();
    float Y_value = Float.parseFloat(Y_string);
    Float XY = new Float(X_value*Y_value);
    r.setAttribute("XY",(Object)XY);
    The problem is as follows. During the first time I try to update a value, the control goes through the logic and returns to the page but the XY value is not updated. But if i change a second value and tab out, the codes works and displays both the updated values of XY. From then on, the code is working fine.
    I'm also not updating the first row and so I didnt perform any logic in AM for the first row.
    Please help me out in finding out the reason for this strange behavior.

    This nature is fine, basically initially your EO x and y columns are null and unless you do a commit, these values don't go in db. The third column will take x and Y coumns values from db and multiply and will get null.
    To solve this issue, you get the values from VO columns x and y in PPR and and put x*y in the third column of Vo, IN THAT ROW.or you can directly get hold of the bean which hold the value of x*y and use setValue after getting x*y.
    ---Mukul

  • Strange behavior in a table with dropTarget and delete action

    I am having a strange behavior in a table with drag and drop and action component to delete row.
    Steps:
    Drag the first row to the table and appears in the destination table (works well)
    Select and change the value by 156, appears an error (works fine)
    delete the row, the row disappears (works well)
    Add the first row again and the value is 156 instead of 158 (why ????)
    I guess the error is the deletion that is not correct, but do not know how?
    Can anyone help?
    I add the source code if you see where I'm wrong
    Java class:
    +public class BeanExample {+
    private ArrayList<RowExample> starttValues;
    private ArrayList<RowExample> endValues;
    +public BeanExample() {+
    super();
    +}+
    +public void setStarttValues(ArrayList<BeanExample.RowExample> starttValues) {+
    this.starttValues = starttValues;
    +}+
    +public ArrayList<BeanExample.RowExample> getStarttValues() {+
    +if (starttValues == null) {+
    starttValues = new ArrayList<BeanExample.RowExample>();
    starttValues.add(new RowExample("1", new Number(158)));
    starttValues.add(new RowExample("21", new Number(12565464)));
    +}+
    return starttValues;
    +}+
    +public void setEndValues(ArrayList<BeanExample.RowExample> endValues) {+
    this.endValues = endValues;
    +}+
    +public ArrayList<BeanExample.RowExample> getEndValues() {+
    +if (endValues == null) {+
    endValues = new ArrayList<BeanExample.RowExample>();
    +}+
    return endValues;
    +}+
    +public void validatorExample(FacesContext facesContext, UIComponent uIComponent, Object object) {+
    Number number = (Number)object;
    +if ((number.longValue() % 2) == 0) {+
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "ES PAR", "ES PAR");
    throw new ValidatorException(message);
    +}+
    +}+
    +public DnDAction handleDrop(DropEvent dropEvent) {+
    Transferable transferable = dropEvent.getTransferable();
    DataFlavor<RowKeySet> rowKeySetFlavor = DataFlavor.getDataFlavor(RowKeySet.class, "loteDrag");
    RowKeySet rowKeySet = transferable.getData(rowKeySetFlavor);
    +if (rowKeySet != null) {+
    CollectionModel dragModel = transferable.getData(CollectionModel.class);
    +if (dragModel != null) {+
    Object currKey = rowKeySet.iterator().next();
    dragModel.setRowKey(currKey);
    RowExample table = (RowExample)dragModel.getRowData();
    getEndValues().add(new RowExample(table.getId(), table.getValue()));
    return dropEvent.getProposedAction();
    +}+
    +}+
    return DnDAction.NONE;
    +}+
    +public void borrarFila(ActionEvent actionEvent) {+
    endValues.remove(0);            RequestContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc1:t2"));
    +}+
    +public static class RowExample {+
    private String id;
    private Number value;
    +public RowExample(String id, Number value) {+
    super();
    this.id = id;
    this.value = value;
    +}+
    +public void setId(String id) {+
    this.id = id;
    +}+
    +public String getId() {+
    return id;
    +}+
    +public void setValue(Number value) {+
    this.value = value;
    +}+
    +public Number getValue() {+
    return value;
    +}+
    +}+
    +}+JSF
    +<?xml version='1.0' encoding='windows-1252'?>+
    +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"+
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    +<jsp:directive.page contentType="text/html;charset=windows-1252"/>+
    +<f:view>+
    +<af:document id="d1">+
    +<af:form id="f1">+
    +<af:panelGroupLayout id="pgl1">+
    +<af:table value="#{beanExample.starttValues}" var="row"+
    rowBandingInterval="0" id="t1" rowSelection="single"
    displayRow="selected" contentDelivery="immediate">
    +<af:column sortable="false" headerText="Id" align="start" id="c2">+
    +<af:outputText value="#{row.id}" id="ot1"/>+
    +</af:column>+
    +<af:column sortable="false" headerText="Value" align="start" id="c1">+
    +<af:outputText value="#{row.value}" id="ot2"/>+
    +</af:column>+
    +<af:collectionDragSource actions="COPY" modelName="loteDrag"/>+
    +</af:table>+
    +<af:panelCollection id="pc1">+
    +<f:facet name="toolbar" >+
    +<af:toolbar id="dc_t2" >+
    +<af:commandToolbarButton shortDesc="Delete"+
    icon="/imagesDemo/delete_ena.png"
    id="dc_ctb3" immediate="true"
    +actionListener="#{beanExample.borrarFila}"/>+
    +</af:toolbar>+
    +</f:facet>+
    +<af:table value="#{beanExample.endValues}" var="row"+
    +rowBandingInterval="0" id="t2">+
    +<af:column sortable="false" headerText="Id" align="start" id="c3">+
    +<af:outputText value="#{row.id}" id="ot3"/>+
    +</af:column>+
    +<af:column sortable="false" headerText="Value" align="start" id="c4" >+
    +<af:inputText value="#{row.value}" autoSubmit="true" id="it1" validator="#{beanExample.validatorExample}"/>+
    +</af:column>+
    +<af:collectionDropTarget actions="COPY" modelName="loteDrag"+
    +dropListener="#{beanExample.handleDrop}"/>+
    +</af:table>+
    +</af:panelCollection>+
    +</af:panelGroupLayout>+
    +</af:form>+
    +</af:document>+
    +</f:view>+
    +</jsp:root>+

    I think the problem is the validator
    I changed the practical case, I added an InputText to enter new values in the first row.
    +<af:inputText immediate="true" label="new value" id="it2"+
    +valueChangeListener="#{beanExample.newvalue}" autoSubmit="true"/>+
    +public void newvalue (ValueChangeEvent valueChangeEvent) {+
    +String valor = (String)valueChangeEvent.getNewValue();+
    +Number valorNumber=null;+
    +try {+
    +valorNumber = new Number (valor);+
    +} catch (SQLException e) {+
    +}+
    +RowExample example = (RowExample) endValues.get(0);+
    +example.setValue(valorNumber);+
    +example.setId(valorNumber.toString());+
    +RichTable table = (RichTable)FacesContext.getCurrentInstance().getViewRoot().findComponent(id);+
    +RequestContext.getCurrentInstance().addPartialTarget(table);+
    +}+
    Case 1
    I drag the first row to the target table (ok)
    The new row appears (ok)
    Enter the value 77 in the InputText (ok)
    id content and value change (ok)
    Case2
    I drag the first row to the destination table
    The new row appears (ok)
    Change the value of the first row by 80 (ok)
    errors appears (by validator) (ok)
    Enter the value 77 in the InputText (ok)
    the id is changed but the value NO (*KO*)
    I do not understand the behavior
    Edited by: josefuente on 27-oct-2010 16:03

  • Strange behavior with obssocookie on different browser

    Hi,
    I am trying to integrate OAM with our application deployed on WLS. I have set up an IIS proxy server and installed a web gate on it. I have seen a couple of strange behavior
    1) If I try to access some static image file, SSO keeps asking for authentication. It happens for both firefox and IE, but it doesn't happen for chrome though. Looks like for image file request, the obssocookie is not passed correctly. Anyone sees that before?
    2) If I use firefox on the machine where WLS app server is installed to connect to proxy server, if I use hostname in the URL, I don't see the obssocookie. If I use IP address in the URL, I can see obssocookie. If I use IE or any browser from any other machine, obssocookie is always available
    thanks.
    -Wei

    I found it in the document
    B.1 How Logout Works
    The WebGate logs a user out when it receives a URL containing "logout." (including the "."), with the exceptions of logout.gif and logout.jpg, for example, logout.html or logout.pl. When the WebGate receives a URL with this string, the value of the ObSSOCookie is set to "logout."
    The Access System sets an obSSOCookie for each user or application that accesses a resource protected by a WebGate. The obSSOCookie enables users to access resources that are protected by the Access System that have the same or a lower authentication level. Removing the ObSSOcookie causes the WebGate to log the user out and requires the user to re-authenticate the next time he or she requests a resource that is protected by the Access System.
    Well, I havn't got that far in the document:)
    Thanks a lot for your help.
    -Wei

  • Strange behavior with DefaultCellEditor

    Hello everybody,
    I found a strange behavior with DefaultCellEditor using a JTextField in a JTable. The following line will show, what I mean:
    setDefaultCellEditor(String.class,new DefaultCellEditor(new JTextField()));
    Imho this should do the same as JTable does already, when it installs a JTextField as default cell editor for cell values of the String class. But, it seems, that it is not the same:
    When I add this line in the constructor of a JTable subclass the editor component seems to be less wide and less high to the right and bottom - it looks so with Win95 with JDK 1.4.0 - but with Win2000 it is correct for example.
    My question is - how can it be, that the normal default cell editor does not have this behavior but when I use the line above, it is displayed in the wrong way?- What does the default cell editor in another way than I do it, that it has not this ugly display?
    I would like to look in the sources, but unfortunately I can't find the source code in JDK 1.4.0 - perhaps you have a hint, where to find it.
    greetings Marsian

    It seems the Label doesn't like it, that it is in a GridCell with rowspan = 2
    If it is in a normal cell (no rowspan), it works.
    If I add ColumnConstraints to the gridpane, it kind of works, but the Label still occupies more space than it should.
    Edited by: csh on 19.07.2012 03:51

  • Strange behavior with Collections

    Hello!
    I have a - from my point of view - strange behavior with a List (same also applies to Vector, LinkedList, and others):
    List<String> myList = new myList<String>;
    myList.add("One");
    while (true) {
    try {
    System.out.println(myList.size());
    throw new Exception();
    } catch (Exception e) {
    e.printStackTrace();
    }And the result is 1, 2, 2, 2, ...although I added only one element. The two elements in the List point to the same object.
    What could case this issue?
    Regards,

    len00x wrote:
    List<String> myList = new myList<String>;This doesn't even look like it will compile for at least one reason, easily two.

  • Strange behavior with Label#setWrapText(true) in GridPane.

    I've got a strange behavior with a Label, which has setWrapText(true) in a GridPane.
    Check out the sample and click the button.
    You see, that the GridPane suddenly behaves as if it had GridPane.setVGrow and HGrow set for the lblStatus.
    (it takes the full available space).
    Furthermore the first column shrinks to a minimum, so that lblText1 can't display its text anymore.
    Tested with 2.1 GA.
    Any help with that?
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Insets;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.layout.GridPane;
    import javafx.stage.Stage;
    public class TestApp4 extends Application {
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(final Stage stage) throws Exception {
            GridPane gridPane = new GridPane();
            gridPane.setPadding(new Insets(2, 2, 2, 2));
            Label lblText1 = new Label();
            lblText1.textProperty().set("Some text");
            Label lblText2 = new Label();
            lblText2.textProperty().set("Some other text");
            Button btnClick = new Button();
            btnClick.textProperty().set("Click me");
            final Label lblStatus = new Label();
            lblStatus.setWrapText(true);
            gridPane.add(lblText1, 0, 0, 1, 1);
            gridPane.add(lblText2, 1, 0);
            gridPane.add(lblStatus, 0, 2, 2, 1);
            gridPane.add(btnClick, 0, 3, 2, 1);
            btnClick.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent actionEvent) {
                    lblStatus.setText("very long text, very long text, very long text, very long text,very long text, very long text");
            gridPane.setGridLinesVisible(true);
            Scene scene = new Scene(gridPane, 300, 300);
            stage.setScene(scene);
            stage.show();
    }Edited by: csh on 19.07.2012 03:35

    It seems the Label doesn't like it, that it is in a GridCell with rowspan = 2
    If it is in a normal cell (no rowspan), it works.
    If I add ColumnConstraints to the gridpane, it kind of works, but the Label still occupies more space than it should.
    Edited by: csh on 19.07.2012 03:51

  • Strange behavior with Bindings??

    Hello to all JavaFX 2 Binding experts,
    I have a strange behavior with Bindings in JavaFX 2.2 (Java 1.7 update 21). Please have a look at the following source code:
    package test;
    import javafx.application.Application;
    import javafx.beans.binding.BooleanBinding;
    import javafx.beans.property.SimpleBooleanProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.fxml.FXML;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.RadioButton;
    import javafx.stage.Stage;
    public class BindingVsProperty extends Application
        @FXML
        private RadioButton opt11;
        @FXML
        private RadioButton opt12;
        @FXML
        private RadioButton opt21;
        @FXML
        private RadioButton opt22;
        @FXML
        private Label lbl11And21;
      @Override
        public void start(Stage arg0) throws Exception
            FXMLLoader l_loader = new FXMLLoader();
            l_loader.setLocation(BindingVsProperty.class.getResource("BindingVsproperty.fxml"));
            l_loader.setController(this);
            l_loader.load();
            Scene l_scene = new Scene((Parent)l_loader.getRoot());
            arg0.setScene(l_scene);
            useBinding1();
            //useBinding2();
            //useBinding3();
            arg0.show();
        private void useBinding1() // NOT WORKING - ChangeListener.changed(..) is not called
            BooleanBinding l_andOpt11Opt21 = opt11.selectedProperty().and(opt21.selectedProperty());
            l_andOpt11Opt21.addListener(new ChangeListener<Boolean>()
                @Override
                public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2)
                    System.out.println("Opt 1.1 AND Opt 2.1 changed to: " + arg2);
        private void useBinding2() // OK - ChangeListener.changed(..) is called
            BooleanBinding l_andOpt11Opt21 = opt11.selectedProperty().and(opt21.selectedProperty());
            lbl11And21.visibleProperty().bind(l_andOpt11Opt21);
            l_andOpt11Opt21.addListener(new ChangeListener<Boolean>()
                @Override
                public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2)
                    System.out.println("Opt 1.1 AND Opt 2.1 changed to: " + arg2);
        private void useBinding3() // NOT WORKING - ChangeListener.changed(..) is not called
            BooleanBinding l_andOpt11Opt21 = opt11.selectedProperty().and(opt21.selectedProperty());
            new SimpleBooleanProperty(false).bind(l_andOpt11Opt21);
            l_andOpt11Opt21.addListener(new ChangeListener<Boolean>()
                @Override
                public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2)
                    System.out.println("Opt 1.1 AND Opt 2.1 changed to: " + arg2);
        public static void main(String[] args)
            launch(args);
    <?xml version="1.0" encoding="UTF-8"?>
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.paint.*?>
    <BorderPane id="BorderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="371.0" xmlns:fx="http://javafx.com/fxml">
      <center>
        <AnchorPane prefHeight="200.0" prefWidth="200.0">
          <children>
            <Label id="lblAnd" fx:id="lbl11And21" layoutX="82.0" layoutY="121.0" text="Group1 Opt1 AND Group2 Opt1 is true" textFill="#41cc00" visible="false" />
            <RadioButton fx:id="opt21" layoutX="216.0" layoutY="24.0" mnemonicParsing="false" text="Group 2 - Opt 1">
              <toggleGroup>
                <ToggleGroup fx:id="group2" />
              </toggleGroup>
            </RadioButton>
            <RadioButton fx:id="opt22" layoutX="216.0" layoutY="67.0" mnemonicParsing="false" text="Group 2 - Opt 2" toggleGroup="$group2" />
            <RadioButton fx:id="opt11" layoutX="29.0" layoutY="24.0" mnemonicParsing="false" text="Group 1 - Opt 1">
              <toggleGroup>
                <ToggleGroup fx:id="group1" />
              </toggleGroup>
            </RadioButton>
            <RadioButton fx:id="opt12" layoutX="29.0" layoutY="67.0" mnemonicParsing="false" text="Group 1- Opt 2" toggleGroup="$group1" />
          </children>
        </AnchorPane>
      </center>
    </BorderPane>
    What I need for my application is the use case in useBinding1(), i.e., a BooleanBinding where several listeners are attached to. The problem is that I never get a callback in the ChangeListener if one of the RadioButton.selectedProperty() is changed.
    Now I tried what happens if I use the same BooleanBinding for another binding to a property plus the listener, now the listener gets callbacks as expected! (see useBinding2() )
    Than I thought may be Bindings must be bound in order to trigger listeners and tried useBinding3() where I bind the BooleanBinding to a new BooleanProperty, in this case the listener doesn't get callback anymore...
    And now I'm very frustrated and hope that anyone out there can help me to understand this strange behavior.
    Thanks a lot!
    WhiteAntelope

    All these work just fine for me: the listeners are all called as expected. Note that the listener is only invoked when the value of the binding actually changes, which doesn't happen every time a radio button is pressed. (For example, if both buttons are unselected, the binding is false. If one button is selected, the binding remains false and the listener is not invoked. When the second button is selected, the binding becomes true, and the listener is invoked.)

  • Strange behavior of HtmlPanelGrid.getChildren().clear();

    I have some problem, described in previous messages.
    Investigating it, I found some strange behavior, which I cannot understand.
    I builded a small application to isolate this strangeness.
    There are two pages, first and second. There are hyperlinks from first page to second. Secon page serves as an indicator, that navigation was successfull. It is not so all the time.
    There is a bean, which constructs a hyperlink at runtime and which contains my problem, as I think.
    The config file is (header and footer skipped):
    <navigation-rule>
    <from-view-id>/welcomeJSF.jsp</from-view-id>
    <navigation-case>
    <from-outcome>select</from-outcome>
    <to-view-id>/secondPage.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    <managed-bean>
    <managed-bean-name>bean</managed-bean-name>
    <managed-bean-class>Buggy.Bean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    One can see, that navigation is always controlled with the one constant string literal -- select. The bean is called just "bean" and it exists during a session.
    First page is (header and footer skipped):
    <f:view>
    <h:form>
    <h:commandLink id="link1" action="select" value="link1 (hardcoded)"/>
    <h:panelGrid id="panel" binding="#{bean.panel}" columns="20" border="1" cellspacing="0">
    <h:commandLink id="link2" action="select" value="link2 (hardcoded)"/>
    </h:panelGrid>
    </h:form>
    </f:view>
    One can see, that there are two hardcoded hyperlinks, one is inside the panelGrid, second is outside. Also it is seen, that the panel is binded with bean property as a whole.
    The second page is just displaying a text to be sure the navigation occured.
    Now the bean (header and footer skipped):
    private HtmlPanelGrid panel;
    public HtmlPanelGrid getPanel() {
    return panel;
    public void setPanel(HtmlPanelGrid panel) {
    this.panel = panel;
    Application application = FacesContext.getCurrentInstance().getApplication();
    MethodExpression expr = application.getExpressionFactory().createMethodExpression(FacesContext.getCurrentInstance().getELContext(), "select", String.class, new Class[0]);
    HtmlCommandLink link = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
    link.setId("link3");
    link.setValue("link3 (softcoded)");
    link.setActionExpression(expr);
    panel.getChildren().clear();
    panel.getChildren().add(link);
    One can see, that a third (softcoded) hyperlink is added to the panel dynamically, with preliminary clearing panel content.
    * STRANGENESSES *
    1) despite the fact, that the panel is cleared prior to adding softcoded hyperlink, I CAN see it on the page (all 3 hyperlinks are seen)
    2) in the debugger I can see, that while executing code, the children list is empty; this can mean, that the order of execution of the Jave code and JSP code is reversed; despite this fact, I see the hardcoded link BEFORE the softcoded
    3) the link2 (hardcoded) is not work, i.e. it is not leads the second page to be displayed
    4) if I comment the line panel.getChildren().clear(); then all 3 hyperlinks start to work

    But when I put links creation code in bean's constructor, it was lost.
    It seems to me, that the system creates panel independently and only after that calls setter of my bean. Ergo, the data from the panel field, initialized in constructor is overwrited.
    Where I should place programmatic filling of panel element?

  • Strange behavior of GetStringUTFChars in Linux

    Good evening!
    I made an implementation of a native method in C++ for Windows and Linux, in windows it works fine, but in Linux I have a strange behavior of GetStringUTFChars here is the piece code :
    JNIEXPORT jint JNICALL Java_MyNativeMethod
    (JNIEnv *env, jobject obj, jstring IpAddress) {
    const char * ccpIpAddress = env->GetStringUTFChars(IpAddress, 0);
    jsize size = env->GetStringLength(ccpIpAddress);
    trace("IpAddress : %s size: %d", ccpIpAddress, size);
    Absolute normal... but when I pass as parameter a string '192.168.1.11'
    I receive from 'IpAddress : HB&#317;1 size: 0' to 'IpAddress : P9D7D6DwD&#65533;MS\H#M\H : 251'
    I made a little and simple test to print a String to verify if is Linux problem but IT WORKED FINE!
    I've notice that the differences between both programs are that the wrong one has been linked with a C lib, but the #define __cplusplus is OK also, and all the compile process use C++ code...
    This is my compilation line
    g++ -o lib{myLib}.so {myImpl}.cpp lib{C li}.so libstdc++.so -I {JAVA_HOME}/include/ -I {JAVA_HOME}/include/linux/ -shared -static -L{JAVA_HOME}/jre/lib/i386/
    (variables put for clarity) and (I tried with gcc also)
    the libstrd++.so is been used in my simple test link options too.
    I was wondering if there is some -Doption which should be defined that
    functions->GetStringChars(this,str,isCopy); implementation ask for...
    or if the link with a C code is messing the things in a different behavior
    Thanks for the help
    Pedro Ribeiro
    Sao Paulo - Brazil

    JNIEXPORT jint JNICALL Java_MyNativeMethod
    (JNIEnv *env, jobject obj, jstring IpAddress) {
    const char * ccpIpAddress = env->GetStringUTFChars(IpAddress, 0);
    jsize size = env->GetStringLength(ccpIpAddress);
    trace("IpAddress : %s size: %d", ccpIpAddress, size);
    =====================
    You tried to get the string length of C character array.
    I think you can get the length of jstring alone.
    Please advice me if I am wrong

  • STRANGE BEHAVIOR OF NVL

    Hi everybody,
    Can you please explain me this strange behavior of NVL function:
    SQL> select nvl(10000,'none') from dual;
    select nvl(10000,'none') from dual
    ERROR at line 1:
    ORA-01722: invalid number
    SQL> select nvl('none',10000) from dual;
    NVL(
    none
    Can you explain what goes on internally to make these statements different?
    I mean why is it expecting a number(as a second arg) in Case 1 and why is it not expecting a character string as a second arg in Case 2? Has it got to do with implicit type-conversion?
    Finally, does NVL need both arguments of the same type?
    Any help will be greatly appreciated.
    Thanks.
    Kishore.

    The return type of NVL is the datatype of the first argument. If the two arguments have different datatypes Oracle applies a conversion. That's why you got your results: in effect what you were running was
    select nvl(10000,to_number('none')) from dual;and
    select nvl('none',to_char(10000)) from dual;Of course, 'none' is not a valid number, hence the ORA-1722 result, whereas 10000 can be successfully rendered as a string.
    If you do not provide NVL with arguments of the same datatype it will apply an implicit conversion to the second datatype. It is always better (that is safer) to avoid implicit data conversion.
    Cheers, APC
    P.S. For bonus points, which argument determines the datatype of a DECODE function?

  • Compiler strange behavior

    Hi friends,
    I dont know whether this is the right forum page to post this topic.
    I've observed a strange behavior of the java compiler may be it is programmed for so.
    As we all know that java.lang.System.arraycopy(Object,int,Object,int,int) method can be used to copy the objects & primitive type arrays, how come? for instance
        String s[] = new String[]{"1", "2"};
        String c[] = new String[s.length];
        System.arraycopy(s, 0, c, 0, s.length); // compiles for objects "and"
        byte b[] = new byte[]{1,1,1};
        byte e[] = new byte[b.length];
        System.arraycopy(b, 0, e, 0, b.length); // compiles for primitive as wellI'm not pin-pointing or arguing just wondering & curious. May be the above is an exception to the Compiler.
    Can any one of you clear my curosity?
    regards,
    Afroze.

    All arrays are Objects, even arrays of primitive data types. They are treated specially, in terms of syntax and by the compiler, but they are still objects with fields (like "length") and methods (like "clone()").
    So in the method arraycopy(Object,int,Object,int,int), the Object arguments can be primitive or Object arrays. Does that help?

Maybe you are looking for

  • Item configuration not possible in Sales Order

    Dear friends, Our requirement is as follows: I have created a configuration material and assigned MTS strategy (10) in MRP3 view. As I am carrying out cost estimate run and SAP does not allow to calculate std cost for config material, I assigned same

  • Can I use the database toolset within a fieldpoint vi?

    I want to be able to read and write to a database on our network using the database toolset. My vi works under windows but does not under fieldpoint. (does not run at all). I've included (loaded) the template while building the executable. As well I'

  • Time of iCal events is changed on phone

    Syncing iCal events with my Sony Ericsson V800 worked fine until a few weeks ago. Since then some, but not all events appear with a changed tme on the phone, mostly by 1 hour. Computer and phone both have the same time zone setting (GMT + 2, Mid Euro

  • Oracle Database Express Edition 11g r2 win_32bit installer

    hello frnds ,I installed oracle database express edition 11.2 r2 release and during the installation I faced this problem .plz help me out give your suggestions. The installer is unable to instantiate the file c:\Users\Sanjeev\AppData\Local\Temp\{1A2

  • [svn] 4879: Patch for integration bug.

    Revision: 4879 Author: [email protected] Date: 2009-02-06 13:12:53 -0800 (Fri, 06 Feb 2009) Log Message: Patch for integration bug. There was a regression with check-in 4793 when getLayoutBoundsX and getLayoutBoundsY were added to Path. Path now trie