Unchecked or unsafe warning message

Hi,
I am getting the following warning message:
Note: ........ uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details
The following is the part of the class thats creating it, the line in bold is the line causing the warning :
public class MyPanel extends JPanel
//player field
private Player player;
//game rooms field
private ArrayList<Room> rooms;
* Constructor for objects of class MyPanel
public MyPanel(Player player, ArrayList rooms)
super();
setBackground(Color.GRAY);
setPreferredSize(new Dimension(240, 320));
this.player = player;
this.rooms = new ArrayList<Room>(rooms);
* Paint the panel.
public void paintComponent(Graphics g)
//other code
Please can anyone help.
Thanks!

public MyPanel(Player player, List<? extends Room> rooms)
// etcThis code is less restrictive, increase the possibilities of the code. Using restricted wildcards you let pass as parameter a list of subclasses of a class, see how the JDK API use this, for example, look the addAll method of Collection:
http://java.sun.com/javase/6/docs/api/java/util/Collection.html&#35;addAll&#40;java.util.Collection&#41;
This method guarantees that objects introduced are valids, but doesn't oblige to collection container be typed as Collection type. In addiction, constructors of ArrayList, LinkedList, etc, have a constructor of this form. You can use furthermore a declaration of Collection of Iterable, but it can be dangerous, because if in the future you want to share the reference passed as parameter and the property of the class, you can't do it. You must see what use will have the class more ahead

