Deprecated something

I have narrowed it down to the events method and it seems there is a problem with the event. I have it working kinda right and I wanted to clear the buffer.
http://www.state.nj.us/military/test/testingjava/applet.htm
try the applet out. type in bob press search then press search again.
it is repeating the text. but it also seems that it may not be the buffer.
THE MAIN CONCERN IS THE DEPRECATED ERROR
the error:
Note: Z:\applications\JCreator LE\MyProjects\helloworld\test\teststate\Virginia.java uses or overrides a deprecated API. Recompile with "-deprecation" for details.
1 warning
the foowing is the code:
import java.awt.*;
import java.applet.*;
import java.lang.*;
import java.io.*;
import java.net.URL;
public class Virginia extends java.applet.Applet
     String results[]=new String[10];
     String resultsString;
     String queryString;
     TextArea lt;
     Label lbQueryString= new Label("Please enter search text:");
     TextField tfQueryString= new TextField(25);
     Button btSearch=new Button("Search");
     Button btClear=new Button("Clear Entry");
     private void getString()
          try{                    
                    URL yahoo = new URL("http://www.nj.gov/military/test/testme.txt");
                    BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));
                    String line= in.readLine();
                    System.out.println(" in ");
                    int i=0;
                    while ( line != null )
                         int index = line.indexOf(queryString.trim());
                         if ( index != -1)
                              results=(line);
                              i++;
                              System.out.println(i);
                         line = in.readLine();
                    in.close();
                    }catch (IOException e)
                    {System.out.println("Error -- " + e.toString());}     
          for (int i=0;i<10;i++)
               if(results[i]!=null)
                    resultsString+=(results[i]+"\n");
     public boolean action(Event evt, Object arg)
          if (evt.target instanceof Button)
               String label = (String)arg;
               if (label.equals("Search"))
                    queryString=tfQueryString.getText();
                         this.getString();
                    lt.setText(resultsString);
               }else
                         queryString="";     
                         lt.setText("");
                    return true;
          }else
               return false;
     public void init()
          lt = new TextArea(resultsString, 10, 50);
          add(lbQueryString);
          add(tfQueryString);
          add(btClear);
          add(btSearch);
          add(lt);
          this.destroy();

