JAXB subclass and attribute problem

My schema has a complex type and an sub-complextype. Both of these types have elements of type string.
The classes that are generated look fine, they both have the attributes created as JAXBElement<String>.
Over the wire, the xml nodes for the attributes are not set correctly
For instance...here is one of the attributes
@XmlElementRef(name = "Name", namespace = "http://schemas.xxxxxx", type = JAXBElement.class)
protected JAXBElement<String> name;
On the wire it should look like
<nsXX:Name>YYY</Name>
instead it looks like
<nsXX:string>YYY</string>

After further testing, it seems like this has nothing to do with the class being a sub-class. Any class that has a field on it that is of type JAXBElement<String>. when it passes through the Marshaller (to System.out stream for instance), it incorrectly writes the xml node as
<string>xyzvalue</string>
instead of
<xyzname in xmlelementreftag>xyzvalue</xyzname in xmlelementreftag>
The only way around this that I have seen is to use JAX-RPC instead of JAX-WS.

Similar Messages

  • Check Required Elements and Attributes in JAXB

    Hi
    I need check required elements and attributes in JAXB java classes , if there are any value for them place it , otherwise place default value in xml file , because of it I upgrade JAXB2.0 to JAXB 2.1 to support "required" in "XmlElement" , I read in "JavaWS(JAXB)Tutorial.pdf" that JAXB itself check required elements and attributes , if there are any value for them place it , otherwise place default value in xml file , the exact part of document is :
    << A property is said to have a set value if that value was assigned to it during unmarshalling or by invoking its mutation method. The value of a property is
    its set value, if defined; otherwise, it is the property’s schema specified default value, if any; otherwise, it is the default initial value for the property’s base type as it would be assigned for an uninitialized field within a Java class. >>
    I want to know , dose JAXB do this task ? (now I work with JAXB2.1 but it doesnt do this task.Maybe I must set some configuration)
    and if JAXB doesnt do it , how I can check required elements and attributes in JAXB ?
    Please help me.
    Shariat

    its all on Apple's Developer site
    http://developer.apple.com/DOCUMENTATION/AppleApplications/Reference/FinalCutPro _XML/index.html

  • Urgent help ----problem of component id and attribute value

    I want to produce a dynamic menu that compoment id and attribute value will be dynamic assigned when logon to system. That means i have to use id="#{aid}" and value="#{avalue}" in following codes.
    The problem are:
    1. Component id looks only accepts constant (hard code data) insteads of varable. I changed id="ADMIN", and it works. It can be empty, and tag will give me one. Therefore, it is not too much affected me.
    2. The f:attribute value, when value="Value" works. However, when value="#{avalue}", first time works, second time it throws Illegal State Exception. I really need this value be assigned by varable.
    Can anyone help me out?
    ----------------------------------------------Code----------------------------------------------
    <h:command_link id="#{aid}" action="#{Action.action}" >
              <f:action_listener type="my.MenuListener"/>
              <h:output_text value="Logon"/>
              <f:attribute name="COMMAND" value="#{avalue}"/>
    </h:command_link>

    -----------2 TreeMenu---------------
    public class MenuTree implements Serializable{
    private String treeId = null;
    private String name = null;
    private Map submenus = new TreeMap(); // name as key, submenu is value;
    private String actionClass = null;
    private boolean isLeaf = false;
    private boolean isRoot = true;
    private MenuTree parent = null;
    public boolean isRoot() {
         return isRoot;
    public void setRoot(boolean root) {
         isRoot = root;
    public MenuTree(){
    public MenuTree getParent(){
         return parent;
    public void setParent(MenuTree parent){
         this.parent = parent;
         if(parent != null) parent.putSubmenu(treeId, this);
         isRoot = false;
    public String getName() {
         return name;
    public void setName(String name) {
         this.name = name;
    public Map getSubmenus() {
         return submenus;
    public boolean getIsNode(){
         return submenus.size() > 0;
    public void putSubmenu(String name, MenuTree menu){
         submenus.put(name, menu);
         * @return Returns the isLeaf.
         public boolean getIsLeaf() {
              return isLeaf;
         public boolean getIsRoot() {
              return isRoot;
         * @param isLeaf The isLeaf to set.
         public void setLeaf(boolean isLeaf) {
              this.isLeaf = isLeaf;
         * @param submenus The submenus to set.
         public void setSubmenus(Map submenus) {
              this.submenus = submenus;
         * @return Returns the actionClass.
         public String getActionClass() {
              return actionClass;
    public void setActionClass(String actionClass) {
         this.actionClass = actionClass;
         public String getTreeId() {
              return treeId;
         * @param id The id to set.
         public void setTreeId(String treeId) {
              this.treeId = treeId;
    ------------3 JSP if want to test change subview to view. I am sure the treeId have value---------------------
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <% request.setAttribute("CONTEXT_PATH", request.getContextPath()); %>
    <LINK rel="stylesheet" type="text/css" href='<c:out value="${requestScope.CONTEXT_PATH}"/>/style/menutree.css'/>
    <SCRIPT type='text/javascript' src='<c:out value="${requestScope.CONTEXT_PATH}"/>/js/hideshow.js'></SCRIPT>
    <!--f:loadBundle basename="bundle.common.Menu" var="bundle"/-->
    <f:subview id="userMenuView">
    <h:form id="userMenuForm">
    <c:set var="root" value="${sessionScope.menuTree}"/>
    <table class="" width="150px" bgcolor="blue">
    <c:forEach var="menuBar" begin="0" items="${root.submenus}">
    <c:set var="menu" value="${menuBar.value}"/>
         <tr>
         <td>
         <c:choose>
              <c:when test="${menu.isLeaf}">
                   <c:set var="menuJSF" value="${menu}" scope="request"/>
                   <h:command_link action="#{Action.action}">
                        <f:action_listener type="com.nusino.web.listener.menu.MenuListener"/>
                        <h:output_text value="#{menuJSF.name}"/>
                        <f:attribute value="#{menuItemJSF.treeId}">
                   </h:command_link>
              </c:when>
              <c:otherwise>
                   <span class="" onclick="javascript:hideshow('<c:out value="${menu.treeId}"/>')">
                        <c:out value="${menu.name}"/>
                   </span>
                   <div id='<c:out value="${menu.treeId}"/>' >
                   <table class="">
                   <c:forEach var="submenu" begin="0" items="${menu.submenus}">
                        <c:set var="menuItem" value="${submenu.value}"/>
                        <tr>
                        <td>
                        <c:choose>
                             <c:when test="${menuItem.isLeaf}">
                                  <c:set var="menuItemJSF" value="${menuItem}" scope="request"/>
                                  <h:command_link action="#{Action.action}">
                                       <f:action_listener type="com.nusino.web.listener.menu.MenuListener"/>
                                       <h:output_text value="#{menuItemJSF.name}"/>
                                       <f:attribute value="#{menuItemJSF.treeId}">
                                  </h:command_link>
                             </c:when>
                             <c:otherwise>
                                  <span class="" onclick="javascript:hideshow('<c:out value="${menuItem.treeId}"/>')">
                                  <c:out value="${menuItem.name}"/>
                                  </span>
                                  <div id='<c:out value="${menuItem.treeId}"/>' >
                                       <table class="">
                                            <c:forEach var="item" begin="0" items="${menuItem.submenus}">
                                                 <c:set var="itemObj" value="${item.value}"/>
                                                 <tr>
                                                 <td>
                                                 <c:choose>
                                                      <c:when test="${itemObj.isLeaf}">
                                                      <c:set var="itemObjJSF" value="${itemObj}" scope="request"/>
                                                           <h:command_link action="#{Action.action}">
                                                                <f:action_listener type="com.nusino.web.listener.menu.MenuListener"/>
                                                                <h:output_text value="#{itemObjJSF.name}"/>
                                                                <f:attribute value="#{itemObjJSF.treeId}">
                                                           </h:command_link>
                                                      </c:when>
                                                      <c:otherwise>
                                                           <span class="">
                                                           <c:out value="${itemObj.name}"/>
                                                           </span>
                                                      </c:otherwise>
                                                 </c:choose>
                                                 </td>
                                                 </tr>
                                            </c:forEach>
                                       </table>
                                  </div>
                             </c:otherwise>
                        </c:choose>
                        </td>
                        </tr>
                   </c:forEach>
                   </table>
                   </div>
              </c:otherwise>
         </c:choose>
         </td>
         </tr>
    </c:forEach>
    </table>
    <script language= "javascript" >
         function prehide(){
              <c:forEach var="menuBar" begin="0" items="${root.submenus}">
                   <c:set var="menu" value="${menuBar.value}"/>
                   <c:if test="${!menu.isLeaf}">
                        hide('<c:out value="${menu.treeId}"/>');
                        <c:forEach var="submenu" begin="0" items="${menu.submenus}">
                             <c:set var="menuItem" value="${submenu.value}"/>
                             <c:if test="${!menuItem.isLeaf}">
                                  hide('<c:out value="${menuItem.treeId}"/>');
                             </c:if>
                        </c:forEach>
                   </c:if>
              </c:forEach>
         if(document.all){
              prehide();
    </script>
    </h:form>
    </f:subview>

  • Hiding methods and attributes while inheriting

    Hello All,
    This is kinda urgent. While making a subclass I want to block access to methods and attributes of super class when anone creates an object of sub-class. In my particular situation I cannot override the methods.
    Let me explain it with an example:
    I have a class A which contains an attribute of type Object. All the methods accept Object type parameters and act accordingly. Now I want to create a sub-class B which acts on Strings only. I can create a wrapper to class A but I want to add some behavior which is specific to strings and use rest of the behavior as in class A. I cannot override the methods of class A because they take Objects as parameters whereas in class B the same methods take string as parameters.
    I hope you have understood the problem. Please reply ASAP.
    Thanks in advance

    Sorry the diagram turned out wrong. ObjectClass and StringClass are both supposed to be derived
    from the AbstractBaseClass.
    This method is one way to achieve what you want. You make an AbstractBaseList class that has only
    protected methods that take objects.
    To implement a generic Object version of this class you extend it and override the protected methods in
    the AbstractBaseList class to make them public.
    To implement a String list you extend the AbstractBaseList class and override the protected methods to
    make them public (but change the type of the parameters).
    The only problem with this approach is that the return types of the methods cannot be changed. Therefore
    I recommend the AbstractBaseList implement a method called
    protected Object getByIndex(int i) {
    // do list type stuff in here
    Then the ObjectList can implement
    public Object get(int i) {
    return super.getByIndex(i);
    and the StringList can implement
    public String get(int i) {
    return (String) super.getByIndex(i);
    In effect all you need to do is to implement wrapper classes that enforce type casting on the Object based
    set/get values.
    Another option is to use JDK1.5 with its generics classes. These effectivly allow you to specify which type of
    object an instance of a class accepts.
    Another question. What is the matter with the Collections classes provided in the JDK?
    matfud

  • JAXB : case insensitive attributes

    I frequently receive an XML file which I do not have control over. ( It is generated outside of my organization)
    I derived a XML schema by analyzing the document structure and used the schema to generate a set of JAXB generated classes.
    Nevertheless, the file sometimes comes with some minor "mistakes" in the attributes names of some entities by having the wrong uppercase or lowercase. (Vgr. myAttributeName vs myAttributeNAme )
    Is there any way to tell JAXB to be case insenstive on the attribute names ?
    Unmarshalling the file fails at the attribute with the wrong case.
    Thanks.

    Unlikely. XML itself defines all element and attribute names to be case-sensitive, and likewise Java defines class and variable names to be case-sensitive. So it wouldn't make sense for JAXB to have a "case-insensitive" option.
    If you can't get the supplier to provide the correct information in the XML file (e.g. they are an important customer and you can't point out to them that they are a bunch of donkeys) then you could pre-process the XML file yourself to correct the errors.

  • Diamond Plus and shutdown problem *resolved*

    I am just wondering if anyone else is experiencing this.  There is one other fellow on another forum that just built a system around this board that is experiencing a similar situation.
    I am running windows (32 bit) and using the original bios (no issues so far, except this if it is one)
    Approximately 60-75% of the time when I go to shut down or restart it acts like I didn't click it, but when I click it the second time it functions normally then.
    When I installed this mainboard it replaced an Asus A8N SLI board, I needed to save some E mails that I had forgotten to save so I did a repair installation of windows.   I just attributed the shutdown "glitch" to that.  I am about to reformat and reinstall windows fresh this morning, maybe this will solve the problem.  (but my gut tells me it probably won't)   Also I installed the SW-ide drivers and the NVidia firewall, which I won't be installing this time.

    Quote from: kakarocht on 22-March-06, 23:08:52
    Do you do any ocing? Have you tried to up the RAM voltage? is your windows is properly installed??
    Yes I do a little overclocking, 2.6Ghz - 217 FSB but SuperPi and Prime 95 stable at that speed.  I just reformatted and the problem is gone,  Like I had mentioned I had done a repair installation when I installed the board from an Asus A8N in order to retrieve some E-Mails, I didn't have the chance to reformat until today.  I really didn't think that would have fixed it, so much for my gut feeling.......

  • Open hub destination of text and attribute for Functional Area

    Hi Expert
    I have a requirement to accommodate both attribute ( 0FUNCT_LOC_ATTR)  and text ( 0FUNCT_LOC_TEXT ) for functional area in open hub destination .For this a DSO has been created from both 0FUNCT_LOC_ATTR, 0FUNCT_LOC_TEXT data sources .Problem is that DSO has 0FUNCT_AREA ( Functional Area ) as only key fields . So text for both english ( EN ) and Dutch ( NL) for particular 0FUNCT_AREA not getting loaded .If we assign both 0LANGU and 0FUNCT_AREA as composite key of dso , data from attribute transformation is loaded as blank as there is no language filed in attribute data source ( 0FUNCT_LOC_ATTR ).   Please let me know how can I design to accommodate both text for different language and functional area for open hub destination  .
    I know that I can create separate open hub destination for master data TEXT and Attribute.
    Any help is highly appreciated.
    Regards
    Saikat

    HI Saikat,
    You can create an additional characteristics counter and make it a key field in the DSO.After that we can populate this characteristics in the end routine .It value would increase by 1 everytime  different text comes for the same functional area.
    Sample code
    data: counter type n,
             w_farea type /bio/oifunc_area.
    Sort result_package by func_area.
    count =0.
    *checking whether we have the same functional area or we have a different functional area.
    Loop at result_package assigning <Result_fields>.
    if w_farea is initial or w_farea = <result_fields>-func_area.
    count = count +1.
    else
    count =1.
    endif.
    w_farea= <result_fields>-func_area.
    <Result_fields>-zcount = count.
    ENDLOOP.
    Clear w_farea.
    This way the value of counter would get increased by one everytime a new text comes for the same functional area.We can have any number of texts for the same functional area by this method.
    The only issue would be when some delta update comes for the existing text in this method.If you are doing a full load to the DSO from the datasource, then there would be no issue with this method.

  • URGENT : nested AM and attribute permission (and action invocation error)

    Hello,
    we have an issue with our application. We have nested AMs and we want to add permission on iterators and attributes.
    We have no problem with the RowSetPermission in the nested AM, we have this in our system-jazn-data.xml
                   <permission>
                        <class>oracle.adf.share.security.authorization.RowSetPermission</class>
                        <name>Application_RootDataControl.Root.NestedDomain1.*</name>
                        <actions>read</actions>
                   </permission>
    But concerning the AttributePermission we have an issue with the nested AM, they're still not rendered as if the permission was not set. The following lines are the declaration of the AttributePermission
                   <permission>
                        <class>oracle.adf.share.security.authorization.AttributePermission</class>
                        <name>Application_RootDataControl.Root.NestedDomain1.TestViewUsage.*</name>
                        <actions>read</actions>
                   </permission>
    But if we change the name to Application_RootDataControl.* it works (although it's not what we want at all)
    Anyone has more information on this issue ?
    We're close to delivery and it's becoming quite urgent, your help will be greatly appreciated.
    thanks
    PS : i use Jdev 10.1.3.3
    Edit :
    I've noticed that with nested application module the bug indicated here still exists in jdev 10.1.3.3 =>
    SECURITY: permissions not allowed with ExecuteWithParams action
    i.e. executeWithParams can't be invoked due to security problem

    Hi,
    your statement "ExecuteWithParams can't be invoked due to security problem " is not correct. This has been fixed in 10.1.3.3. You can't specify authorization for the ExecuteWithParams operation, but the fix has been such as that no explicit authorization is needed.
    However, the usecase that is not covered in the usecase for authorizing ExecuteWithParams is if this operation is part of a nested AM. So you may want to test the operation in the root AM to see the fix working (as it does for me). If it works for you in teh root AM but not the nested AM then this might be subject of another bug yet to file
    Frank

  • How to preserve encoded characters at text and attributes node?

    <greeting>hello, <World> </greeting>
    When I run a SAX parser, it automatically decodes the characters
    and make the document ill-formed after the round trip.
    <greeting>hello, <world> </greeting> --- ERROR
    Q: How do I preserve those special characters at text node and attribute nodes?
    Thanks

    Thanks for you guys' help.
    It's great to get a real-time help from this online community.
    Yue,
    What I attempted to do was
    0. I have 6G <database> document having 1.4 M <entry>s.
    1. Read one <entry> at a time using SAX
    2. Save each <entry> to a buffer
    3. Pass the buffer to a Unmarshaller ( JAXB ) and create a JavaObject
    Repeat above moving to next <entry> until reaches to the end.
    At step 1, unescape happens
    becomes >< becomes <
    and & &
    making my doc malformed (which is legal) :(
    At step 2, I did the following to perserve <, >, and &
    str = str.replaceAll( ">", "&gt;");
    str = str.replaceAll( "<", "&lt;");
    str = str.replaceAll( "&", "&amp;");At step 3, JAXB is now happy to get a healthy XML input
    <greeting>hello, <World></greeting>
    It turned out to be nobody's fault but myself.
    It was a good lesson, though.
    Thanks, buddies

  • Regarding Regions and Attributes

    Hi All,
    I am using Regions and Attributes to display a page in supplier portal. I had define all the Attributes in that region. One of the attribute is of type poplist ie Item Style is poplist. I am using picklist view object Definition to get the values from the table. It is an xml file in which i have written a query to get the values. Here is the XML file
    <?xml version="1.0" encoding='ISO-8859-1'?>
    <!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
    <!-- $Header: FmcPosCurrencyVO.xml 115.0 2001/08/02 15:23:00 pkm ship $ -->
    <ViewObject
    Name="FmcPosCurrencyVO"
    BindingStyle="Oracle"
    CustomQuery="true"
    RowClass="oracle.apps.fnd.framework.server.OAViewRowImpl"
    ComponentClass="oracle.apps.fnd.framework.server.OAViewObjectImpl"
    FetchMode="FETCH_AS_NEEDED" >
    <SQLQuery><![CDATA[
    SELECT currency_code,start_date_active,end_date_active FROM fnd_currencies
    WHERE enabled_flag = 'Y' and sysdate BETWEEN NVL(start_date_active,SYSDATE) AND NVL(end_date_active,sysdate)
    ]]></SQLQuery>
    <DesignTime>
    <Attr Name="_codeGenFlag" Value="4" />
    </DesignTime>
    <ViewAttribute
    Name="DisplayedField"
    IsQueriable="false"
    IsPersistent="false"
    Type="java.lang.String"
    Expression="DISPLAYED_FIELD"
    SQLType="VARCHAR"
    Precision="150"
    AliasName="DISPLAYED_FIELD" >
    <DesignTime>
    <Attr Name="_DisplaySize" Value="150" />
    </DesignTime>
    </ViewAttribute>
    <ViewAttribute
    Name="InternalValue"
    IsQueriable="false"
    IsPersistent="false"
    Type="java.lang.String"
    Expression="INTERNAL_VALUE"
    SQLType="VARCHAR"
    Precision="150"
    AliasName="INTERNAL_VALUE" >
    <DesignTime>
    <Attr Name="_DisplaySize" Value="150" />
    </DesignTime>
    </ViewAttribute>
    </ViewObject>
    Now I want to know how can i set the default value to it. Right now it is showing the the first of the list as the defualt value. And also i want to know what exactly is Picklist Display Attribute and Picklist value Attribute is used, while rendering the page in the portal.
    Please try to help me to solve this problem.
    Thanks in Advance
    Manohar

    Any help on this pls...

  • SAPKW70016 bugs with reference characteristics  and attributes

    Hi, experts!
    I have very big problem.
    When we've imported SAP BW SP 16 somthing went wrong as of reference characteristic and attributes.
    1) If InfoSet contains reference characteristic, it can't be activated. (Error message RSO404)
    2) If transformation rule is "read master data" and source characteristic contain compounded characteristic wiht same attribute as target field, and componded characteristic is above lexicographical then source characteristic. When you save this transformation this source field is removed from transformation rules? transformation can't be activated!!!
    3) When you use in compounded characteristics which are reference characteristic and you want to use this source characteristic in rule "read master data" you'll get dump.
    Now about reason and trials to resolve this problems.
    2) The reason is incorrect sorting and reading internal tables with characters in source fields in transformation with attribute target field. Problem is resolved with using rule "ABAP", FM "RSAU_READ_MASTER_DATA".
    3) and 1) The reason is program look for name REFERENCE character in table in field BASE characteristics names. Problem was resolved only fo happen 3) with disable "better" functionality "lookup_master_data" (note 1092539).
    Problem 1) is still open...
    What can I do?
    Thanks for all replies!
    P.S. Notes 1116379, 1112742, 1125321 have been implemented.
    Best regards,
    Antoshkin Vitaly.

    Hi, did you try to implement this following notes ?
    1158243     InfoSet in MultiProvider: Error message R7I 135
    1157410     InfoObject as InfoProvider: Follow-on note for Note 1063194
    1152136     Error during master data reading (ERROR_IN_MD_BUFFERING)
    1147263     Temporal hier. join characteristic, compounding, attributes
    1119777     THJ characteristic for referenced characteristic is missing
    1118497     Incorrect where-used list for referencing characteristics
    It´s have important corrections for SAPKW70016 version.
    I hope that this notes can be helpful.
    Best regards,
    Walter Oliveira.

  • ERMS Attribute "Problem Status" not picking up value in Mail Form

    Hi All,
    As per the current system, we have a mail form where we have added an attribute "Problem Tracking Text" and it inserts the Problem record number in the outgoing email.
    Currently we need to add another attribute, "Problem Status". But when this is added to the Mail form, it does not pick the status in the outgoing email.
    "Problem Status" attribute is maintained under E-Mail Response Management System -> Define Repository
    What other configuration is missing. Please advise.

    Issue is resolved. For those who might face this issue in future-
    Problem Status is automatically stored in Fact Base. There is no need to have them as text in the email.
    One can directly add them in rule policy. It was not working for us because Fact Base it was stored as E0005 and in Rule policy it was stored as Completed. Once we changed the input value for rule policy to E0005, it works perfectly.

  • I am not able to launch FF everytime i tr to open it, it says FF has to submit a crash report, i even tried doing that and the report was submitted too, but stiil FF did not start, and the problem still persists, please help me solve this issue in English

    Question
    I am not able to launch FF everytime i try to open it, it says FF has to submit a crash report,and restore yr tabs. I even tried doing that and the report was submitted too, but still FF did not start, and the problem still persists, please help me solve this issue
    '''(in English)'''

    Hi Danny,
    Per my understanding that you can't get the expect result by using the expression "=Count(Fields!TICKET_STATUS.Value=4) " to count the the TICKET_STATUS which value is 4, the result will returns the count of all the TICKET_STATUS values(206)
    but not 180, right?
    I have tested on my local environment and can reproduce the issue, the issue caused by you are using the count() function in the incorrect way, please modify the expression as below and have a test:
    =COUNT(IIF(Fields!TICKET_STATUS.Value=4 ,1,Nothing))
    or
    =SUM(IIF(Fields!TICKET_STATUS=4,1,0))
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • BOSD, Battery issues and Heating problem after iOS 8 upgrade

    i have upgraded my iPad mini to iOS 8. Ever since I upgraded to iOS 8 am facing blue screen issues and heating problem as well. This is really frustrating even the patch iOS 8.0.2 dint solve the problem. Are you guys listening our complaints. When will you fixing it.

    The same thing happened to me on my 2012 Subaru Outback.  I'm not sure this will help you since you have a Honda, but I'm posting this just in case.
    I paired the audio on my car with my iPhone 6.  However, when I turned the car off and back on again, the iPhone would not pair automatically.  I had to manually connect the iPhone with the car.  Turns out there are two separate bluetooth pairings on my car: one for phone which allows up to 5 devices and one for audio which allows only one device.  So I did the second bluetooth pairing for the phone (had already done the audio), and that fixed it.  YMMV

  • I am making code to try to make a game and my problem is that my code......

    I am making code to try to make a game and my problem is that my code
    will not let it change the hit everytime so im getting the first guy to hit 1 then next hits 8 and so on and always repeats.
    Another problem is that I would like it to attack with out me telling it how much times to attack. I am using Object oriented programming.
    Here is the code for my objects:
    import java.lang.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.util.Random;
    import static java.lang.Math.*;
    import java.awt.*;
    import java.awt.color.*;
    class rockCrab {
         //Wounding formula
         double sL = 70;                                   // my Strength Level
         double bP = 1;                                   // bonus for prayer (is 1 times prayer bonus)
         double aB = 0;                                 // equipment stats
         double eS = (sL * bP) + 3;                         // effective strength
         double bD = floor(1.3 + (eS/10) + (aB/80) + ((eS*aB)/640));     // my base damage
         //Attack formula
         double aL = 50;                                   // my Attack Level
         double eD = 1;                                   // enemy's Defence
         double eA = aL / eD;                              // effective Attack
         double eB = 0;                                   // equipment bonus'
         double bA = ((eA/10) * (eB/10));                    // base attack
         //The hit formula
         double fA = random() * bA;
         double fH = random() * bD;
         double done = rint(fH - fA);
         //health formula
         double health = floor(10 + sL/10 * aL/10);
         rockCrab() {
         void attack() {
              health = floor(10 + sL/10 * aL/10);
              double done = rint(fH - fA);
              fA = random() * bA;
              fH = random() * bD;
              done = rint(fH - fA);
              System.out.println("Rockcrab hit" +done);
    import java.lang.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.util.Random;
    import static java.lang.Math.*;
    import java.awt.*;
    import java.awt.color.*;
    class self {
         //Wounding formula
         double sL = 1;                                   // my Strength Level
         double bP = 1;                                   // bonus for prayer (is 1 times prayer bonus)
         double aB = 0;                                 // equipment stats
         double eS = (sL * bP) + 3;                         // effective strength
         double bD = floor(1.3 + (eS/10) + (aB/80) + ((eS*aB)/640));     // my base damage
         //Attack formula
         double aL = 1;                                   // my Attack Level
         double eD = 1;                                   // enemy's Defence
         double eA = aL / eD;                              // effective Attack
         double eB = 0;                                   // equipment bonus'
         double bA = ((eA/10) * (eB/10));                    // base attack
         //The hit formula
         double fA = random() * bA;
         double fH = random() * bD;
         double done = rint(fH - fA);
         //health formula
         double health = floor(10 + sL/10 * aL/10);
         self() {
         void attack() {
              health = floor(10 + sL/10 * aL/10);
              fA = random() * bA;
              fH = random() * bD;
              done = rint(fH - fA);
              System.out.println("You hit" +done);
    }Here is the main code that writes what the objects do:
    class fight {
         public static void main(String[] args) {
              self instance1 = new self();
              rockCrab instance2 = new rockCrab();
              instance2.health = instance2.health - instance1.done;
              System.out.println("You hit: " +instance1.done);
              System.out.println("rockCrabs health: " + instance2.health);
              instance1.health = instance1.health - instance2.done;
              System.out.println("RockCrab hit: " +instance2.done);
              System.out.println("rockCrabs health: " + instance1.health);
              instance2.health = instance2.health - instance1.done;
              System.out.println("You hit: " +instance1.done);
              System.out.println("rockCrabs health: " + instance2.health);
              instance1.health = instance1.health - instance2.done;
              System.out.println("RockCrab hit: " +instance2.done);
              System.out.println("rockCrabs health: " + instance1.health);
              instance2.health = instance2.health - instance1.done;
              System.out.println("You hit: " +instance1.done);
              System.out.println("rockCrabs health: " + instance2.health);
              instance1.health = instance1.health - instance2.done;
              System.out.println("RockCrab hit: " +instance2.done);
              System.out.println("rockCrabs health: " + instance1.health);
              instance2.health = instance2.health - instance1.done;
              System.out.println("You hit: " +instance1.done);
              System.out.println("rockCrabs health: " + instance2.health);
              instance1.health = instance1.health - instance2.done;
              System.out.println("RockCrab hit: " +instance2.done);
              System.out.println("rockCrabs health: " + instance1.health);
    }when the code is run it says something like this:
    you hit 1
    RockCrabs health is 9
    RockCrab hit 7
    your health is 38
    you hit 1
    RockCrabs health is 8
    RockCrab hit 7
    your health is 31
    you hit 1
    RockCrabs health is 7
    RockCrab hit 7
    your health is 24
    you hit 1
    RockCrabs health is 6
    RockCrab hit 7
    your health is 17
    my point is whatever some one hits it always repeats that
    my expected output would have to be something like
    you hit 1
    RockCrabs health is 9
    RockCrab hit 9
    your health is 37
    you hit 3
    RockCrabs health is 6
    RockCrab hit 4
    your health is 33
    you hit 2
    RockCrabs health is 4
    RockCrab hit 7
    your health is 26
    you hit 3
    RockCrabs health is 1
    RockCrab hit 6
    your health is 20
    Edited by: rade134 on Jun 4, 2009 10:58 AM

    [_Crosspost_|http://forums.sun.com/thread.jspa?threadID=5390217] I'm locking.

Maybe you are looking for