public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: Question about getEncoding method on different platforms
@ 2003-03-06 16:35 Patrick Ellis
  2003-03-07  5:01 ` Brian Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick Ellis @ 2003-03-06 16:35 UTC (permalink / raw)
  To: Brian Jones; +Cc: mauve-discuss

Brian,

I updated Mauve today and some of the errors where corrected. It seems like the code was not updated for gnu/testlet/java/io/PipedStream/Test.java code available() and for gnu/testlet/java/io/OutputStreamWriter/jdk11.java

 FAIL: gnu.testlet.java.io.OutputStreamWriter.jdk11: OutputStreamWriter(writer, encoding) (number 1)
got ISO8859_3 but expected 8859_3

>  // Now set up our reader
>       PipedInputStream pis = new PipedInputStream();
>       pis.connect(pos);
>       new Thread(pstw).start();
>            harness.check(pis.available() > 0, "available()");

Also, If I could get write access to CVS that would be ok for future updates.

Pat Ellis
SDE Build and Test Team
Phone:      (919) 531-0355   
R2263     Patrick.Ellis@sas.com
SAS...  The Power to Know


-----Original Message-----
From: Brian Jones [mailto:cbj@gnu.org] 
Sent: Wednesday, March 05, 2003 11:37 PM
To: Patrick Ellis
Cc: mauve-discuss@sources.redhat.com
Subject: Re: Question about getEncoding method on different platforms


"Patrick Ellis" <Patrick.Ellis@sas.com> writes:

> I have testcases that are failing across several platforms because the 
> encoding value that is returned from the different platforms does not 
> match the 8859_1 value that is being expected by the testcase. Example 
> the value of ASCII is returned for Sun and Linux.
> 
> Question: Should the mauve code be changed to reflect the correct 
> values expected for each platform ?

Again check to see if you've updated your Mauve since Mark checked this in... 

Btw, you seem to be using Mauve a lot.  Have you considered whether you need the ability to commit new tests or changes to CVS more directly?  Getting write access to CVS is pretty easy with Mauve.

2003-02-13  Mark Wielaard  <mark@klomp.org>

        * gnu/testlet/java/io/InputStreamReader/jdk11.java (test): Just check
        that encoding is non-null when opened and null when closed. Checking
        the actual encoding name is as good as impossible pre 1.4.
        * gnu/testlet/java/io/OutputStreamWriter/jdk11.java (test):Likewise.

Brian
-- 
Brian Jones <cbj@gnu.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Question about getEncoding method on different platforms
  2003-03-06 16:35 Question about getEncoding method on different platforms Patrick Ellis
@ 2003-03-07  5:01 ` Brian Jones
  2003-03-15 15:59   ` Mark Wielaard
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Jones @ 2003-03-07  5:01 UTC (permalink / raw)
  To: Patrick Ellis; +Cc: mauve-discuss

"Patrick Ellis" <Patrick.Ellis@sas.com> writes:

> Brian,
> 
> I updated Mauve today and some of the errors where corrected. It
> seems like the code was not updated for
> gnu/testlet/java/io/PipedStream/Test.java code available() and for
> gnu/testlet/java/io/OutputStreamWriter/jdk11.java
> 
>  FAIL: gnu.testlet.java.io.OutputStreamWriter.jdk11:
> OutputStreamWriter(writer, encoding) (number 1) got ISO8859_3 but
> expected 8859_3
>

I think I fixed this last one.  There is already a fix in Test.java
for PipedStream so be sure your copy was updated from CVS.  It looks
like below.

      // Now set up our reader
      PipedInputStream pis = new PipedInputStream();
      pis.connect(pos);
      new Thread(pstw).start();
      pstw.waitTillReady();      // THE FIX
      harness.check(pis.available() > 0, "available()");

Brian
-- 
Brian Jones <cbj@gnu.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Question about getEncoding method on different platforms
  2003-03-07  5:01 ` Brian Jones