I tried to compile you program, but it failed. The problem is that you tried to assign String value to String[] in following code.
results=(line);
It need to be changed to: results=line;
Another problem is that your define array size for results as 10. If the file that you got from internet has more than 10 line number, you will get exception.
By the way, for DEPRECATED ERROR I fixed your codes as shown bellow. It will fix the deprecation problem.
import java.awt.*;
import java.applet.*;
import java.lang.*;
import java.io.*;
import java.net.URL;
public class Virginia extends java.applet.Applet
String results[]=new String[10];
String resultsString;
String queryString;
TextArea lt;
Label lbQueryString= new Label("Please enter search text:");
TextField tfQueryString= new TextField(25);
Button btSearch=new Button("Search");
Button btClear=new Button("Clear Entry");
private void getString()
try{
URL yahoo = new URL("http://www.nj.gov/military/test/testme.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));
String line= in.readLine();
System.out.println(" in ");
int i=0;
while ( line != null )
int index = line.indexOf(queryString.trim());
if ( index != -1)
results=(line);
i++;
System.out.println(i);
line = in.readLine();
in.close();
}catch (IOException e)
{System.out.println("Error -- " + e.toString());}
for (int i=0;i<10;i++)
if(results!=null)
resultsString+=(results+"\n");
/*public boolean action(Event evt, Object arg)
if (evt.target instanceof Button)
String label = (String)arg;
if (label.equals("Search"))
queryString=tfQueryString.getText();
this.getString();
lt.setText(resultsString);
}else
queryString="";
lt.setText("");
return true;
}else
return false;
public void init()
btnSearch.addActionListener(new ButtonHandler());
btClear.addActionListener(new ButtonHandler());
lt = new TextArea(resultsString, 10, 50);
add(lbQueryString);
add(tfQueryString);
add(btClear);
add(btSearch);
add(lt);
this.destroy();
class ButtonHandler implements ActionListener{
     public void actionPerformed(ActionEvent e){
          String s=e.getActionCommand();
          if (s.equals("Search"))
               queryString=tfQueryString.getText();
               getString();
               lt.setText(resultsString);
          }else if (s.equals("Clear Entry"))
               queryString="";
               lt.setText("");

Similar Messages

  • [solved] trying to figure out BASH configuration files

    I am trying to figure out where to properly place commands in the many stated/existing BASH configuration files —reading the wiki and the man page I see there are what at first glance are too many files:
    from: http://www.gnu.org/software/bash/manual … rtup-Files
    invoked as an interactive login shell or with --login:
    1. executes /etc/profile
    2. executes-first-one-of-the-following: ~/.bash_profile
    2. executes-first-one-of-the-following: ~/.bash_login
    2. executes-first-one-of-the-following: ~/.profile
    from: https://wiki.archlinux.org/index.php/bash#Configuration
    configuration file sourcing order at startup ... by default in arch:
    /etc/profile (indirectly) sources /etc/bash.bashrc
    /etc/skel/.bash_profile (which users are encouraged to copy to ~/.bash_profile) sources ~/.bashrc
    which means that /etc/bash.bashrc and ~/.bashrc will be executed for all interactive shells whether they are login shells or not
    It isn't clear to me what exactly means file#1 "indirectly sources" file#2: including ? append target file ? use file#2 instead of file#1 ?
    It isn't clear either if ~/.bash_login and/or ~/.bash_logout are ignored (or not) in arch
    so /etc/profile should be the (preferred) system-wide configuration file ?
    so ~/.bash_profile should be the (preferred) user-specific configuration file ?
    If so, does it means I should delete /etc/bash.bashrc (this is where I currently have system-wide commands) in favor of (ie: moving the content to) /etc/profile ?
    Last edited by ivanborodin (2014-06-10 16:28:21)

    First and foremost: thanks for the replies.
    Ziusudra wrote:As the Wiki states ...
    I am fully aware of what the wiki is stating —I even included the link in my first post. The problem is not that I am not aware of what it is stating, it is just I don't understand it and thus my post to begin with. More precisely; this highlighted line:
    Note: /etc/bash.bashrc is non-standard, only some distributions like Arch Linux have this included because packagers have added a -DSYS_BASHRC="/etc/bash.bashrc" flag at compilation time, in order to have a system bashrc file.
    which clearly states /etc/bach.bashrc is non-standard was the first hint to me that these files were legacy/going-to-be-deprecated/something-like-this (my assumption) in favor of newer (my assumption) /etc/profile and ~/.bash_profile
    Maybe I am asking some obvious question (this is why I am asking it in the newbie corner) but please, have in mind that for someone coming from the Windows world some things/concepts are totally alien at first sight, for eg: in Windows you start Powershell and you have one (only one) place to set your configuration options and the like. Here I am offered with:
    • 2 possible system-wide files: /etc/profile and /etc/bash.bashrc
    • 2 possible user-specific files: ~/.bash_profile and ~/.bashrc
    • 1 possible user-specific files: ~/.bash_login (and ~/.bash_logout)
    ... so I have (at least) 5 different places to execute commands upon login.
    I was carefully reading all the files present on my current installation and now I understand what "indirectly sourced" means: including (if the file is present just insert it here)
    I still don't understand what commands should be placed in which file; for eg: system-wide aliases should be placed in /etc/profile or in /etc/bash.bashrc ?
    One more time, I am not a rocket-scientist nor I am a dummy, but the wiki just states file precedence without offering any details as best practices or something like that and just figure out: that for such a basic-thing I am getting different answers from two users (someone with 6000+ posts) ... either one: or the wiki is not clear or this thing is a little more complex than it seems at first sight ... just my thought.
    Anyway, needless to say, thank you both for your time and patience.

  • Community repo (sustainability)

    I'm not familiar with the details of the process involved in maintaining the community repository. However, as an Arch user I witness some of its faults. If these faults are a reason to evaluate or not how things are being done, or to gauge the Community repository quality, I leave it to those in the know. But when a package that has a hard kernel dependency is upgraded in the Community repo and that package doesn't include an essential module which renders it virtually useless, I get annoyed. I need to rollback both package and kernel upgrade. I'd expect from the community repo, what I don't ask in AUR; care.
    I'm not judgmental of the TU (or any other TU for that matter). I fully understand and appreciate all the hard work that they brought upon themselves and the dedication they often show. However when a TU is maintaining well above 1000 packages, something got to be wrong in the humble opinion of this user of yours. It's expected that gross mistakes will eventually happen. And it's when I lose confidence in the Community repo and wonder if it's just not AUR with appointed people to give it a the proper look of an official repo. If the policy is to hold everything that is humanly possible in Community, even if at the end of a string, I think that makes more damage than good.
    The incident isn't isolated. They happen not because we have bad TU (of that I'm positive). But almost certainly because we have overtaxed TUs, either by choice or imposition. Anyways... all this is my my opinion. I'm however, as a user, asked to adhere to the Arch Way. Complexity without complication. I don't expect this to have a double meaning.

    marfig wrote:I'm not familiar with the details of the process involved in maintaining the community repository. However, as an Arch user I witness some of its faults. If these faults are a reason to evaluate or not how things are being done, or to gauge the Community repository quality, I leave it to those in the know. But when a package that has a hard kernel dependency is upgraded in the Community repo and that package doesn't include an essential module which renders it virtually useless, I get annoyed. I need to rollback both package and kernel upgrade. I'd expect from the community repo, what I don't ask in AUR; care.
    this things happen and most cases are upstream issues. i know about powertop and it was a mistake but vmware modules seems to be because upstream deprecated something i guess.(lets see how the bug report is going)
    I'm not judgmental of the TU (or any other TU for that matter). I fully understand and appreciate all the hard work that they brought upon themselves and the dedication they often show. However when a TU is maintaining well above 1000 packages, something got to be wrong in the humble opinion of this user of yours. It's expected that gross mistakes will eventually happen. And it's when I lose confidence in the Community repo and wonder if it's just not AUR with appointed people to give it a the proper look of an official repo. If the policy is to hold everything that is humanly possible in Community, even if at the end of a string, I think that makes more damage than good.
    i fully agree with you. our TUs and developers teams is way to small compared with the amount of packages that we have in the repos. What about applying as TU and help us maintaining(translation getting rid of crap from our repos) ?
    Last edited by wonder (2010-08-20 16:51:17)

  • Adobe Configurator and deprecated Flash-based panel support in Adobe CC products

    Does Configurator 4.0 (or Configurator 3) support the creation of HTML5-based panels?
    I received the following email from Adobe: 
    Photoshop CC, starting in the middle of 2014, will remove support for Flash-based extensions. All other Creative Cloud products have already marked Flash-based panel support as deprecated at this time, meaning no future enhancements or bug fixes will be coming for Flash-based extensions.
    The current version of Photoshop CC already includes support for a new type of HTML5 based panel. We are currently working on a new version of Adobe Extension Builder designed specifically to support the creation of these HTML5 based panels.  You can download a free preview here: http://labs.adobe.com/technologies/extensionbuilder3/.
    Details about developing HTML5 extensions for Photoshop as well as for other Creative Cloud products are available in the Extension Builder pre-release program here: https://adobeformscentral.com/?f=6V6IgvE0yLQQ7bgadxNXaw .   You can also join the Photoshop developers' prerelease program for details specific to Photoshop.  If you're interested, please let me know and I will get you setup.
    Will the panels created by Configurator 4.0 work in PS CC after the middle of 2014 when support for Flash-based extensions is removed from Photoshop CC?  For that matter, will the panels created in Configurator 3.0 work in PS CC after the middle of 2014?

    I've carefully read all the posts here and would like to give my feedback on the whole question. I'm a professional retoucher and a teacher as well, and during my professional carrer I've built dozens of panels.
    I do really take advantage of boosting my productivity with any customized panel, as automation is something that adds speed, reliability and dramatically reduce errors during repetitive tasks. Therefore, I can't live without it.
    Now, I  understand why Adobe wants to move towards HTML 5, but please give us the ability to keep our work at the same level of efficiency we currently have. Photoshop is not for amateurs, it's a professional software. And professionals must keep their productivity, for sure they can't afford any loss of it, especially in these times!
    Moving from Flash to HTML 5  means rebuilding all the existing panels from scratch: how much this will cost to us in terms of time (and money) if we could have an HTML 5 version of Configurator? And how much, if we don't have a tool like Configurator at all? Three times, ten times as much? Maybe Adobe knows the answer, not me, I'm not a coder. But I'd like to know this answer.
    Further, picture this: I've taught several classes for at least  five intercontinental companies on how to build actions and organize them into panels for improving their productivity. Every time the response was the same: BOOM!
    They had a huge speed improvement in their daily workflows, and started to build dozens of panels by themselves for any possibile use. It was like opening a Pandora's box for them (their words).
    Every one who attended my classes, have taught the same topic inside their company and the reaction was always the same. So now, in every company in which I've taught building panels and actions, there are hundreds of panels for many different uses, all over the world. Of course, as 100% of them were specifically built for internal use, they shared the panels among them, but not outside their company.
    Many of them who are now mid-advanced users, have written to me asking how they could keep their panels working correctly in the next CC version of Photoshop. I have no solution for them, unless many of them become coders. That's a bad answer, I must admit, but no way out right now.
    Their reply to me was very straight: "well, we won't upgrade any copy of Photoshop until we can keep our panels working correctly for sure. For us is much more important being productive and efficient than upgrading to the latest version, if this means to lower our performance, no doubt."
    Adobe wanted to integrate all their softwares into the Creative Cloud. So far so good, I'm for it. But when you decide to integrate everything saying to the world that "it's for the sake of a better productivity", then you must really integrate them. Otherwise people will think that it was only a commercial move. So why we can't build panels for the applications inside Muse, for example? It was introduced to allow people to build  websites quickly and efficiently using HTML 5, taking care about the layout instead of investing too much time in coding.
    Exactly what Configurator allowed to do. Focus on the result with minimal time cost, aka money cost.
    World is running faster, therefore we need to work faster too. And without Configurator we won't. I can't disagree with all the people that won't upgrade Photoshop, if this means that they'll work slower because they can't use their panels carefully made by themselves. Photoshop is a tool for producing ideas and other nice stuff, like any software. The faster it is, the most people will like it, the better will sold. A simple truth. Think about what happened to Apple Finalcut ProX and how many users switched to Premiere. Photoshop has no competitors except new versions of itself.
    And this does not apply only the CC users. Look at the bigger picture: how many users still using CS6 with all their fully working panels won't upgrade to CC if they know they'll reduce their productivity?
    Think about the answer. Carefully.

  • EJB Stateless Session Bean how to recompile with "-deprecation" 10.1.2.0.2

    I have a EJB SLSB and I can deploy it to OC4J 10.1.2.0.2. However upon deployment OC4J is telling me:
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -deprecation for detailsCan somebody tell me how I can make OC4J recompile EJBs with -deprecation set to true?

    I suppose you'd be the first to start screaming at
    them for all the bugs in the 10.1.3 production
    release, if the Oracle guys concentrated more on
    getting something out quickly rather than providing a
    reliable product.C'mon, the only reason I'm pushing this is the fact that from the (OTN) website it looks like 10.1.3 has been around for years, whereas the truth is that the actual production date is unknown. What I am experiencing around me is Oracle loosing credibility regarding Java/J2EE with their direct competitors already having J2EE 1.4 support. The project I'm currently involved in was forced to use 10.1.2.0.2 since it is the last production release of the Oracle Application Server. This is J2EE 1.3 technology which is fairly old stuff.
    And... yes I'm amongst other things a developer and well aware of the challenges that come with creating software. Although in our projects we like to keep a relatively clear scope and not cramp as much features as possible in a version, just to satisfy the checklists :-)

  • "Oops, something went wrong." error message when t...

    Since I was forced onto the new version of Skype due to the deprecation of historical versions I have been unable record a video message. Whilst I am able to participate in video calls with no hitches at all, attempting to record a video message instantly gives me the following error message:
    "Oops, something went wrong.
    Please try again, or get in touch if you need help."
    Unfortunately, Microsoft struggle to implement error codes in their software, I can only assume this is because consumers find technical looking numbers terrifying, so I have absolutely no idea what the problem is - it could be a near infinite number of things.
    I have done a full reinstallation of Skype, multiple times, including deleting all registries that are associated with Skype (as suggested in the Skype support site), clearing any obvious user caches that exist, and so on. Still, the problem persists. Not a single video source available on my computer allows the recording of a video message, so I do not believe this is a problem with my webcam or driver.
    Running Windows 7 Home Premium 64-bit, Skype 6.18.0.106.
    I would appreciate any suggestions to solve this frustrating problem. Thank you.
    - BanTheCatEmoji

    Please,  run the DirectX diagnostics tool (32-bit version).
    Go to Windows Start and in the Run box type dxdiag.exe and press the OK button. This will start the DirectX diagnostics program. Run this diagnostics and save the results to a file. Please, attach this file to your post.
    Be aware that you will have to zip this file before attaching it here.

  • Provide Multi Language Content in Knowledge Management // Class deprecated

    Hello,
    I tried to implement the blog "Provide Multi Language Content in Knowledgle Management" by Thomas Kuri (BridingIT).
    I have problems to import the the following class:
    import com.sapportals.portal.prt.service.usermanagement.IUserManagementService;
    I always get the warning "The type IUserManagementService" is deprecated. I use the following jar file for that:
    j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.portal.usermanagement\lib\com.sap.portal.usermanagementapi.jar
    Is that the wrong jar file? Or am I doing something else wrong?
    Thanks for your help!!
    Kirsten

    Hi,
    she's trying to implement the code example from this article:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/207ba610-08ac-2b10-1787-fc477da4b5bf
    In this article, the deprecated class is used. Why? The code obviously is not written for EP7, but for EP6 with EP5 support. In the function: getEP5User is used to retrieve the EP5 user.
    If you're not too experienced or just want to try something / PoC it's OK to just copy & paste some sample code. For using this code in an EP7 portal I would recommend to adapt the code.
    br,
    Tobias

  • String deprecation

    I have a warning when compiling a jdk1.1 file under j2sdk1.4
    the String(byte[],int)has been deprecated and I didn't understand how to change the instruction using string constructors as it is said in the note in the documentation.
    please tell me how.
    thanks

    If you look at the Documentation for String:
    http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html#constructor_summary
    It says:
    String(byte[] ascii, int hibyte)
    Deprecated. This method does not properly convert bytes into characters. As of JDK 1.1, the preferred way to do this is via the String constructors that take a charset name or that use the platform's default charset.
    And here is that constructor
    String(byte[] bytes, String charsetName)
    Constructs a new String by decoding the specified array of bytes using the specified charset.
    You can start with this "ISO-8859-1" as charsetName, then look here is you want something different.
    http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc

  • Deprecated Thread Methods

    My organization has recently come from the Microsoft world into the J2EE world. In .Net, Microsoft has an abort method on threads that is similar to the Java's stop method. Unfortunately, the stop method has been deprecated.
    While I have read the information on why this method is dangerous, I don't understand why the method has been removed. If I have a situation that warrants killing a thread (such as in the case of an application server that hosts other threads of execution), why remove it from the platform? While I agree with Sun's article on seeking out alternative methods, there are still exceptions where a thread just needs to be interrupted so that it can get out of a deadlock, endless loop or blocking I/O.
    Since the stop method is deprecated, is there an equivalent VM call that I can interface from native code?
    I must say that I feel a bit like I'm being mothered by Sun.

    From your comments, you make a strong argument that suggests there's no need for a VM-level stop function.
    This puzzles me because operating systems implement kill methods to terminate rogue processes, yet they remain efficient and manage to keep things clean. Granted, multiple processes don't generally share memory structures but certainly the OS, on their behalf, shares memory structures. I'm puzzled as to why similar desires/features aren't present in the JRE.
    Regardless, short of running multiple JRE instances, each managing just one piece of work, the current deprecated status of the stop method renders Java without the ability to stop something that's gone wild unless the application is specifically pre-programmed to anticipate this behavior. (Of course that's a bit of a catch 22 in and of itself but...)
    There is also a subscription to the notion that my company or company x can write perfect software that never hangs a Java-based application server. I feel that this is impractical -- especially when what businesses ask of IT continues to get more complex.
    At this point perhaps it's fair to reveal the underlying reasons for my up-to-now, hypothetical questions. In my situation, company x is actually Sun. They failed to expose a socket timeout on their implementation of HTTPUrlConnection. I suppose that pretty much removes the luster from the argument that I, or anyone else, can write perfect software when the inventors of Java are themselves, imperfect. Of course, like you said and the JDK documents, the stop method will not abort a blocking socket read anyway (...although there's no reason why it couldn't except for more flawed design decisions...)
    I've certainly investigated alternative packages but I'm just chasing a moving target. HTTPUrlConnection today, class x tomorrow. That's why I was wanting something at the framework level to provide a trap door so that recovery without terminating the JRE is possible.

  • Thread.stop() -- Why is it deprecated ? - What alternatives ?

    Hi,
    I'm creating an XMPP server in Java and I have a problem. I have a thread that run the SAX parser and is constantly blocking to recive data from my socket. Now the problem is that at some point (after the authentication) I need to stop the XML parsing.
    The only way I can do this, I think, is by using the Thread.stop() method, but it is deprecated :(
    I read the FAQ about this deprecation but the alternatives given can't work for me:
    - I can't close the eocket because I need to read another XML document right after on the socket
    - I can't call Thread.interrupt() because the thread is blocking on an IO
    - I can't use a shared variable because the thread is blocked inside the SAX parser that call from time to time a callback. I can't modify the SAX code :(
    Does anyone have an idea how to make my thread stop the parsing ?
    Thanks
    Mildred

    If you've read the "FAQ" on deprecation of stop etc then you already know why stop() is deprecated - it is inherently unsafe as you can't know for sure what your thread was doing when you tried to stop it. Further, what those documents don't tell you is that Thread.stop doesn't break you out of most blocking situations any way - so it wouldn't necessarily help even if it weren't deprecated.
    I don't know the I/O or threading architecture of what you are working with so the following may not be applicable, but hopefully something will help:
    One of the alternatives you didn't mention is setting the SO_TIMEOUT option on the socket so that your thread can periodically check if its actually been cancelled. I don't know if that is possible in this case it depends on how the use of sockets gets exposed by the library.
    Other possibilities for unblocking a thread are to give the thread what it is waiting for - some data on the socket in this case. If you can send something that can be interpreted as "stop looking for more data", or if you check for cancellation before trying to interpret the data at all, then you can unblock the thread by writing to the socket. Whether this is feasible depends on how the real data is written to the socket.
    Final possibility is to create a new thread to do the socket reading. Your parser thread can then read from a BlockingQueue, for example, that is populated with data from the socket thread. You can use interrupt() to cancel the parser thread and just ignore the socket thread - which presumably will unblock when the next real data arrives.

  • Deprecated API compilation error

    Please help. Attached is my source code. I'm receiving a compilation error that reads 'RnrBooksApp.java uses or overrides a deprecated API. Recompile with -deprecation for details.' I'm very new to Java, so I appreciate any assistance. Thank you!
    //ClassName: RnrBooksApp
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    public class RnrBooksApp extends Frame implements ItemListener, ActionListener
         //Declare database variables
         Connection conBook;
         Statement cmdBook;
         ResultSet rsBook;
         boolean blnSuccessfulOpen = false;
         //Declare components
         Choice lstBooks               = new Choice();
         TextField txtISBN          = new TextField(13);
         TextField txtTitle          = new TextField(50);
         TextField txtAuthor = new TextField(30);
         TextField txtPublisher     = new TextField(30);
         Button btnAdd      = new Button("Add");
         //Button btnUpdate = new Button("Update");
         Button btnEdit     = new Button("Save");
         Button btnCancel = new Button("Cancel");
         Button btnDelete = new Button("Delete");
         Label lblMessage = new Label(" ");
         public static void main(String args[])
              //Declare an instance of this application
              RnrBooksApp thisApp = new RnrBooksApp();
              thisApp.createInterface();
         public void createInterface()
              //Load the database and set up the frame
              loadDatabase();
              if (blnSuccessfulOpen)
                   //Set up frame
                   setTitle("Books Database");
                   addWindowListener(new WindowAdapter()
                                  public void windowClosing(WindowEvent event)
                                  stop();
                                  System.exit(0);
                   setLayout(new BorderLayout());
                   //Set up top panel
                   Panel pnlTop = new Panel(new GridLayout(2, 2, 10, 10));
                   pnlTop.add(new Label("ISBN"));
                   lstBooks.insert("Select a Book to Display", 0);
                   lstBooks.addItemListener(this);
                   pnlTop.add(lstBooks);
                   pnlTop.add(new Label(" "));
                   add(pnlTop, "North");
                   //Set up center panel
                   Panel pnlMiddle = new Panel(new GridLayout(5, 2, 10, 10));
                   pnlMiddle.getInsets();
                   pnlMiddle.add(new Label("ISBN"));
                   pnlMiddle.add(txtISBN);
                   pnlMiddle.add(new Label("Title"));
                   pnlMiddle.add(txtTitle);
                   pnlMiddle.add(new Label("Author"));
                   pnlMiddle.add(txtAuthor);
                   pnlMiddle.add(new Label("Publisher"));
                   pnlMiddle.add(txtPublisher);
                   setTextToNotEditable();
                   Panel pnlLeftButtons = new Panel(new GridLayout(0, 2, 10, 10));
                   Panel pnlRightButtons = new Panel(new GridLayout(0, 2, 10, 10));
                   pnlLeftButtons.add(btnAdd);
                   btnAdd.addActionListener(this);
                   pnlLeftButtons.add(btnEdit);
                   btnEdit.addActionListener(this);
                   pnlRightButtons.add(btnDelete);
                   btnDelete.addActionListener(this);
                   pnlRightButtons.add(btnCancel);
                   btnCancel.addActionListener(this);
                   btnCancel.setEnabled(false);
                   pnlMiddle.add(pnlLeftButtons);
                   pnlMiddle.add(pnlRightButtons);
                   add(pnlMiddle, "Center");
                   //Set up bottom panel
                   add(lblMessage, "South");
                   lblMessage.setForeground(Color.red);
                   //Display the frame
                   setSize(400, 300);
                   setVisible(true);
              else
                   stop(); //Close any open connection
                   System.exit(-1); //Exit with error status
         public Insets insets()
              //Set frame insets
              return new Insets(40, 15, 15, 15);
         public void loadDatabase()
              try
                   //Load the Sun drivers
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              catch (ClassNotFoundException err)
                   try
                   //Load the Microsoft drivers
                   Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");
                   catch (ClassNotFoundException error)
                   System.err.println("Drivers did not load properly");
              try
                   //Connect to the database
                   conBook = DriverManager.getConnection("jdbc:odbc:Book");
                   //Create a ResultSet
                   cmdBook = conBook.createStatement();
                   rsBook = cmdBook.executeQuery(
                        "Select * from Book;");
                   loadBooks(rsBook);
                   blnSuccessfulOpen = true;
              catch(SQLException error)
                   System.err.println("Error: " + error.toString());
         public void loadBooks(ResultSet rsBook)
              //Fill ISBN list box
              try
                   while(rsBook.next())
                   lstBooks.add(rsBook.getString("ISBN"));
              catch (SQLException error)
                   System.err.println("Error in Display Record." + "Error: " + error.toString());
         public void itemStateChanged(ItemEvent event)
              //Retrieve and display the selected record
              String strISBN = lstBooks.getSelectedItem();
              lblMessage.setText(""); //Delete instructions
              try
                   rsBook = cmdBook.executeQuery(
                        "Select * from Book where [ISBN] = '"
                        + strISBN + "';");
                   txtISBN.setText(strISBN);
                   displayRecord(rsBook);
                   setTextToEditable();
              catch(SQLException error)
                   lblMessage.setText("Error in result set. " + "Error: " + error.toString());
         public void displayRecord(ResultSet rsBook)
              //Display the current record
              try
                   if(rsBook.next())
                        txtTitle.setText(rsBook.getString("Title"));
                        txtAuthor.setText(rsBook.getString("Author"));
                        txtPublisher.setText(rsBook.getString("Publisher"));
                        lblMessage.setText("");
                   else
                        lblMessage.setText("Record not found");
                        clearTextFields();
              catch (SQLException error)
                   lblMessage.setText("Error: " + error.toString());
         public void actionPerformed(ActionEvent event)
              //Test the command buttons
              Object objSource = event.getSource();
              if(objSource == btnAdd && event.getActionCommand () == "Add")
                   Add();
              else if (objSource == btnAdd)
                   Save();
              else if(objSource == btnEdit)
                   Edit();
              else if(objSource == btnDelete)
                   Delete();
              else if(objSource == btnCancel)
                   Cancel();
         public void setTextToNotEditable()
              //Lock the text fields
              txtISBN.setEditable(false);
              txtTitle.setEditable(false);
              txtAuthor.setEditable(false);
              txtPublisher.setEditable(false);
         public void setTextToEditable()
              //Unlock the text fields
              txtISBN.setEditable(true);
              txtTitle.setEditable(true);
              txtAuthor.setEditable(true);
              txtPublisher.setEditable(true);
         public void clearTextFields()
              //Clear the text fields
              txtISBN.setText("");
              txtTitle.setText("");
              txtAuthor.setText("");
              txtPublisher.setText("");
         public void Add()
              //Add a new record
              lblMessage.setText(" ");     //Clear previous message
              setTextToEditable();                //Unlock the text fields
              clearTextFields();                //Clear text field contents
              txtISBN.requestFocus ();
              //Set up the OK and Cancel buttons
              btnAdd.setLabel("OK");
              btnCancel.setEnabled(true);
              //Disable the Delete and Edit buttons
              btnDelete.setEnabled(false);
              btnEdit.setEnabled(false);
         public void Save()
                        //Save the new record
                        // Activated when the Add button has an "OK" label
                        if (txtISBN.getText().length ()== 0 || txtAuthor.getText().length() == 0)
                             lblMessage.setText("The ISBN or Author is blank");
                        else
                             try
                                  cmdBook.executeUpdate("Insert Into Book "
                                            + "([ISBN], [Title], [Author], [Publisher]) "
                                            + "Values('"
                                            + txtISBN.getText() + "', '"
                                            + txtTitle.getText() + "', '"
                                            + txtAuthor.getText() + "', '"
                                            + txtPublisher.getText() + "')");
                                  //Add to name list
                                  lstBooks.add(txtISBN.getText());
                                  //Reset buttons
                                  Cancel();
                             catch(SQLException error)
                                  lblMessage.setText("Error: " + error.toString());
         public void Delete()
                        //Delete the current record
                        int intIndex = lstBooks.getSelectedIndex();
                        String strISBN = lstBooks.getSelectedItem();
                        if(intIndex == 0)          //Make sure a record is selected
                                                      //Position 0 holds a text message
                             lblMessage.setText("Please select the record to be deleted");
                        else
                             //Delete the record from the database
                             try
                                  cmdBook.executeUpdate(
                                       "Delete from Book where [ISBN] = '" + strISBN + "';");
                                  clearTextFields();               //Delete from screen
                                  lstBooks.remove(intIndex);          //Delete from list
                                  lblMessage.setText("Record deleted");     //Display message
                             catch(SQLException error)
                                  lblMessage.setText("Error during Delete."
                                       + "Error: " + error.toString());
         public void Cancel()
                        //Enable the Delete and Edit buttons
                        btnDelete.setEnabled(true);
                        btnEdit.setEnabled(true);
                        //Disable the Cancel button
                        btnCancel.setEnabled(false);
                        //Change caption of button
                        btnAdd.setLabel("Add");
                        //Clear the text fields and status bar
                        clearTextFields();
                        lblMessage.setText("");
         public void Edit()
                        //Save the modified record
                        int intIndex = lstBooks.getSelectedIndex();
                        if(intIndex == 0)          //Make sure a record is selected
                                                      //Position 0 holds a text message
                             lblMessage.setText("Please select the record to change");
                        else
                             String strISBN = lstBooks.getSelectedItem();
                             try
                                  cmdBook.executeUpdate("Update Book "
                                       + "Set [ISBN] = '" + txtISBN.getText() + "', "
                                       + "[Title] = '" + txtTitle.getText() + "', "
                                       + "[Author] = '" + txtAuthor.getText() + "', "
                                       + "[Publisher] = '" + txtPublisher.getText() + "' "
                                       + "Where [ISBN] = '" + strISBN + "';");
                                  if (!strISBN.equals(txtISBN.getText()))
                                       //Last name changed; change the list
                                       lstBooks.remove(intIndex); //Remove the old entry
                                       lstBooks.add(txtISBN.getText()); //Add the new entry
                             catch(SQLException error)
                                  lblMessage.setText("Error during Edit. " + "Error: " + error.toString());
         public void stop()
              //Terminate the connection
              try
                   if (conBook != null)
                   conBook.close();
              catch(SQLException error)
                   lblMessage.setText("Unable to disconnect");

    How DO you compile then?
    If you don't type "javac", you must be using an IDE.
    In your IDE there should be some kind of configuration
    tab or option for "compiler options" or compilation options
    or compiler arguments... something like that.
    put "-deprecation" in that text box and recompile.
    Your compiler should tell you all about which methods
    are deprecated -- you then go to your trust JavaDocs
    and lookup those methods in the API and read WHY they
    are deprecated (i.e. OLD, outdated, defunct, no longer used)
    and what you should use instead. Then, correct your
    code to no longer use the deprecated methods and instead
    do things as suggested in the deprecation comments.

  • Deprecated Message

    Why when I use:
    <jsp:forward page = "<%= FormatUtils.nvl(request.getParameter("servico"), "") %>">
    <jsp:param name = "matricula" value = "<%= FormatUtils.nvl(request.getParameter("matricula"), "") %>" />
    <jsp:param name = "senha" value = "<%= FormatUtils.nvl(request.getParameter("senha"), "") %>" />
    <jsp:param name = "competencia" value = "<%= FormatUtils.nvl(request.getParameter("competencia"), "") %>" />
    </jsp:forward>
    I receive:
    "Documentos.jsp": Warning #: 368 : method encode(java.lang.String) in class java.net.URLEncoder has been deprecated

    "deprecated" means you're not supposed to use that function anymore. You probably upgraded to a more up-to-date version of Java, which has broken all of your old code.
    Go to the Java API documentation websites, look up the function that's giving you problems. Make sure you're looking up the section for the version you're using. Most of the time, all they did was change the name of the method to something more "kool." Such as "enabled" vs. "isEnabled". "putValue" vs. "setAttribute". That kind of crap. Other times, they moved the functionality to a completely different object. "Date" vs. "Calendar". In any event, the documentation generally explains what the "new improved" way of accomplishing something has become.
    Remember, Java people don't give a rats tail for backwards compatibility.

  • Deprecation of net-tools

    So net-tools has been deprecated in favor of NetworkManager  and Netcfg, but netcfg depends on net-tools. Is Netcfg replacing the Net-tools functionality with something else?

    The ML has the on-going discussion on this. Short answer, yes, eventually (patches welcome).

  • Deprecated log level constants

    Hi,
    In my DB class I have the following:
    sssn.setLogLevel(DefaultSessionLog.FINE);
    where sssn is a Server session. In Eclipse I'm getting the warning:
    The field SessionLog.FINE is deprecated
    I can see in the javadoc that that is the case but as far as I can tell there are no other constants defined and I should just use int:s to avoid the warnings.
    I'm reluctant to do that since that is not as descriptive as the constant and what if the int:s representinh the desired level change in a future relase?
    Am I missin something here or did Oracle miss something when they deprecated the level constants and not just the methods of the class?
    Regards,
    Andrei

    Andrei,
    We did miss something here. When SessionLog (oracle.toplink.sessions) was deprecated and the new SessionLog (oracle.toplink.logging) was introduced we ensured backwards compatibility through inheritance.
    I have also seen the issue within JDeveloper when I use SessionLog (oracle.toplink.logging) statics. The warning shows in the code editor but I do not get any compiler warning for the deprecation.
    The issue is that in this case we did not replicate the statics to the non-deprecated classes. This issue has been logged and will be addressed in a future release.
    Doug

  • Deprecated parameter PLSQL_DEBUG

    I am compliling a procedure using 11g. I get two warnings:
    Warning(1): PLW-06013: deprecated parameter PLSQL_DEBUG forces PLSQL_OPTIMIZE_LEVEL <= 1
    Warning(1): PLW-06015: parameter PLSQL_DEBUG is deprecated; use PLSQL_OPTIMIZE_LEVER = 1
    What does this mean? Should I do as suggested or should I look for something wrong with my code?

    I had a quick play with this but couldn't reproduce it in 11.2.0.1.
    SQL> alter session set plsql_warnings='enable:all';
    SQL> alter package testit compile plsql_debug=true;
    SP2-0809: Package altered with compilation warnings
    SQL> show errors package testit;
    Errors for PACKAGE TESTIT:
    LINE/COL   ERROR
    0/0        PLW-06013: deprecated parameter PLSQL_DEBUG forces PLSQL_OPTIMIZE_LEVEL <= 1
    0/0        PLW-06015: parameter PLSQL_DEBUG is deprecated; use PLSQL_OPTIMIZE_LEVEL = 1So far so good. But then the issue goes away when I recompile.
    SQL> alter package testit compile;
    Package altered.
    SQL> show errors package testit;
    No errors.I tried setting PLSQL_DBUG at the session level, but still no warnings:
    SQL> alter session set plsql_ccflags = 'PLSQL_DEBUG:TRUE';
    Session altered.
    SQL> alter package testit compile;
    Package altered.
    SQL> show errors package testit;
    No errors.Wondering what I'm missing - perhaps some session or package-level setting that retains the compilation parameter?
    Anything odd in user_plsql_object_settings for the package?

Maybe you are looking for