Similar Messages

  • TURNING OFF UNSAFE WARNING MESSAGE

    Hi Can anyone help, i need to turn off a message that comes up in Powerpoint in the Mac, when i link 2 presentations together i get a warning message - Potentially Unsafe Do You Want To Continue ? i can click it but it looks poor when you are presenting ?
    This is driving me mad, is it something i can turn off on the Mac ?
    Paul

    This is a PowerPoint issue, and this forum is for solving problems with Mac OS X 10.6. You'll get better results posting on the [MS Office for Mac forums|http://www.officeformac.com/ProductForums>.

  • Warning : PerformRecord.java use uncheck or unsafe operations

    /*When compile (with version 1.5.0_05) have a warnning message
    Note : PerformRecord.java use uncheck or unsafe operations
    Note : Recompile wiht -XLint : uncheck for details
    How can I solve this problem*/
    this is my code :
    import java.sql.*;
    import java.util.*;
    public class PerformRecord
         public static final String DEFAULT_DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
    public static final String DEFAULT_URL = "Jdbc:Odbc:PersonalODBC";
    public static final String DEFAULT_USERNAME = "Personal";
    public static final String DEFAULT_PASSWORD = "moshan74";
         public Connection conn = null;
         public String querySQL;
         /*==Constructor class== */
         public PerformRecord()
              /*load JDBC driver*/
              try{
                   Class.forName(DEFAULT_DRIVER);
              }catch (ClassNotFoundException e){System.err.println(e.getMessage());}          
         /*===Method class*/
         /*set value for connection var*/
         public void getConnection()
              this.conn = setConnect();
         /*get QuerySQL*/
         public void setQuery(String sql)
              this.querySQL = sql;
         /*open connection */
         public Connection setConnect()
              try{
              conn = DriverManager.getConnection(DEFAULT_URL,DEFAULT_USERNAME,DEFAULT_PASSWORD);               
              }catch (SQLException e){System.err.print(e.getMessage());     }
              return conn;
         /*close connection*/
         public void closeConnect()
    try{
    conn.close();
    }catch (Exception e){ }
         /*execute query statement */
         public Object executeQuery()
              Object returnValue = null;
              try{
                   /*executing query and check result */
                   Statement stmt          = conn.createStatement();               
                   boolean hasResultSet = stmt.execute(querySQL);
                   if (hasResultSet)
                        /*get set of the record*/
                        ResultSet rs               = stmt.getResultSet();
                        /*get set of the column*/
                        ResultSetMetaData meta = rs.getMetaData();
                        /*amount column*/
                        int numColumns = meta.getColumnCount();
                        /*arrayLisst to add data*/     
                        List rows          = new ArrayList();
    while (rs.next())
    Map thisRow = new LinkedHashMap();// 1 element(1 row,i column)
    for (int i = 1; i <= numColumns; ++i)
    String columnName = meta.getColumnName(i);
    Object value = rs.getObject(columnName);
    thisRow.put(columnName, value);
    rows.add(thisRow);
    rs.close();
    stmt.close();
                   this.closeConnect();
    returnValue = rows;
    else
    int updateCount = stmt.getUpdateCount();
    returnValue = new Integer(updateCount);
              }catch (SQLException e){System.err.print(e.getMessage());     }
    return returnValue;
    ps>> I want to to use Generics to help it but I don't know how to do it in the right way . Can you you help me?
    Thanks
    Arunya

    regarding your Map/LinkedHashMap, since you keys are String and you values are Objects... you would define you Map using those two as you data type pair...
    ap<String,Object>thisRow = new LinkedHashMap<String,Object>();and similar for you List/ArrayList where you putting Maps into...
    List<Map<String,Object>> rows = new ArrayList<Map<String,Object>>();for more information on generics read...
    [url http://java.sun.com/docs/books/tutorial/java/javaOO/generics.html]Sun's The Java Tutorial : Generics
    - MaxxDmg...
    - ' He who never sleeps... '

  • Warning  "unchecked or unsafe operations" when use Vector

    Can any one tell me why i get "unchecked or unsafe operations " warning.
    What I want to do is return 2 vector from the first method but i figure out by making it as object array would make thing easier for me. Then i try to use it on the second method and it give me error. The program still run fine but I just want to know what happen and what the affect of keeping it?
       public static Object[] chessPosition()
            Vector <Component> blackLocation = new Vector <Component> ();
            Vector <Component> whiteLocation = new Vector <Component> ();
             for(int y = 0; y < 8; y++)
                 for(int x = 0; x < 8; x++)
                     Component c = ChessBoard.board.findComponentAt(x*75, y*75);
                     if(c instanceof JLabel)
                         if(c.getName().startsWith("white"))
                             whiteLocation.add(c);
                         if(c.getName().startsWith("black"))
                             blackLocation.add(c);
            Object [] a = new Object[2];
            a[0] = blackLocation;
            a[1] = whiteLocation;
            return a;
        public static void blackPotential()
            Object[] a = chessPosition();
            Vector <Component> blacks = (Vector <Component>)a[0];
        }Thanks in advance

    Lest I make a jackhole of myself:
            Object[] a = chessPosition();
            Vector<Component> blacks = (Vector<Component>) a[0]; You're casting objects to a vector of Components.
    Try this on for size:
        public static Vector<Vector<Component>> chessPosition()
            Vector<Component> blackLocation = new Vector<Component>();
            Vector<Component> whiteLocation = new Vector<Component>();
            for (int y = 0; y < 8; y++)
                for (int x = 0; x < 8; x++)
                    Component c = ChessBoard.board.findComponentAt(x * 75, y * 75);
                    if (c instanceof JLabel)
                        if (c.getName().startsWith("white"))
                            whiteLocation.add(c);
                        if (c.getName().startsWith("black"))
                            blackLocation.add(c);
            Vector<Vector<Component>> v = new Vector<Vector<Component>>();
            v.add(blackLocation);
            v.add(whiteLocation);
            return v;
        public static void blackPotential()
            Vector<Vector<Component>> a = chessPosition();
            Vector<Component> blacks = (Vector<Component>) a.get(1);
        }Joe
    XLint's still your friend
    Message was edited by:
    Joe_h

  • Jdeveloper warning uses unchecked or unsafe operations

    Greetings:
    I am getting warnings on my oc4j console that look like :
    Note: C:\product\10.1.3\OracleAS_1\j2ee\home\application-deployments\pl\plBeans\generated\PlLoginPrefixesEJB_StatelessSessionBeanWrapper9.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    I get these when I use a JDeveloper created SessionEJB bean. Is there something i can do to "fix" this or should i just ignore it?
    Thanks
    troy

    Hi,
    I have the following code which I have got from a book but when I compile I get a warning .... uses unchecked or unsafe operations.
    class CompTypeComparator implements Comparator
      public int compare(Object o1, Object o2)
        int j1 = ((CompType)o1).j;
        int j2 = ((CompType)o2).j;
        return (j1 < j2 ? -1 : (j1 == j2 ? 0 : 1));
    public class ComparatorTest
      public static void main(String[] args)
        CompType[] a = new CompType[10];
        Arrays2.fill(a, CompType.generator());
        System.out.println("before sorting, a = " + Arrays.asList(a));
        Arrays.sort(a, new CompTypeComparator());
        System.out.println("after sorting, a = " + Arrays.asList(a));
    }I have met this error before in other code from the book and have been able to sort it by myself. This one I could not solve since I do not fully understand the syntax of the Arrays.sort() method. IE
    sort(T[] a, Comparator<? super T> c)Presumably this error is because the book used an older version of the compiler than the version I am using (V5.0 or is it V1.5).
    Could anyone explain the error, how I can solve it and what the sort method means particularly "? super T"?
    Regards FarmerJo

  • MyJava.java uses unchecked or unsafe operations

    I get the following warning message when I use ant from within Eclipse:
    compile:
    [javac] Compiling 2 source files to C:\eclipse\workspace\StoreInfo\build
    [javac] Note: C:\eclipse\workspace\StoreInfo\src\StoreInfo.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    I tried running my ant script from a dos prompt and still get the same message. I know its just a warning, but has anyone got a clue as to what the message means? How can I modify my ant script to recompile withe the -Xlint option?
    Thanks
    vedshar

    Vedshar,
    these messages occur when you are using classes that support the new J2SE 1.5 feature - generics. You get them when you do not explicitly specify the type of the collection's content.
    For example:
    List l = new ArrayList();
    list.add("String");
    list.add(55);If you want to have a collection of a single data type you can get rid of the messages by:
    List<String> l = new ArrayList<String>();
    list.add("String");If you need to put multiple data types into once collection, you do:
    List<Object> l = new ArrayList<Object>();
    list.add("String");
    list.add(55);If you add the -Xlint:unchecked parameter to the compiler, you get the specific details about the problem.
    Vita Santrucek

  • Owner.java uses unchecked or unsafe operations.

         * addVecOwners() Method
         * @param g the is the Owner object
         * The method is used to add the owner
    public void addVecOwners(Owner ow)
        getVecOwners().add(ow);
    or
         * addVecBoats() method
         * @param bt holds the Boat object
    public boolean addVecBoats(Boat bt)
         boolean result = false;
         if( getVecOwnerBoats().contains(bt) == true )
              result = false;
         else
              getVecOwnerBoats().add(bt);
              result = true;
         return result;
    }          Above are the two type of sample coding I typed. I get the following errors when I typed it.
    Owner.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Please help me to get ridof the warning messages.

    If you decide to use generics, you'll have to modify your code
    everywhere you use the collections.
    Before:
    private Vector vecOwners = new Vector();
    private Vector vecOwnerBoats = new Vector();
    public Vector getVecOwners()
        return vecOwners;
    public Vector getVecOwnerBoats()
        return vecOwnerBoats;
    public void addVecOwners(Owner ow)
        getVecOwners().add(ow);    
    public boolean addVecBoats(Boat bt)
        boolean result = false;
        if (!getVecOwnerBoats().contains(bt))
            getVecOwnerBoats().add(bt);
            result = true;
        return result;
    }With generics:
    private Vector<Owner> vecOwners = new Vector<Owner>();
    private Vector<Boat> vecOwnerBoats = new Vector<Boat>();
    public Vector<Owner> getVecOwners()
        return vecOwners;
    public Vector<Boat> getVecOwnerBoats()
        return vecOwnerBoats;
    public void addVecOwners(Owner ow)
        getVecOwners().add(ow);    
    public boolean addVecBoats(Boat bt)
        boolean result = false;
        if (!getVecOwnerBoats().contains(bt))
            getVecOwnerBoats().add(bt);
            result = true;
        return result;
    }Regards

  • Warning Messages in the log file

    Hi,
    I see following warning message in my log files. Can any one help me what exactly this means?
    "Skipping grouping rule '(null)' in profile 'Global_Profile_Records_Management_FieldGroup'. The grouped field 'xCategoryID' is a parent "
    Thanks,
    Vidya

    See: Skipping Grouping Rule 'General' In Profile - Warnings [ID 1202354.1]     
    Cause:
    p51044545 Hiding dDocName and dSecurityGroup with IsGroup set throws IdocScript error
    Solution:
    Unchecking the IsGroup flag will avoid the reporting of the mentioned warnings
    -ryan

  • Warning messages in system log after upgrading to SP4

    Hello there, I am starting to see quite a lot of warning messages in the system log saying the following:
    Failed loading JDBC Driver class com.microsoft.jdbc.sqlserver.SQLServerDriver - Exception:java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
    Failed loading JDBC Driver class com.sap.dbtech.jdbc.DriverSapDB - Exception:java.lang.ClassNotFoundException: com.sap.dbtech.jdbc.DriverSapDB
    Failed loading JDBC Driver class org.gjt.mm.mysql.Driver - Exception:java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    We are using MSSQL as the underlying database, so maybe something needs to be unchecked somewhere? Any ideas?
    Best regards,
    Anders

    Anders,
        I just updated to SP4 and tried a user creation (my database is also MSSQL). I did not see any warnings in the system logs. Like Thomas said you must have extra entries in the Tools/Option/Java/JDBC driver names.
    All you need is just one entry "com.microsoft.sqlserver.jdbc.SQLServerDriver".
    Hope this helps.
    Thanks
    Shabna

  • Warning messages (Moving from JDK1.4 to DJK1.5)

    I got some warning messages after I moved from 1.4 to 1.5, can someone show me the right way to avoid them ?
    =====================================================================
    Scanner.java:909: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector
    Region[Region_Id].add(region_element);
    In my code :
    region_element=new Region_Element();
    static Vector Region[]=new Vector[64];
    I tied :
    static Vector<Region_Element> Region[]=new Vector<Region_Element>[64];
    but still got warning message.
    =====================================================================
    Set_Maker.java:31: warning: [unchecked] unchecked cast
    found : java.lang.Object
    required: java.util.TreeSet<java.lang.Object>
    try { S1=(TreeSet<Object>)o1; }
    In my code :
    static final Comparator<Object> TreeSet_Order=new Comparator<Object>()
    public int compare(Object o1,Object o2)
    if (Debug) System.out.println("=00= o1="+o1+" o2="+o2);
    TreeSet<Object> S1=new TreeSet<Object>(TreeSet_Order);
    TreeSet<Object> S2=new TreeSet<Object>(TreeSet_Order);
    try { S1=(TreeSet<Object>)o1; } // Line 31
    catch (ClassCastException e) { S1.add(o1); }
    ==================================================================
    JDBCAdapter.java:190: warning: [unchecked] unchecked call to setElementAt(E,int) as a member of the raw type java.util.Vector
    dataRow.setElementAt(value, column);
    In my code :
    Vector     rows=new Vector();
    public void setValueAt(Object value,int row,int column)
    Vector dataRow=(Vector)rows.elementAt(row);
    dataRow.setElementAt(value, column); // Line 190
    =================================================================
    TableSorter.java:60: warning: [unchecked] unchecked call to compareTo(T) as a member of the raw type java.lang.Comparable
    public int compare(Object o1, Object o2) { return ((Comparable) o1).compareTo(o2); }
    In my code :
    public static final Comparator COMPARABLE_COMAPRATOR = new Comparator()
    public int compare(Object o1, Object o2) { return ((Comparable) o1).compareTo(o2); } // Line 60
    ==================================================================
    TableSorter.java:260: warning: [unchecked] unchecked call to compare(T,T) as a member of the raw type java.util.Comparator
    else { comparison = getComparator(column).compare(o1, o2); }
    In my code :
    protected Comparator getComparator(int column)
    Class columnType = tableModel.getColumnClass(column);
    Comparator comparator = (Comparator) columnComparators.get(columnType);
    if (comparator != null) { return comparator; }
    if (Comparable.class.isAssignableFrom(columnType)) { return COMPARABLE_COMAPRATOR; }
    return LEXICAL_COMPARATOR;
    Object o1 = tableModel.getValueAt(row1, column);
    Object o2 = tableModel.getValueAt(row2, column);
    else { comparison = getComparator(column).compare(o1, o2); } // Line 260

    I have tried so many ways but I can't seem to get rid of the warning on this matter. I have no idea how to use the generics on Vector. The other part of Generics I can undertand but just this. In my case I am adding multiple types of datatype and how am I supposed just say if it is supposed to be
    <String> or <Interger>or a
    <Double>. I even tried using the Wildcard
    <?>. Still no effect on it. Earlier I was trying it out with a Cosole program so I just revised the Version back to 1.4 SDK but now I am implementing a GUI to the program and I am in a real need to know how to solve it since I have to use the 1.5 JDK. Please Help me. I can't even find an example out there which uses Generic type methods to add to the Vector using the getter and setter method. Could there be a problem with the getter or setter of the program?

  • I'm having the same registry issues with my CDROM, getting the warning when iTunes starts up.  I've followed the article on how to add the upperFIlter to the registry and it solves the warning message but the DVD/CD writer disappears completely.

    I'm having thet same registry issues with my CD-/DVD as is talked about in one of the fix articles I've found here. I added the UpperFilter entry to the registry since it was not there and restarted.  This fixes the warning message but then there's no CD/DVD device shown at all in windows.  I can put it back to normal and vice versa and get the same results, but I can't get this issue fixed. When I get the registry warning on starting iTunes, I can still rip from CDs and my DVD burner works just fine using other programs.
    Any more ideas?

    This fixes the warning message but then there's no CD/DVD device shown at all in windows.
    That symptom suggests the afs.sys issue ... but there's some other things that might cause it too.
    We'd better check to see if we can find what's going on.
    Could you post your diagnostics for us please?
    In iTunes, go "Help > Run Diagnostics". Uncheck the boxes other than DVD/CD tests, as per the following screenshot:
    ... and click "Next".
    When you get through to the final screen:
    ... click the "Copy to Clipboard" button and paste the diagnostics into a reply here.

  • Unchecked or unsafe  error

    code]     private static void constructCodeTable(BinaryTreeNode btn,Stack st,Hashtable codeTable)
              if(btn!=null)
                   if(btn instanceof LeafNode)
                        codeTable.put(((InternalNode)btn).getKey(),st);
                   else
                        st.push(new Integer(0));
                        constructCodeTable(((InternalNode)btn).getLeftChild(),st,codeTable);
                        st.pop();
                        st.push(new Integer(1));
                        constructCodeTable(((InternalNode)btn).getRightChild(),st,codeTable);
                        st.pop();
    InternalNode.java and LeafNode.java extends BInaryNode.java
    InternalNode has function getLeftChild() and getRightChild()
    LeafNode.java has function getKey();
    when compiled , getting error:
    Note: uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details..
    can anyone tell why?

    RTFM, look through older posts, and think for yourself.
    This has been asked (and answered) a thousand times before.
    P.S. it's not an error, it's a warning.

  • Use Unchecked or unsafe operations: recompile with -Xlint

    hi all..
    I'm trying to create a GUI to select the necessary port to open. I got this code from JAVA cookbook:
    I'm using windows XP and JDK 1.6..
    import java.io.*;
    import javax.comm.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    public class PortChooser extends JDialog implements ItemListener {
    HashMap map = new HashMap();
    String selectedPortName;
    CommPortIdentifier selectedPortIdentifier;
    JComboBox serialPortsChoice;
    JComboBox parallelPortsChoice;
    JComboBox other;
    SerialPort ttya;
    JLabel choice;
    protected final int PAD = 5;
    public void itemStateChanged(ItemEvent e) {
    selectedPortName = (String)((JComboBox)e.getSource()).getSelectedItem();
    selectedPortIdentifier = (CommPortIdentifier)map.get(selectedPortName);
    choice.setText(selectedPortName);
    public String getSelectedName() {
    return selectedPortName;
    public CommPortIdentifier getSelectedIdentifier() {
    return selectedPortIdentifier;
    public static void main(String[] ap) {
    PortChooser c = new PortChooser(null);
    c.setVisible(true);// blocking wait
    System.out.println("You chose " + c.getSelectedName() +" (known by " + c.getSelectedIdentifier() + ").");
    System.exit(0);
    public PortChooser(JFrame parent) {
    super(parent, "Port Chooser", true);
    makeGUI();
    populate();
    finishGUI();
    protected void makeGUI() {
    Container cp = getContentPane();
    JPanel centerPanel = new JPanel();
    cp.add(BorderLayout.CENTER, centerPanel);
    centerPanel.setLayout(new GridLayout(0,2, PAD, PAD));
    centerPanel.add(new JLabel("Serial Ports", JLabel.RIGHT));
    serialPortsChoice = new JComboBox();
    centerPanel.add(serialPortsChoice);
    serialPortsChoice.setEnabled(false);
    centerPanel.add(new JLabel("Parallel Ports", JLabel.RIGHT));
    parallelPortsChoice = new JComboBox();
    centerPanel.add(parallelPortsChoice);
    parallelPortsChoice.setEnabled(false);
    centerPanel.add(new JLabel("Unknown Ports", JLabel.RIGHT));
    other = new JComboBox();
    centerPanel.add(other);
    other.setEnabled(false);
    centerPanel.add(new JLabel("Your choice:", JLabel.RIGHT));
    centerPanel.add(choice = new JLabel());
    JButton okButton;
    cp.add(BorderLayout.SOUTH, okButton = new JButton("OK"));
    okButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
              PortChooser.this.dispose();
    /** Populate the ComboBoxes by asking the Java Communications API
    * what ports it has. Since the initial information comes from
    * a Properties file, it may not exactly reflect your hardware.
    protected void populate() {
    Enumeration pList = CommPortIdentifier.getPortIdentifiers();
    while (pList.hasMoreElements()) {
    CommPortIdentifier cpi = (CommPortIdentifier)pList.nextElement();
    // System.out.println("Port " + cpi.getName());
    map.put(cpi.getName(), cpi);
    if (cpi.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    serialPortsChoice.setEnabled(true);
    serialPortsChoice.addItem(cpi.getName());
    else if (cpi.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
    parallelPortsChoice.setEnabled(true);
    parallelPortsChoice.addItem(cpi.getName());
    else {
    other.setEnabled(true);
    other.addItem(cpi.getName());
    serialPortsChoice.setSelectedIndex(-1);
    parallelPortsChoice.setSelectedIndex(-1);
    protected void finishGUI() {
    serialPortsChoice.addItemListener(this);
    parallelPortsChoice.addItemListener(this);
    other.addItemListener(this);
    pack();
    //addWindowListener(new WindowCloser(this, true));
    }}When i compile this it says PortChooser.java uses unchecked or unsafe operation
    recompile with -Xlint(any one know what this is?)
    Is it the JDK version i'm using ? First i thought it's a security issue.As in windows is not letting me access the serial ports.
    I checked with device manager.My serial ports are open. Ichanged my BIOS settings as well..
    (I read inputs from parallel port.But i dont use the comm api for that)
    I have installed the rxtx gnu.io package as well..
    Tried import gnu.io.* instead of javax.comm.*; still the same compilatiion error!!!
    Thanks in advance
    goodnews:-(

    It is basically a warning (not an error) that the compiler gives you to let you know that you are using a raw type where Java now supports generic types.
    For example, in the code you use:
    HashMap where you can use HashMap<String,String> to let the compiler know that you intend inserting Strings for both the key and the value. The former is considered to be unsafe because the compiler cannot control what is inserted into the HashMap while in the latter case it can ensure that only Strings are used for both keys and values.
    The compiler is also letting you know that if you want to see the details of these "unsafe" operations you can use the -Xlint:unchecked option when compiling and the compiler will show you exactly which lines contain the code that is generating the warning. So to compile with this option you would use javac -Xlint:unchecked ClassToCompile.

  • "unchecked or unsafe operation" Warnings

    i downloaded some source example code to run on my machine , but the code is based on java 1.4, my machine is java 5.0, and when i compile the code, the Note on "unchecked or unsafe operation" Warnings comes out. i've try to add the type of arrayList and hashMaps(the main data structure the code used)as the author said in his book, but the notes warning still come out...help me please...

    i downloaded some source example code to run on my
    machine , but the code is based on java 1.4, my
    machine is java 5.0, and when i compile the code, the
    Note on "unchecked or unsafe operation" Warnings
    comes out. i've try to add the type of arrayList and
    hashMaps(the main data structure the code used)as the
    author said in his book, but the notes warning still
    come out...help me please...don't panic! they are exactly what they say they are, warnings. no harm will come to you!

  • Unchecked or  unsafe operations

    I am trying to compile code and I am receiving the error message unchecked or unsafe operations. I tried compiling it with the -Xlint:unchecked and it pointed towards a portion on the code I placed below. The code is too long to put the whole thing in here.
    private Vector getNextRow( ResultSet rs,
    ResultSetMetaData rsmd ) throws SQLException
    Vector currentRow = new Vector();
    for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
    switch( rsmd.getColumnType( i ) ) {
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
    currentRow.addElement( rs.getString( i ) );
    break;
    case Types.INTEGER:
    currentRow.addElement( new Long( rs.getLong( i ) ) );
    break;
    case Types.REAL:
    currentRow.addElement( new Float( rs.getDouble( i ) ) );
    break;
    case Types.DATE:
    currentRow.addElement( rs.getDate( i ) );
    break;
    default:
    System.out.println( "Type was: " +
    rsmd.getColumnTypeName( i ) );
    return currentRow;

    If Vector<String> currentRow = new Vector<String>(); isn't correct because there's different types you must find superclass of classes that you add, in this case, Object.
    Vector<Object> currentRow = new Vector<Object>();

Maybe you are looking for

  • How to see html code in a php file using CS5.5 without using testing server?

    In CS5.5 when I open a page with php extention, DW does not show any html code in design view without me having to set up a testing server. In DW 8 it would open the same files and show me the html in design view. I have no need to test php code, I j

  • How to generate barcode from text field in adobe form???

    hello everyone, I'm new in this forum and I hope that there are people who can answer my question. I use Adobe Acrobat Pro 9. I have converted a Word template to a PDF template and everything works fine. I would like to generate a barcode of the cont

  • GUI TextArea

    I have a GUI class (as follows) my problem is that i can't change the text in it appart from at the constructor stage. The bold text in the constructor works fine, but the bold line at the bottom doesn't put the text i want in the textarea, i get a n

  • Log & Capture Screen not opening and Final Cut Pro just quits! HELP!

    Hi everyone, I've been searching through the forums and reading up on similar issues but to no avail my problem still exists and I'm about to put a hammer to my computer. I have a G5 Mac at work and use my G4 for home use. Earlier today I was at work

  • Why would 0BI_ALL need to be manually regenerated?

    Question regarding the 0BI_ALL setting of S_RS_AUTH: At some point yesterday, all our users started getting authorizaton errors on all Infoproviders, with the same message you would receive if you did not have S_RS_AUTH permissions.  However, all use