Changeset 1391 for branches/GNU/src/gcc/libjava/gnu
- Timestamp:
- Apr 27, 2004, 8:39:34 PM (21 years ago)
- Location:
- branches/GNU/src/gcc
- Files:
-
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gcc
- Property svn:ignore
-
old new 26 26 configure.vr 27 27 configure.vrs 28 dir.info 28 29 Makefile 29 dir.info30 30 lost+found 31 31 update.out
-
- Property svn:ignore
-
branches/GNU/src/gcc/libjava/gnu/awt/j2d/DirectRasterGraphics.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 2000 Free Software Foundation1 /* Copyright (C) 2000, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 62 62 public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints); 63 63 64 public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints); 64 public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints, 65 int translateX, int translateY); 65 66 66 67 public void drawString(String str, int x, int y); -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/awt/j2d/Graphics2DImpl.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 2000 Free Software Foundation1 /* Copyright (C) 2000, 2002, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 10 10 11 11 import java.awt.Color; 12 import java.awt.Composite; 12 13 import java.awt.Image; 13 14 import java.awt.Shape; … … 20 21 import java.awt.Paint; 21 22 import java.awt.RenderingHints; 23 import java.awt.Stroke; 22 24 import java.awt.geom.AffineTransform; 23 25 import java.awt.image.ImageObserver; 26 import java.awt.image.BufferedImage; 27 import java.awt.image.BufferedImageOp; 28 import java.awt.image.RenderedImage; 29 import java.awt.image.renderable.RenderableImage; 30 import java.text.AttributedCharacterIterator; 31 import java.util.Map; 24 32 25 33 /** … … 452 460 throw new UnsupportedOperationException(msg); 453 461 } 462 463 public void drawImage(BufferedImage image, BufferedImageOp op, int x, int y) 464 { 465 throw new UnsupportedOperationException("not implemented yet"); 466 } 467 468 public void drawRenderedImage(RenderedImage image, AffineTransform xform) 469 { 470 throw new UnsupportedOperationException("not implemented yet"); 471 } 472 473 public void drawRenderableImage(RenderableImage image, AffineTransform xform) 474 { 475 throw new UnsupportedOperationException("not implemented yet"); 476 } 477 478 public void drawString(AttributedCharacterIterator iterator, 479 int x, int y) 480 { 481 throw new UnsupportedOperationException("not implemented yet"); 482 } 483 484 public void drawString(AttributedCharacterIterator iterator, float x, 485 float y) 486 { 487 throw new UnsupportedOperationException("not implemented yet"); 488 } 489 490 public void setComposite(Composite comp) 491 { 492 throw new UnsupportedOperationException("not implemented yet"); 493 } 494 495 public void setStroke(Stroke stroke) 496 { 497 throw new UnsupportedOperationException("not implemented yet"); 498 } 499 500 public void setRenderingHints(Map hints) 501 { 502 throw new UnsupportedOperationException("not implemented yet"); 503 } 504 505 public void addRenderingHints(Map hints) 506 { 507 throw new UnsupportedOperationException("not implemented yet"); 508 } 509 510 public Composite getComposite() 511 { 512 throw new UnsupportedOperationException("not implemented yet"); 513 } 514 515 public Stroke getStroke() 516 { 517 throw new UnsupportedOperationException("not implemented yet"); 518 } 454 519 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/awt/j2d/IntegerGraphicsState.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 2000 Free Software Foundation1 /* Copyright (C) 2000, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 213 213 public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) 214 214 { 215 if ((tx == 0) ||(ty == 0))215 if ((tx == 0) && (ty == 0)) 216 216 { 217 217 directGfx.drawPolyline(xPoints, yPoints, nPoints); … … 224 224 public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) 225 225 { 226 if ((tx == 0) ||(ty == 0))226 if ((tx == 0) && (ty == 0)) 227 227 { 228 228 directGfx.drawPolygon(xPoints, yPoints, nPoints); … … 233 233 } 234 234 235 public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) 236 { 237 if ((tx == 0) || (ty == 0)) 238 { 239 directGfx.fillPolygon(xPoints, yPoints, nPoints); 240 return; 241 } 242 243 throw new UnsupportedOperationException("translate not implemented"); 235 public void fillPolygon (int[] xPoints, int[] yPoints, int nPoints) 236 { 237 // FIXME: remove tx & ty args once translation via AffineTransform 238 // is implemented. 239 directGfx.fillPolygon (xPoints, yPoints, nPoints, tx, ty); 244 240 } 245 241 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/awt/xlib/XGraphics.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 2000 Free Software Foundation1 /* Copyright (C) 2000, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 177 177 } 178 178 179 public void fillPolygon(int[] xPoints, int[] yPoints, int 180 nPoints)181 { 182 throw new UnsupportedOperationException("not implemented");179 public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints, 180 int translateX, int translateY) 181 { 182 context.fillPolygon(xPoints, yPoints, nPoints, translateX, translateY); 183 183 } 184 184 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/awt/xlib/XGraphicsConfiguration.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 2000 Free Software Foundation1 /* Copyright (C) 2000, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 13 13 import java.awt.Graphics2D; 14 14 import java.awt.Graphics; 15 import java.awt.GraphicsDevice; 15 16 import java.awt.Point; 16 17 import java.awt.Color; … … 129 130 * 130 131 * @param offset Offset to data. The given offset does not include 131 * data buffer offset, which will also be added. */ 132 * data buffer offset, which will also be added. 133 */ 132 134 static void attachData(XImage ximage, DataBuffer dataB, int offset) 133 135 { … … 237 239 } 238 240 241 /** 242 * Gets the associated device that this configuration describes. 243 * 244 * @return the device 245 */ 246 public GraphicsDevice getDevice() 247 { 248 throw new UnsupportedOperationException("not implemented"); 249 } 250 251 /** 252 * Returns a buffered image optimized to this device, so that blitting can 253 * be supported in the buffered image. 254 * 255 * @param w the width of the buffer 256 * @param h the height of the buffer 257 * @return the buffered image, or null if none is supported 258 */ 239 259 public BufferedImage createCompatibleImage(int width, 240 260 int height, … … 243 263 throw new UnsupportedOperationException("not implemented"); 244 264 } 245 265 266 /** 267 * Returns a buffered volatile image optimized to this device, so that 268 * blitting can be supported in the buffered image. Because the buffer is 269 * volatile, it can be optimized by native graphics accelerators. 270 * 271 * @param w the width of the buffer 272 * @param h the height of the buffer 273 * @return the buffered image, or null if none is supported 274 * @see Component#createVolatileImage(int, int) 275 * @since 1.4 276 */ 277 public VolatileImage createCompatibleVolatileImage(int w, int h) 278 { 279 throw new UnsupportedOperationException("not implemented"); 280 } 281 246 282 /** 247 283 * FIXME: I'm not sure which color model that should be returned here. … … 354 390 int getPixel(Color color) 355 391 { 392 /* FIXME: consider an integer technique whenever 393 * the ColorModel is 8 bits per color. 394 * The problem with using integers is that it doesn't work unless 395 * the colors are 8 bits each (as in the array), since ColorModel.getDataElement(int[],int) 396 * expects non-normalized values. For example, in a 16-bit display mode, you 397 * would typically have 5 bits each for red and blue, and 6 bits for green. 356 398 int[] components = 357 { 358 color.getRed(), 359 color.getGreen(), 360 color.getBlue(), 361 0xff 362 }; 363 364 ColorModel cm = getColorModel(); 365 return cm.getDataElement(components, 0); 399 { 400 color.getRed (), 401 color.getGreen (), 402 color.getBlue (), 403 0xff 404 }; 405 */ 406 407 float[] normalizedComponents = 408 { 409 ((float)color.getRed ()) / 255F, 410 ((float)color.getGreen ()) / 255F, 411 ((float)color.getBlue ()) / 255F, 412 1 413 }; 414 int[] unnormalizedComponents = { 0, 0, 0, 0xff }; 415 ColorModel cm = getColorModel (); 416 cm.getUnnormalizedComponents(normalizedComponents, 0, 417 unnormalizedComponents, 0); 418 return cm.getDataElement (unnormalizedComponents, 0); 366 419 } 367 420 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/awt/xlib/XToolkit.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 2000, 2002 Free Software Foundation1 /* Copyright (C) 2000, 2002, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 10 10 11 11 import java.awt.*; 12 import java.awt.dnd.*; 13 import java.awt.dnd.peer.*; 14 import java.awt.im.*; 12 15 import java.awt.peer.*; 13 16 import java.awt.image.ImageProducer; … … 16 19 import java.awt.datatransfer.Clipboard; 17 20 import java.util.Properties; 21 import java.util.Map; 18 22 19 23 import gnu.gcj.xlib.Display; … … 170 174 public java.awt.image.ColorModel getColorModel() 171 175 { 172 throw new UnsupportedOperationException("not implemented yet");176 return getDefaultXGraphicsConfiguration().getColorModel(); 173 177 } 174 178 … … 319 323 } 320 324 321 322 /* 323 public DragSourceContextPeer 324 createDragSourceContextPeer(DragGestureEvent dge) 325 throws InvalidDnDOperationException; 326 327 public DragGestureRecognizer 328 createDragGestureRecognizer(Class abstractRecognizerClass, 329 DragSource ds, Component c, 330 int srcActions, DragGestureListener dgl) { 331 throw new UnsupportedOperationException("not implemented"); 332 } 333 */ 334 335 336 /* 337 public Map mapInputMethodHighlight(InputMethodHighlight highlight); 338 */ 325 public DragSourceContextPeer 326 createDragSourceContextPeer(DragGestureEvent dge) 327 throws InvalidDnDOperationException 328 { 329 throw new UnsupportedOperationException("not implemented"); 330 } 331 332 public DragGestureRecognizer 333 createDragGestureRecognizer(Class abstractRecognizerClass, 334 DragSource ds, Component c, 335 int srcActions, DragGestureListener dgl) 336 { 337 throw new UnsupportedOperationException("not implemented"); 338 } 339 340 341 public Map mapInputMethodHighlight(InputMethodHighlight highlight) 342 { 343 throw new UnsupportedOperationException("not implemented"); 344 } 339 345 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/classpath/Configuration.java.in
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 52 52 // For libgcj we never load the JNI libraries. 53 53 boolean INIT_LOAD_LIBRARY = false; 54 55 // For libgcj we have native methods for proxy support.... 56 boolean HAVE_NATIVE_GET_PROXY_DATA = false; 57 boolean HAVE_NATIVE_GET_PROXY_CLASS = false; 58 boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false; 54 59 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/convert/Output_EUCJIS.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 1999 Free Software Foundation1 /* Copyright (C) 1999, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 23 23 public native int write (String str, int inpos, int inlength, char[] work); 24 24 25 public boolean havePendingBytes() 26 { 27 return pending1 >= 0; 28 } 29 25 30 int pending1 = -1; 26 31 int pending2; -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/convert/Output_SJIS.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 1999 Free Software Foundation1 /* Copyright (C) 1999, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 23 23 public native int write (String str, int inpos, int inlength, char[] work); 24 24 25 public boolean havePendingBytes() 26 { 27 return pending >= 0; 28 } 29 25 30 int pending = -1; 26 31 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/convert/Output_UTF8.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 1999, 2000 Free Software Foundation1 /* Copyright (C) 1999, 2000, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 105 105 value = (hi_part - 0xD800) * 0x400 + (ch - 0xDC00) + 0x10000; 106 106 buf[count++] = (byte) (0xF0 | (value >> 18)); 107 avail--; 107 108 bytes_todo = 3; 108 109 hi_part = 0; … … 119 120 return inpos - start_pos; 120 121 } 122 123 public boolean havePendingBytes() 124 { 125 return bytes_todo > 0; 126 } 127 121 128 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/convert/UnicodeToBytes.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 1999, 2000, 2001 Free Software Foundation1 /* Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 147 147 } 148 148 149 /** 150 * Returns true when the converter has consumed some bytes that are 151 * not yet converted to characters because further continuation 152 * bytes are needed. Defaults to false, should be overridden by 153 * decoders that internally store some bytes. 154 */ 155 public boolean havePendingBytes() 156 { 157 return false; 158 } 159 149 160 /** Indicate that the converter is resuable. 150 161 * This class keeps track of converters on a per-encoding basis. -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/convert/natIconv.cc
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 269 269 if (r != (size_t) -1 && inc == 0 && outc == 0) 270 270 result = (c != 0xfeff); 271 272 // Release iconv handle. 273 iconv_close (handle); 271 274 } 272 275 #endif /* HAVE_ICONV */ -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/protocol/core/Connection.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 14 14 import java.net.*; 15 15 import java.io.*; 16 import java.util.Map; 16 17 import java.util.Vector; 17 18 import java.util.Hashtable; … … 70 71 } 71 72 return (String) hdrHash.get(name.toLowerCase()); 73 } 74 75 // Override default method in URLConnection. 76 public Map getHeaderFields() 77 { 78 try 79 { 80 getHeaders(); 81 } 82 catch (IOException x) 83 { 84 return null; 85 } 86 return hdrHash; 72 87 } 73 88 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/protocol/file/Connection.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 13 13 import java.net.*; 14 14 import java.io.*; 15 import java.util.Map; 15 16 import java.util.Vector; 16 17 import java.util.Hashtable; … … 97 98 98 99 // Override default method in URLConnection. 100 public Map getHeaderFields() 101 { 102 try 103 { 104 getHeaders(); 105 } 106 catch (IOException x) 107 { 108 return null; 109 } 110 return hdrHash; 111 } 112 113 // Override default method in URLConnection. 99 114 public String getHeaderField(int n) 100 115 { -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/protocol/http/Connection.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 // Connection.java - Implementation of HttpURLConnection for http protocol. 2 2 3 /* Copyright (C) 1999, 2000 Free Software Foundation3 /* Copyright (C) 1999, 2000, 2003 Free Software Foundation 4 4 5 5 This file is part of libgcj. … … 13 13 import java.net.*; 14 14 import java.io.*; 15 import java.util.Map; 15 16 import java.util.Vector; 16 17 import java.util.Hashtable; … … 25 26 * Written using on-line Java Platform 1.2 API Specification, as well 26 27 * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). 27 * Status: Minimal subset of functionality. Proxies and Redirects 28 * not yet handled. FileNameMap handling needs to be considered. 29 * useCaches, ifModifiedSince, and allowUserInteraction need 30 * consideration as well as doInput and doOutput. 28 * Status: Minimal subset of functionality. Proxies only partially 29 * handled; Redirects not yet handled. FileNameMap handling needs to 30 * be considered. useCaches, ifModifiedSince, and 31 * allowUserInteraction need consideration as well as doInput and 32 * doOutput. 31 33 */ 32 34 … … 40 42 private BufferedInputStream bufferedIn; 41 43 44 private static int proxyPort = 80; 45 private static boolean proxyInUse = false; 46 private static String proxyHost = null; 47 48 static 49 { 50 // Recognize some networking properties listed at 51 // http://java.sun.com/j2se/1.4/docs/guide/net/properties.html. 52 String port = null; 53 proxyHost = System.getProperty("http.proxyHost"); 54 if (proxyHost != null) 55 { 56 proxyInUse = true; 57 if ((port = System.getProperty("http.proxyPort")) != null) 58 { 59 try 60 { 61 proxyPort = Integer.parseInt(port); 62 } 63 catch (Throwable t) 64 { 65 // Nothing. 66 } 67 } 68 } 69 } 70 42 71 public Connection(URL url) 43 72 { … … 85 114 // Get address and port number. 86 115 int port; 87 InetAddress destAddr = InetAddress.getByName(url.getHost()); 88 if ((port = url.getPort()) == -1) 89 port = 80; 90 91 // Open socket and output stream. 92 sock = new Socket(destAddr, port); 116 if (proxyInUse) 117 { 118 port = proxyPort; 119 sock = new Socket(proxyHost, port); 120 } 121 else 122 { 123 InetAddress destAddr = InetAddress.getByName(url.getHost()); 124 if ((port = url.getPort()) == -1) 125 port = 80; 126 // Open socket and output stream. 127 sock = new Socket(destAddr, port); 128 } 129 93 130 PrintWriter out = new PrintWriter(sock.getOutputStream()); 94 131 … … 123 160 } 124 161 125 // TODO: public boolean usingProxy()126 162 public boolean usingProxy() 127 163 { 128 return false;164 return proxyInUse; 129 165 } 130 166 … … 166 202 167 203 return (String) hdrHash.get(name.toLowerCase()); 204 } 205 206 // Override default method in URLConnection. 207 public Map getHeaderFields() 208 { 209 if (!connected) 210 try 211 { 212 connect(); 213 } 214 catch (IOException x) 215 { 216 return null; 217 } 218 219 return hdrHash; 168 220 } 169 221 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/protocol/jar/Connection.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 1999 Free Software Foundation1 /* Copyright (C) 1999, 2002 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 10 10 11 11 import java.net.URL; 12 import java.net.URLConnection; 12 13 import java.net.JarURLConnection; 13 14 import java.net.URLStreamHandler; … … 15 16 import java.net.ProtocolException; 16 17 import java.io.IOException; 18 import java.io.InputStream; 19 import java.io.File; 20 import java.io.FileOutputStream; 17 21 import java.util.jar.JarFile; 22 import java.util.zip.ZipFile; 18 23 import java.util.Hashtable; 19 24 20 25 /** 21 26 * Written using on-line Java Platform 1.2 API Specification. 22 * Status: Needs a way to download jar files and store them in the local file23 * system. I don't know how to do that in a portable way. For now, it can only handle24 * connections to a jar:file: url's.25 27 * 26 28 * @author Kresten Krab Thorup <krab@gnu.org> … … 71 73 else 72 74 { 73 /* 74 FIXME: Here we need to download and cache the jar 75 file in the local file system! Stupid design. Why 76 can't we just create a JarFile from a bag of bytes? 77 */ 78 79 throw new java.io.IOException("cannot create jar file from " + 80 jarFileURL); 75 URLConnection urlconn = jarFileURL.openConnection(); 76 InputStream is = urlconn.getInputStream(); 77 byte[] buf = new byte[4*1024]; 78 File f = File.createTempFile("cache", "jar"); 79 FileOutputStream fos = new FileOutputStream(f); 80 int len = 0; 81 while((len = is.read(buf)) != -1) 82 fos.write(buf, 0, len); 83 fos.close(); 84 // Always verify the Manifest, open read only and delete when done. 85 // XXX ZipFile.OPEN_DELETE not yet implemented. 86 // jf = new JarFile(f, true, ZipFile.OPEN_READ | ZipFile.OPEN_DELETE); 87 jarfile = new JarFile(f, true, ZipFile.OPEN_READ); 81 88 } 82 89 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/runtime/FirstThread.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 95 95 static final Class Khttp = gnu.gcj.protocol.http.Handler.class; 96 96 static final Class Kjar = gnu.gcj.protocol.jar.Handler.class; 97 static final Class KinputASCII = gnu.gcj.convert.Input_ASCII.class; 98 static final Class KoutputASCII = gnu.gcj.convert.Output_ASCII.class; 97 99 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/runtime/SharedLibLoader.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 2001 Free Software Foundation1 /* Copyright (C) 2001, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 28 28 * @param libname named of shared library (passed to dlopen) 29 29 * @param parent the parent ClassLoader 30 * @par em flags passed to dlopen30 * @param flags passed to dlopen 31 31 */ 32 32 public SharedLibLoader(String libname, ClassLoader parent, int flags) -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/runtime/VMClassLoader.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 1999, 2001 Free Software Foundation1 /* Copyright (C) 1999, 2001, 2002 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 34 34 try 35 35 { 36 if (e.endsWith(".jar") || e.endsWith (".zip")) 37 { 38 File archive = new File (e); 39 try { 40 p.addElement(new URL("jar", "", -1, "file://" 41 + archive.getCanonicalPath () 42 + "!/")); 43 } catch (IOException ex) { 44 // empty 45 } 46 } 47 else if (e.endsWith ("/")) 36 if (!e.endsWith (File.separator) && new File (e).isDirectory ()) 37 p.addElement (new URL("file", "", -1, e + File.separator)); 38 else 48 39 p.addElement (new URL("file", "", -1, e)); 49 else if (new File (e).isDirectory ())50 p.addElement (new URL("file", "", -1, e + "/"));51 else52 /* Ignore path element. */;53 40 } 54 41 catch (java.net.MalformedURLException x) -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/runtime/natSharedLibLoader.cc
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 // natSharedLibLoader.cc - Implementation of FirstThread native methods. 2 2 3 /* Copyright (C) 2001 Free Software Foundation3 /* Copyright (C) 2001, 2003 Free Software Foundation 4 4 5 5 This file is part of libgcj. … … 63 63 handler = (gnu::gcj::RawData*) h; 64 64 #else 65 const char *msg = "Share edLibLoader is not supported on this platform";65 const char *msg = "SharedLibLoader is not supported on this platform"; 66 66 throw new java::lang::UnsupportedOperationException(JvNewStringLatin1(msg)); 67 67 #endif -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/xlib/GC.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 2000 Free Software Foundation1 /* Copyright (C) 2000, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 85 85 86 86 public native void fillRectangle(int x, int y, int w, int h); 87 public native void fillPolygon(int[] xPoints, int[] yPoints, int nPoints, 88 int translateX, int translateY); 87 89 88 90 /** -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/gcj/xlib/natGC.cc
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* Copyright (C) 2000 Free Software Foundation1 /* Copyright (C) 2000, 2003 Free Software Foundation 2 2 3 3 This file is part of libgcj. … … 12 12 13 13 #include <gcj/cni.h> 14 #include <gcj/array.h> 14 15 #include <gnu/gcj/RawData.h> 15 16 #include <java/lang/String.h> … … 155 156 } 156 157 158 void gnu::gcj::xlib::GC::fillPolygon(jintArray xPoints, jintArray yPoints, 159 jint nPoints, 160 jint translateX, jint translateY) 161 { 162 Display* display = target->getDisplay(); 163 ::Display* dpy = (::Display*) (display->display); 164 ::Drawable drawableXID = target->getXID(); 165 ::GC gc = (::GC) structure; 166 typedef ::XPoint xpoint; 167 std::vector<xpoint> points(nPoints+1); 168 for (int i=0; i<nPoints; i++) 169 { 170 points[i].x = elements(xPoints)[i] + translateX; 171 points[i].y = elements(yPoints)[i] + translateY; 172 } 173 points[nPoints] = points[0]; 174 XFillPolygon(dpy, drawableXID, gc, &(points.front()), nPoints, 175 Complex, CoordModeOrigin); 176 // no fast fail 177 } 178 157 179 void gnu::gcj::xlib::GC::clearArea(jint x, jint y, jint w, jint h, 158 180 jboolean exposures) -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/lang/reflect/TypeSignature.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* TypeSignature.java -- Class used to compute type signatures 2 Copyright (C) 1998 Free Software Foundation, Inc.2 Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 GNU Classpath is distributed in the hope that it will be useful, but 12 12 WITHOUT ANY WARRANTY; without even the implied warranty of … … 45 45 46 46 /** 47 This class provides static methods that can be used to compute 48 type-signatures of <code>Class</code>s or <code>Member</code>s. 49 More specific methods are also provided for computing the 50 type-signature of <code>Constructor</code>s and 51 <code>Method</code>s. Methods are also provided to go in the 52 reverse direction. 53 */ 47 * This class provides static methods that can be used to compute 48 * type-signatures of <code>Class</code>s or <code>Member</code>s. 49 * More specific methods are also provided for computing the 50 * type-signature of <code>Constructor</code>s and 51 * <code>Method</code>s. Methods are also provided to go in the 52 * reverse direction. 53 * 54 * @author Eric Blake <ebb9@email.byu.edu> 55 */ 54 56 public class TypeSignature 55 57 { 56 57 /** 58 Returns a <code>String</code> representing the type-encoding of 59 CLAZZ. Type-encodings are computed as follows: 60 61 <pre> 62 boolean -> "Z" 63 byte -> "B" 64 char -> "C" 65 double -> "D" 66 float -> "F" 67 int -> "I" 68 long -> "J" 69 short -> "S" 70 void -> "V" 71 arrays -> "[" + type-encoding of component type 72 object -> "L" 73 + fully qualified class name with "."'s replaced by "/"'s 74 + ";"</pre> 75 */ 76 public static String getEncodingOfClass( Class clazz ) 77 { 78 if( clazz.isPrimitive() ) 79 { 80 if( clazz == Boolean.TYPE ) 81 return "Z"; 82 if( clazz == Byte.TYPE ) 83 return "B"; 84 if( clazz == Character.TYPE ) 85 return "C"; 86 if( clazz == Double.TYPE ) 87 return "D"; 88 if( clazz == Float.TYPE ) 89 return "F"; 90 if( clazz == Integer.TYPE ) 91 return "I"; 92 if( clazz == Long.TYPE ) 93 return "J"; 94 if( clazz == Short.TYPE ) 95 return "S"; 96 if( clazz == Void.TYPE ) 97 return "V"; 98 else 99 throw new RuntimeException( "Unknown primitive class " + clazz ); 100 } 101 else if( clazz.isArray() ) 102 { 103 return '[' + getEncodingOfClass( clazz.getComponentType() ); 104 } 105 else 106 { 107 String classname = clazz.getName(); 108 int name_len = classname.length(); 109 char[] buf = new char[ name_len + 2 ]; 110 buf[0] = 'L'; 111 classname.getChars( 0, name_len, buf, 1 ); 112 113 int i; 114 for( i=1; i <= name_len; i++ ) 58 /** 59 * Returns a <code>String</code> representing the type-encoding of a class. 60 * The .class file format has different encodings for classes, depending 61 * on whether it must be disambiguated from primitive types or not; hence 62 * the descriptor parameter to choose between them. If you are planning 63 * on decoding primitive types along with classes, then descriptor should 64 * be true for correct results. Type-encodings are computed as follows: 65 * 66 * <pre> 67 * boolean -> "Z" 68 * byte -> "B" 69 * char -> "C" 70 * double -> "D" 71 * float -> "F" 72 * int -> "I" 73 * long -> "J" 74 * short -> "S" 75 * void -> "V" 76 * arrays -> "[" + descriptor format of component type 77 * object -> class format: fully qualified name with '.' replaced by '/' 78 * descriptor format: "L" + class format + ";" 79 * </pre> 80 * 81 * @param type the class name to encode 82 * @param descriptor true to return objects in descriptor format 83 * @return the class name, as it appears in bytecode constant pools 84 * @see #getClassForEncoding(String) 85 */ 86 public static String getEncodingOfClass(String type, boolean descriptor) 87 { 88 if (! descriptor || type.charAt(0) == '[') 89 return type.replace('.', '/'); 90 if (type.equals("boolean")) 91 return "Z"; 92 if (type.equals("byte")) 93 return "B"; 94 if (type.equals("short")) 95 return "S"; 96 if (type.equals("char")) 97 return "C"; 98 if (type.equals("int")) 99 return "I"; 100 if (type.equals("long")) 101 return "J"; 102 if (type.equals("float")) 103 return "F"; 104 if (type.equals("double")) 105 return "D"; 106 if (type.equals("void")) 107 return "V"; 108 return 'L' + type.replace('.', '/') + ';'; 109 } 110 111 /** 112 * Gets the descriptor encoding for a class. 113 * 114 * @param clazz the class to encode 115 * @param descriptor true to return objects in descriptor format 116 * @return the class name, as it appears in bytecode constant pools 117 * @see #getEncodingOfClass(String, boolean) 118 */ 119 public static String getEncodingOfClass(Class clazz, boolean descriptor) 120 { 121 return getEncodingOfClass(clazz.getName(), descriptor); 122 } 123 124 /** 125 * Gets the descriptor encoding for a class. 126 * 127 * @param clazz the class to encode 128 * @return the class name, as it appears in bytecode constant pools 129 * @see #getEncodingOfClass(String, boolean) 130 */ 131 public static String getEncodingOfClass(Class clazz) 132 { 133 return getEncodingOfClass(clazz.getName(), true); 134 } 135 136 137 /** 138 * This function is the inverse of <code>getEncodingOfClass</code>. This 139 * accepts both object and descriptor formats, but must know which style 140 * of string is being passed in (usually, descriptor should be true). In 141 * descriptor format, "I" is treated as int.class, in object format, it 142 * is treated as a class named I in the unnamed package. 143 * 144 * @param type_code the class name to decode 145 * @param descriptor if the string is in descriptor format 146 * @return the corresponding Class object 147 * @throws ClassNotFoundException if the class cannot be located 148 * @see #getEncodingOfClass(Class, boolean) 149 */ 150 public static Class getClassForEncoding(String type_code, boolean descriptor) 151 throws ClassNotFoundException 152 { 153 if (descriptor) 115 154 { 116 if( buf[i] == '.' ) 117 buf[i] = '/'; 155 switch (type_code.charAt(0)) 156 { 157 case 'B': 158 return byte.class; 159 case 'C': 160 return char.class; 161 case 'D': 162 return double.class; 163 case 'F': 164 return float.class; 165 case 'I': 166 return int.class; 167 case 'J': 168 return long.class; 169 case 'S': 170 return short.class; 171 case 'V': 172 return void.class; 173 case 'Z': 174 return boolean.class; 175 default: 176 throw new ClassNotFoundException("Invalid class name: " 177 + type_code); 178 case 'L': 179 type_code = type_code.substring(1, type_code.length() - 1); 180 // Fallthrough. 181 case '[': 182 } 118 183 } 119 120 buf[i] = ';'; 121 return new String( buf ); 122 } 123 } 124 125 126 /** 127 This function is the inverse of <code>getEncodingOfClass</code>. 128 129 @see getEncodingOfClass 130 131 @exception ClassNotFoundException If class encoded as type_code 132 cannot be located. 133 */ 134 public static Class getClassForEncoding( String type_code ) 184 return Class.forName(type_code.replace('/', '.')); 185 } 186 187 /** 188 * Gets the Class object for a type name. 189 * 190 * @param type_code the class name to decode 191 * @return the corresponding Class object 192 * @throws ClassNotFoundException if the class cannot be located 193 * @see #getClassForEncoding(String, boolean) 194 */ 195 public static Class getClassForEncoding(String type_code) 135 196 throws ClassNotFoundException 136 197 { 137 if( type_code.equals( "B" ) ) 138 return Byte.TYPE; 139 if( type_code.equals( "C" ) ) 140 return Character.TYPE; 141 if( type_code.equals( "D" ) ) 142 return Double.TYPE; 143 if( type_code.equals( "F" ) ) 144 return Float.TYPE; 145 if( type_code.equals( "I" ) ) 146 return Integer.TYPE; 147 if( type_code.equals( "J" ) ) 148 return Long.TYPE; 149 if( type_code.equals( "S" ) ) 150 return Short.TYPE; 151 if( type_code.equals( "Z" ) ) 152 return Boolean.TYPE; 153 if( type_code.charAt( 0 ) == 'L' ) 154 { 155 return Class.forName( 156 type_code.substring( 1, type_code.length() - 1 ).replace( '/', '.' )); 157 } 158 if( type_code.charAt( 0 ) == '[' ) 159 { 160 int last_bracket = type_code.lastIndexOf( '[' ); 161 String brackets = type_code.substring( 0, last_bracket + 1 ); 162 String component = type_code.substring( last_bracket + 1 ); 163 164 // ??? This is what the Classpath implementation did, but I don't 165 // think that it's correct. The JLS says that Class.forName takes the 166 // classname of an array element in fully qualified form, whereas this 167 // code is tring to strip off the punctuation. 168 169 // if( component.charAt( 0 ) == 'L' ) 170 // component = 171 // component.substring( 1, component.length() - 1 ).replace('/', '.'); 172 173 if( component.charAt( 0 ) == 'L' ) 174 component = component.replace('/', '.'); 175 176 return Class.forName( brackets + component ); 177 } 178 else 179 throw new ClassNotFoundException( "Type code cannot be parsed as a valid class name" ); 180 } 181 182 183 /** 184 Returns a <code>String</code> representing the type-encoding of 185 M. The type-encoding of a method is: 186 187 "(" + type-encodings of parameter types + ")" 188 + type-encoding of return type 189 */ 190 public static String getEncodingOfMethod( Method m ) 191 { 192 String returnEncoding = getEncodingOfClass( m.getReturnType() ); 198 return getClassForEncoding(type_code, true); 199 } 200 201 /** 202 * Returns a <code>String</code> representing the type-encoding of a 203 * method. The type-encoding of a method is: 204 * 205 * "(" + parameter type descriptors + ")" + return type descriptor 206 * 207 * XXX This could be faster if it were implemented natively. 208 * 209 * @param m the method to encode 210 * @return the encoding 211 */ 212 public static String getEncodingOfMethod(Method m) 213 { 193 214 Class[] paramTypes = m.getParameterTypes(); 194 String[] paramEncodings = new String[ paramTypes.length ]; 195 196 String paramEncoding; 197 int size = 2; // make room for parens 198 for( int i=0; i < paramTypes.length; i++ ) 199 { 200 paramEncoding = getEncodingOfClass( paramTypes[i] ); 201 size += paramEncoding.length(); 202 paramEncodings[i] = paramEncoding; 203 } 204 205 size += returnEncoding.length(); 206 207 StringBuffer buf = new StringBuffer( size ); 208 buf.append( '(' ); 209 210 for( int i=0; i < paramTypes.length; i++ ) 211 { 212 buf.append( paramEncodings[i] ); 213 } 214 215 buf.append( ')' ); 216 buf.append( returnEncoding ); 217 215 StringBuffer buf = new StringBuffer().append('('); 216 for (int i = 0; i < paramTypes.length; i++) 217 buf.append(getEncodingOfClass(paramTypes[i].getName(), true)); 218 buf.append(')').append(getEncodingOfClass(m.getReturnType().getName(), 219 true)); 218 220 return buf.toString(); 219 221 } 220 222 221 222 /** 223 Returns a <code>String</code> representing the type-encoding of 224 C. The type-encoding of a method is: 225 226 "(" + type-encodings of parameter types + ")V" 227 */ 228 public static String getEncodingOfConstructor( Constructor c ) 223 /** 224 * Returns a <code>String</code> representing the type-encoding of a 225 * constructor. The type-encoding of a method is: 226 * 227 * "(" + parameter type descriptors + ")V" 228 * 229 * XXX This could be faster if it were implemented natively. 230 * 231 * @param c the constructor to encode 232 * @return the encoding 233 */ 234 public static String getEncodingOfConstructor(Constructor c) 229 235 { 230 236 Class[] paramTypes = c.getParameterTypes(); 231 String[] paramEncodings = new String[ paramTypes.length ]; 232 233 String paramEncoding; 234 int size = 3; // make room for parens and V for return type 235 for( int i=0; i < paramTypes.length; i++ ) 236 { 237 paramEncoding = getEncodingOfClass( paramTypes[i] ); 238 size += paramEncoding.length(); 239 paramEncodings[i] = paramEncoding; 240 } 241 242 StringBuffer buf = new StringBuffer( size ); 243 buf.append( '(' ); 244 245 for( int i=0; i < paramTypes.length; i++ ) 246 { 247 buf.append( paramEncodings[i] ); 248 } 249 250 buf.append( ")V" ); 251 237 StringBuffer buf = new StringBuffer().append('('); 238 for (int i = 0; i < paramTypes.length; i++) 239 buf.append(getEncodingOfClass(paramTypes[i].getName(), true)); 240 buf.append(")V"); 252 241 return buf.toString(); 253 242 } 254 243 255 256 /** 257 Returns a <code>String</code> representing the type-encoding of 258 MEM. <code>Constructor</code>s are handled by 259 <code>getEncodingOfConstructor</code>. <code>Method</code>s are 260 handled by <code>getEncodingOfMethod</code>. <code>Field</code>s 261 are handled by returning the encoding of the type of the 262 <code>Field</code>. 263 */ 264 public static String getEncodingOfMember( Member mem ) 265 { 266 if( mem instanceof Constructor ) 267 return getEncodingOfConstructor( (Constructor)mem ); 268 if( mem instanceof Method ) 269 return getEncodingOfMethod( (Method)mem ); 244 /** 245 * Returns a <code>String</code> representing the type-encoding of a 246 * class member. This appropriately handles Constructors, Methods, and 247 * Fields. 248 * 249 * @param mem the member to encode 250 * @return the encoding 251 */ 252 public static String getEncodingOfMember(Member mem) 253 { 254 if (mem instanceof Constructor) 255 return getEncodingOfConstructor((Constructor) mem); 256 if (mem instanceof Method) 257 return getEncodingOfMethod((Method) mem); 270 258 else // Field 271 return getEncodingOfClass( ((Field)mem).getType());272 } 273 } 259 return getEncodingOfClass(((Field) mem).getType().getName(), true); 260 } 261 } // class TypeSignature -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/dgc/DGCImpl.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* 2 Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.2 Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 47 47 import gnu.java.rmi.server.UnicastServerRef; 48 48 49 import java.util.Hashtable; 50 51 /** 52 * I let DGCImpl to extend UnicastServerRef, but not 53 * UnicastRemoteObject, because UnicastRemoteObject must 54 * exportObject automatically. 55 */ 49 56 public class DGCImpl 50 extends UnicastRemoteObject implements DGC { 57 extends UnicastServerRef implements DGC { 58 59 private static final long LEASE_VALUE = 600000L; 60 // leaseCache caches a LeaseRecord associated with a vmid 61 private Hashtable leaseCache = new Hashtable(); 51 62 52 63 public DGCImpl() throws RemoteException { 53 super(new UnicastServerRef(new ObjID(ObjID.DGC_ID), 0, RMISocketFactory.getSocketFactory()));64 super(new ObjID(ObjID.DGC_ID), 0, RMISocketFactory.getSocketFactory()); 54 65 } 55 66 56 67 public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease) throws RemoteException { 57 System.out.println("DGCImpl.dirty - not implemented"); 68 VMID vmid = lease.getVMID(); 69 if (vmid == null) 70 vmid = new VMID(); 71 long leaseValue = LEASE_VALUE; 72 //long leaseValue = lease.getValue(); 73 lease = new Lease(vmid, leaseValue); 74 synchronized(leaseCache){ 75 LeaseRecord lr = (LeaseRecord)leaseCache.get(vmid); 76 if (lr != null) 77 lr.reset(leaseValue); 78 else{ 79 lr = new LeaseRecord(vmid, leaseValue); 80 leaseCache.put(vmid, lr); 81 } 82 } 83 58 84 return (lease); 59 85 } 60 86 61 87 public void clean(ObjID[] ids, long sequenceNum, VMID vmid, boolean strong) throws RemoteException { 62 System.out.println("DGCImpl.clean - not implemented"); 88 // Not implemented 63 89 } 90 91 /** 92 * LeaseRecord associates a vmid to expireTime. 93 */ 94 private static class LeaseRecord{ 95 private VMID vmid; 96 private long expireTime; 97 98 LeaseRecord(VMID vmid, long leaseValue){ 99 this.vmid = vmid; 100 reset(leaseValue); 101 } 102 103 // reset expireTime 104 void reset(long leaseValue){ 105 long l = System.currentTimeMillis(); 106 expireTime = l + leaseValue; 107 } 64 108 65 } 109 boolean isExpired(){ 110 long l = System.currentTimeMillis(); 111 if ( l > expireTime) 112 return true; 113 return false; 114 } 115 116 } //End of LeaseRecord 117 118 } //End of DGCImpl -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* DGCImpl_Skel.java 2 Copyright (C) 2002 Free Software Foundation, Inc. 3 4 This file is part of GNU Classpath. 5 6 GNU Classpath is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 GNU Classpath is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU Classpath; see the file COPYING. If not, write to the 18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 02111-1307 USA. 20 21 Linking this library statically or dynamically with other modules is 22 making a combined work based on this library. Thus, the terms and 23 conditions of the GNU General Public License cover the whole 24 combination. 25 26 As a special exception, the copyright holders of this library give you 27 permission to link this library with independent modules to produce an 28 executable, regardless of the license terms of these independent 29 modules, and to copy and distribute the resulting executable under 30 terms of your choice, provided that you also meet, for each linked 31 independent module, the terms and conditions of the license of that 32 module. An independent module is a module which is not derived from 33 or based on this library. If you modify this library, you may extend 34 this exception to your version of the library, but you are not 35 obligated to do so. If you do not wish to do so, delete this 36 exception statement from your version. */ 37 38 1 39 // Skel class generated by rmic - DO NOT EDIT! 2 40 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* DGCImpl_Stub.java 2 Copyright (C) 2002 Free Software Foundation, Inc. 3 4 This file is part of GNU Classpath. 5 6 GNU Classpath is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 GNU Classpath is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU Classpath; see the file COPYING. If not, write to the 18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 02111-1307 USA. 20 21 Linking this library statically or dynamically with other modules is 22 making a combined work based on this library. Thus, the terms and 23 conditions of the GNU General Public License cover the whole 24 combination. 25 26 As a special exception, the copyright holders of this library give you 27 permission to link this library with independent modules to produce an 28 executable, regardless of the license terms of these independent 29 modules, and to copy and distribute the resulting executable under 30 terms of your choice, provided that you also meet, for each linked 31 independent module, the terms and conditions of the license of that 32 module. An independent module is a module which is not derived from 33 or based on this library. If you modify this library, you may extend 34 this exception to your version of the library, but you are not 35 obligated to do so. If you do not wish to do so, delete this 36 exception statement from your version. */ 37 38 1 39 // Stub class generated by rmic - DO NOT EDIT! 2 40 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/registry/RegistryImpl.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 65 65 public RegistryImpl(int port, RMIClientSocketFactory cf, RMIServerSocketFactory sf) throws RemoteException { 66 66 super(new UnicastServerRef(new ObjID(ObjID.REGISTRY_ID), port, sf)); 67 ((UnicastServerRef)getRef()).exportObject(this); 67 // The following is unnecessary, because UnicastRemoteObject export itself automatically. 68 //((UnicastServerRef)getRef()).exportObject(this); 68 69 } 69 70 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* RegistryImpl_Skel.java 2 Copyright (C) 2002 Free Software Foundation, Inc. 3 4 This file is part of GNU Classpath. 5 6 GNU Classpath is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 GNU Classpath is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU Classpath; see the file COPYING. If not, write to the 18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 02111-1307 USA. 20 21 Linking this library statically or dynamically with other modules is 22 making a combined work based on this library. Thus, the terms and 23 conditions of the GNU General Public License cover the whole 24 combination. 25 26 As a special exception, the copyright holders of this library give you 27 permission to link this library with independent modules to produce an 28 executable, regardless of the license terms of these independent 29 modules, and to copy and distribute the resulting executable under 30 terms of your choice, provided that you also meet, for each linked 31 independent module, the terms and conditions of the license of that 32 module. An independent module is a module which is not derived from 33 or based on this library. If you modify this library, you may extend 34 this exception to your version of the library, but you are not 35 obligated to do so. If you do not wish to do so, delete this 36 exception statement from your version. */ 37 38 1 39 // Skel class generated by rmic - DO NOT EDIT! 2 40 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 /* RegistryImpl_Stub.java 2 Copyright (C) 2002 Free Software Foundation, Inc. 3 4 This file is part of GNU Classpath. 5 6 GNU Classpath is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 GNU Classpath is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU Classpath; see the file COPYING. If not, write to the 18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 02111-1307 USA. 20 21 Linking this library statically or dynamically with other modules is 22 making a combined work based on this library. Thus, the terms and 23 conditions of the GNU General Public License cover the whole 24 combination. 25 26 As a special exception, the copyright holders of this library give you 27 permission to link this library with independent modules to produce an 28 executable, regardless of the license terms of these independent 29 modules, and to copy and distribute the resulting executable under 30 terms of your choice, provided that you also meet, for each linked 31 independent module, the terms and conditions of the license of that 32 module. An independent module is a module which is not derived from 33 or based on this library. If you modify this library, you may extend 34 this exception to your version of the library, but you are not 35 obligated to do so. If you do not wish to do so, delete this 36 exception statement from your version. */ 37 38 1 39 // Stub class generated by rmic - DO NOT EDIT! 2 40 … … 30 68 try { 31 69 java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class }); 32 useNewInvoke = true;70 useNewInvoke = false; 33 71 $method_bind_0 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("bind", new java.lang.Class[] {java.lang.String.class, java.rmi.Remote.class}); 34 72 $method_list_1 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("list", new java.lang.Class[] {}); -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/server/RMIHashes.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 40 40 import java.lang.reflect.Method; 41 41 import java.lang.Class; 42 import gnu.java.security.provider.SHA; 42 import gnu.java.io.NullOutputStream; 43 import gnu.java.lang.reflect.TypeSignature; 44 import java.security.MessageDigest; 45 import java.security.DigestOutputStream; 46 import java.io.DataOutputStream; 47 import java.io.ByteArrayOutputStream; 43 48 44 49 public class RMIHashes 45 50 { 51 //There're other places using DigestOutputStream to generate hash in classpath, but I think the way I used 52 //here is more efficient, anyway, you can switch to DigestOutputStream by doing like "//or:" comments say. 53 54 //or:add this statement: private static final NullOutputStream nullOutputStream = new NullOutputStream (); 46 55 public static long getMethodHash(Method meth) 47 56 { 48 return meth.hashCode (); 57 //Object Serialization Spec 8.3 58 try 59 { 60 MessageDigest md = MessageDigest.getInstance ("SHA"); 61 //or:remove this statement: DigestOutputStream digest_out = new DigestOutputStream (nullOutputStream, md); 62 ByteArrayOutputStream digest_out = new ByteArrayOutputStream(); 63 DataOutputStream data_out = new DataOutputStream (digest_out); 64 65 StringBuffer sbuf = new StringBuffer(); 66 sbuf.append(meth.getName()); 67 sbuf.append('('); 68 Class params[] = meth.getParameterTypes(); 69 for(int i = 0; i < params.length; i++) 70 sbuf.append(TypeSignature.getEncodingOfClass(params[i])); 71 sbuf.append(')'); 72 Class rcls = meth.getReturnType(); 73 if(rcls != Void.TYPE) 74 sbuf.append(TypeSignature.getEncodingOfClass(rcls)); 75 else 76 sbuf.append('V'); 77 78 data_out.writeUTF (sbuf.toString()); 79 data_out.flush(); 80 data_out.close (); 81 82 md.update(digest_out.toByteArray()); //or:remove this statement 83 byte[] sha = md.digest (); 84 long result = 0; 85 int len = sha.length < 8 ? sha.length : 8; 86 for (int i=0; i < len; i++) 87 result += (long)(sha[i] & 0xFF) << (8 * i); 88 return result; 89 }catch(Exception _){ 90 return -1L; 91 } 49 92 } 50 93 … … 54 97 } 55 98 } 99 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/server/RMIObjectInputStream.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* 2 Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.2 Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 45 45 import java.net.MalformedURLException; 46 46 import java.rmi.server.RMIClassLoader; 47 import java.lang.ClassNotFoundException; 48 import java.lang.reflect.Proxy; 47 49 48 50 public class RMIObjectInputStream 49 51 extends ObjectInputStream { 50 52 51 UnicastConnectionManager manager; 52 53 public RMIObjectInputStream(InputStream strm, UnicastConnectionManager man) throws IOException { 53 public RMIObjectInputStream(InputStream strm) throws IOException { 54 54 super(strm); 55 manager = man;56 55 enableResolveObject(true); 57 56 } 58 57 59 58 protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { 60 //System.out.println("Resolving class: " + desc.getName()); 61 String annotation = (String)readObject(); 62 if (annotation == null) { 63 return (super.resolveClass(desc)); 59 String annotation = (String)getAnnotation(); 60 61 try { 62 if(annotation == null) 63 return (RMIClassLoader.loadClass(desc.getName())); 64 else 65 return (RMIClassLoader.loadClass(annotation, desc.getName())); 64 66 } 65 else { 66 try { 67 return (RMIClassLoader.loadClass(new URL(annotation), desc.getName())); 68 } 69 catch (MalformedURLException _) { 70 throw new ClassNotFoundException(desc.getName()); 71 } 67 catch (MalformedURLException _) { 68 throw new ClassNotFoundException(desc.getName()); 72 69 } 73 70 } 74 71 72 //Separate it for override by MarshalledObject 73 protected Object getAnnotation() 74 throws IOException, ClassNotFoundException 75 { 76 return readObject(); 75 77 } 78 79 protected Class resolveProxyClass(String intfs[]) 80 throws IOException, ClassNotFoundException 81 { 82 String annotation = (String)getAnnotation(); 83 84 Class clss[] = new Class[intfs.length]; 85 if(annotation == null) 86 clss[0] = RMIClassLoader.loadClass(intfs[0]); 87 else 88 clss[0] = RMIClassLoader.loadClass(annotation, intfs[0]); 89 90 //assume all interfaces can be loaded by the same classloader 91 ClassLoader loader = clss[0].getClassLoader(); 92 for (int i = 0; i < intfs.length; i++) 93 clss[i] = Class.forName(intfs[i], false, loader); 94 95 try { 96 return Proxy.getProxyClass(loader, clss); 97 } catch (IllegalArgumentException e) { 98 throw new ClassNotFoundException(null, e); 99 } 100 } 101 102 protected Object readValue(Class valueClass) throws IOException, ClassNotFoundException { 103 if(valueClass.isPrimitive()){ 104 if(valueClass == Boolean.TYPE) 105 return new Boolean(readBoolean()); 106 if(valueClass == Byte.TYPE) 107 return new Byte(readByte()); 108 if(valueClass == Character.TYPE) 109 return new Character(readChar()); 110 if(valueClass == Short.TYPE) 111 return new Short(readShort()); 112 if(valueClass == Integer.TYPE) 113 return new Integer(readInt()); 114 if(valueClass == Long.TYPE) 115 return new Long(readLong()); 116 if(valueClass == Float.TYPE) 117 return new Float(readFloat()); 118 if(valueClass == Double.TYPE) 119 return new Double(readDouble()); 120 else 121 throw new Error("Unsupported primitive class: " + valueClass); 122 } else 123 return readObject(); 124 } 125 126 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* 2 Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.2 Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 42 42 import java.io.IOException; 43 43 import java.rmi.server.RMIClassLoader; 44 import java.rmi.Remote; 45 import java.rmi.server.RemoteStub; 46 import java.rmi.server.ObjID; 44 47 45 48 public class RMIObjectOutputStream … … 48 51 public RMIObjectOutputStream(OutputStream strm) throws IOException { 49 52 super(strm); 53 enableReplaceObject(true); 54 } 55 56 //Separate it for override by MarshalledObject 57 protected void setAnnotation(String annotation) throws IOException{ 58 writeObject(annotation); 50 59 } 51 60 52 61 protected void annotateClass(Class cls) throws IOException { 53 //System.out.println("Annotating class: " + cls); 54 writeObject(RMIClassLoader.getClassAnnotation(cls)); 62 setAnnotation(RMIClassLoader.getClassAnnotation(cls)); 63 } 64 65 protected void annotateProxyClass(Class cls) 66 throws IOException 67 { 68 annotateClass(cls); 69 } 70 71 protected Object replaceObject(Object obj) 72 throws IOException 73 { 74 if((obj instanceof Remote) && !(obj instanceof RemoteStub)){ 75 UnicastServerRef ref = UnicastServer.getExportedRef((Remote)obj); 76 if (ref != null) 77 return ref.getStub(); 78 } 79 return obj; 80 } 81 82 protected void writeValue(Object value, Class valueClass) throws IOException{ 83 if(valueClass.isPrimitive()){ 84 if(valueClass == Boolean.TYPE) 85 writeBoolean(((Boolean)value).booleanValue()); 86 else 87 if(valueClass == Byte.TYPE) 88 writeByte(((Byte)value).byteValue()); 89 else 90 if(valueClass == Character.TYPE) 91 writeChar(((Character)value).charValue()); 92 else 93 if(valueClass == Short.TYPE) 94 writeShort(((Short)value).shortValue()); 95 else 96 if(valueClass == Integer.TYPE) 97 writeInt(((Integer)value).intValue()); 98 else 99 if(valueClass == Long.TYPE) 100 writeLong(((Long)value).longValue()); 101 else 102 if(valueClass == Float.TYPE) 103 writeFloat(((Float)value).floatValue()); 104 else 105 if(valueClass == Double.TYPE) 106 writeDouble(((Double)value).doubleValue()); 107 else 108 throw new Error("Unsupported primitive class: " + valueClass); 109 } else 110 writeObject(value); 55 111 } 56 112 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/server/UnicastConnection.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* 2 Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.2 Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 45 45 import java.io.ObjectInputStream; 46 46 import java.io.ObjectOutputStream; 47 import java.io.BufferedInputStream; 48 import java.io.BufferedOutputStream; 47 49 import java.io.ObjectOutput; 48 50 import java.io.ObjectInput; … … 60 62 ObjectOutputStream oout; 61 63 64 // reviveTime and expireTime make UnicastConnection pool-able 65 long reviveTime = 0; 66 long expireTime = Long.MAX_VALUE; 67 62 68 UnicastConnection(UnicastConnectionManager man, Socket sock) { 63 69 this.manager = man; … … 66 72 67 73 void acceptConnection() throws IOException { 68 //System.out.println("Accepting connection on " + lport); 69 din = new DataInputStream(sock.getInputStream()); 70 dout = new DataOutputStream(sock.getOutputStream()); 74 //System.out.println("Accepting connection on " + sock); 75 //Use BufferedXXXStream would be more efficient 76 din = new DataInputStream(new BufferedInputStream(sock.getInputStream())); 77 dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream())); 71 78 72 79 int sig = din.readInt(); … … 86 93 dout.writeUTF(manager.serverName); 87 94 dout.writeInt(manager.serverPort); 95 dout.flush(); 88 96 89 97 // Read their hostname and port … … 95 103 96 104 void makeConnection(int protocol) throws IOException { 97 dout = new DataOutputStream(sock.getOutputStream()); 98 din = new DataInputStream(sock.getInputStream()); 105 //Use BufferedXXXStream would be more efficient 106 din = new DataInputStream(new BufferedInputStream(sock.getInputStream())); 107 dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream())); 99 108 100 109 // Send header … … 102 111 dout.writeShort(PROTOCOL_VERSION); 103 112 dout.writeByte(protocol); 104 105 113 dout.flush(); 114 106 115 if (protocol != SINGLE_OP_PROTOCOL) { 107 116 // Get back ack. … … 118 127 dout.writeUTF(manager.serverName); 119 128 dout.writeInt(manager.serverPort); 129 dout.flush(); 120 130 } 121 131 // Okay, ready to roll ... … … 132 142 ObjectInputStream getObjectInputStream() throws IOException { 133 143 if (oin == null) { 134 oin = new RMIObjectInputStream(din, manager);144 oin = new RMIObjectInputStream(din); 135 145 } 136 146 return (oin); … … 145 155 146 156 void disconnect() { 157 try { 158 if(oout != null) 159 oout.close(); 160 sock.close(); 161 } 162 catch (IOException _) { 163 } 164 147 165 oin = null; 148 oout = null; 149 try { 150 sock.close(); 151 } 152 catch (IOException _) { 153 } 166 oout = null; 154 167 din = null; 155 168 dout = null; 156 169 sock = null; 170 } 171 172 public static final long CONNECTION_TIMEOUT = 10000L; 173 174 static boolean isExpired(UnicastConnection conn, long l){ 175 if (l <= conn.expireTime ) 176 return false; 177 return true; 178 } 179 180 static void resetTime(UnicastConnection conn){ 181 long l = System.currentTimeMillis(); 182 conn.reviveTime = l; 183 conn.expireTime = l + CONNECTION_TIMEOUT; 157 184 } 158 185 … … 161 188 */ 162 189 public void run() { 190 do{ 163 191 try { 164 192 UnicastServer.dispatch(this); 193 //don't discardConnection explicitly, only when 194 // exception happens or the connection's expireTime 195 // comes 196 } catch (Exception e ){ 165 197 manager.discardConnection(this); 166 } 167 catch (Exception e) { 168 e.printStackTrace(); 169 } 170 } 171 172 } 198 break; 199 } 200 }while(true); 201 } 202 203 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/server/UnicastConnectionManager.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* 2 Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.2 Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 42 42 import java.rmi.server.RMIClientSocketFactory; 43 43 import java.rmi.RemoteException; 44 import gnu.java.rmi.server.UnicastConnection;45 import java.util.Hashtable;46 import java.net.Socket;47 import java.net.ServerSocket;48 44 import java.io.IOException; 49 45 import java.io.ObjectOutput; 50 46 import java.io.ObjectInput; 47 import java.io.DataInputStream; 51 48 import java.lang.Thread; 52 49 import java.lang.Runnable; 53 50 import java.net.InetAddress; 51 import java.net.Socket; 52 import java.net.ServerSocket; 54 53 import java.net.UnknownHostException; 54 55 import java.util.ArrayList; 56 import java.util.ConcurrentModificationException; 57 import java.util.Enumeration; 58 import java.util.Hashtable; 59 import java.util.Iterator; 60 61 import gnu.java.rmi.server.UnicastConnection; 55 62 56 63 public class UnicastConnectionManager … … 58 65 59 66 private static String localhost; 67 // use different maps for server/client type UnicastConnectionManager 60 68 private static Hashtable servers = new Hashtable(); 61 62 private Thread serverThread; 69 private static Hashtable clients = new Hashtable(); 70 private ArrayList connections; //client connection pool 71 72 // make serverThread volatile for poll 73 private volatile Thread serverThread; 63 74 private ServerSocket ssock; 64 75 String serverName; 65 76 int serverPort; 77 78 static private Thread scavenger; 79 80 // If client and server are in the same VM, serverobj represents server 81 Object serverobj; 82 83 private static RMISocketFactory defaultSocketFactory = RMISocketFactory.getSocketFactory(); 66 84 private RMIServerSocketFactory serverFactory; 67 85 private RMIClientSocketFactory clientFactory; 68 86 87 // The following is for debug 88 private static int ncsock = 0; //count of client socket 89 private static int nssock = 0; //count of server socket 90 private static int ncmanager = 0; //count of client manager 91 private static int nsmanager = 0; //count of server manager 92 93 private static final boolean debug = false; 94 95 private static final Object GLOBAL_LOCK = new Object(); 96 69 97 static { 70 98 try { 71 localhost = InetAddress.getLocalHost().getHostName(); 99 //Use host address instead of host name to avoid name resolving issues 100 //localhost = InetAddress.getLocalHost().getHostName(); 101 localhost = InetAddress.getLocalHost().getHostAddress(); 72 102 } 73 103 catch (UnknownHostException _) { 74 104 localhost = "localhost"; 75 105 } 76 } 77 106 107 108 } 109 110 //Only one scavenger thread running globally 111 private static void startScavenger(){ 112 scavenger = new Thread(new Runnable(){ 113 public void run(){ 114 if (debug) System.out.println("************* start scavenger."); 115 boolean liveon = true; 116 while (liveon){ 117 // Sleep for the expire timeout 118 try{ 119 Thread.sleep(UnicastConnection.CONNECTION_TIMEOUT); 120 }catch(InterruptedException _ie){ 121 break; 122 } 123 liveon = false; 124 // Scavenge all clients' connections that're expired 125 Iterator iter = clients.values().iterator(); 126 long l = System.currentTimeMillis(); 127 try{ 128 while(iter.hasNext()){ 129 UnicastConnectionManager man = (UnicastConnectionManager)iter.next(); 130 ArrayList conns = man.connections; 131 synchronized(conns) { // is the lock a little coarser? 132 for (int last = conns.size() - 1; 133 last >= 0; 134 --last) 135 { 136 UnicastConnection conn = (UnicastConnection)conns.get(last); 137 if (UnicastConnection.isExpired(conn, l)){ 138 conns.remove(last); 139 conn.disconnect(); 140 conn = null; 141 }else 142 liveon = true; //there're still live connections 143 } 144 } 145 } 146 }catch(ConcurrentModificationException cme) { 147 // handle it lazily 148 liveon = true; 149 } 150 } 151 scavenger = null; 152 if (debug) System.out.println("************* exit scavenger."); 153 } 154 }); 155 scavenger.start(); 156 } 157 158 /** 159 * Client UnicastConnectionManager constructor 160 */ 78 161 private UnicastConnectionManager(String host, int port, RMIClientSocketFactory csf) { 79 162 ssock = null; … … 82 165 serverFactory = null; 83 166 clientFactory = csf; 84 } 85 167 connections = new ArrayList(); 168 } 169 170 /** 171 * Server UnicastConnectionManager constructor 172 */ 86 173 private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) { 87 174 try { … … 111 198 //System.out.println("getInstance: " + host + "," + port + "," + csf); 112 199 if (csf == null) { 113 csf = RMISocketFactory.getSocketFactory(); 114 } 200 csf = defaultSocketFactory; 201 } 202 // change host name to host address to avoid name resolving issues 203 try{ 204 host = InetAddress.getByName(host).getHostAddress(); 205 }catch(Exception _){} 206 115 207 TripleKey key = new TripleKey(host, port, csf); 116 UnicastConnectionManager man = (UnicastConnectionManager) servers.get(key);208 UnicastConnectionManager man = (UnicastConnectionManager)clients.get(key); 117 209 if (man == null) { 118 210 man = new UnicastConnectionManager(host, port, csf); 119 servers.put(key, man); 211 if (debug) { 212 ncmanager++; 213 System.out.println("\n\n ====== " + ncmanager + " client managers.\n\n"); 214 } 215 clients.put(key, man); 216 217 // Detect if client and server are in the same VM, i.e., their keys are equal 218 UnicastConnectionManager svrman = (UnicastConnectionManager)servers.get(key); 219 if(svrman != null){ // server and client are in the same VM 220 man.serverobj = svrman.serverobj; 221 } 120 222 } 121 223 return (man); … … 129 231 //System.out.println("getInstance: " + port + "," + ssf); 130 232 if (ssf == null) { 131 ssf = RMISocketFactory.getSocketFactory();233 ssf = defaultSocketFactory; 132 234 } 133 235 TripleKey key = new TripleKey(localhost, port, ssf); … … 135 237 if (man == null) { 136 238 man = new UnicastConnectionManager(port, ssf); 239 if (debug) { 240 nsmanager++; 241 System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); 242 } 137 243 // The provided port might not be the set port. 138 244 key.port = man.serverPort; … … 159 265 private UnicastConnection getServerConnection() throws IOException { 160 266 Socket sock = ssock.accept(); 267 sock.setTcpNoDelay(true); //?? 161 268 UnicastConnection conn = new UnicastConnection(this, sock); 162 269 conn.acceptConnection(); 163 //System.out.println("Server connection " + conn); 270 if (debug){ 271 nssock++; 272 System.out.println("\n\n ****** " + nssock + " server socks.\n\n"); 273 } 274 //System.out.println("Server connection " + sock); 164 275 return (conn); 165 276 } … … 169 280 */ 170 281 private UnicastConnection getClientConnection() throws IOException { 282 ArrayList conns = connections; 283 UnicastConnection conn; 284 285 synchronized(conns) { 286 int nconn = conns.size() - 1; 287 288 // if there're free connections in connection pool 289 if(nconn >= 0) { 290 conn = (UnicastConnection)conns.get(nconn); 291 //Should we check if conn is alive using Ping?? 292 conns.remove(nconn); 293 294 // Check if the connection is already expired 295 long l = System.currentTimeMillis(); 296 if (!UnicastConnection.isExpired(conn, l)){ 297 return conn; 298 }else { 299 conn.disconnect(); 300 conn = null; 301 } 302 } 303 } 304 171 305 Socket sock = clientFactory.createSocket(serverName, serverPort); 172 UnicastConnectionconn = new UnicastConnection(this, sock);306 conn = new UnicastConnection(this, sock); 173 307 conn.makeConnection(DEFAULT_PROTOCOL); 174 //System.out.println("Client connection " + conn); 308 309 if (debug) { 310 ncsock++; 311 System.out.println("\n\n ====== " + ncsock + " client socks.\n\n"); 312 } 313 175 314 return (conn); 176 315 } … … 182 321 public void discardConnection(UnicastConnection conn) { 183 322 //System.out.println("Discarding connection " + conn); 323 //conn.disconnect(); 324 if (ssock != null) //server connection 184 325 conn.disconnect(); 326 else { 327 // To client connection, we'd like to return back to pool 328 UnicastConnection.resetTime(conn); 329 //Ensure there're only one scavenger globally 330 synchronized(GLOBAL_LOCK) { 331 connections.add(conn); //borrow this lock to garantee thread safety 332 if (scavenger == null) 333 startScavenger(); 334 } 335 } 185 336 } 186 337 … … 195 346 } 196 347 serverThread = new Thread(this); 348 // The following is not necessary when java.lang.Thread's constructor do this. 349 // serverThread.setContextClassLoader(Thread.currentThread().getContextClassLoader()); 197 350 } 198 351 serverThread.start(); … … 200 353 201 354 /** 355 * Stop a server on this manager 356 */ 357 public void stopServer() { 358 synchronized(this) { 359 if(serverThread != null){ 360 serverThread = null; 361 try{ 362 ssock.close(); 363 }catch(Exception _){} 364 } 365 } 366 } 367 368 /** 202 369 * Server thread for connection manager. 203 370 */ 204 371 public void run() { 205 for (; ;) {372 for (;serverThread != null;) { // if serverThread==null, then exit thread 206 373 try { 207 374 //System.out.println("Waiting for connection on " + serverPort); 208 375 UnicastConnection conn = getServerConnection(); 209 (new Thread(conn)).start(); 376 // use a thread pool to improve performance 377 //ConnectionRunnerPool.dispatchConnection(conn); 378 (new Thread(conn)).start(); 210 379 } 211 380 catch (Exception e) { 212 381 e.printStackTrace(); 213 382 } 214 383 } … … 229 398 String host = in.readUTF(); 230 399 int port = in.readInt(); 231 RMIClientSocketFactory csf = ((RMIObjectInputStream)in).manager.clientFactory; 232 return (getInstance(host, port, csf)); 400 //RMIClientSocketFactory csf = ((RMIObjectInputStream)in).manager.clientFactory; 401 //return (getInstance(host, port, csf)); 402 return (getInstance(host, port, null)); 233 403 } 234 404 … … 263 433 if (this.host.equals(other.host) && 264 434 this.other == other.other && 265 (this.port == other.port || this.port == 0 || other.port == 0)) {435 (this.port == other.port /* || this.port == 0 || other.port == 0*/)) { 266 436 return (true); 267 437 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/server/UnicastRef.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* 2 Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.2 Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 63 63 import java.io.DataOutputStream; 64 64 65 import java.lang.reflect.InvocationTargetException; 66 65 67 public class UnicastRef 66 68 implements RemoteRef, ProtocolConstants { … … 70 72 71 73 /** 72 * Used by serialization. 73 */ 74 private UnicastRef() { 74 * Used by serialization, and let subclass capable of having default constructor 75 */ 76 //private 77 UnicastRef() { 75 78 } 76 79 … … 85 88 86 89 public Object invoke(Remote obj, Method method, Object[] params, long opnum) throws Exception { 90 // Check if client and server are in the same VM, then local call can be used to 91 // replace remote call, but it's somewhat violating remote semantic. 92 Object svrobj = manager.serverobj; 93 if(svrobj != null){ 94 //local call 95 Object ret = null; 96 try{ 97 ret = method.invoke(svrobj, params); 98 }catch(InvocationTargetException e){ 99 throw (Exception)e.getTargetException(); 100 } 101 //System.out.println("\n\n ***** local call: " + method + "\nreturn: " + ret + "\n\n"); 102 return ret; 103 } 104 //System.out.println("***************** remote call:" + manager.serverPort); 87 105 return (invokeCommon(obj, method, params, -1, opnum)); 88 106 } … … 108 126 out.writeInt(opnum); 109 127 out.writeLong(hash); 110 if (params != null) { 111 for (int i = 0; i < params.length; i++) { 112 if (params[i] instanceof UnicastRemoteObject) { 113 out.writeObject(UnicastRemoteObject.exportObject((UnicastRemoteObject)params[i])); 114 } 115 else { 116 out.writeObject(params[i]); 117 } 118 } 119 } 128 129 // must handle primitive class and their wrapper classes 130 Class clss[] = method.getParameterTypes(); 131 for(int i = 0; i < clss.length; i++) 132 ((RMIObjectOutputStream)out).writeValue(params[i], clss[i]); 120 133 121 134 out.flush(); … … 132 145 try { 133 146 din = conn.getDataInputStream(); 134 if (din.readUnsignedByte() != MESSAGE_CALL_ACK) { 135 throw new RemoteException("Call not acked"); 147 148 if ((returncode = din.readUnsignedByte()) != MESSAGE_CALL_ACK) { 149 conn.disconnect(); 150 throw new RemoteException("Call not acked:" + returncode); 136 151 } 137 152 138 153 in = conn.getObjectInputStream(); 139 140 154 returncode = in.readUnsignedByte(); 141 155 ack = UID.read(in); 142 returnval = in.readObject(); 156 157 Class cls = method.getReturnType(); 158 if(cls == Void.TYPE){ 159 returnval = null; 160 in.readObject(); 161 }else 162 returnval = ((RMIObjectInputStream)in).readValue(cls); 163 143 164 } 144 165 catch (IOException e3) { 166 //for debug: e3.printStackTrace(); 145 167 throw new RemoteException("call return failed: ", e3); 146 168 } 147 169 170 /* if DGCAck is necessary?? 171 //According to RMI wire protocol, send a DGCAck 172 // to indicate receiving return value 173 dout.writeByte(MESSAGE_DGCACK); 174 ack.write(dout); 175 out.flush(); 176 */ 177 148 178 manager.discardConnection(conn); 149 179 150 if (returncode != RETURN_ACK ) {180 if (returncode != RETURN_ACK && returnval != null) { 151 181 throw (Exception)returnval; 152 182 } … … 159 189 */ 160 190 public RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash) throws RemoteException { 161 return (new UnicastRemoteCall(obj, opnum, hash)); 191 UnicastConnection conn; 192 193 try { 194 conn = manager.getConnection(); 195 } 196 catch (IOException e1) { 197 throw new RemoteException("connection failed to host: " + manager.serverName, e1); 198 } 199 200 //obj: useless? 201 202 return (new UnicastRemoteCall(conn, objid, opnum, hash)); 162 203 } 163 204 … … 167 208 public void invoke(RemoteCall call) throws Exception { 168 209 UnicastRemoteCall c = (UnicastRemoteCall)call; 169 Object ret = invokeCommon((Remote)c.getObject(), (Method)null, c.getArguments(), c.getOpnum(), c.getHash()); 170 c.setReturnValue(ret); 210 call.executeCall(); 171 211 } 172 212 … … 175 215 */ 176 216 public void done(RemoteCall call) throws RemoteException { 177 /* Does nothing */ 217 UnicastRemoteCall c = (UnicastRemoteCall)call; 218 try{ 219 c.done(); 220 } catch(IOException e){} 221 UnicastConnection conn = c.getConnection(); 222 manager.discardConnection(conn); 178 223 } 179 224 … … 184 229 manager.write(out); 185 230 objid.write(out); 186 out.writeByte(RETURN_ACK); 231 // This byte is somewhat confusing when interoperating with JDK 232 out.writeByte(0); //RETURN_ACK); 187 233 } 188 234 … … 190 236 manager = UnicastConnectionManager.read(in); 191 237 objid = ObjID.read(in); 192 if (in.readByte() != RETURN_ACK) { 238 byte ack = in.readByte(); 239 // This byte is somewhat confusing when interoperating with JDK 240 if (ack != RETURN_ACK && ack != 0/*jdk ack value*/) { 193 241 throw new IOException("no ack found"); 194 242 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 39 39 40 40 import java.lang.Exception; 41 import java.io.DataInputStream; 42 import java.io.DataOutputStream; 41 43 import java.io.IOException; 42 44 import java.io.ObjectOutput; … … 44 46 import java.io.StreamCorruptedException; 45 47 import java.rmi.server.RemoteCall; 48 import java.rmi.RemoteException; 49 import java.rmi.MarshalException; 50 import java.rmi.UnmarshalException; 51 import java.rmi.server.UID; 52 import java.rmi.server.ObjID; 53 import java.rmi.server.RemoteObject; 54 46 55 import java.util.Vector; 47 56 48 public class UnicastRemoteCall implements RemoteCall 57 public class UnicastRemoteCall 58 implements RemoteCall, ProtocolConstants 49 59 { 50 60 … … 57 67 private int ptr; 58 68 69 private ObjectOutput oout; 70 private ObjectInput oin; 71 59 72 /** 60 73 * Incoming call. … … 68 81 * Outgoing call. 69 82 */ 70 UnicastRemoteCall(Object obj, int opnum, long hash) 71 { 72 this.object = obj; 83 UnicastRemoteCall(UnicastConnection conn, ObjID objid, int opnum, long hash) 84 throws RemoteException 85 { 86 this.conn = conn; 73 87 this.opnum = opnum; 74 88 this.hash = hash; 75 } 76 89 90 // signal the call when constructing 91 try 92 { 93 DataOutputStream dout = conn.getDataOutputStream(); 94 dout.write(MESSAGE_CALL); 95 96 oout = conn.getObjectOutputStream(); 97 objid.write(oout); 98 oout.writeInt(opnum); 99 oout.writeLong(hash); 100 } 101 catch(IOException ex) 102 { 103 throw new MarshalException("Try to write header but failed.", ex); 104 } 105 } 106 107 UnicastConnection getConnection() 108 { 109 return conn; 110 } 111 77 112 public ObjectOutput getOutputStream() throws IOException 113 { 114 if (conn != null) 115 { 116 if(oout == null) 117 return (oout = conn.getObjectOutputStream()); 118 else 119 return oout; 120 } 121 else 122 { 123 vec = new Vector(); 124 return (new DummyObjectOutputStream()); 125 } 126 } 127 128 public void releaseOutputStream() throws IOException 129 { 130 if(oout != null) 131 oout.flush(); 132 } 133 134 public ObjectInput getInputStream() throws IOException 135 { 136 if (conn != null) 137 { 138 if(oin == null) 139 return (oin = conn.getObjectInputStream()); 140 else 141 return oin; 142 } 143 else 144 { 145 ptr = 0; 146 return (new DummyObjectInputStream()); 147 } 148 } 149 150 public void releaseInputStream() throws IOException 151 { 152 // Does nothing. 153 } 154 155 public ObjectOutput getResultStream(boolean success) 156 throws IOException, StreamCorruptedException 78 157 { 79 158 vec = new Vector(); 80 159 return new DummyObjectOutputStream(); 81 160 } 82 83 public void releaseOutputStream() throws IOException 84 { 85 // Does nothing. 86 } 87 88 public ObjectInput getInputStream() throws IOException 89 { 90 if (conn != null) 91 return conn.getObjectInputStream(); 92 ptr = 0; 93 return new DummyObjectInputStream(); 94 } 95 96 public void releaseInputStream() throws IOException 97 { 98 // Does nothing. 99 } 100 101 public ObjectOutput getResultStream(boolean success) 102 throws IOException, StreamCorruptedException 103 { 104 vec = new Vector(); 105 return new DummyObjectOutputStream(); 106 } 107 161 108 162 public void executeCall() throws Exception 109 163 { 110 throw new Error("Not implemented"); 164 byte returncode; 165 ObjectInput oin; 166 try 167 { 168 releaseOutputStream(); 169 DataInputStream din = conn.getDataInputStream(); 170 if (din.readByte() != MESSAGE_CALL_ACK) 171 throw new RemoteException("Call not acked"); 172 173 oin = getInputStream(); 174 returncode = oin.readByte(); 175 UID.read(oin); 176 } 177 catch(IOException ex) 178 { 179 throw new UnmarshalException("Try to read header but failed:", ex); 180 } 181 182 //check return code 183 switch(returncode) 184 { 185 case RETURN_ACK: //it's ok 186 return; 187 case RETURN_NACK: 188 Object returnobj; 189 try 190 { 191 returnobj = oin.readObject(); 192 } 193 catch(Exception ex2) 194 { 195 throw new UnmarshalException 196 ("Try to read exception object but failed", ex2); 197 } 198 199 if(!(returnobj instanceof Exception)) 200 throw new UnmarshalException("Should be Exception type here: " 201 + returnobj); 202 throw (Exception)returnobj; 203 204 default: 205 throw new UnmarshalException("Invalid return code"); 206 } 111 207 } 112 208 113 209 public void done() throws IOException 114 210 { 115 / * Does nothing */211 // conn.disconnect(); 116 212 } 117 213 118 214 Object returnValue() 119 215 { 120 return vec.elementAt(0);216 return (vec.size() > 0 ? vec.elementAt(0) : null); 121 217 } 122 218 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/server/UnicastServer.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* 2 Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.2 Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 46 46 import java.util.Hashtable; 47 47 import java.net.UnknownHostException; 48 import java.rmi.Remote; 48 49 import java.rmi.server.ObjID; 49 50 import java.rmi.server.UnicastRemoteObject; … … 57 58 implements ProtocolConstants { 58 59 59 static private Hashtable objects = new Hashtable(); 60 static private Hashtable objects = new Hashtable(); //mapping OBJID to server ref 61 static private Hashtable refcache = new Hashtable(); //mapping obj itself to server ref 60 62 static private DGCImpl dgc; 61 63 … … 63 65 startDGC(); 64 66 objects.put(obj.objid, obj); 67 refcache.put(obj.myself, obj); 65 68 obj.manager.startServer(); 69 } 70 71 // FIX ME: I haven't handle force parameter 72 public static boolean unexportObject(UnicastServerRef obj, boolean force) { 73 objects.remove(obj.objid); 74 refcache.remove(obj.myself); 75 obj.manager.stopServer(); 76 return true; 77 } 78 79 public static UnicastServerRef getExportedRef(Remote remote){ 80 return (UnicastServerRef)refcache.get(remote); 66 81 } 67 82 … … 70 85 try { 71 86 dgc = new DGCImpl(); 72 ((UnicastServerRef)dgc.getRef()).exportObject(dgc); 87 // Changed DGCImpl to inherit UnicastServerRef directly 88 //((UnicastServerRef)dgc.getRef()).exportObject(dgc); 89 dgc.exportObject(dgc); 73 90 } 74 91 catch (RemoteException e) { … … 101 118 Object returnval; 102 119 int returncode = RETURN_ACK; 120 // returnval is from Method.invoke(), so we must check the return class to see 121 // if it's primitive type 122 Class returncls = null; 103 123 if (uref != null) { 104 124 try { 105 125 // Dispatch the call to it. 106 126 returnval = uref.incomingMessageCall(conn, method, hash); 127 returncls = uref.getMethodReturnType(method, hash); 107 128 } 108 129 catch (Exception e) { … … 122 143 out.writeByte(returncode); 123 144 (new UID()).write(out); 124 out.writeObject(returnval); 145 if(returnval != null && returncls != null) 146 ((RMIObjectOutputStream)out).writeValue(returnval, returncls); 147 else 148 out.writeObject(returnval); 125 149 126 150 out.flush(); -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/rmi/server/UnicastServerRef.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* 2 Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.2 Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 64 64 import java.io.ObjectInputStream; 65 65 import java.io.ObjectOutputStream; 66 import java.io.ObjectInput; 67 import java.io.ObjectOutput; 66 68 import java.util.Hashtable; 67 69 68 70 public class UnicastServerRef 69 extends UnicastRef { 71 extends UnicastRef 72 implements ServerRef{ //SHOULD implement ServerRef 70 73 71 74 final static private Class[] stubprototype = new Class[] { RemoteRef.class }; 72 75 73 Remote myself; 76 Remote myself; //save the remote object itself 74 77 private Skeleton skel; 75 78 private RemoteStub stub; 76 private Hashtable methods; 79 private Hashtable methods = new Hashtable(); 80 81 /** 82 * Used by serialization. 83 */ 84 UnicastServerRef() 85 { 86 } 77 87 78 88 public UnicastServerRef(ObjID id, int port, RMIServerSocketFactory ssf) { … … 84 94 if (myself == null) { 85 95 myself = obj; 96 // Save it to server manager, to let client calls in the same VM to issue 97 // local call 98 manager.serverobj = obj; 86 99 87 100 // Find and install the stub … … 96 109 97 110 // Build hash of methods which may be called. 98 buildMethodHash(obj.getClass() );111 buildMethodHash(obj.getClass(), true); 99 112 100 113 // Export it. … … 105 118 } 106 119 120 public RemoteStub exportObject(Remote remote, Object obj) 121 throws RemoteException 122 { 123 //FIX ME 124 return exportObject(remote); 125 } 126 127 public RemoteStub getStub(){ 128 return stub; 129 } 130 131 132 public boolean unexportObject(Remote obj, boolean force) { 133 // Remove all hashes of methods which may be called. 134 buildMethodHash(obj.getClass(), false); 135 return UnicastServer.unexportObject(this, force); 136 } 137 107 138 private Object getHelperClass(Class cls, String type) { 108 139 try { 109 String classname = cls.getName(); 110 Class scls = Class.forName(classname + type); 140 String classname = cls.getName(); 141 ClassLoader cl = cls.getClassLoader(); //DONT use "Class scls = Class.forName(classname + type);" 142 Class scls = cl.loadClass(classname + type); 111 143 if (type.equals("_Stub")) { 112 144 try { … … 148 180 } 149 181 150 private void buildMethodHash(Class cls) { 151 methods = new Hashtable(); 182 private void buildMethodHash(Class cls, boolean build) { 152 183 Method[] meths = cls.getMethods(); 153 184 for (int i = 0; i < meths.length; i++) { … … 157 188 } 158 189 long hash = RMIHashes.getMethodHash(meths[i]); 159 methods.put(new Long (hash), meths[i]); 190 if(build) 191 methods.put(new Long (hash), meths[i]); 192 else 193 methods.remove(new Long (hash)); 160 194 //System.out.println("meth = " + meths[i] + ", hash = " + hash); 161 195 } 196 } 197 198 Class getMethodReturnType(int method, long hash) throws Exception 199 { 200 if (method == -1) { 201 Method meth = (Method)methods.get(new Long (hash)); 202 return meth.getReturnType(); 203 }else 204 return null; 162 205 } 163 206 … … 190 233 } 191 234 } 192 return (meth.invoke(myself, args)); 235 //We must reinterpret the exception thrown by meth.invoke() 236 //return (meth.invoke(myself, args)); 237 Object ret = null; 238 try{ 239 ret = meth.invoke(myself, args); 240 }catch(InvocationTargetException e){ 241 throw (Exception)(e.getTargetException()); 242 } 243 return ret; 193 244 } 194 245 // Otherwise this is JDK 1.1 style RMI - we find the skeleton -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/security/provider/DefaultPolicy.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* DefaultPolicy.java 2 Copyright (C) 2001 Free Software Foundation, Inc.2 Copyright (C) 2001, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 48 48 public class DefaultPolicy extends Policy 49 49 { 50 static Permissions allPermissions = new Permissions(); 51 52 static 53 { 54 allPermissions.add(new AllPermission()); 55 } 50 static Permission allPermission = new AllPermission(); 56 51 57 52 public PermissionCollection getPermissions(CodeSource codesource) 58 53 { 59 return allPermissions; 54 Permissions perms = new Permissions(); 55 perms.add(allPermission); 56 return perms; 60 57 } 61 58 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/security/provider/Gnu.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* Gnu.java --- Gnu provider main class 2 Copyright (C) 1999 Free Software Foundation, Inc.2 Copyright (C) 1999, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 46 46 super( "GNU", 1.0, "GNU provider v1.0 implementing SHA-1, MD5, DSA"); 47 47 48 // Note that all implementation class names are referenced by using 49 // Class.getName(). That way when we staticly link the Gnu provider 50 // we automatically get all the implementation classes. 51 48 52 // Signature 49 put("Signature.SHA1withDSA", "gnu.java.security.provider.DSASignature"); 53 put("Signature.SHA1withDSA", 54 gnu.java.security.provider.DSASignature.class.getName()); 50 55 51 56 put("Alg.Alias.Signature.DSS", "SHA1withDSA"); … … 63 68 64 69 // Key Pair Generator 65 put("KeyPairGenerator.DSA", "gnu.java.security.provider.DSAKeyPairGenerator"); 70 put("KeyPairGenerator.DSA", 71 gnu.java.security.provider.DSAKeyPairGenerator.class.getName()); 66 72 67 73 put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA"); … … 70 76 71 77 // Message Digests 72 put("MessageDigest.SHA", "gnu.java.security.provider.SHA");73 put("MessageDigest.MD5", "gnu.java.security.provider.MD5");78 put("MessageDigest.SHA", gnu.java.security.provider.SHA.class.getName()); 79 put("MessageDigest.MD5", gnu.java.security.provider.MD5.class.getName()); 74 80 75 81 // Format "Alias", "Actual Name" … … 78 84 79 85 // Algorithm Parameters 80 put("AlgorithmParameters.DSA", "gnu.java.security.provider.DSAAlgorithmParameters"); 86 put("AlgorithmParameters.DSA", 87 gnu.java.security.provider.DSAParameters.class.getName()); 81 88 82 89 // Algorithm Parameter Generator 83 put("AlgorithmParameterGenerator.DSA", "gnu.java.security.provider.DSAAlgorithmParameterGenerator"); 90 put("AlgorithmParameterGenerator.DSA", 91 gnu.java.security.provider.DSAParameterGenerator.class.getName()); 84 92 85 93 // SecureRandom 86 put("SecureRandom.SHA1PRNG", "gnu.java.security.provider.SHA1PRNG");87 94 put("SecureRandom.SHA1PRNG", 95 gnu.java.security.provider.SHA1PRNG.class.getName()); 88 96 89 97 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/security/provider/SHA.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* SHA.java -- Class implementing the SHA-1 algorithm as specified in [1]. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.2 Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 59 59 public int engineGetDigestLength() 60 60 { 61 return 16;61 return 20; 62 62 } 63 63 64 64 public void engineUpdate (byte b) 65 65 { 66 int i = ( int)bytecount % 64;67 int shift = (3 - i % 4) * 8;66 int i = ((int)bytecount) & 0x3f; //wgs 67 int shift = (3 - i % 4) << 3; 68 68 int idx = i / 4; 69 69 70 // if you could index ints, this would be: W[idx][shift/8] = b71 W[idx] = (W[idx] & ~(0xff << shift)) | (( b& 0xff) << shift);70 i = (int)b; 71 W[idx] = (W[idx] & ~(0xff << shift)) | ((i & 0xff) << shift); 72 72 73 73 // if we've filled up a block, then process it 74 if (( ++ bytecount) % 64== 0)74 if (((++bytecount) & 0x3f) == 0) 75 75 munch (); 76 76 } … … 100 100 public byte[] engineDigest () 101 101 { 102 long bitcount = bytecount * 8;102 long bitcount = bytecount << 3; 103 103 engineUpdate ((byte)0x80); // 10000000 in binary; the start of the padding 104 104 105 105 // add the rest of the padding to fill this block out, but leave 8 106 106 // bytes to put in the original bytecount 107 while (( int)bytecount % 64!= 56)107 while ((bytecount & 0x3f) != 56) 108 108 engineUpdate ((byte)0); 109 109 -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/security/provider/SHA1PRNG.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* SHA1PRNG.java --- Secure Random SPI SHA1PRNG 2 Copyright (C) 1999, 2001 Free Software Foundation, Inc.2 Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 52 52 int seedpos; 53 53 int datapos; 54 private boolean seeded = false; // set to true when we seed this 54 55 55 56 public SHA1PRNG() … … 58 59 digest = MessageDigest.getInstance("SHA"); 59 60 } catch ( NoSuchAlgorithmException nsae) { 60 System.out.println("Failed to find SHA Message Digest: " + nsae); 61 nsae.printStackTrace(); 61 // System.out.println("Failed to find SHA Message Digest: " + nsae); 62 // nsae.printStackTrace(); 63 throw new InternalError ("no SHA implementation found"); 62 64 } 63 65 … … 65 67 seedpos = 0; 66 68 data = new byte[40]; 67 datapos = 0; 68 69 new Random().nextBytes(seed); 70 71 byte digestdata[]; 72 digestdata = digest.digest( data ); 73 System.arraycopy( digestdata, 0, data, 0, 20); 74 69 datapos = 20; // try to force hashing a first block 75 70 } 76 71 … … 85 80 public void engineNextBytes(byte[] bytes) 86 81 { 82 ensureIsSeeded (); 87 83 int loc = 0; 88 84 while (loc < bytes.length) … … 114 110 return tmp; 115 111 } 112 113 private void ensureIsSeeded() 114 { 115 if (!seeded) 116 { 117 new Random(0L).nextBytes(seed); 118 119 byte[] digestdata = digest.digest(data); 120 System.arraycopy(digestdata, 0, data, 0, 20); 121 122 seeded = true; 123 } 124 } 125 116 126 } -
Property cvs2svn:cvs-rev
changed from
-
branches/GNU/src/gcc/libjava/gnu/java/text/SentenceBreakIterator.java
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 1 1 /* SentenceBreakIterator.java - Default sentence BreakIterator. 2 Copyright (C) 1999, 2001 Free Software Foundation, Inc.2 Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 92 92 && Character.getType(n) == Character.END_PUNCTUATION) 93 93 n = iter.next(); 94 // Skip spaces. 95 while (n != CharacterIterator.DONE 96 && Character.getType(n) == Character.SPACE_SEPARATOR) 97 n = iter.next(); 98 // Skip optional paragraph separator. 99 if (n != CharacterIterator.DONE 100 && Character.getType(n) == Character.PARAGRAPH_SEPARATOR) 94 // Skip (java) space, line and paragraph separators. 95 while (n != CharacterIterator.DONE && Character.isWhitespace(n)) 101 96 n = iter.next(); 102 97 … … 112 107 && Character.getType(n) == Character.END_PUNCTUATION) 113 108 n = iter.next(); 114 // Skip spaces. We keep count because we need at least 115 // one for this period to represent a terminator. 109 // Skip (java) space, line and paragraph separators. 110 // We keep count because we need at least one for this period to 111 // represent a terminator. 116 112 int spcount = 0; 117 while (n != CharacterIterator.DONE 118 && Character.getType(n) == Character.SPACE_SEPARATOR) 113 while (n != CharacterIterator.DONE && Character.isWhitespace(n)) 119 114 { 120 115 n = iter.next(); … … 163 158 if (! Character.isLowerCase(c) 164 159 && (nt == Character.START_PUNCTUATION 165 || nt == Character.SPACE_SEPARATOR))160 || Character.isWhitespace(n))) 166 161 { 167 162 int save = iter.getIndex(); … … 174 169 if (n == CharacterIterator.DONE) 175 170 break; 176 if (Character. getType(n) == Character.SPACE_SEPARATOR)177 { 178 // Must have at least on cespace after the `.'.171 if (Character.isWhitespace(n)) 172 { 173 // Must have at least one (java) space after the `.'. 179 174 int save2 = iter.getIndex(); 180 175 while (n != CharacterIterator.DONE 181 && Character. getType(n) == Character.SPACE_SEPARATOR)176 && Character.isWhitespace(n)) 182 177 n = iter.previous(); 183 178 // Skip close punctuation. … … 204 199 break; 205 200 } 206 else if ( nt == Character.SPACE_SEPARATOR201 else if (Character.isWhitespace(n) 207 202 || nt == Character.END_PUNCTUATION) 208 203 { 209 204 int save = iter.getIndex(); 210 // Skip spaces.211 while (n != CharacterIterator.DONE 212 && Character. getType(n) == Character.SPACE_SEPARATOR)205 // Skip (java) space, line and paragraph separators. 206 while (n != CharacterIterator.DONE 207 && Character.isWhitespace(n)) 213 208 n = iter.previous(); 214 209 // Skip close punctuation. -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.