@ 2003-03-15 15:59   ` Mark Wielaard
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2003-03-15 15:59 UTC (permalink / raw)
  To: Brian Jones; +Cc: Patrick Ellis, mauve-discuss

Hi,

On Fri, 2003-03-07 at 06:01, Brian Jones wrote:
> "Patrick Ellis" <Patrick.Ellis@sas.com> writes:
> > I updated Mauve today and some of the errors where corrected. It
> > seems like the code was not updated for
> > gnu/testlet/java/io/PipedStream/Test.java code available() and for
> > gnu/testlet/java/io/OutputStreamWriter/jdk11.java
> > 
> >  FAIL: gnu.testlet.java.io.OutputStreamWriter.jdk11:
> > OutputStreamWriter(writer, encoding) (number 1) got ISO8859_3 but
> > expected 8859_3
> >
> I think I fixed this last one.

I changed it again slightly. You correctly point out:

	// ISO-8859-1 is a required encoding and this is the
	// "preferred" name, latin1 is a legal alias
	// see also http://www.iana.org/assignments/character-sets

But getEncoding() is defined to return the "historical" name even when
you put in the the preferred alias according to the IANA character set
list... This means that the canonical name for an encoding differs
depending on what API (old java.io or new java.nio) you are using.
Bleuch. http://java.sun.com/j2se/1.4.1/docs/guide/intl/encoding.doc.html

Cheers,

Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Question about getEncoding method on different platforms
@ 2003-03-06 14:39 Patrick Ellis
  0 siblings, 0 replies; 6+ messages in thread
From: Patrick Ellis @ 2003-03-06 14:39 UTC (permalink / raw)
  To: Brian Jones; +Cc: mauve-discuss

Thanks Brian,

I have not updated since Jan 27. 
I had not considered committing new test to mauve. I will let you know.


Pat Ellis
SDE Build and Test Team
Phone:      (919) 531-0355   
R2263     Patrick.Ellis@sas.com
SAS...  The Power to Know


-----Original Message-----
From: Brian Jones [mailto:cbj@gnu.org] 
Sent: Wednesday, March 05, 2003 11:37 PM
To: Patrick Ellis
Cc: mauve-discuss@sources.redhat.com
Subject: Re: Question about getEncoding method on different platforms


"Patrick Ellis" <Patrick.Ellis@sas.com> writes:

> I have testcases that are failing across several platforms because the 
> encoding value that is returned from the different platforms does not 
> match the 8859_1 value that is being expected by the testcase. Example 
> the value of ASCII is returned for Sun and Linux.
> 
> Question: Should the mauve code be changed to reflect the correct 
> values expected for each platform ?

Again check to see if you've updated your Mauve since Mark checked this in... 

Btw, you seem to be using Mauve a lot.  Have you considered whether you need the ability to commit new tests or changes to CVS more directly?  Getting write access to CVS is pretty easy with Mauve.

2003-02-13  Mark Wielaard  <mark@klomp.org>

        * gnu/testlet/java/io/InputStreamReader/jdk11.java (test): Just check
        that encoding is non-null when opened and null when closed. Checking
        the actual encoding name is as good as impossible pre 1.4.
        * gnu/testlet/java/io/OutputStreamWriter/jdk11.java (test):Likewise.

Brian
-- 
Brian Jones <cbj@gnu.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Question about getEncoding method on different platforms
  2003-03-05 16:11 Patrick Ellis
@ 2003-03-06  4:36 ` Brian Jones
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Jones @ 2003-03-06  4:36 UTC (permalink / raw)
  To: Patrick Ellis; +Cc: mauve-discuss

"Patrick Ellis" <Patrick.Ellis@sas.com> writes:

> I have testcases that are failing across several platforms because
> the encoding value that is returned from the different platforms
> does not match the 8859_1 value that is being expected by the
> testcase. Example the value of ASCII is returned for Sun and Linux.
> 
> Question: Should the mauve code be changed to reflect the correct
> values expected for each platform ?

Again check to see if you've updated your Mauve since Mark checked
this in... 

Btw, you seem to be using Mauve a lot.  Have you considered whether
you need the ability to commit new tests or changes to CVS more
directly?  Getting write access to CVS is pretty easy with Mauve.

2003-02-13  Mark Wielaard  <mark@klomp.org>

        * gnu/testlet/java/io/InputStreamReader/jdk11.java (test): Just check
        that encoding is non-null when opened and null when closed. Checking
        the actual encoding name is as good as impossible pre 1.4.
        * gnu/testlet/java/io/OutputStreamWriter/jdk11.java (test):Likewise.

Brian
-- 
Brian Jones <cbj@gnu.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Question about getEncoding method on different platforms
@ 2003-03-05 16:11 Patrick Ellis
  2003-03-06  4:36 ` Brian Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick Ellis @ 2003-03-05 16:11 UTC (permalink / raw)
  To: mauve-discuss


I have testcases that are failing across several platforms because the encoding value that is returned from the different platforms does not match the
8859_1 value that is being expected by the testcase. Example the value of ASCII is returned for Sun and Linux. 

Question: Should the mauve code be changed to reflect the correct values expected for each platform ?

Code:
gnu/testlet/java/io/InputStreamReader/jdk11.java

// Tags: JDK1.1

package gnu.testlet.java.io.InputStreamReader;

import gnu.testlet.Testlet;
import gnu.testlet.TestHarness;

import java.io.*;

public class jdk11 implements Testlet
{
  public void test (TestHarness harness)
  {
    try
      {
                InputStreamReader isr = new InputStreamReader (new StringBufferInputStream ("zardoz has spoken"));
                harness.check(!isr.ready(), "ready()");   // deprecated post-1.1
                harness.check(isr.getEncoding(), "8859_1", "getEncoding");
                char[] cbuf = new char[10];
                isr.read (cbuf, 0, cbuf.length);
                String tst = new String(cbuf);
                harness.check(tst, "zardoz has", "read(buf[], off, len)");
                harness.check(isr.read(), ' ', "read()");
                isr.close ();
                harness.check(true, "close()");
      }
    catch (IOException e)
      {
                harness.check(false, "IOException unexpected");
      }
  }
}

gnu/testlet/java/io/OutputStreamWriter/jdk11.java

// Tags: JDK1.1

package gnu.testlet.java.io.OutputStreamWriter;

import gnu.testlet.Testlet;
import gnu.testlet.TestHarness;
import java.io.OutputStreamWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

public class jdk11 implements Testlet
{
  public void test (TestHarness harness)
  {
    try
      {
                String tstr = "ABCDEFGH";
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                OutputStreamWriter osw = new OutputStreamWriter (baos);  //Default encoding
                harness.check(true, "OutputStreamWriter(writer)");
                harness.check(osw.getEncoding(), "8859_1", "getEncoding");
                osw.write(tstr.charAt(0));                                      // 'A'
                harness.check(true,"write(int)");
                osw.write("ABCDE", 1, 3);                                       // 'ABCD'
                harness.check(true,"write(string, off, len)");
                char[] cbuf = new char[8];
                tstr.getChars(4, 8, cbuf, 0);
                osw.write(cbuf, 0, 4);                                          // 'ABCDEFGH'
                harness.check(true,"write(char[], off, len)");
                osw.flush();
                harness.check(true, "flush()");
                harness.check(baos.toString(), tstr, "Wrote all characters okay");
                osw.close ();
                harness.check(true, "close()");
                ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
                OutputStreamWriter osw2 = new OutputStreamWriter(baos2, "8859_3");
                harness.check(osw2.getEncoding(), "8859_3", "OutputStreamWriter(writer, encoding)");

      }
    catch (IOException e)
      {
                harness.check(false, "IOException unexpected");
      }
  }
}



From JavaTM 2 Platform
Std. Ed. v1.4.1
getEncoding
public String <../../java/lang/String.html>  getEncoding()
	Return the name of the character encoding being used by this stream. 
	If the encoding has an historical name then that name is returned; otherwise the encoding's canonical name is returned. 
	If this instance was created with the OutputStreamWriter(OutputStream, String) <../../java/io/OutputStreamWriter.html>  constructor then the returned name, being unique for the encoding, may differ from the name passed to the constructor. This method may return null if the stream has been closed. 
Returns: 
	The historical name of this encoding, or possibly null if the stream has been closed 
See Also: 
	Charset <../../java/nio/charset/Charset.html> 



Pat Ellis
SDE Build and Test Team
Phone:      (919) 531-0355   
R2263     Patrick.Ellis@sas.com
SAS...  The Power to Know

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-03-15 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-06 16:35 Question about getEncoding method on different platforms Patrick Ellis
2003-03-07  5:01 ` Brian Jones
2003-03-15 15:59   ` Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2003-03-06 14:39 Patrick Ellis
2003-03-05 16:11 Patrick Ellis
2003-03-06  4:36 ` Brian Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).