[cp-patches] FYI: DefaultFormatter fixlet

2006-01-20 Thread Roman Kennke
This fixes the DefaultFormatter constructor which shouldn't set a value
class (according to a mauve test that I also committed).

2006-01-20  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/text/DefaultFormatter.java
(DefaultFormatter): Don't set a value class.

/Roman
Index: javax/swing/text/DefaultFormatter.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultFormatter.java,v
retrieving revision 1.6
diff -u -r1.6 DefaultFormatter.java
--- javax/swing/text/DefaultFormatter.java	30 Nov 2005 23:02:37 -	1.6
+++ javax/swing/text/DefaultFormatter.java	20 Jan 2006 12:05:00 -
@@ -219,7 +219,6 @@
 commitsOnValidEdit = true;
 overwriteMode = true;
 allowsInvalid = true;
-valueClass = Object.class;
   }
 
   /**
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: Implementing multiple editors for JTable (with example)

2006-01-20 Thread Anthony Balkissoon
On Thu, 2006-01-19 at 13:36 +0100, Meskauskas Audrius wrote:
 This patch add the multi-editor support for JTable. The table now 
 supports the two editors: text and boolean. The boolean values are 
 rendered and edited using JCheckBox.
 
 I  add the more complicated table example to the Swing demo to show the 
 table with header, multiple data types (text and boolean at the moment) 
 and placed int the scroll window. 

This is awesome stuff!  Good work, man.

--Tony



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] RFC: gnu.regexp: fixed bugs in RETokenRepeated

2006-01-20 Thread Ito Kazumitsu
From: Ito Kazumitsu [EMAIL PROTECTED]
Date: Thu, 19 Jan 2006 23:22:52 +0900 (JST)

 And this is my fix.

Slightly improved. And this is supposed to fix the bug #25837

ChangeLog
2006-01-20  Ito Kazumitsu  [EMAIL PROTECTED]

Fixes bug #25837
* gnu/regexp/REMatch.java(empty): New boolean indicating
an empty string matched.
* gnu/regexp/RE.java(match): Sets empty flag when an empty
string matched.
(initialize): Support back reference \10, \11, and so on.
(parseInt): renamed from getEscapedChar and returns int.
* gnu/regexp/RETokenRepeated.java(match): Sets empty flag
when an empty string matched. Fixed a bug of the case where
an empty string matched. Added special handling of {0}.
* gnu/regexp/RETokenBackRef.java(match): Sets empty flag
when an empty string matched. Fixed the case insensitive matching.

Index: classpath/gnu/regexp/RE.java
===
RCS file: /cvsroot/classpath/classpath/gnu/regexp/RE.java,v
retrieving revision 1.11
diff -u -r1.11 RE.java
--- classpath/gnu/regexp/RE.java19 Jan 2006 13:45:51 -  1.11
+++ classpath/gnu/regexp/RE.java20 Jan 2006 16:37:03 -
@@ -825,12 +825,31 @@
   }
 
   // BACKREFERENCE OPERATOR
-  //  \1 \2 ... \9
+  //  \1 \2 ... \9 and \10 \11 \12 ...
   // not available if RE_NO_BK_REFS is set
+  // Perl recognizes \10, \11, and so on only if enough number of
+  // parentheses have opened before it, otherwise they are treated
+  // as aliases of \010, \011, ... (octal characters).  In case of
+  // Sun's JDK, octal character expression must always begin with \0.
+  // We will do as JDK does. But FIXME, take a look at (a)(b)\29.
+  // JDK treats \2 as a back reference to the 2nd group because
+  // there are only two groups. But in our poor implementation,
+  // we cannot help but treat \29 as a back reference to the 29th group.
 
   else if (unit.bk  Character.isDigit(unit.ch)  
!syntax.get(RESyntax.RE_NO_BK_REFS)) {
addToken(currentToken);
-   currentToken = new 
RETokenBackRef(subIndex,Character.digit(unit.ch,10),insens);
+   int numBegin = index - 1;
+   int numEnd = pLength;
+   for (int i = index; i  pLength; i++) {
+   if (! Character.isDigit(pattern[i])) {
+   numEnd = i;
+   break;
+   }
+   }
+   int num = parseInt(pattern, numBegin, numEnd-numBegin, 10);
+
+   currentToken = new RETokenBackRef(subIndex,num,insens);
+   index = numEnd;
   }
 
   // START OF STRING OPERATOR
@@ -999,12 +1018,12 @@
 return index;
   }
 
-  private static char getEscapedChar(char[] input, int pos, int len, int 
radix) {
+  private static int parseInt(char[] input, int pos, int len, int radix) {
 int ret = 0;
 for (int i = pos; i  pos + len; i++) {
ret = ret * radix + Character.digit(input[i], radix);
 }
-return (char)ret;
+return ret;
   }
 
   /**
@@ -1059,7 +1078,7 @@
l++;
   }
   if (l != expectedLength) return null;
-  ce.ch = getEscapedChar(input, pos + 2, l, 16);
+  ce.ch = (char)(parseInt(input, pos + 2, l, 16));
  ce.len = l + 2;
 }
 else {
@@ -1077,7 +1096,7 @@
   }
   if (l == 3  input[pos + 2]  '3') l--;
   if (l = 0) return null;
-  ce.ch = getEscapedChar(input, pos + 2, l, 8);
+  ce.ch = (char)(parseInt(input, pos + 2, l, 8));
   ce.len = l + 2;
 }
 else {
@@ -1246,12 +1265,20 @@
   
 /* Implements abstract method REToken.match() */
 boolean match(CharIndexed input, REMatch mymatch) { 
-   if (firstToken == null) return next(input, mymatch);
+   int origin = mymatch.index;
+   boolean b;
+   if (firstToken == null) {
+   b = next(input, mymatch);
+   if (b) mymatch.empty = (mymatch.index == origin);
+   return b;
+   }
 
// Note the start of this subexpression
mymatch.start[subIndex] = mymatch.index;
 
-   return firstToken.match(input, mymatch);
+   b = firstToken.match(input, mymatch);
+   if (b) mymatch.empty = (mymatch.index == origin);
+   return b;
 }
   
   /**
Index: classpath/gnu/regexp/REMatch.java
===
RCS file: /cvsroot/classpath/classpath/gnu/regexp/REMatch.java,v
retrieving revision 1.2
diff -u -r1.2 REMatch.java
--- classpath/gnu/regexp/REMatch.java   2 Jul 2005 20:32:15 -   1.2
+++ classpath/gnu/regexp/REMatch.java   20 Jan 2006 16:37:03 -
@@ -67,6 +67,7 @@
 int[] start; // start positions (relative to offset) for each (sub)exp.
 int[] end;   // end positions for the same
 REMatch next; // other possibility (to avoid having to use arrays)
+boolean empty; // empty string matched
 
 public Object 

[cp-patches] Patch: DefaultStyledDocument debugging methods.

2006-01-20 Thread Lillian Angel
Removed the debugging methods from this class.

2006-01-20  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/text/DefaultStyledDocument.java
(pad): Removed, not needed.
(printElements): Likewise.
(printEdit): Likewise.

Index: javax/swing/text/DefaultStyledDocument.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultStyledDocument.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- javax/swing/text/DefaultStyledDocument.java	17 Jan 2006 19:57:44 -	1.40
+++ javax/swing/text/DefaultStyledDocument.java	20 Jan 2006 19:28:40 -	1.41
@@ -67,44 +67,7 @@
 public class DefaultStyledDocument extends AbstractDocument
   implements StyledDocument
 {
-  // Prints some spaces.
-  // This is just debugging code that will be used temporarily.
-  static void pad(int pad)
-  {
-for (int i = 0; i  pad; i++)
-  System.out.print( );
-  }
-
-  // Displays the Element hierarchy starting with codestart/code.
-  // This is just debugging code that will be used temporarily.
-  static void printElements (Element start, int pad)
-  {
-pad(pad);
-if (pad == 0)
-  System.out.println (ROOT ELEMENT (+start.getStartOffset()+, 
-  + start.getEndOffset()+));
-else if (start instanceof AbstractDocument.BranchElement)
-  System.out.println (BranchElement (+start.getStartOffset()+, 
-  + start.getEndOffset()+));
-else
-  {
-try
-  {
-System.out.println (LeafElement (+start.getStartOffset()+, 
-+ start.getEndOffset()+): 
-+ start.getAttributes().getAttributeCount() + : 
-+ start.getDocument().
-getText(start.getStartOffset(), 
-start.getEndOffset() - 
-start.getStartOffset()));
-  }
-catch (BadLocationException ble)
-  {
-  }
-  }
-for (int i = 0; i  start.getElementCount(); i ++)
-  printElements (start.getElement(i), pad+3);
-  }
+  
   /**
* An [EMAIL PROTECTED] UndoableEdit} that can undo attribute changes to an element.
*
@@ -1092,45 +1055,6 @@
 }
 
 /**
- * This is a debugging method.  Since we don't apply changes immediately
- * this method is helpful for debugging purposes so you can tell what the
- * tree will look like after all edits are applied.
- */
-void printPendingEdits()
-{
-  int size = edits.size();
-  System.out.println (PENDING EDITS);
-  for (int i = 0; i  size; i++)
-{
-  Edit edit = (Edit)edits.elementAt(i);
-  if (edit.e.isLeaf() || edit.e.getElementCount()  0)
-System.out.print(printElement(edit.e));
-  System.out.println(starting offset: +edit.index);
-  if (edit.added != null)
-for (int k = 0; k  edit.added.size(); k ++)
-  System.out.println (added: +printElement((Element)edit.added.elementAt(k)));
-  if (edit.removed != null)
-for (int k = 0; k  edit.removed.size(); k ++)
-  System.out.println (removed: +printElement((Element)edit.removed.elementAt(k)));
-}
-  System.out.println (END PENDING EDITS); 
-}
-
-/**
- * This is a helper method for debugging.  To avoid NPE we can't just
- * print BranchElements because they may have no children.  So this
- * method prints Elements and handles the case of BranchElements with
- * no children.
- * @param e the Element to print
- * @return a String describing the given Element
- */
-String printElement (Element e)
-{
-  if (e.isLeaf() || e.getElementCount()  0)
-return e.toString();
-  return BranchElement with no children;
-}
-/**
  * Inserts a content element into the document structure.
  * 
  * @param tag the element spec
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch to make Classpath HEAD build work again with Darwin

2006-01-20 Thread Chris Burdess
The attached patch allows the build to complete on Darwin. I'd very  
much appreciate any comments as I'm really not an expert on the new  
target-native stuff.


This fixes bug #25872 among other things.
--
犬 Chris Burdess
  They that can give up essential liberty to obtain a little safety
  deserve neither liberty nor safety. - Benjamin Franklin



patch
Description: Binary data




PGP.sig
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: FYI: fix http redirect bug

2006-01-20 Thread Tom Tromey
I'm checking this in.

We weren't properly discarding the response body when we saw an http
redirect response.  This was found when debugging the Eclipse
bugzilla plugin, see

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=178445

Tom

Index: ChangeLog
from  Tom Tromey  [EMAIL PROTECTED]

* gnu/java/net/protocol/http/HTTPURLConnection.java (connect):
Read response body for redirect.

Index: gnu/java/net/protocol/http/HTTPURLConnection.java
===
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java,v
retrieving revision 1.16
diff -u -r1.16 HTTPURLConnection.java
--- gnu/java/net/protocol/http/HTTPURLConnection.java 20 Jan 2006 20:56:03 
- 1.16
+++ gnu/java/net/protocol/http/HTTPURLConnection.java 20 Jan 2006 22:13:50 -
@@ -1,5 +1,5 @@
 /* HTTPURLConnection.java --
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -256,6 +256,22 @@
 
 if (isRedirect(response)  getInstanceFollowRedirects())
   {
+   // Read the response body, if there is one.  If the
+   // redirect points us back at the same server, we will use
+   // the cached connection, so we must make sure there is no
+   // pending data in it.
+InputStream body = response.getBody();
+   if (body != null)
+ {
+   byte[] ignore = new byte[1024];
+   while (true)
+ {
+   int n = body.read(ignore, 0, ignore.length);
+   if (n == -1)
+ break;
+ }
+ }
+
 // Follow redirect
 String location = response.getHeader(Location);
if (location != null)


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: RFC: X509 parsing fix

2006-01-20 Thread Tom Tromey
I've been looking at this bug:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174708

This is actually two separate bugs -- an EOF exception in Jessie, and
an X509 parsing bug in Classpath.  I believe the latter buglet was
introduced here:

http://lists.gnu.org/archive/html/classpath-patches/2005-07/msg00156.html

Also while looking at this I noticed that there is similar X509
parsing code in Jessie, and it seems to already have the appended
change in it.

I'd appreciate comments from people who actually understand this code
in depth...

Tom

Index: ChangeLog
from  Tom Tromey  [EMAIL PROTECTED]

* gnu/java/security/x509/X509Certificate.java (parse):
Unconditionally read value; for version==1 case when reading
algorithm ID.

Index: gnu/java/security/x509/X509Certificate.java
===
--- gnu/java/security/x509/X509Certificate.java (revision 109835)
+++ gnu/java/security/x509/X509Certificate.java (working copy)
@@ -1,5 +1,5 @@
 /* X509Certificate.java -- X.509 certificate.
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -661,10 +661,7 @@
 der.skip(spki.getLength());
 logger.log (Component.X509, read subjectPublicKey == {0}, subjectKey);
 
-if (version  1)
-  {
-val = der.read();
-  }
+val = der.read();
 if (version = 2  val.getTagClass() != DER.UNIVERSAL  val.getTag() == 
1)
   {
 byte[] b = (byte[]) val.getValue();


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Re: Patch: RFC: X509 parsing fix

2006-01-20 Thread Tom Tromey
 Tom == Tom Tromey [EMAIL PROTECTED] writes:

Tom I've been looking at this bug:
Tom https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174708

FWIW I'm going to check this in to the gcc 4.1 branch.
After I wrote this patch I accidentally tested the wrong gij... when
I test the patched one, it works with the test case in this PR.

I'll check this in to Classpath on Monday, barring objection.

Tom


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches