Method declaration problem

Hi,
I'm trying to write a class that lets the user enter the values for some parameters all of which are Floats.
I have get and set methods for each parameter.
example of some code:
public class Parameters
       private Float loat affinityThresholdScalar;
        public InitialiseParams(Float aT)
              affinityThresholdScalar = aT;
     public void setAffinityThresholdScalar(Float aT)
              affinityThresholdScalar = aT;
       public Float getAffinityThresholdScalar()
              return affinityThresholdScalar;
}The error i'm getting is:
invalid method declaration; return type required
public InitialiseParams(Float aT,Float cR,Float hR,Float k,Float s,Float sV,Float tR)
can anybody help?
Thanks

The error i'm getting is:
invalid method declaration; return type required
public InitialiseParams(Float aT,Float
aT,Float cR,Float hR,Float k,Float s,Float sV,Float tR)
can anybody help?Yup: read the error diagnostic: the compiler found a method 'InitialiseParams',
but it didn't find the return type of that method (because you didn't supply any).
Even methods that return nothing, return 'void', so you should simply
alter the method definition to:public void InitialiseParams(Float aT) {
      affinityThresholdScalar = aT;
}kind regards,
Jos

Similar Messages

  • ClassCastException in method declaration in JSP page??

    i keep getting this ClassCastException in my jsp page. The line that
    is apparently the problem is the <%! where the method declaration
    starts. I can't seem to figure out why this is happening, can someone
    please help? Here is the full code:
    java.lang.ClassCastException
         at quickfix0itm_0submit__jsp.addUpdate(/epsc/quickfix_itm_submit.jsp:25)
         at quickfix0itm_0submit__jsp._jspService(/epsc/quickfix_itm_submit.jsp:165)
         at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
         at com.caucho.jsp.Page.subservice(Page.java:506)
         at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
         at com.caucho.server.http.Invocation.service(Invocation.java:315)
         at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
         at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:344)
         at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
         at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
         at java.lang.Thread.run(Thread.java:534)
    <%
    if ( (session.getAttribute("setID") == null ) || ( !session.getAttribute("setID").equals(session.getId()) ))
            out.write("You are either not logged in or your session has timed out due to inactivity.<BR>"
                    + "Please <a href=\"index.jsp\">return to the login screen</a> and login again<BR><BR>");
    else
    %>
    <%@ page language=java %>
    <%@ page import='java.sql.*' %>
    <%@ page import='javax.sql.*' %>
    <%@ page import='javax.naming.*' %>
    <%@ page import='java.io.*' %>
    <%@ page import='java.util.Hashtable' %>
    <%@ page import='java.util.Vector' %>
    <%@ page import='java.util.Enumeration' %>
    <%@ page import='java.util.Calendar' %>
    <%@ page import='java.util.GregorianCalendar' %>
    <%!
    private void addUpdate(String[] tmpP, String[] UIDs, String curName, String colName, String lastIdx, Hashtable uid_updates)
         if (curName.equals(colName))
              for (int c = 0; c < UIDs.length; c++)
                   Object[] tmp = (Object[])uid_updates.get(UIDs[c]);
                   Vector colNames = new Vector();
                   Vector colValues = new Vector();
                   if (tmp == null)
                        tmp = new Object[2];
                   else
                        colNames = (Vector)tmp[0];
                        colValues = (Vector)tmp[1];
                   String updateVal = tmpP[0];
                   colNames.add(curName);
                   colValues.add(updateVal);
                   tmp[0] = colNames;
                   tmp[1] = colValues;
                   uid_updates.remove(UIDs[c]);
                   uid_updates.put(UIDs[c], tmp);
         else
              int uidIdx = curName.lastIndexOf(lastIdx);
              String uidcode = curName.substring(uidIdx + 1);
              Object[] tmp = (Object[])uid_updates.get(uidcode);
              Vector colNames = new Vector();
              Vector colValues = new Vector();
              if (tmp == null)
                   tmp = new Object[2];
              else
                   colNames = (Vector)tmp[0];
                   colValues = (Vector)tmp[1];
              //String[] tmpP = request.getParameterValues(curName);
              String updateVal = tmpP[0];
              colNames.add(colName);
              colValues.add(updateVal);
              tmp[0] = colNames;
              tmp[1] = colValues;
              uid_updates.remove(uidcode);
              uid_updates.put(uidcode, tmp);
    %>
    <%
    String ss = "0";
    String force_noon = "0";
    String qfix_duration = "2";
    int qfixd = 2;
    String mod_keys = "";
    String[] mktmp = request.getParameterValues("mod_keys");
    if (mktmp == null)
         out.print("Error! Please go back and try again.");
    else
         mod_keys = mktmp[0];
    Hashtable uid_updates = new Hashtable();
    String[] UIDs = new String[1];
    if (mod_keys.equals("1"))
         UIDs = request.getParameterValues("UID");
         for (int storeUIDs = 0; storeUIDs < UIDs.length; storeUIDs++)
              Vector tmp = new Vector();
              uid_updates.put(UIDs[storeUIDs], tmp);
    Enumeration cols = request.getParameterNames();
    while (cols.hasMoreElements())
         String curName = (String)cols.nextElement();
         if (curName.indexOf("BusName") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "BusName", "e", uid_updates);
         else if (curName.equals("ss"))
              String[] asdfadf  = request.getParameterValues(curName);
              if (asdfadf != null)
                   ss = "1";
              else
                   ss = "0";
         else if (curName.equals("force_noon"))
              String[] asdfadf  = request.getParameterValues(curName);
              force_noon = asdfadf[0];
         else if (curName.equals("qfix_duration"))
              String[] asdfadf  = request.getParameterValues(curName);
              qfix_duration = asdfadf[0];
              qfixd = Integer.parseInt(qfix_duration);
         else if (curName.indexOf("DisplayLine") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "DisplayLine", "e", uid_updates);
         else if (curName.indexOf("CityName") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "CityName", "e", uid_updates);
         else if (curName.indexOf("PAC") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "PAC", "C", uid_updates);
         else if (curName.indexOf("ProvDisp") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "ProvDisp", "p", uid_updates);
         else if (curName.indexOf("TeleNum") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "TeleNum", "m", uid_updates);
         else if (curName.indexOf("ProvCode") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "ProvCode", "e", uid_updates);
         else if (curName.indexOf("Dircode") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "Dircode", "e", uid_updates);
         else if (curName.indexOf("Hdgcode") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "Hdgcode", "e", uid_updates);
         else if (curName.indexOf("EMail") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "EMail", "l", uid_updates);
         else if (curName.indexOf("URL") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "URL", "L", uid_updates);
         else if (curName.indexOf("DispAd") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "DispAd", "d", uid_updates);
         else if (curName.indexOf("TOPlus") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "TOPlus", "s", uid_updates);
         else if (curName.indexOf("EStore") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "EStore", "e", uid_updates);
         else if (curName.indexOf("HSLINE_EN") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "HSLINE_EN", "N", uid_updates);
         else if (curName.indexOf("HSLINE_FR") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "HSLINE_FR", "R", uid_updates);
         else if (curName.indexOf("MtlPlus") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "MtlPlus", "s", uid_updates);
         else if (curName.indexOf("CalPlus") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "CalPlus", "s", uid_updates);
         else if (curName.indexOf("EdmPlus") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "EdmPlus", "s", uid_updates);
         else if (curName.indexOf("VanPlus") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "VanPlus", "s", uid_updates);
         else if (curName.indexOf("DEALER_LOCATOR") != -1)
              addUpdate(request.getParameterValues(curName), UIDs, curName, "DEALER_LOCATOR", "R", uid_updates);
    long curTime = System.currentTimeMillis();
    long monthMS = 2629743832L;
    long expLength = monthMS * qfixd;
    long expTime = curTime + expLength;
    java.sql.Date d1 = new java.sql.Date(System.currentTimeMillis());
    String Start_Date = d1.toString();
    d1 = new java.sql.Date(expTime);
    String Expiry_Date = d1.toString();
    Context env1 = (Context) new InitialContext().lookup("java:comp/env");
    DataSource source1 = (DataSource) env1.lookup("jdbc/epsc");
    Connection conn1 = source1.getConnection();
    String Pub_ID = "";
    try {
         Enumeration uidKeys = uid_updates.keys();
         while (uidKeys.hasMoreElements())
              String Unique_ID = (String)uidKeys.nextElement();
              Object[] updateData = (Object[])uid_updates.get(Unique_ID);
              Vector colNames = (Vector)updateData[0];
              Vector colValues = (Vector)updateData[1];
              String selectRecord = "SELECT * from epsc_ypca WHERE Unique_ID='" + Unique_ID + "';";
              Statement getRecord = conn1.createStatement();
              ResultSet returned = getRecord.executeQuery(selectRecord);
              Pub_ID = returned.getString("Pub_ID");
              boolean createDelete = false;
              String updateString = "";
              for (int b = 0; b < colNames.size(); b++)
                   if (b != 0)
                        updateString = updateString + ", ";
                   String colName = (String)colNames.get(b);
                   String colVals = (String)colValues.get(b);
                   if (colName.equals("BusName") || colName.equals("DisplayLine") || colName.equals("ProvDisp") || colName.equals("CityName") || colName.equals("PAC") || colName.equals("TeleNum"))
                        if (!((returned.getString(colName)).equals(colVals)))
                             createDelete = true;
                   updateString = updateString + colName + "='" + colVals + "'";
              if (createDelete)
                   //create delete
                   String delFromQuickfixes = "DELETE FROM epsc_quickfixes WHERE Start_Date='" + Start_Date + "' AND Pub_ID='" + Pub_ID + "' AND QFix_Type='2';";
                   Statement delItm = conn1.createStatement();
                   delItm.execute(delFromQuickfixes);
                   String insertQfixDel = "INSERT INTO epsc_quickfixes SELECT *, '0' as UID, '" + Start_Date + "' as Start_Date, '" + Expiry_Date + "' as Expiry_Date, '2' as QFix_Type, '0' as ss, '" + force_noon + "' as force_noon FROM epsc_ypca WHERE Pub_ID='" + Pub_ID + "' AND (Record_Ind='2' OR Record_Ind='4' OR Record_Ind='6');";
                   Statement insertQFDEL = conn1.createStatement();
                   insertQFDEL.execute(insertQfixDel);
              String updateRecords = "UPDATE epsc_ypca SET " + updateString + " WHERE Unique_ID='" + Unique_ID + "';";
         String selectAndInsert = "INSERT INTO epsc_quickfixes SELECT *, '0' as UID, '" + Start_Date + "' as Start_Date, '" + Expiry_Date + "' as Expiry_Date, '3' as QFix_Type, '" + ss + "' as ss, '" + force_noon + "' as force_noon FROM epsc_ypca WHERE Pub_ID='" + Pub_ID + "';";
         Statement insertIntoQfix = conn1.createStatement();
         insertIntoQfix.execute(selectAndInsert);
         out.write("Quickfix Successfully submitted.<BR><BR>\r\n");
    catch (SQLException e)
            out.write("<h1>SQL ERROR: " + e.getMessage() + "<BR><BR>Please report to administrator</h1>");
    finally{
            conn1.close();
    %>
    <BR><BR>[ <a href="menu.jsp">Return To Main</a> ]
    </center>
    </BODY>
    </HTML>
    <%
    %>

    it is the exact same as the one i originally posted:
    500 Servlet Exception
    java.lang.ClassCastException
         at quickfix0itm_0submit__jsp.addUpdate(/epsc/quickfix_itm_submit.jsp:24)
         at quickfix0itm_0submit__jsp._jspService(/epsc/quickfix_itm_submit.jsp:169)
         at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
         at com.caucho.jsp.Page.subservice(Page.java:506)
         at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
         at com.caucho.server.http.Invocation.service(Invocation.java:315)
         at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
         at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:344)
         at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
         at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
         at java.lang.Thread.run(Thread.java:534)

  • NullPointerException on a method declaration?

    Hi all,
    I'm not sure whether I should be posting this here on on the app server board.
    But anyway, I have an ADF application (with ADF Faces) that works fine in JDev 10.1.3, and after some difficulty, I've managed to get it deployed, so that the first page comes up properly in a browser.
    When I click on a link in my navigation tree, however, I get an error in the method called by the CommandLink in the tree node. Here's what it is:
    javax.faces.FacesException: #{homeBean.treeNavigate}: javax.faces.el.EvaluationException
    Caused by [at the bottom]: java.lang.NullPointerException
    at mypackage.BasePage.TreeNavigate (BasePage.java:53)
    So OK, for some reason my code is firing a null pointer exception in the deployed version. Let's see what it is by checking BasePage.java, line 53:
    53) public String treeNavigate() {
    A method declaration. That shouldn't be able to throw a NullPointerException, or indeed any other runtime error, should it?
    Can anyone shed some light about what might be going on here?
    Thanks much,
    Avrom

    public void drawPictures(int size, Graphics page)
              page.drawImage (board, 0, 0, 720, 567, this);
    public void paint (Graphics page)
              drawPictures (APPLET_WIDTH, page);
    private final int APPLET_WIDTH = 720;
    board = getImage (getDocumentBase(), "board.jpg"); //inside my init() methodThanks for the quite response. I looked at my code with your suggestions and came up with this:
    If I take away my "paint" method, the buttons have no problems, but, of course, no picture comes up. Any ideas?
    I was also throw out the fact that this is my first time with GUIs. My teacher saved them to the end last year, got lazy, and then never did them. So if I am using horrible self-taught practices, it would be awesome if you can let me know, so I can improve. Thanks.
    Edited by: 7sunami on Feb 22, 2009 6:00 PM

  • Invalid method declarations?

    hi, new to JAVA, and i have a problem, I am getting invalid method declarations for "printStraightLine()" and "printSumOfYears();" and would like them to become valid so that way i am able to start cracking away at the formulas...any type of suggestions would be appreciated...Mike...so here's the code:
    import java.io.*;
      class Depreciation
        private char choice;
        private int purchasePrice;
        private int salvageValue;
        private int usefulLife;
        private printSumOfYears();
        private printStraightLine();
        private double deprec;
       Depreciation()   {}
       Depreciation(char choice, int purchasePrice, int salvageValue, int usefulLife)
           this.choice = choice;
           this.purchasePrice = purchasePrice;
           this.salvageValue = salvageValue;
           this.usefulLife = usefulLife;
        public char getchoice()
                {return choice;}
        public int getpurchasePrice()
                {return purchasePrice;}
        public int getsalvageValue()
                {return salvageValue;}
        public int getusefulLife()
                {return usefulLife ;}
      void setDepreciation(int purchasePrice, int salvageValue, int usefulLife)
        this.purchasePrice = purchasePrice;
          this.salvageValue = salvageValue;
          this.usefulLife = usefulLife;
      void setChoice(char choice)
      {  this.choice = choice;}
    public printStraightLine()
    {   double deprec;
        while (usefulLife < 0);
        for (usefulLife = 1; usefulLife <= usefulLife; usefulLife++)
            deprec = (purchasePrice - salvageValue) / (usefulLife);
            System.out.println("Year"+ usefulLife + "\t" + "Depreciation" + "\t" + deprec);
    public printSumOfYears()
      { double deprec;
          while (usefulLife <=1);
          for (usefulLife = usefulLife; usefulLife <= 1; usefulLife--)
              deprec =
              System.out.println("Year"+ usefulLife + "\t" + "Depreciation" + "\t" + deprec);
    public String toString();
              String s = new String();
              s = ' ' + "Purchase Price = " + purchasePrice + "  " + "Salvage Value = " + salvageValue + "  " + "Use Life = " + usefulLife + "  " + "Sum of Years = " + SumOfYears + "  " + "Straight Line = " + StraightLine;
              return s;
     

    That did it! I forgot to declare printSumof... and print Straight... as String Methods...
    ok now ive gotten rid of all the syntax errors in it and now ive run into a larger problem...the menu class that i have, wont accept my Depreciation...i think its perhaps theres something wrong with the toString Method perhaps but this is the last bit i need to get over the hill, per se...so heres the Depreciation Coding(without syntax errors and following it will be my MenuDrivenClass that corresponds....
    DEPRECIATION CODING
    import java.io.*;
      class Depreciation
        private char choice;
        private double purchasePrice;
        private double salvageValue;
        private int usefulLife;
       Depreciation()   {}
       Depreciation(char choice, double purchasePrice, double salvageValue, int usefulLife)
           this.choice = choice;
           this.purchasePrice = purchasePrice;
           this.salvageValue = salvageValue;
           this.usefulLife = usefulLife;
        public char getChoice()
                {return choice;}
        public double getpurchasePrice()
                {return purchasePrice;}
        public double getsalvageValue()
                {return salvageValue;}
        public int getusefulLife()
                {return usefulLife ;}
      void setDepreciation(double purchasePrice, double salvageValue, int usefulLife)
        this.purchasePrice = purchasePrice;
          this.salvageValue = salvageValue;
          this.usefulLife = usefulLife;
      void setChoice(char choice)
      {  this.choice = choice;}
    public String printStraightLine()
    {   double deprec;
        while (usefulLife < 0);
        for (usefulLife = 1; usefulLife <= usefulLife; usefulLife++)
            deprec = (purchasePrice - salvageValue) / (usefulLife);
            System.out.println("Year"+ usefulLife + "\t" + "Depreciation" + "\t" + deprec);
    public String printSumOfYears() //musthave decrementing loop
      { double deprec;
          while (usefulLife >=1);
          for (usefulLife = usefulLife; usefulLife >= 1; usefulLife--)
              deprec = 20-10;
              System.out.println("Year"+ usefulLife + "\t" + "Depreciation" + "\t" + deprec);
    public String toString()
              String d = new String();
              d = ' ' + "Purchase Price = " + purchasePrice + "  " + "Salvage Value = " + salvageValue + "  " + "Use Life = " + usefulLife + "  " + "Sum of Years = " + printSumOfYears() + "  " + "Straight Line = " + printStraightLine();
              return d;
      NOW HERES THE MENU DRIVEN CLASS
    // Professor Dreher
    import java.text.DecimalFormat;
    import java.io.*;
    public class MenuDrivenClass2
        public static void main(String[] args)throws IOException
          BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
          char choice;
          Depreciation myDepreciation = new Depreciation();
          do
            PrintMenu();
            choice = GetChoice();
            switch (choice)
              case 'i': myDepreciation= getInput();
                        break;
              case 'a': System.out.println(myDepreciation);
                        myDepreciation.printStraightLine();
                        break;
              case 'b': System.out.println(myDepreciation);
                        myDepreciation.printSumOfYears();
                        break;
              case 'q': System.out.print(" Goodbye, have a nice day! ");
                        break;
           }//ends switch
         }while(choice != 'q');
       }//ends main
      static void PrintMenu()
          System.out.println("\n\n i - to input new depreciation information ");
          System.out.println(" a - to use the straight-line method ");
          System.out.println(" b - to use the sum-of-the-years' digits method ");
          System.out.println(" q - to quit ");
          System.out.print(" --> " );
      static char GetChoice()throws IOException
           BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
           char choice;
           do
             String text = in.readLine();
             choice = Character.toLowerCase(text.charAt(0));
             if(choice != 'i' && choice != 'a' && choice != 'b'  && choice != 'q')
               {  System.out.print(" Incorrect choice, please try again! ");}
            } while (choice != 'i' && choice != 'a' && choice != 'b'  && choice != 'q');
           return(choice);
      static Depreciation getInput()throws IOException
           BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
           System.out.print("\n Enter Purchase Price: ");
           double purchasePrice = Double.parseDouble(in.readLine());
           System.out.print(" Enter Salvage Value: ");
           double salvageValue = Double.parseDouble(in.readLine());
           System.out.print(" Enter Useful Life: ");
           int usefulLife = Integer.parseInt(in.readLine());
           Depreciation d = new Depreciation(purchasePrice,salvageValue,usefulLife);
           return(d);              
    }IN THE LAST LINE(Depreciation d=....), the "new" is a syntax error, reading..."cannot resolve symbol Depreciation (double, double, int) @ line 86"....I thank all for helping me...the Duke Dollars is now up to 10...any help is greatly appreciated....SO, any thoughts?

  • Method declaration of an interface

    Hi,
    Here's an interface definition.
    public interface Foo {
    public Object getSomeObject(Object param);
    What i want to find out is,
    why do we need to specify a variable reference in the interface?
    public interface Foo {
    public Object getSomeObject(Object);//throws error.
    Thank you.

    Hi,
    Here's an interface definition.
    public interface Foo {
    public Object getSomeObject(Object param);
    What i want to find out is,
    why do we need to specify a variable reference inthe
    interface?
    public interface Foo {
    public Object getSomeObject(Object);//throwserror.
    Thank you.The interface method is just a signature that all
    classes implementing the interface must follow. Its
    syntax requires that the variable reference is
    included. There is no other reason. Its like the word
    "bought" is spelt the way it is..It could have also
    been splet as "bot" but that is incorrect.!!!
    That is right.
    It is just a signature. Also, it allows the compiler to perform its actions consistently, most of all, thereby not offering any special privileges to an interface method declaration. As we all know that the byte code representation of an 'interface type' is also a class.

  • Should I declare IllegalArgumentException in my method declaration

    Hi,
    I have a setter method which throws an IllegalArgumentException which is of type RuntimeException... It means that I need not declare it in my method declaration, but I should explicity describe in Javadoc.
    Is it a good practice to declare it in throws clause just to make it more readable? or is it superfluous and unnecessary because I am going to describe it in Javadoc anyway?
    I mean....
      * @throws IllegalArgumentException
    public void setterMethod() {
    vs
      * @throws IllegalArgumentException
    public void setterMethod() throws IllegalArgumentException {
    }Thank you,
    Srikanth

    I have a setter method which throws an
    IllegalArgumentException which is of type
    RuntimeException... It means that I need not declare
    it in my method declaration, but I should explicity
    describe in Javadoc.If you conclude that it is important that the other programmers know in which situation your method throws an IllegalArgumentException then go ahead and describe it in javadoc. If you think that it's not important, or it's not necessary, you don't need to describe it. But in general, the unchecked exception IllegalArgumentException, if it is used according to its purposes, deserves a javadoc description. Although I think you are not using this exception appropriately, because your method doesn't even have a parameter! I hope you are showing just an example, just to support your question.
    Is it a good practice to declare it in throws clause
    just to make it more readable? or is it superfluous
    and unnecessary because I am going to describe it in
    Javadoc anyway?No! It does not make it more readable. IllegalArgumentException is an unchecked exception, so you have to take advantage of this "uncheackability", that is, the advantage of not being needed to declare that the method throws it. In any case, you shouldn't declare the throws clause for any kind of unchecked exception. A description in javadoc is enough. But I see that you're just saying that the method can throw IllegalArgumentException, in the javadoc. Why don't you give more details? It is a good practice. See below an example:
      * @throws IllegalArgumentException if the parameter name passed is null,
      * or if it is equal to "".
    public void setterMethod(String name) {
    }

  • Invalid method declaration; return type required

    The code:
              public Reminder(int seconds) {
            timer = new Timer();
            timer.schedule(new RemindTask(), seconds*1000);
        class RemindTask extends TimerTask {
            public void run() {
                System.out.format("Time's up!%n");
                timer.cancel(); //Terminate the timer thread
    public static void main(String[] args)
              JFrame.setDefaultLookAndFeelDecorated(true);
              JDialog.setDefaultLookAndFeelDecorated(true);
              try
                   UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              catch (Exception ex)
                   System.out.println("Failed loading L&F: ");
                   System.out.println(ex);
           new superball();
                    new Reminder(5);
            System.out.format("Task scheduled.%n");
    //= End of Testing =
        }Gives:
    "invalid method declaration; return type required"
    If i add void to public Reminder(int seconds) {It prints:
    cannot find symbol
    symbol : class Reminder
    location: class superball
    new Reminder(5);
    Is it because of the public class?
    public class superball extends JFrameHere is the FULL code:
    /*                      superball                                 */
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.regex.Pattern;
    import java.util.Timer;
    import java.util.TimerTask;
    import java.util.*;
    import java.io.*;
    * Summary description for superball
    public class superball extends JFrame
         // Variables declaration
         int ballx;
      int bally;
         int jumpstop;
         int stopper;
         int coin;
         int coinx;
         int coiny;
         int coinvaluex;
         int coinvaluey;
      Timer timer;
      private int value = 0;
         private static Random r = new Random();
         private JLabel jLabel1;
         private JLabel jLabel2;
         private JLabel jLabel4;
         private JLabel jLabel5;
         private JLabel jLabel7;
         private JLabel jLabel9;
         private JLabel jLabel10;
         private JPanel contentPane;
         private JPanel jPanel1;
         // End of variables declaration
         public superball()
              super();
              initializeComponent();
              // TODO: Add any constructor code after initializeComponent call
              this.setVisible(true);
          * This method is called from within the constructor to initialize the form.
          * WARNING: Do NOT modify this code. The content of this method is always regenerated
          * by the Windows Form Designer. Otherwise, retrieving design might not work properly.
          * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder
          * to retrieve your design properly in future, before revising this method.
         private void initializeComponent()
              jLabel1 = new JLabel();
              jLabel2 = new JLabel();
              jLabel4 = new JLabel();
              jLabel5 = new JLabel();
              jLabel7 = new JLabel();
              jLabel9 = new JLabel();
              jLabel10 = new JLabel();
              coin = 1;
              coinx = Math.abs(r.nextInt()) % 460 + 100;
              coiny = Math.abs(r.nextInt()) % 200 + 100;
              ballx = 342;
              bally = 338;
              jumpstop = 0;
              stopper = 13;
              contentPane = (JPanel)this.getContentPane();
              jPanel1 = new JPanel();
              // jLabel1
              jLabel1.setIcon(new ImageIcon("IMG\\coin.gif"));
              jLabel1.setText("0");
              // jLabel2
              jLabel2.setIcon(new ImageIcon("IMG\\logo.PNG"));
              // jLabel4
              jLabel4.setIcon(new ImageIcon("IMG\\black.GIF"));
              // jLabel5
              jLabel5.setIcon(new ImageIcon("IMG\\ballstanding2.gif"));
              // jLabel7
              jLabel7.setIcon(new ImageIcon("IMG\\star-heart.gif"));
              jLabel7.setText(" 100");
              // jLabel9
              jLabel9.setIcon(new ImageIcon("IMG\\coin.gif"));
              // jLabel10
              jLabel10.setIcon(new ImageIcon("IMG\\stage1.GIF"));
              // contentPane
              contentPane.setLayout(null);
              contentPane.setBackground(new Color(255, 254, 254));
              addComponent(contentPane, jLabel5, 342,338,60,18);
              addComponent(contentPane, jLabel1, 561,4,100,18);
              addComponent(contentPane, jLabel2, 2,3,208,24);
              addComponent(contentPane, jLabel7, 495,4,60,18);
              addComponent(contentPane, jLabel9, coinx,coiny,19,18);
              addComponent(contentPane, jLabel2, 2,3,208,24);
              addComponent(contentPane, jLabel10, -2,29,738,412);
              addComponent(contentPane, jPanel1, 79,209,200,100);
              // jPanel1
              jPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
              jPanel1.setFocusable(true);
              jPanel1.addKeyListener(new KeyAdapter() {
                   public void keyPressed(KeyEvent e)
                        jPanel1_keyPressed(e);
                   public void keyReleased(KeyEvent e)
                        jPanel1_keyReleased(e);
                   public void keyTyped(KeyEvent e)
                        jPanel1_keyTyped(e);
              // superball
              this.setTitle("Superball created by Hannes Karlsson");
              this.setLocation(new Point(0, 0));
              this.setSize(new Dimension(617, 450));
              this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              this.setResizable(false);
         /** Add Component Without a Layout Manager (Absolute Positioning) */
         private void addComponent(Container container,Component c,int x,int y,int width,int height)
              c.setBounds(x,y,width,height);
              container.add(c);
         // TODO: Add any appropriate code in the following Event Handling Methods
         private void jPanel1_keyPressed(KeyEvent e)
              System.out.println("\njPanel1_keyPressed(KeyEvent e) called.");
              // TODO: Add any handling code here
              if(e.getKeyCode()==e.VK_LEFT) // when the user enters left
                  jLabel5.setLocation(new Point(ballx--, bally));
                        jLabel5.setLocation(new Point(ballx--, bally));
                        jLabel5.setLocation(new Point(ballx--, bally));
                        jLabel5.setLocation(new Point(ballx--, bally));
                        jLabel5.setIcon(new ImageIcon("IMG\\ballroll.gif"));
                        } // equalling PLAIN_SPEED
                                            if(e.getKeyCode()==e.VK_RIGHT) // when the user enters right
                  jLabel5.setLocation(new Point(ballx++, bally));
                        jLabel5.setLocation(new Point(ballx++, bally));
                        jLabel5.setLocation(new Point(ballx++, bally));
                        jLabel5.setLocation(new Point(ballx++, bally));
                        jLabel5.setIcon(new ImageIcon("IMG\\ballroll.gif"));
                        } // equalling PLAIN_SPEED
                                                                if(e.getKeyCode()==e.VK_UP) // when the user enters up
                  jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setIcon(new ImageIcon("IMG\\balljetpack.gif"));
                        } // equalling PLAIN_SPEED
                                                                                    if(e.getKeyCode()==e.VK_DOWN) // when the user enters up
                  jLabel5.setLocation(new Point(ballx, bally++));
                        jLabel5.setLocation(new Point(ballx, bally++));
                        jLabel5.setLocation(new Point(ballx, bally++));
                        jLabel5.setLocation(new Point(ballx, bally++));
                        jLabel5.setIcon(new ImageIcon("IMG\\ballroll.gif"));
                        } // equalling PLAIN_SPEED     
                        if(bally>=340)
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                                  System.out.println("LOW!!!");
                        if(bally<=-2)
                        jLabel5.setLocation(new Point(ballx, bally++));
                        jLabel5.setLocation(new Point(ballx, bally++));
                        jLabel5.setLocation(new Point(ballx, bally++));
                        jLabel5.setLocation(new Point(ballx, bally++));
                                  System.out.println("HIGH!!!");
                                            if(ballx>=594)
                        jLabel5.setLocation(new Point(ballx--, bally));
                        jLabel5.setLocation(new Point(ballx--, bally));
                        jLabel5.setLocation(new Point(ballx--, bally));
                        jLabel5.setLocation(new Point(ballx--, bally));
                                  System.out.println("RIGHT!!!");
                                                                if(ballx<=-3)
                        jLabel5.setLocation(new Point(ballx++, bally));
                        jLabel5.setLocation(new Point(ballx++, bally));
                        jLabel5.setLocation(new Point(ballx++, bally));
                        jLabel5.setLocation(new Point(ballx++, bally));
                                  System.out.println("LEFT!!!");
                                                                           if (bally==294 && (ballx > 218 && ballx < 274))
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                                                                           if (bally==262 && (ballx > 246 && ballx < 306))
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                                                       if (bally==230 && (ballx > 486 && ballx < 562))
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                                        if (bally==310 && (ballx > 486 && ballx < 594))
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                         if (bally==262 && (ballx > 442 && ballx < 514))
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
          if (bally==294 && (ballx > 378 && ballx < 466))
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                        jLabel5.setLocation(new Point(ballx, bally--));
                   // COIN
                         if ((bally > coiny-10 && bally < coiny+10) && (ballx > coinx-10 && ballx < coinx+10))
                coinx = Math.abs(r.nextInt()) % 617 + 1;
                coiny = Math.abs(r.nextInt()) % 300 + 1;
                   jLabel9.setLocation(new Point(coinx, coiny));
                        System.out.println("Coinx:"+coinx+"");
                        System.out.println("Coiny:"+coiny+"");
                        jLabel1.setText(""+ coin++ +"");
                        System.out.println("Ballx:"+ballx+"");
                        System.out.println("Bally:"+bally+"");
         private void jPanel1_keyReleased(KeyEvent e)
              System.out.println("\njPanel1_keyReleased(KeyEvent e) called.");
              // TODO: Add any handling code here
              jLabel5.setIcon(new ImageIcon("IMG\\ballstanding2.gif"));
         private void jPanel1_keyTyped(KeyEvent e)
              System.out.println("\njPanel1_keyTyped(KeyEvent e) called.");
              // TODO: Add any handling code here
         // TODO: Add any method code to meet your needs in the following area
    //============================= Testing ================================//
    //=                                                                    =//
    //= The following main method is just for testing this class you built.=//
    //= After testing,you may simply delete it.                            =//
    //======================================================================//
              public void Reminder(int seconds) {
            timer = new Timer();
            timer.schedule(new RemindTask(), seconds*1000);
        class RemindTask extends TimerTask {
            public void run() {
                System.out.format("Time's up!%n");
                timer.cancel(); //Terminate the timer thread
         public static void main(String[] args)
              JFrame.setDefaultLookAndFeelDecorated(true);
              JDialog.setDefaultLookAndFeelDecorated(true);
              try
                   UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              catch (Exception ex)
                   System.out.println("Failed loading L&F: ");
                   System.out.println(ex);
           new superball();
                    new Reminder(5);
            System.out.format("Task scheduled.%n");
    //= End of Testing =
    }

    No, it's because you can't have a constructor called Reminder if you don't have a class named Reminder.

  • Strange about invoking web service method declared “string  method(void)”;

    Dear forum readers
    I’m experimenting with OpenESB and web services. I’ve create a simple web service using NetBeans 6.1. The method consists of a single method, getTime, that is declared:
    String getTime()
    My current experiment is to invoke this method from a BPEL-process using the “Invoke” process object. The strange thing is that it seems like I have to provide a “dummy” inbound variable from the BPEL-designer even though the method doesn’t take any parameters. I include a snippet from the BPEL process below which includes the section where I set the dummy GetTimeIn-variable and then invokes the WS method getTime().
    <assign name="Assign2">
    <copy>
    <from>'DummyValue'</from>
    <to variable="GetTimeIn" part="parameters"/>
    </copy>
    </assign>
    <invoke name="Invoke1" partnerLink="PartnerLink1" operation="getTime" xmlns:tns="http://ws/" portType="tns:MyWebService" outputVariable="GetTimeOut" inputVariable="GetTimeIn"/>
    If I don’t initiate the dummy variable or remove it altogether, I can’t successfully call the method. If I include the dummy in-parameter the call works just fine and I get back the current time as a string.
    I must admit that I’m still a rookie to web services, especially when calling them from a BPEL-process, so it may be a very trivial reason for this behaviour. Anyway, any help on this matter would be greatly appreciated.
    Regards, Ola

    Thank you both for the response. Regarding Rennay’s posting I have an additional question. When I create a new web service I don't have the "Document Literal" option nor a "Concrete Configuration" tab. I've created the web service using the "Web Application" project type and then adding a web service using the "Web Service..." wizard. This wizard doesn't have the configuration properties you mention, but if I add a WSDL-file to a BPEL-project the wizard has the properties you mention.
    Is it possible to create a web service, programmed as an ordinary Java-class, from an existing WSDL-file? In that case it may solve the problem with the “Document Literal” property. Currently I don’t know any other way to create such a web-service other than the through the web service wizard in a web application project. Of course, it’s possible to craft it from scratch but that’s to much work to be practical.
    Regards, Ola

  • Invalid method declaration

    Hi there,
    I have a problem to compile below sentences.
    import java.awt.* ;
    import javax.swing.* ;
    import java.awt.event.* ;
    public class p662 extends JFrame
    public ShowColors()
    ** invalid method declariration for ShowColors ****
    super ("Using colors") ;
    Please help me.
    Best regards

    What the diddley?
    Your class name is p662 (what the heck is that?).
    The declaration public ShowColors looks like a constructor. You call super in it with a String argument, which looks like you want to invoke a JFrame ctor.
    You can't invoke a super class constructor in any method except a class constructor. The class constructors must have the same name as the class. The class must go in a file whose name is the same as the public class inside.
    You should follow the Sun coding standards for naming:
    http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
    What are you doing here? This is unintelligible. - MOD

  • Array declaration problems

    hi
    i am having problems with my array declarations
    import java.io.*;
    public class bubbleSort4{
      public static void main (String []args) throws IOException{
        BufferedReader input=new BufferedReader (new FileReader("numbers.txt"));
        for (int blah=0; blah<0; blah+=1 ){
        int array1[];
        array1[blah]=Integer.parseInt(input.readLine());
        }//end of for
        input.close();
        bubbleSort4(array1);
      }//end of main
    public static void bubbleSort4(int[] array1) {
      int newLowest = 0;            // index of first comparison
        int newHighest = array1.length-1;  // index of last comparison
        while (newLowest < newHighest) {
            int highest = newHighest;
            int lowest  = newLowest;
            newLowest = array1.length;    // start higher than any legal index
            for (int i=lowest; i<highest; i++) {
                if (array1[i] > array1[i+1]) {
                   // exchange elements
                   int temp = array1; array1[i] = array1[i+1]; array1[i+1] = temp;
    if (i<newLowest) {
    newLowest = i-1;
    if (newLowest < 0) {
    newLowest = 0;
    }//end of if
    } else if (i>newHighest) {
    newHighest = i+1;
    }//end of else if
    }//end of if
    }//end of for
    }//end of while
    }//end method bubbleSort4
    }//end of class
    i get the error where i call the bubbleSort4 method with the array1 in brakets, it says that it doesnt recognize the variable. i know thats because i declared it in the for loop, but when i declare the array outside the for loop, it says that it was not initialized when i use it in the for loop. a vicious cycle. lol. so please, someone help....

    int array1[];you must initilize the array1
    example :
    int [] array1 = null;or
    int [] array1 = new int [10];
    for (int blah=0; blah<0; blah+=1 ){the codes will never go into the above for loop since
    blah always >= 0;

  • I have a basic applet method timing problem with Firefox (and Chrome), not IE nor Opera. Works if JavaScript issues windows.alert() prior, fails otherwise.

    I have an applet method, which is invoked from a JavaScript function, that is triggered by the window.onload event. The problem seems to center in the loading of the applet and its methods.
    If I step through the 3 applet acceptance prompts (I chose to use a down-level Java), the applet method is never invoked, nor is an exception raised. How this happens is beyond my understanding.
    As additional information, the Init(), start(), and "desired" Java methods all use the synchronized keyword. This is an attempt to minimize the exposure to a multi-thread environment.
    If I issue a message from JavaScript (via window.alert()) PRIOR to invoking the method, I can get the desired results in special circumstances:
    1) When the alert is presented, Firefox also prompts, SIMULTANEOUSLY, to block/continue the applet (the first of the 3 applet acceptance prompts). I can accept that these are separate threads.
    2a) If I walk through the 3 applet acceptance prompts FIRST, and then hit the OK button on the alert message SECOND, I get the desired results, my applet method executes, and all is well (other than the fact that I would prefer not to have the alert in place at all).
    2b) If I hit the OK button on the alert message FIRST, and then walk through the 3 applet acceptance prompts SECOND, I get the same results as when the page loads WITHOUT the alert, which is the applet method is never invoked, nor is an exception raised. Weird, huh?
    The above problem only occurs when the browser and the applet's URL are loaded for the first time.
    Subsequent invocations (after the page & applet has been loaded initially) do not have the failing symptoms.
    It is my understanding that IE and Firefox (and Chrome and Opera, for that matter) each use the same implementation of JavaScript provided by Microsoft. Please correct me if this information is inaccurate.
    The failing page and it's applet are proprietary; I cannot provide the Internet URL, nor the Java or JavaScript source, to aid in your analysis.

    I can speak to the source code, but have no access to it.
    The current process/thread that invokes an applet method must check to see that the applet is not currently being loaded by another process/thread. If it is being loaded, the current process/thread should block until the load is complete, THEN attempt to invoke the applet method.
    Please forward my concern to a knowledgable developer. The nature of the problem, once identified, can be addressed in a very straightforward manner.

  • HDV 1080i to Standard def DVD "Ken Stone" method- interlace problems, help!

    Greetings,
    I am on a tight deadline to produce a standard def DVD for an art exhibit, from HDV material that was imported and edited natively in FCP 7 as 1080i. I used the "Ken Stone" method of exporting the 10 minute sequence using QT conversion, as a pro res 422 HQ quicktime movie, then I took it into compressor 3.5 to make a Mpeg-2 file for a standard def DVD.
    The problem is that the video that came out of compressor, when simulated in DVD SP 3.5 (and also when burned on DVD) has weird "interlaced" looking edges whenever there is movement in the video. It is a figure against a black background, and whenever the figure moves back and forth against the black background, the edges of the figure show interlaced-looking lines. The rest of the video where there is slow movement looks fine. BTW, motion was set to "Best" in compressor.
    What am I doing wrong? was there something not mentioned in Stone's walk-thru, having to do with de-interlacing, or something I have missed? Is there a better way to produce a standard def DVD from HDV 1080i material?
    Thank you so much for your help. I am down to the wire on this one...
    AKJ

    exporting the 10 minute sequence using QT conversion, as a pro res 422 HQ quicktime movie...
    You are adding an unneeded compression cycle for a start. Export with QuickTime Conversion always recompresses your footage, even when you use the same settings as your Timeline.
    Export to QuickTime with Current Settings, Self Contained will give you a Master file that is identical to what you edited.
    weird "interlaced" looking edges whenever there is movement in the video...
    If your source material is interlaced it will look odd on a computer monitor. It will display correctly on a TV set.
    having to do with de-interlacing, or something I have missed?
    Deinterlacing will throw away half of the vertical resolution. Bye bye HD. No good can come of that, right?
    What is your intended delivery format? Does the method that you are currently using to view the material compare with how the end product will be seen?

  • XSLT Grouping & Muenchian Method STRANGE PROBLEM

    Hi Everyone!
    I'm having a problem using a XMLTRANSFORM for grouping Muenchian Method.
    There are three oracle databases:
    DB1: Win2k3, Oracle 9.2.0.7 Standard,
    DB2: Win2k3, Oracle 9.2.0.7 Enterprise,
    DB3: WinXP, Oracle 10.2.0.1 XE.
    DB1 and DB2 are installed on different computers.
    And there are two scripts:
    S1: select
      xmltransform(xmltype(
      '<PROJECTS>
      <PROROW>
        <id>2</id><name>Customer 1</name><project_name>Project 2</project_name>
      </PROROW>
      <PROROW>
        <id>1</id><name>Customer 1</name><project_name>Project 1</project_name>
      </PROROW>
      <PROROW>
        <id>3</id><name>Customer 2</name><project_name>Project 1</project_name>
      </PROROW>
    </PROJECTS>'),
    xmltype(
    '<?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" encoding="UTF-8" version="1.0" indent="yes"></xsl:output>
    <xsl:key name="rows" match="PROROW" use="name" />
    <xsl:template match="PROJECTS">
    <xsl:element name="ROOT">
      <xsl:apply-templates
        select="PROROW[generate-id(.) = generate-id(key(''rows'', name)[1])]">
            <!--<xsl:value-of select="key(''rows'', name)">-->
      </xsl:apply-templates>
    </xsl:element>  
    </xsl:template>
    <xsl:template match="PROROW">
      <b><xsl:value-of select="name" /></b>
      <ul>
        <xsl:for-each select="key(''rows'', name)">
          <li>
            <xsl:element name="COUNT_KEYS">
              <xsl:value-of select="count(key(''rows'', name))" />
            </xsl:element>
            <a href="projects_results.xml?project={id}">
              <xsl:value-of select="project_name" />
            </a>
          </li>
        </xsl:for-each>
      </ul>
    </xsl:template>
    </xsl:stylesheet>')) x
    from dual;S2: select
      xmltransform(xmltype(
      '<REPORT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="report.xsd">
      <CONCEPT ID="0" TYPE="0">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">0</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.93a</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.94</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.44</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.93</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.94</COL>
        </ROW>
      </CONCEPT>
    </REPORT>'),
    xmltype(
    '<?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="UTF-8" version="1.0" indent="yes"></xsl:output>
    <xsl:key name="rows" match="CONCEPT" use="concat(@ID, @TYPE)" />
    <xsl:template match="REPORT">
      <xsl:copy>
          <xsl:apply-templates select="@*"/> 
          <xsl:apply-templates
            select="CONCEPT[generate-id(.) = generate-id(key(''rows'', concat(@ID, @TYPE))[1])]"/>
      </xsl:copy>
    </xsl:template>
    <xsl:template match="CONCEPT">
      <xsl:copy>
          <xsl:apply-templates select="@*"/>
          <!--<xsl:value-of select="count(key(''rows'', concat(@ID, @TYPE)))"/>|-->
          <xsl:for-each select="key(''rows'', concat(@ID, @TYPE))">
                        <xsl:copy-of select="ROW"/>
          </xsl:for-each>
      </xsl:copy>    
    </xsl:template>
    <xsl:template match="@*">
      <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:stylesheet>')) x
    from dual;S1 comes from http://sourceware.org/ml/xsl-list/2000-07/msg00458.html.
    S2 is mine.
    The results of executing these scripts are:
    S1 on DB1 & DB2:
    <ROOT>
      <b>Customer 1</b>
      <ul>
        <li>
          <COUNT_KEYS>1</COUNT_KEYS>
          <a href="projects_results.xml?project=2">Project 2</a>
        </li>
      </ul>
      <b>Customer 2</b>
      <ul>
        <li>
          <COUNT_KEYS>1</COUNT_KEYS>
          <a href="projects_results.xml?project=3">Project 1</a>
        </li>
      </ul>
    </ROOT>S2 on DB1 & DB2 is variable. For example:
    <REPORT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="report.xsd">
      <CONCEPT ID="0" TYPE="0">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">0</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.93</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.94</COL>
        </ROW>
      </CONCEPT>
    </REPORT>I obtained results with 2 (first two) and 5 (correct result!) <ROW> elements for <CONCEPT ID=”0” TYPE=”1”>.
    When I run S3 cyclic it returns (randomly): 2, 2, 2, 2, 5, 5, 2, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 2, ,2, 2, 2,5, 5, 5, 5, 5, 2, 2, 2 ROWs for 2nd CONCEPT. Sounds impossible? 1st CONCEPT is always with 1 <ROW>.
    I noticed that, when I remove xsi:noNamespaceSchemaLocation="report.xsd" attribute or set it to the value of not registered schema, S2 always return one (the first from the top) ROW for both CONCEPTs.
    I don't think it is a problem of my report.xsd schema, but the content of this schema is:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:flags="291" oraxdb:schemaURL="report.xsd" oraxdb:schemaOwner="SYS" oraxdb:numProps="7">
      <xs:element name="REPORT" type="reportType" oraxdb:propNumber="2447" oraxdb:global="true" oraxdb:SQLName="REPORT" oraxdb:SQLType="reportType229_T" oraxdb:SQLSchema="SYS" oraxdb:memType="258"/>
      <xs:complexType name="reportType" oraxdb:SQLType="reportType229_T" oraxdb:SQLSchema="SYS">
        <xs:sequence>
          <xs:element maxOccurs="unbounded" name="CONCEPT" oraxdb:propNumber="2453" oraxdb:global="false" oraxdb:SQLName="CONCEPT" oraxdb:SQLType="CONCEPT230_T" oraxdb:SQLSchema="SYS" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false" oraxdb:SQLCollType="CONCEPT236_COLL" oraxdb:SQLCollSchema="SYS">
            <xs:complexType oraxdb:SQLType="CONCEPT230_T" oraxdb:SQLSchema="SYS">
              <xs:sequence>
                <xs:element maxOccurs="unbounded" name="ROW" oraxdb:propNumber="2452" oraxdb:global="false" oraxdb:SQLName="ROW234" oraxdb:SQLType="ROW231_T" oraxdb:SQLSchema="SYS" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false" oraxdb:SQLCollType="ROW234235_COLL" oraxdb:SQLCollSchema="SYS">
                  <xs:complexType oraxdb:SQLType="ROW231_T" oraxdb:SQLSchema="SYS">
                    <xs:sequence>
                      <xs:element maxOccurs="unbounded" name="COL" oraxdb:propNumber="2451" oraxdb:global="false" oraxdb:SQLName="COL" oraxdb:SQLType="COL232_T" oraxdb:SQLSchema="SYS" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false" oraxdb:SQLCollType="COL233_COLL" oraxdb:SQLCollSchema="SYS">
                        <xs:complexType oraxdb:SQLType="COL232_T" oraxdb:SQLSchema="SYS">
                          <xs:simpleContent>
                            <xs:extension base="xs:string">
                              <xs:attribute name="NAME" type="xs:string" use="required" oraxdb:propNumber="2450" oraxdb:global="false" oraxdb:SQLName="NAME" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1"/>
                            </xs:extension>
                          </xs:simpleContent>
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
              <xs:attribute name="ID" type="xs:short" use="required" oraxdb:propNumber="2448" oraxdb:global="false" oraxdb:SQLName="ID" oraxdb:SQLType="NUMBER" oraxdb:memType="3" oraxdb:memByteLength="2"/>
              <xs:attribute name="TYPE" type="xs:short" use="required" oraxdb:propNumber="2449" oraxdb:global="false" oraxdb:SQLName="TYPE" oraxdb:SQLType="NUMBER" oraxdb:memType="3" oraxdb:memByteLength="2"/>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>S1 on DB3:
    <ROOT>
      <b>Customer 1</b>
      <ul>
        <li>
          <COUNT_KEYS>2</COUNT_KEYS>
          <a href="projects_results.xml?project=2">Project 2</a>
        </li>
        <li>
          <COUNT_KEYS>2</COUNT_KEYS>
          <a href="projects_results.xml?project=1">Project 1</a>
        </li>
      </ul>
      <b>Customer 2</b>
      <ul>
        <li>
          <COUNT_KEYS>1</COUNT_KEYS>
          <a href="projects_results.xml?project=3">Project 1</a>
        </li>
      </ul>
    </ROOT>S2 on DB3
    <REPORT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="report.xsd">
      <CONCEPT ID="0" TYPE="0">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">0</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.93a</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.94</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.44</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.93</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.94</COL>
        </ROW>
      </CONCEPT>
    </REPORT>DB3 always generates good results for both scripts. <CONCEPT ID=”0” TYPE=”1”> always consists of 5 ROWs regardless of the attribute xsi:noNamespaceSchemaLocation value (schema registered or not). It is my computer at home. I decided to install oracle there because of the problems with DB1 and DB2. Unfortunately these are my DBs at work. So I need to run XMLTRANSFORM there.
    IMHO problems of S2 derive from result of S1 - function count(key(''rows'', name))
    always returns 1 regardless of number of rows. But this is only my supposition.
    I don’t know what is going on. The results of S3 on DB1/2 make me sick.
    I tried client 9.2.0.8, instant client 11.1.0.6.0 and no client – a job (transformation was inserted to a table) and this problem still exists.
    Any suggestions?
    Thanks in advice…
    Tomek.

    Hi,
    maybe you are right (I think similar), but I can't find any information about this bug on the Internet. So this is strange, if it is really a bug. I hope somebody used (or tried to use) this Muenchian Method in oracle 9.2.x, and can tell does it works or not.
    In [Oracle9i XML Developers Kits|www.oracle.com/technology/tech/xml/xdk_sample/9ir2_xdkfaq.html] there is written:
    "You can do the grouping in your XSLT stylesheet Steve Muench's Book "Building Oracle XML Applications" book dedicates a section in Chapter 9 to techniques for doing this kind of grouping in XSLT to present one- or multi-level break reports...
    The technique that I present in steve's book was coined the (blush...) "Muenchian Method" for doing grouping in XSLT."
    Thanks,
    Tomek.
    Edited by: tdomanek on 2009-03-15 17:14
    Edited by: tdomanek on 2009-03-15 23:48

  • Flex SDK 4 : mx.chart package and declaration of style 'direction' conflicts with previous declaration problem

    Hi There,
    We have recently downloaded SDK 4 and had configured the same for
    developement in flex builder 3, we are already using SDK 3.0. However
    to our surprise there were compile time error reported for mx.chart
    related classes. To resolve this we thought to import relevant .swc
    like datavisualization, automation from sdk 3.0, and it worked and
    resolved compile time error. But we landed up in on more problem that
    is 'Declaration of style 'direction' conflicts with previous
    declaration in E:\Softwares\FlexBuilder\sdks\SDK 4\frameworks\libs
    \datavisualization.swc(mx/charts/GridLines)'.
    If you could pleas help us to resolve these issues and also if you
    could answer these queries would be good
    1) SDK 4 has been declared to be open source, then why mx.chart
    package is not part of it?
    2) Why would 'Declaration of style 'direction' conflicts with previous
    declaration' occur?
    3) What are the other component and packages that are not part of open
    source for which license is still required?
    Waiting for reponse in anticipation.
    Thanks,

    I got this same error with the following setup.
    1. Building a SWC with Flex 4.0 Beta2 on FlashBuilder4
    2. SWC references other SWC that are built with Flex3.
    3. Define a <mx:ColumnChart id="column" ...> in a Flex4 skin.
    4. Got this compiler error. 
    Any idea if this is not supposed to work? I'm hoping I don't need all referenced swcs to be recompiled with Flex4 SDK. Some of those are external dependency that I do not have source code access.
    Thanks for any help.
    kam

  • Servlet declaration problem

    i've got 2 servlets declared in my web.xml
    <servlet-mapping>
        <url-pattern id='/FindPictureServlet'/>
        <servlet-name id="be.econocom.ecopeople.http.FindPictureServlet"/>
      </servlet-mapping> 
    <servlet-mapping>
        <url-pattern id='/FindRouteServlet'/>
        <servlet-name id="be.econocom.ecopeople.http.FindRouteServlet"/>
      </servlet-mapping>FindPictureServlet on the detailperson.jsp was already done by someone else.
    I have to use a same servlet to find a route on another page.
    i implement it.
    I put the 2 servlet calls on the detailperson.jsp and they work.
    on my new page not ...
    From where comes this problem ??
    THX vinch

    servlet.jar is here :
    <tomcatdir>\common\lib
    add it to your compiler classpath

Maybe you are looking for