:/ Seems that my eclipse plugin decided to update the example/src/main/java/org/apache/mina/example/haiku/ 1.1 branch while still correctly adding some files to the example/src/test/java/org/apache/mina/example/ 1.0 branch
Yet i imported 1.0 branch in my eclipse project Need to investigate and fix this tonight ... anyone already had this problem ? Cordialement, Regards, -Edouard De Oliveira- http://tedorg.free.fr/en/main.php ----- Message d'origine ---- De : "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> À : [EMAIL PROTECTED] Envoyé le : Mercredi, 23 Juillet 2008, 8h58mn 02s Objet : svn commit: r679004 - in /mina/branches: 1.0/example/src/test/java/org/apache/mina/example/haiku/ 1.1/example/src/main/java/org/apache/mina/example/haiku/ Author: edeoliveira Date: Tue Jul 22 23:58:01 2008 New Revision: 679004 URL: http://svn.apache.org/viewvc?rev=679004&view=rev Log: DIRMINA-394 Backport of haiku example to 1.0 branch Added: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/ mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java (contents, props changed) - copied, changed from r678140, mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java (contents, props changed) - copied, changed from r678140, mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/PhraseUtilitiesTest.java (props changed) - copied unchanged from r678140, mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/PhraseUtilitiesTest.java mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java (contents, props changed) - copied, changed from r678140, mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java Modified: mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/Haiku.java mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidationServer.java mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidator.java mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidatorIoHandler.java mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/InvalidHaikuException.java mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/PhraseUtilities.java mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/ToHaikuIoFilter.java Copied: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java (from r678140, mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java) URL: http://svn.apache.org/viewvc/mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java?p2=mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java&p1=mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java&r1=678140&r2=679004&rev=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java (original) +++ mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java Tue Jul 22 23:58:01 2008 @@ -30,7 +30,6 @@ public class HaikuValidatorIoHandlerTest extends MockObjectTestCase { private IoHandler handler; - @Override protected void setUp() throws Exception { super.setUp(); @@ -42,9 +41,9 @@ session.expects(once()).method("write").with(eq("HAIKU!")); IoSession sessionProxy = (IoSession) session.proxy(); - handler.messageReceived(sessionProxy, new Haiku( + handler.messageReceived(sessionProxy, new Haiku(new String[] { "Oh, I drank too much.", "Why, oh why did I sign up", - "For an eight thirty?")); + "For an eight thirty?" })); } public void testInvalidHaiku() throws Exception { @@ -53,7 +52,7 @@ eq("NOT A HAIKU: phrase 1, 'foo' had 1 syllables, not 5")); IoSession sessionProxy = (IoSession) session.proxy(); - handler.messageReceived(sessionProxy, - new Haiku("foo", "a haiku", "poo")); + handler.messageReceived(sessionProxy, new Haiku(new String[] { "foo", + "a haiku", "poo" })); } } Propchange: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorIoHandlerTest.java ------------------------------------------------------------------------------ svn:mergeinfo = Copied: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java (from r678140, mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java) URL: http://svn.apache.org/viewvc/mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java?p2=mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java&p1=mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java&r1=678140&r2=679004&rev=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java (original) +++ mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java Tue Jul 22 23:58:01 2008 @@ -62,7 +62,6 @@ private HaikuValidator validator; - @Override protected void setUp() throws Exception { super.setUp(); @@ -70,9 +69,9 @@ } public void testValidateHaikus() throws Exception { - for (String s : HAIKUS) { + for (int i = 0, max = HAIKUS.length; i < max; i++) { + String s = HAIKUS[i]; String[] lines = s.split("\n"); - Haiku haiku = new Haiku(lines); validator.validate(haiku); Propchange: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/HaikuValidatorTest.java ------------------------------------------------------------------------------ svn:mergeinfo = Propchange: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/PhraseUtilitiesTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/PhraseUtilitiesTest.java ------------------------------------------------------------------------------ svn:mergeinfo = Copied: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java (from r678140, mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java) URL: http://svn.apache.org/viewvc/mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java?p2=mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java&p1=mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java&r1=678140&r2=679004&rev=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java (original) +++ mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java Tue Jul 22 23:58:01 2008 @@ -33,7 +33,6 @@ public class ToHaikuIoFilterTest extends MockObjectTestCase { private IoFilter filter; - @Override protected void setUp() throws Exception { super.setUp(); @@ -66,7 +65,8 @@ Mock nextFilter = mock(IoFilter.NextFilter.class); nextFilter.expects(once()).method("messageReceived").with( - eq(sessionProxy), eq(new Haiku("one", "two", "three"))); + eq(sessionProxy), + eq(new Haiku(new String[] { "one", "two", "three" }))); IoFilter.NextFilter nextFilterProxy = (IoFilter.NextFilter) nextFilter .proxy(); Propchange: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: mina/branches/1.0/example/src/test/java/org/apache/mina/example/haiku/ToHaikuIoFilterTest.java ------------------------------------------------------------------------------ svn:mergeinfo = Modified: mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/Haiku.java URL: http://svn.apache.org/viewvc/mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/Haiku.java?rev=679004&r1=679003&r2=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/Haiku.java (original) +++ mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/Haiku.java Tue Jul 22 23:58:01 2008 @@ -22,12 +22,12 @@ /** * @author Apache Mina Project (dev@mina.apache.org) - * @version $Rev: $, $Date: $ + * @version $Rev$, $Date$ */ public class Haiku { private final String[] phrases; - public Haiku(String... lines) { + public Haiku(String[] lines) { this.phrases = lines; if (null == lines || lines.length != 3) { throw new IllegalArgumentException("Must pass in 3 phrases of text"); @@ -38,7 +38,6 @@ return phrases; } - @Override public boolean equals(Object o) { if (this == o) return true; @@ -50,12 +49,10 @@ return Arrays.equals(phrases, haiku.phrases); } - @Override public int hashCode() { return Arrays.hashCode(phrases); } - @Override public String toString() { return Arrays.toString(phrases); } Modified: mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidationServer.java URL: http://svn.apache.org/viewvc/mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidationServer.java?rev=679004&r1=679003&r2=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidationServer.java (original) +++ mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidationServer.java Tue Jul 22 23:58:01 2008 @@ -20,8 +20,6 @@ import java.net.InetSocketAddress; import java.nio.charset.Charset; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.filter.codec.textline.TextLineCodecFactory; @@ -29,13 +27,16 @@ import org.apache.mina.transport.socket.nio.SocketAcceptor; import org.apache.mina.transport.socket.nio.SocketAcceptorConfig; +import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; +import edu.emory.mathcs.backport.java.util.concurrent.Executors; + /** * @author Apache Mina Project (dev@mina.apache.org) * @version $Rev: $, $Date: $ */ public class HaikuValidationServer { - public static void main(String... args) throws Exception { + public static void main(String[] args) throws Exception { ExecutorService executor = Executors.newCachedThreadPool(); SocketAcceptor acceptor = new SocketAcceptor(Runtime.getRuntime() .availableProcessors(), executor); Modified: mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidator.java URL: http://svn.apache.org/viewvc/mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidator.java?rev=679004&r1=679003&r2=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidator.java (original) +++ mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidator.java Tue Jul 22 23:58:01 2008 @@ -20,7 +20,7 @@ /** * @author Apache Mina Project (dev@mina.apache.org) - * @version $Rev: $, $Date: $ + * @version $Rev$, $Date$ */ public class HaikuValidator { private static final int[] SYLLABLE_COUNTS = { 5, 7, 5 }; Modified: mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidatorIoHandler.java URL: http://svn.apache.org/viewvc/mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidatorIoHandler.java?rev=679004&r1=679003&r2=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidatorIoHandler.java (original) +++ mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/HaikuValidatorIoHandler.java Tue Jul 22 23:58:01 2008 @@ -23,14 +23,13 @@ /** * @author Apache Mina Project (dev@mina.apache.org) - * @version $Rev: $, $Date: $ + * @version $Rev$, $Date$ */ public class HaikuValidatorIoHandler extends IoHandlerAdapter { private final HaikuValidator validator = new HaikuValidator(); - @Override public void messageReceived(IoSession session, Object message) throws Exception { Haiku haiku = (Haiku) message; Modified: mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/InvalidHaikuException.java URL: http://svn.apache.org/viewvc/mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/InvalidHaikuException.java?rev=679004&r1=679003&r2=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/InvalidHaikuException.java (original) +++ mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/InvalidHaikuException.java Tue Jul 22 23:58:01 2008 @@ -20,7 +20,7 @@ /** * @author Apache Mina Project (dev@mina.apache.org) - * @version $Rev: $, $Date: $ + * @version $Rev$, $Date$ */ public class InvalidHaikuException extends Exception { private static final long serialVersionUID = 34877739006797894L; Modified: mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/PhraseUtilities.java URL: http://svn.apache.org/viewvc/mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/PhraseUtilities.java?rev=679004&r1=679003&r2=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/PhraseUtilities.java (original) +++ mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/PhraseUtilities.java Tue Jul 22 23:58:01 2008 @@ -8,7 +8,9 @@ static int countSyllablesInPhrase(String phrase) { int syllables = 0; - for (String word : phrase.split("[^\\w-]+")) { + String[] words = phrase.split("[^\\w-]+"); + for (int i = 0, max = words.length; i < max; i++) { + String word = words[i]; if (word.length() > 0) { syllables += countSyllablesInWord(word.toLowerCase()); } Modified: mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/ToHaikuIoFilter.java URL: http://svn.apache.org/viewvc/mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/ToHaikuIoFilter.java?rev=679004&r1=679003&r2=679004&view=diff ============================================================================== --- mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/ToHaikuIoFilter.java (original) +++ mina/branches/1.1/example/src/main/java/org/apache/mina/example/haiku/ToHaikuIoFilter.java Tue Jul 22 23:58:01 2008 @@ -30,14 +30,12 @@ */ public class ToHaikuIoFilter extends IoFilterAdapter { - @SuppressWarnings( { "unchecked" }) - @Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { - List<String> phrases = (List<String>) session.getAttribute("phrases"); + List phrases = (List) session.getAttribute("phrases"); if (null == phrases) { - phrases = new ArrayList<String>(); + phrases = new ArrayList(); session.setAttribute("phrases", phrases); } @@ -46,8 +44,8 @@ if (phrases.size() == 3) { session.removeAttribute("phrases"); - super.messageReceived(nextFilter, session, new Haiku(phrases - .toArray(new String[3]))); + super.messageReceived(nextFilter, session, new Haiku( + (String[]) phrases.toArray(new String[3]))); } } } _____________________________________________________________________________ Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr