[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jedit-users
Subject:    Re: [ jEdit-users ] changed some deprecated method in jedit 4.2 at
From:       Slava Pestov <slava () jedit ! org>
Date:       2005-12-18 21:07:31
Message-ID: 43A5CF93.1020003 () jedit ! org
[Download RAW message or body]

Hi,

Sending manually-annotated changesets in an HTML e-mail message is not 
very useful. Please learn to use the Unix 'diff' tool, and send unified 
diffs (-u switch).

Slava

Joshua Kim wrote:
> Hi all
> 1. In "RosterThread class" and the class works for showing plugin panel 
> basically. In order to stop thread, we call thread.stop() in 
> PluginManagerProgress.java two times. Since stop method is deprecated,
> I changed into setDeamon(true) in RosterThread class and use interrupt() 
> method.
> This is original source code in PluginManagerProgress.java
> <line: 137> //{{{ ActionHandler class
>     class ActionHandler implements ActionListener
>     {
>         public void actionPerformed(ActionEvent evt)
>         {
>             if(evt.getSource() == stop)
>             {
>                 thread.interrupt();
>                 dispose();
>             }
>         }
>     } //}}}
> 
>     //{{{ WindowHandler class
>     class WindowHandler extends WindowAdapter
>     {
>         boolean done;
> 
>         public void windowOpened(WindowEvent evt)
>         {
>             if(done)
>                 return;
> 
>             done = true;
>             thread = new RosterThread();
>             thread.start();
>         }
> 
>         public void windowClosing(WindowEvent evt)
>         {
>             thread.stop();
>             dispose();
>         }
> <line: 170>    } //}}}
> 
> 
> This is changed source code.
>     //{{{ ActionHandler class
> <line 137:>     class ActionHandler implements ActionListener {
>         public void actionPerformed(ActionEvent evt)
>         {
>             if(evt.getSource() == stop)
>             {
>                 thread.interrupt();
>                 dispose();
>             }
>         }
>     } //}}}
> 
>     //{{{ WindowHandler class
>     class WindowHandler extends WindowAdapter
>     {
>         boolean done;
> 
>         public void windowOpened(WindowEvent evt)
>         {
>             if(done)
>                 return;
> 
>             done = true;
>             thread = new RosterThread();
>             thread.setDeamon(true);
>             thread.start();
>         }
> 
>         public void windowClosing(WindowEvent evt){
>             thread.interupt();
>             dispose();
>         }
> <line 170:>     } //}}}
> 
> 2.
> * Since thread.stop() and thread.stop(Throwable obj) are both 
> deprecated, Workthread has warning messages about stop(new Abort()).
> * warning messages:
> [javac] C:\Adam\TomcatSwitch\org\gjt\sp\util\WorkThread.java:49: warning: st
> op(java.lang.Throwable) in java.lang.Thread has been deprecated
>     [javac]                             stop(new Abort());
>  
>  
> * This is original source code.
> -
> <Line 33: > public void abortCurrentRequest(){
>         synchronized(abortLock)
>         {
>             if(abortable && !aborted)
>                 stop(new Abort());
>             aborted = true;
>         }
>     }
> 
>     public static class Abort extends Error
>     {
>         public Abort()
>         {
>             super("Work request aborted");
>         }
>     }    
>     
> * This is a new source code. Since Abort has Error parent, I can 
> initialize Abort class first
> and if it has Error exception and catch will get the error and throw new 
> error exception.
> <Line 33: > public void abortCurrentRequest() throws Error {
>         synchronized(abortLock)
>         {
>         try{
>             if(abortable && !aborted){
>                 Abort a = new Abort();
>         }
>         catch(Error e ) {        
>             aborted = true;
>             throw new Error();
>         }
>     }
> 
> 3)
> * warning message:
>  [javac] C:\Adam\TomcatSwitch\JEdit\bsh\Remote.java:143: warning: 
> encode(java
> lang.String) in java.net.URLEncoder has been deprecated
>    [javac]             sb.append( URLEncoder.encode( text ) );
>                
> * Since URLEncoder.encode(String value) is deprecated, but Jedit 4.2 api 
> does not mention this because I assume this is helper function. That is 
> we got warning messages here. So I modified encode(string a) to 
> encode(string url, string supportedCharacter encoding)
> * original source code
> <line 137:>
> static String doHttp( String postURL, String text )
>     {
>         String returnValue = null;
>         StringBuffer sb = new StringBuffer();
>         sb.append( "bsh.client=Remote" );
>         sb.append( "&bsh.script=" );
>         sb.append( URLEncoder.encode( text) );
>         String formData = sb.toString(  );
>     
> *  new source code     
> <line 137:>
> static String doHttp( String postURL, String text )
>     {
>         String returnValue = null;
>         StringBuffer sb = new StringBuffer();
>         sb.append( "bsh.client=Remote" );
>         sb.append( "&bsh.script=" );
>         sb.append( URLEncoder.encode( text, "UTF-8" ) );
>         String formData = sb.toString(  );
> 
> 
> thanks.
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
-- 
-----------------------------------------------
jEdit Users' List
jEdit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic