Import GNU Classpath (classpath-0_97_2-release).
libjava/ 2008-06-28 Matthias Klose <doko@ubuntu.com> Import GNU Classpath (classpath-0_97_2-release). * Regenerate class and header files. * Regenerate auto* files. * gcj/javaprims.h: Define jobjectRefType. * jni.cc (_Jv_JNI_GetObjectRefType): New (stub only). (_Jv_JNIFunctions): Initialize GetObjectRefType. * gnu/classpath/jdwp/VMVirtualMachine.java, java/security/VMSecureRandom.java: Merge from classpath. * HACKING: Fix typo. * ChangeLog-2007: New file. * configure.ac: Set JAVAC, pass --disable-regen-headers to classpath. libjava/classpath/ 2008-06-28 Matthias Klose <doko@ubuntu.com> * m4/ac_prog_javac.m4: Disable check for JAVAC, when not configured with --enable-java-maintainer-mode. * aclocal.m4, configure: Regenerate. * native/jni/gstreamer-peer/Makefile.am: Do not link with libclasspathnative. * native/jni/gstreamer-peer/Makefile.in: Regenerate. * tools/Makefile.am, lib/Makefile.am: Use JAVAC for setting JCOMPILER, drop flags not understood by gcj. From-SVN: r137223
This commit is contained in:
@@ -260,7 +260,7 @@ public class AWTKeyStroke implements Serializable
|
||||
c.setAccessible(true);
|
||||
// Create a new instance, to make sure that we can, and
|
||||
// to cause any ClassCastException.
|
||||
AWTKeyStroke dummy = (AWTKeyStroke) c.newInstance(null);
|
||||
AWTKeyStroke dummy = (AWTKeyStroke) c.newInstance();
|
||||
return c;
|
||||
}
|
||||
});
|
||||
@@ -632,7 +632,7 @@ public class AWTKeyStroke implements Serializable
|
||||
else
|
||||
try
|
||||
{
|
||||
stroke = (AWTKeyStroke) c.newInstance(null);
|
||||
stroke = (AWTKeyStroke) c.newInstance();
|
||||
stroke.keyChar = keyChar;
|
||||
stroke.keyCode = keyCode;
|
||||
stroke.modifiers = modifiers;
|
||||
@@ -643,7 +643,7 @@ public class AWTKeyStroke implements Serializable
|
||||
throw (Error) new InternalError().initCause(e);
|
||||
}
|
||||
// Check level 1 cache.
|
||||
AWTKeyStroke cached = (AWTKeyStroke) cache.get(stroke);
|
||||
AWTKeyStroke cached = cache.get(stroke);
|
||||
if (cached == null)
|
||||
cache.put(stroke, stroke);
|
||||
else
|
||||
|
||||
@@ -1322,10 +1322,10 @@ public class Container extends Component
|
||||
while (true)
|
||||
{
|
||||
if (comp == null)
|
||||
return false;
|
||||
if (comp == this)
|
||||
return true;
|
||||
return false;
|
||||
comp = comp.getParent();
|
||||
if (comp == this)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
|
||||
while (i.hasNext ())
|
||||
{
|
||||
KeyEventPostProcessor processor = (KeyEventPostProcessor) i.next ();
|
||||
if (processor.postProcessKeyEvent ((KeyEvent) e))
|
||||
if (processor.postProcessKeyEvent (e))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class Desktop
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an istance of the Desktop Class.
|
||||
* Returns an instance of the Desktop Class.
|
||||
*
|
||||
* If this implementation does not support Desktop, an
|
||||
* UnsupportedOperationException will be thrown.
|
||||
@@ -155,7 +155,7 @@ public class Desktop
|
||||
* @return true if this class is supported on the current platform;
|
||||
* false otherwise
|
||||
*/
|
||||
private static boolean isDesktopSupported()
|
||||
public static boolean isDesktopSupported()
|
||||
{
|
||||
if (GraphicsEnvironment.isHeadless())
|
||||
return false;
|
||||
|
||||
@@ -229,6 +229,11 @@ public class Font implements Serializable
|
||||
// The ClasspathToolkit-provided peer which implements this font
|
||||
private transient ClasspathFontPeer peer;
|
||||
|
||||
/**
|
||||
* The cached hashcode. A value of 0 (default initialized) means that the
|
||||
* hashcode is not computed yet.
|
||||
*/
|
||||
private transient int hashCode;
|
||||
|
||||
/**
|
||||
* Creates a <code>Font</code> object from the specified string, which
|
||||
@@ -1318,7 +1323,21 @@ public class Font implements Serializable
|
||||
*/
|
||||
public int hashCode()
|
||||
{
|
||||
return this.toString().hashCode();
|
||||
// We cache the hashcode. This makes sense, because the font wouldn't
|
||||
// change the relevant properties.
|
||||
if (hashCode == 0)
|
||||
{
|
||||
hashCode = getName().hashCode() ^ getTransform().hashCode() ^ getSize()
|
||||
^ getStyle();
|
||||
// In the rare case when the above yields 0, we set this to some other
|
||||
// value to avoid recomputing over and over again. This is still
|
||||
// conform to the specification of hashCode().
|
||||
if (hashCode == 0)
|
||||
{
|
||||
hashCode = -1;
|
||||
}
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -211,12 +211,12 @@ public class GridBagLayout
|
||||
|
||||
protected GridBagConstraints lookupConstraints (Component component)
|
||||
{
|
||||
GridBagConstraints result = (GridBagConstraints) comptable.get (component);
|
||||
GridBagConstraints result = comptable.get (component);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
setConstraints (component, defaultConstraints);
|
||||
result = (GridBagConstraints) comptable.get (component);
|
||||
result = comptable.get (component);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -224,8 +224,7 @@ public class GridBagLayout
|
||||
|
||||
private GridBagConstraints lookupInternalConstraints (Component component)
|
||||
{
|
||||
GridBagConstraints result =
|
||||
(GridBagConstraints) internalcomptable.get (component);
|
||||
GridBagConstraints result = internalcomptable.get (component);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
@@ -562,7 +561,7 @@ public class GridBagLayout
|
||||
x = 0;
|
||||
else
|
||||
{
|
||||
Component lastComponent = (Component) lastInRow.get(new Integer(constraints.gridy));
|
||||
Component lastComponent = lastInRow.get(new Integer(constraints.gridy));
|
||||
GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
|
||||
x = lastConstraints.gridx + Math.max(1, lastConstraints.gridwidth);
|
||||
}
|
||||
@@ -573,7 +572,7 @@ public class GridBagLayout
|
||||
{
|
||||
if (lastInRow.containsKey(new Integer(y)))
|
||||
{
|
||||
Component lastComponent = (Component) lastInRow.get(new Integer(y));
|
||||
Component lastComponent = lastInRow.get(new Integer(y));
|
||||
GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
|
||||
x = Math.max (x,
|
||||
lastConstraints.gridx + Math.max(1, lastConstraints.gridwidth));
|
||||
@@ -595,7 +594,7 @@ public class GridBagLayout
|
||||
}
|
||||
else
|
||||
{
|
||||
Component lastComponent = (Component)lastInCol.get(new Integer(constraints.gridx));
|
||||
Component lastComponent = lastInCol.get(new Integer(constraints.gridx));
|
||||
GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
|
||||
y = lastConstraints.gridy + Math.max(1, lastConstraints.gridheight);
|
||||
}
|
||||
@@ -606,7 +605,7 @@ public class GridBagLayout
|
||||
{
|
||||
if (lastInCol.containsKey(new Integer(x)))
|
||||
{
|
||||
Component lastComponent = (Component) lastInCol.get(new Integer(x));
|
||||
Component lastComponent = lastInCol.get(new Integer(x));
|
||||
GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
|
||||
y = Math.max (y,
|
||||
lastConstraints.gridy + Math.max(1, lastConstraints.gridheight));
|
||||
@@ -636,7 +635,7 @@ public class GridBagLayout
|
||||
{
|
||||
if(lastInRow.containsKey(new Integer(y)))
|
||||
{
|
||||
Component lastComponent = (Component) lastInRow.get(new Integer(y));
|
||||
Component lastComponent = lastInRow.get(new Integer(y));
|
||||
GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
|
||||
if (constraints.gridx > lastConstraints.gridx)
|
||||
{
|
||||
@@ -653,7 +652,7 @@ public class GridBagLayout
|
||||
{
|
||||
if(lastInCol.containsKey(new Integer(x)))
|
||||
{
|
||||
Component lastComponent = (Component) lastInCol.get(new Integer(x));
|
||||
Component lastComponent = lastInCol.get(new Integer(x));
|
||||
GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
|
||||
if (constraints.gridy > lastConstraints.gridy)
|
||||
{
|
||||
@@ -707,7 +706,7 @@ public class GridBagLayout
|
||||
{
|
||||
if (lastInRow.containsKey(new Integer(y)))
|
||||
{
|
||||
Component lastComponent = (Component) lastInRow.get(new Integer(y));
|
||||
Component lastComponent = lastInRow.get(new Integer(y));
|
||||
GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
|
||||
|
||||
if (lastConstraints.gridwidth == GridBagConstraints.RELATIVE)
|
||||
@@ -742,7 +741,7 @@ public class GridBagLayout
|
||||
{
|
||||
if (lastInCol.containsKey(new Integer(x)))
|
||||
{
|
||||
Component lastComponent = (Component) lastInRow.get(new Integer(x));
|
||||
Component lastComponent = lastInRow.get(new Integer(x));
|
||||
if (lastComponent != null)
|
||||
{
|
||||
GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
|
||||
@@ -804,7 +803,7 @@ public class GridBagLayout
|
||||
// STEP 4: Determine sizes and weights for rows.
|
||||
for (int i = 0; i < sortedByHeight.size(); i++)
|
||||
{
|
||||
Component component = (Component) sortedByHeight.get(i);
|
||||
Component component = sortedByHeight.get(i);
|
||||
|
||||
// If component is not visible we dont have to care about it.
|
||||
if (!component.isVisible())
|
||||
@@ -904,7 +903,7 @@ public class GridBagLayout
|
||||
int i = 0;
|
||||
if (list.size() > 0)
|
||||
{
|
||||
GridBagConstraints gbc = lookupInternalConstraints((Component) list.get(i));
|
||||
GridBagConstraints gbc = lookupInternalConstraints(list.get(i));
|
||||
int otherspan = sortByWidth ?
|
||||
gbc.gridwidth :
|
||||
gbc.gridheight;
|
||||
@@ -915,7 +914,7 @@ public class GridBagLayout
|
||||
i++;
|
||||
if (i < list.size())
|
||||
{
|
||||
gbc = lookupInternalConstraints((Component) list.get(i));
|
||||
gbc = lookupInternalConstraints(list.get(i));
|
||||
otherspan = sortByWidth ?
|
||||
gbc.gridwidth :
|
||||
gbc.gridheight;
|
||||
|
||||
@@ -286,7 +286,8 @@ final class LightweightDispatcher
|
||||
private void redispatch(MouseEvent ev, Component target, int id)
|
||||
{
|
||||
Component source = ev.getComponent();
|
||||
if (target != null)
|
||||
assert target != null;
|
||||
if (target.isShowing())
|
||||
{
|
||||
// Translate coordinates.
|
||||
int x = ev.getX();
|
||||
|
||||
@@ -38,8 +38,6 @@ exception statement from your version. */
|
||||
|
||||
package java.awt;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* This class implements a keyboard accelerator for a menu item.
|
||||
*
|
||||
|
||||
@@ -426,10 +426,15 @@ public class ICC_Profile implements Serializable
|
||||
System.arraycopy(headerData, 0, data, 0, ProfileHeader.HEADERSIZE);
|
||||
|
||||
// read the rest
|
||||
if (in.read(data, ProfileHeader.HEADERSIZE,
|
||||
header.getSize() - ProfileHeader.HEADERSIZE) != header.getSize()
|
||||
- ProfileHeader.HEADERSIZE)
|
||||
throw new IOException("Incorrect profile size");
|
||||
int totalBytes = header.getSize() - ProfileHeader.HEADERSIZE;
|
||||
int bytesLeft = totalBytes;
|
||||
while (bytesLeft > 0)
|
||||
{
|
||||
int read = in.read(data,
|
||||
ProfileHeader.HEADERSIZE + (totalBytes - bytesLeft),
|
||||
bytesLeft);
|
||||
bytesLeft -= read;
|
||||
}
|
||||
|
||||
return getInstance(data);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public abstract class DragGestureRecognizer implements Serializable
|
||||
|
||||
public InputEvent getTriggerEvent()
|
||||
{
|
||||
return events.size() > 0 ? (InputEvent) events.get(0) : null;
|
||||
return events.size() > 0 ? events.get(0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -221,37 +221,8 @@ public class MouseEvent extends InputEvent
|
||||
int x, int y, int clickCount, boolean popupTrigger,
|
||||
int button)
|
||||
{
|
||||
super(source, id, when, modifiers);
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.clickCount = clickCount;
|
||||
this.popupTrigger = popupTrigger;
|
||||
this.button = button;
|
||||
if (button < NOBUTTON || button > BUTTON3)
|
||||
throw new IllegalArgumentException();
|
||||
if ((modifiers & EventModifier.OLD_MASK) != 0)
|
||||
{
|
||||
if ((modifiers & BUTTON1_MASK) != 0)
|
||||
this.button = BUTTON1;
|
||||
else if ((modifiers & BUTTON2_MASK) != 0)
|
||||
this.button = BUTTON2;
|
||||
else if ((modifiers & BUTTON3_MASK) != 0)
|
||||
this.button = BUTTON3;
|
||||
}
|
||||
// clear the mouse button modifier masks if this is a button
|
||||
// release event.
|
||||
if (id == MOUSE_RELEASED)
|
||||
this.modifiersEx &= ~(BUTTON1_DOWN_MASK
|
||||
| BUTTON2_DOWN_MASK
|
||||
| BUTTON3_DOWN_MASK);
|
||||
|
||||
if (source != null)
|
||||
{
|
||||
Point screenLoc = source.getLocationOnScreen();
|
||||
absX = screenLoc.x + x;
|
||||
absY = screenLoc.y + y;
|
||||
}
|
||||
this(source, id, when, modifiers, x, y, 0, 0, clickCount, popupTrigger,
|
||||
button);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,9 +39,7 @@ exception statement from your version. */
|
||||
package java.awt.font;
|
||||
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.AttributedString;
|
||||
import java.text.BreakIterator;
|
||||
import java.awt.Shape;
|
||||
|
||||
public final class LineBreakMeasurer
|
||||
{
|
||||
|
||||
@@ -39,7 +39,6 @@ exception statement from your version. */
|
||||
package java.awt.font;
|
||||
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.AttributedString;
|
||||
import java.awt.Shape;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1279,7 +1279,7 @@ public abstract class Arc2D extends RectangularShape
|
||||
width = (float) r.getWidth();
|
||||
height = (float) r.getHeight();
|
||||
this.start = start;
|
||||
this.extent = (float) extent;
|
||||
this.extent = extent;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1714,10 +1714,10 @@ public abstract class CubicCurve2D implements Shape, Cloneable
|
||||
*/
|
||||
public Rectangle2D getBounds2D()
|
||||
{
|
||||
float nx1 = (float) Math.min(Math.min(x1, ctrlx1), Math.min(ctrlx2, x2));
|
||||
float ny1 = (float) Math.min(Math.min(y1, ctrly1), Math.min(ctrly2, y2));
|
||||
float nx2 = (float) Math.max(Math.max(x1, ctrlx1), Math.max(ctrlx2, x2));
|
||||
float ny2 = (float) Math.max(Math.max(y1, ctrly1), Math.max(ctrly2, y2));
|
||||
float nx1 = Math.min(Math.min(x1, ctrlx1), Math.min(ctrlx2, x2));
|
||||
float ny1 = Math.min(Math.min(y1, ctrly1), Math.min(ctrly2, y2));
|
||||
float nx2 = Math.max(Math.max(x1, ctrlx1), Math.max(ctrlx2, x2));
|
||||
float ny2 = Math.max(Math.max(y1, ctrly1), Math.max(ctrly2, y2));
|
||||
return new Rectangle2D.Float(nx1, ny1, nx2 - nx1, ny2 - ny1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1457,10 +1457,10 @@ public abstract class QuadCurve2D implements Shape, Cloneable
|
||||
*/
|
||||
public Rectangle2D getBounds2D()
|
||||
{
|
||||
float nx1 = (float) Math.min(Math.min(x1, ctrlx), x2);
|
||||
float ny1 = (float) Math.min(Math.min(y1, ctrly), y2);
|
||||
float nx2 = (float) Math.max(Math.max(x1, ctrlx), x2);
|
||||
float ny2 = (float) Math.max(Math.max(y1, ctrly), y2);
|
||||
float nx1 = Math.min(Math.min(x1, ctrlx), x2);
|
||||
float ny1 = Math.min(Math.min(y1, ctrly), y2);
|
||||
float nx2 = Math.max(Math.max(x1, ctrlx), x2);
|
||||
float ny2 = Math.max(Math.max(y1, ctrly), y2);
|
||||
return new Rectangle2D.Float(nx1, ny1, nx2 - nx1, ny2 - ny1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,12 +216,11 @@ public class InputContext
|
||||
recent.put(locale, im);
|
||||
return true;
|
||||
}
|
||||
InputMethod next = (InputMethod) recent.get(locale);
|
||||
outer:
|
||||
InputMethod next = recent.get(locale);
|
||||
if (next != null)
|
||||
for (int i = 0, limit = descriptors.size(); i < limit; i++)
|
||||
{
|
||||
InputMethodDescriptor d = (InputMethodDescriptor) descriptors.get(i);
|
||||
InputMethodDescriptor d = descriptors.get(i);
|
||||
Locale[] list;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -188,7 +188,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
|
||||
if (dst == null)
|
||||
dst = createCompatibleDestImage(src, null);
|
||||
|
||||
Graphics2D gr = (Graphics2D) dst.createGraphics();
|
||||
Graphics2D gr = dst.createGraphics();
|
||||
gr.setRenderingHints(hints);
|
||||
gr.drawImage(src, transform, null);
|
||||
return dst;
|
||||
|
||||
@@ -158,7 +158,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
|
||||
* @param srcOffset - Starting offset into the source pixel data array.
|
||||
* @param srcScansize - Source array scanline size.
|
||||
* @param rx,ry - Scaling factor.
|
||||
* @param dstScansize - Destination array scanline size.
|
||||
* @param destScansize - Destination array scanline size.
|
||||
*/
|
||||
private byte[] averagePixels(int srcx, int srcy, int srcw, int srch,
|
||||
ColorModel model, byte[] srcPixels,
|
||||
@@ -218,7 +218,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
|
||||
* @param srcOffset - Starting offset into the source pixel data array.
|
||||
* @param srcScansize - Source array scanline size.
|
||||
* @param rx,ry - Scaling factor.
|
||||
* @param dstScansize - Destination array scanline size.
|
||||
* @param destScansize - Destination array scanline size.
|
||||
*/
|
||||
private int[] averagePixels(int srcx, int srcy, int srcw, int srch,
|
||||
ColorModel model, int[] srcPixels,
|
||||
|
||||
@@ -41,8 +41,6 @@ package java.awt.image;
|
||||
import gnu.java.awt.Buffers;
|
||||
import gnu.java.awt.ClasspathGraphicsEnvironment;
|
||||
import gnu.java.awt.ComponentDataBlitOp;
|
||||
import gnu.java.awt.peer.gtk.CairoSurface;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
|
||||
@@ -69,9 +69,34 @@ public class PixelInterleavedSampleModel
|
||||
*/
|
||||
public SampleModel createCompatibleSampleModel(int width, int height)
|
||||
{
|
||||
// Find minimum band offset.
|
||||
int minBandoff = bandOffsets[0];
|
||||
int numBands = bandOffsets.length;
|
||||
for (int i = 1; i < numBands; i++)
|
||||
{
|
||||
if (bandOffsets[i] < minBandoff)
|
||||
{
|
||||
minBandoff = bandOffsets[i];
|
||||
}
|
||||
}
|
||||
// Adjust band offsets so that minimum offset is at 0.
|
||||
int[] bandOff;
|
||||
if (minBandoff > 0)
|
||||
{
|
||||
bandOff = new int[numBands];
|
||||
for (int i = 0; i < numBands; i++)
|
||||
{
|
||||
bandOff[i] = bandOffsets[i] - minBandoff;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bandOff = bandOffsets;
|
||||
}
|
||||
// Adjust scanline stride for new width.
|
||||
return new PixelInterleavedSampleModel(dataType, width, height,
|
||||
pixelStride, scanlineStride,
|
||||
bandOffsets);
|
||||
pixelStride, pixelStride * width,
|
||||
bandOff);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ public abstract class RGBImageFilter extends ImageFilter
|
||||
{
|
||||
for (int xp = 0; xp < w; xp++)
|
||||
{
|
||||
filtered[xp] = model.getRGB((pixels[index] & 0xff));
|
||||
filtered[xp] = model.getRGB((pixels[index]));
|
||||
index++;
|
||||
}
|
||||
index += scansize - w;
|
||||
|
||||
@@ -302,7 +302,7 @@ public class Raster
|
||||
Point location)
|
||||
{
|
||||
SampleModel sm = new ComponentSampleModel(dataBuffer.getDataType(),
|
||||
w, h, scanlineStride, pixelStride, bandOffsets);
|
||||
w, h, pixelStride, scanlineStride, bandOffsets);
|
||||
return createWritableRaster(sm, dataBuffer, location);
|
||||
}
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ public class Beans
|
||||
* Objects.
|
||||
*
|
||||
* @param bean the Bean to cast.
|
||||
* @param newClass the Class to cast it to.
|
||||
* @param newBeanClass the Class to cast it to.
|
||||
*
|
||||
* @return whether the Bean can be cast to the class type
|
||||
* in question.
|
||||
|
||||
@@ -127,7 +127,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate
|
||||
{
|
||||
Method readMethod = propertyDescs[i].getReadMethod();
|
||||
|
||||
args[i] = readMethod.invoke(oldInstance, null);
|
||||
args[i] = readMethod.invoke(oldInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate
|
||||
|
||||
if (readMethod != null && writeMethod != null)
|
||||
{
|
||||
Object oldValue = readMethod.invoke(oldInstance, null);
|
||||
Object oldValue = readMethod.invoke(oldInstance);
|
||||
|
||||
if (oldValue != null)
|
||||
out.writeStatement(new Statement(oldInstance,
|
||||
|
||||
@@ -195,7 +195,7 @@ public class Encoder
|
||||
|
||||
PersistenceDelegate pd = (PersistenceDelegate) delegates.get(type);
|
||||
|
||||
return (pd != null) ? pd : (PersistenceDelegate) defaultPersistenceDelegate;
|
||||
return (pd != null) ? pd : defaultPersistenceDelegate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -173,19 +173,17 @@ public class EventHandler implements InvocationHandler
|
||||
try
|
||||
{
|
||||
// Look for boolean property getter isProperty
|
||||
getter = o.getClass().getMethod("is" + capitalize(prop),
|
||||
null);
|
||||
getter = o.getClass().getMethod("is" + capitalize(prop));
|
||||
}
|
||||
catch (NoSuchMethodException nsme1)
|
||||
{
|
||||
try {
|
||||
// Look for regular property getter getProperty
|
||||
getter = o.getClass().getMethod("get" + capitalize(prop),
|
||||
null);
|
||||
getter = o.getClass().getMethod("get" + capitalize(prop));
|
||||
} catch(NoSuchMethodException nsme2) {
|
||||
try {
|
||||
// Finally look for a method of the name prop
|
||||
getter = o.getClass().getMethod(prop, null);
|
||||
getter = o.getClass().getMethod(prop);
|
||||
} catch(NoSuchMethodException nsme3) {
|
||||
// Ok, give up with an intelligent hint for the user.
|
||||
throw new RuntimeException("Method not called: Could not find a property or method '" + prop
|
||||
@@ -194,7 +192,7 @@ public class EventHandler implements InvocationHandler
|
||||
}
|
||||
}
|
||||
try {
|
||||
Object val = getter.invoke(o, null);
|
||||
Object val = getter.invoke(o);
|
||||
|
||||
if (rest != null)
|
||||
return getProperty(val, rest);
|
||||
@@ -304,7 +302,7 @@ public class EventHandler implements InvocationHandler
|
||||
// more specification compliant than the JDK itself because this one will fail in such a case.
|
||||
try
|
||||
{
|
||||
actionMethod = targetClass.getMethod(action, null);
|
||||
actionMethod = targetClass.getMethod(action);
|
||||
}
|
||||
catch(NoSuchMethodException nsme)
|
||||
{
|
||||
@@ -342,7 +340,7 @@ public class EventHandler implements InvocationHandler
|
||||
throw new ArrayIndexOutOfBoundsException(0);
|
||||
|
||||
// Invoke target.action(property)
|
||||
return actionMethod.invoke(target, null);
|
||||
return actionMethod.invoke(target);
|
||||
} catch(InvocationTargetException ite) {
|
||||
throw new RuntimeException(ite.getCause());
|
||||
} catch(IllegalAccessException iae) {
|
||||
|
||||
@@ -346,8 +346,8 @@ public class PropertyChangeSupport implements Serializable
|
||||
{
|
||||
if (oldVal != newVal)
|
||||
firePropertyChange(new PropertyChangeEvent(source, propertyName,
|
||||
new Integer(oldVal),
|
||||
new Integer(newVal)));
|
||||
Integer.valueOf(oldVal),
|
||||
Integer.valueOf(newVal)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -349,8 +349,8 @@ public class VetoableChangeSupport implements Serializable
|
||||
{
|
||||
if (oldVal != newVal)
|
||||
fireVetoableChange(new PropertyChangeEvent(source, propertyName,
|
||||
new Integer(oldVal),
|
||||
new Integer(newVal)));
|
||||
Integer.valueOf(oldVal),
|
||||
Integer.valueOf(newVal)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -164,7 +164,7 @@ public class XMLDecoder
|
||||
*
|
||||
* @param in InputStream to read XML data from.
|
||||
* @param owner Owner object which can be accessed and modified while parsing.
|
||||
* @param exceptionListener ExceptionListener instance to which exception notifications are send.
|
||||
* @param listener ExceptionListener instance to which exception notifications are send.
|
||||
* @param cl ClassLoader instance that is used for calls to <code>Class.forName(String, boolean, ClassLoader)</code>
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@ exception statement from your version. */
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import gnu.classpath.NotImplementedException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
@@ -88,11 +86,6 @@ public class BeanContextServicesSupport
|
||||
|
||||
private BeanContextServiceProvider provider;
|
||||
|
||||
private BCSSProxyServiceProvider(BeanContextServiceProvider p)
|
||||
{
|
||||
provider = p;
|
||||
}
|
||||
|
||||
public Iterator getCurrentServiceSelectors (BeanContextServices bcs,
|
||||
Class serviceClass)
|
||||
{
|
||||
@@ -427,7 +420,7 @@ public class BeanContextServicesSupport
|
||||
* Subclasses may envelope its behaviour in order to read further
|
||||
* serialized data to the stream.
|
||||
*
|
||||
* @param oos the stream from which data is being deserialized.
|
||||
* @param ois the stream from which data is being deserialized.
|
||||
* @throws IOException if an I/O error occurs.
|
||||
* @throws ClassNotFoundException if the class of a deserialized object
|
||||
* can not be found.
|
||||
|
||||
@@ -794,12 +794,12 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
}
|
||||
|
||||
/**
|
||||
* Deerializes the children using the
|
||||
* Deserializes the children using the
|
||||
* {@link #deserialize(ObjectInputStream, Collection} method
|
||||
* and then calls {@link childDeserializedHook(Object, BCSChild)}
|
||||
* for each child deserialized.
|
||||
*
|
||||
* @param oos the output stream.
|
||||
* @param ois the input stream.
|
||||
* @throws IOException if an I/O error occurs.
|
||||
*/
|
||||
public final void readChildren (ObjectInputStream ois)
|
||||
|
||||
@@ -88,11 +88,6 @@ public class BufferedReader extends Reader
|
||||
// This is package-private because it is used by LineNumberReader.
|
||||
static final int DEFAULT_BUFFER_SIZE = 8192;
|
||||
|
||||
/**
|
||||
* The line buffer for <code>readLine</code>.
|
||||
*/
|
||||
private StringBuffer sbuf = null;
|
||||
|
||||
/**
|
||||
* Create a new <code>BufferedReader</code> that will read from the
|
||||
* specified subordinate stream with a default buffer size of 8192 chars.
|
||||
@@ -455,10 +450,7 @@ public class BufferedReader extends Reader
|
||||
pos++;
|
||||
return str;
|
||||
}
|
||||
if (sbuf == null)
|
||||
sbuf = new StringBuffer(200);
|
||||
else
|
||||
sbuf.setLength(0);
|
||||
StringBuilder sbuf = new StringBuilder(200);
|
||||
sbuf.append(buffer, pos, i - pos);
|
||||
pos = i;
|
||||
// We only want to return null when no characters were read before
|
||||
|
||||
@@ -267,7 +267,7 @@ public class CharArrayWriter extends Writer
|
||||
* sequence is wrapped around an input buffer, the results will
|
||||
* depend on the current position and length of that buffer.
|
||||
*
|
||||
* @param seq the character sequence to append. If seq is null,
|
||||
* @param cs the character sequence to append. If seq is null,
|
||||
* then the string "null" (the string representation of null)
|
||||
* is appended.
|
||||
* @return a reference to this object.
|
||||
@@ -294,7 +294,7 @@ public class CharArrayWriter extends Writer
|
||||
* <code>append(seq.subSequence(start,end))</code> when the sequence
|
||||
* is not null.
|
||||
*
|
||||
* @param seq the character sequence to append. If seq is null,
|
||||
* @param cs the character sequence to append. If seq is null,
|
||||
* then the string "null" (the string representation of null)
|
||||
* is appended.
|
||||
* @param start the index of the first Unicode character to use from
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* DataInputStream.java -- FilteredInputStream that implements DataInput
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005, 2008
|
||||
Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -349,7 +350,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
|
||||
*/
|
||||
public final String readLine() throws IOException
|
||||
{
|
||||
StringBuffer strb = new StringBuffer();
|
||||
StringBuilder strb = new StringBuilder();
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -590,13 +591,56 @@ public class DataInputStream extends FilterInputStream implements DataInput
|
||||
public static final String readUTF(DataInput in) throws IOException
|
||||
{
|
||||
final int UTFlen = in.readUnsignedShort ();
|
||||
byte[] buf = new byte [UTFlen];
|
||||
|
||||
return readUTF(in, UTFlen);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is similar to <code>readUTF</code>, but the
|
||||
* UTF-8 byte length is in 64 bits.
|
||||
* This method is not public. It is used by <code>ObjectInputStream</code>.
|
||||
*
|
||||
* @return The <code>String</code> read
|
||||
*
|
||||
* @exception EOFException If end of file is reached before reading
|
||||
* the String
|
||||
* @exception UTFDataFormatException If the data is not in UTF-8 format
|
||||
* @exception IOException If any other error occurs
|
||||
*
|
||||
* @see DataOutput#writeUTFLong
|
||||
*/
|
||||
final String readUTFLong () throws IOException
|
||||
{
|
||||
long l = readLong ();
|
||||
if (l > Integer.MAX_VALUE)
|
||||
throw new IOException("The string length > Integer.MAX_VALUE");
|
||||
final int UTFlen = (int)l;
|
||||
return readUTF (this, UTFlen);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method performs the main task of <code>readUTF</code> and
|
||||
* <code>readUTFLong</code>.
|
||||
*
|
||||
* @param in The <code>DataInput</code> source to read from
|
||||
*
|
||||
* @param len The UTF-8 byte length of the String to be read
|
||||
*
|
||||
* @return The String read from the source
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*
|
||||
* @see DataInput#readUTF
|
||||
*/
|
||||
private static final String readUTF(DataInput in, int len) throws IOException
|
||||
{
|
||||
byte[] buf = new byte [len];
|
||||
|
||||
// This blocks until the entire string is available rather than
|
||||
// doing partial processing on the bytes that are available and then
|
||||
// blocking. An advantage of the latter is that Exceptions
|
||||
// could be thrown earlier. The former is a bit cleaner.
|
||||
in.readFully (buf, 0, UTFlen);
|
||||
in.readFully (buf, 0, len);
|
||||
|
||||
return convertFromUTF (buf);
|
||||
}
|
||||
@@ -703,7 +747,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
|
||||
{
|
||||
// Give StringBuffer an initial estimated size to avoid
|
||||
// enlarge buffer frequently
|
||||
StringBuffer strbuf = new StringBuffer (buf.length / 2 + 2);
|
||||
StringBuilder strbuf = new StringBuilder (buf.length / 2 + 2);
|
||||
|
||||
for (int i = 0; i < buf.length; )
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* DataOutputStream.java -- Writes primitive Java datatypes to streams
|
||||
Copyright (C) 1998, 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -379,19 +379,20 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
|
||||
|
||||
/**
|
||||
* Calculate the length, in bytes, of a <code>String</code> in Utf8 format.
|
||||
* This method is package-private so that <code>ObjectOutputStream</code>
|
||||
* may use it. The return type is long so that a long string whose
|
||||
* Utf8 byte count is 64 bit long may be handled.
|
||||
*
|
||||
* @param value The <code>String</code> to measure
|
||||
* @param start String index at which to begin count
|
||||
* @param sum Starting Utf8 byte count
|
||||
*
|
||||
* @throws UTFDataFormatException if result would exceed 65535
|
||||
*/
|
||||
private int getUTFlength(String value, int start, int sum)
|
||||
throws IOException
|
||||
long getUTFlength(String value, int start, long sum)
|
||||
{
|
||||
int len = value.length();
|
||||
|
||||
for (int i = start; i < len && sum <= 65535; ++i)
|
||||
for (int i = start; i < len; ++i)
|
||||
{
|
||||
char c = value.charAt(i);
|
||||
if (c >= '\u0001' && c <= '\u007f')
|
||||
@@ -402,9 +403,6 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
|
||||
sum += 3;
|
||||
}
|
||||
|
||||
if (sum > 65535)
|
||||
throw new UTFDataFormatException ();
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
@@ -441,11 +439,71 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
|
||||
* @see DataInput#readUTF
|
||||
*/
|
||||
public final synchronized void writeUTF(String value) throws IOException
|
||||
{
|
||||
long l = getUTFlength(value, 0, 0);
|
||||
if (l > 65535)
|
||||
throw new UTFDataFormatException ();
|
||||
writeUTFShort(value, (int)l);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method performs the main task of <code>writeUTF</code>.
|
||||
* This method is package-private because ObjectOutputStream uses it.
|
||||
*
|
||||
* @param value The <code>String</code> to write to the output in UTF format
|
||||
*
|
||||
* @param bytelen The UTF-8 byte length of the <code>String</code>. When
|
||||
* this method is called, the expected byte length must have been calculated
|
||||
* by <code>getUTFlength</code>.
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*
|
||||
* @see DataInput#readUTF
|
||||
*/
|
||||
final synchronized void writeUTFShort(String value, int bytelen)
|
||||
throws IOException
|
||||
{
|
||||
writeShort(bytelen);
|
||||
writeUTFBytes(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is similar to <code>writeUTF</code>, but it writes the
|
||||
* UTF-8 byte length in 64 bits.
|
||||
* This method is not public but <code>ObjectOutputStream</code> uses it.
|
||||
*
|
||||
* @param value The <code>String</code> to write to the output in UTF format
|
||||
*
|
||||
* @param bytelen The UTF-8 byte length of the <code>String</code>. When
|
||||
* this method is called, the expected byte length must have been calculated
|
||||
* by <code>getUTFlength</code>.
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*
|
||||
*/
|
||||
final synchronized void writeUTFLong(String value, long bytelen)
|
||||
throws IOException
|
||||
{
|
||||
writeLong(bytelen);
|
||||
writeUTFBytes(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method performes the main task of <code>writeUTF</code> and
|
||||
* <code>WriteUTFLong</code>, which is to write the UTF-8 byte
|
||||
* sequence to the output.
|
||||
*
|
||||
* @param value The <code>String</code> to write to the output in UTF format
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*
|
||||
*/
|
||||
private final synchronized void writeUTFBytes(String value)
|
||||
throws IOException
|
||||
{
|
||||
int len = value.length();
|
||||
int i = 0;
|
||||
int pos = 0;
|
||||
boolean lengthWritten = false;
|
||||
|
||||
if (buf == null)
|
||||
buf = new byte[512];
|
||||
@@ -472,14 +530,6 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
|
||||
buf[pos++] = (byte) (0x80 | (0x3f & c));
|
||||
}
|
||||
}
|
||||
if (! lengthWritten)
|
||||
{
|
||||
if (i == len)
|
||||
writeShort(pos);
|
||||
else
|
||||
writeShort(getUTFlength(value, i, pos));
|
||||
lengthWritten = true;
|
||||
}
|
||||
write(buf, 0, pos);
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
@@ -1292,6 +1292,73 @@ public class File implements Serializable, Comparable<File>
|
||||
return VMFile.setExecutable(path, executable, ownerOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the total space for the partition pointed by this file path, in bytes.
|
||||
*
|
||||
* @return the total number of bytes in this partition.
|
||||
* @since 1.6
|
||||
*/
|
||||
public long getTotalSpace()
|
||||
{
|
||||
// check security manager.
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
s.checkPermission(new RuntimePermission("getFileSystemAttributes"));
|
||||
checkRead();
|
||||
|
||||
return VMFile.getTotalSpace(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the free space in the partition pointed by this file path, in bytes.
|
||||
*
|
||||
* @return the number of free bytes in this partition.
|
||||
* @since 1.6
|
||||
*/
|
||||
public long getFreeSpace()
|
||||
{
|
||||
// check security manager.
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
s.checkPermission(new RuntimePermission("getFileSystemAttributes"));
|
||||
checkRead();
|
||||
|
||||
return VMFile.getFreeSpace(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the usable space in the partition pointed by this file path, in bytes.
|
||||
* This is not necessarily the same as the number returned by
|
||||
* {@link #getFreeSpace()}.
|
||||
*
|
||||
* <strong>Implementation note</strong>: Unlike the RI, on Linux and UNIX
|
||||
* like systems this methods take into account the reserved space for the
|
||||
* "root" user. This means that the returned results will be a little
|
||||
* different if a normal user or root perform the query.
|
||||
*
|
||||
* Also, the bytes returned should be interpreted as an hint, and may be
|
||||
* different at each call of this method or even right after the method
|
||||
* returns.
|
||||
*
|
||||
* @return the number of usable bytes in this partition.
|
||||
* @since 1.6
|
||||
*/
|
||||
public long getUsableSpace()
|
||||
{
|
||||
// check security manager.
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
s.checkPermission(new RuntimePermission("getFileSystemAttributes"));
|
||||
checkRead();
|
||||
|
||||
// root users can use the reserved extra space
|
||||
String user = System.getProperty("user.name");
|
||||
if (user != null && user.equals("root"))
|
||||
return VMFile.getFreeSpace(path);
|
||||
|
||||
return VMFile.getUsableSpace(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the file represented by this object to be read only.
|
||||
* A read only file or directory cannot be modified. Please note that
|
||||
|
||||
@@ -59,7 +59,7 @@ public class FileOutputStream extends OutputStream
|
||||
{
|
||||
private FileDescriptor fd;
|
||||
|
||||
private FileChannelImpl ch;
|
||||
private final FileChannelImpl ch;
|
||||
|
||||
/**
|
||||
* This method initializes a <code>FileOutputStream</code> object to write
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* ObjectInputStream.java -- Class used to read serialized objects
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
@@ -367,7 +367,6 @@ public class ObjectInputStream extends InputStream
|
||||
}
|
||||
|
||||
case TC_STRING:
|
||||
case TC_LONGSTRING:
|
||||
{
|
||||
if(dump) dumpElement("STRING=");
|
||||
String s = this.realInputStream.readUTF();
|
||||
@@ -377,6 +376,16 @@ public class ObjectInputStream extends InputStream
|
||||
break;
|
||||
}
|
||||
|
||||
case TC_LONGSTRING:
|
||||
{
|
||||
if(dump) dumpElement("STRING=");
|
||||
String s = this.realInputStream.readUTFLong();
|
||||
if(dump) dumpElementln(s);
|
||||
ret_val = processResolution(null, s, assignNewHandle(s,shared),
|
||||
shared);
|
||||
break;
|
||||
}
|
||||
|
||||
case TC_ARRAY:
|
||||
{
|
||||
if(dump) dumpElementln("ARRAY");
|
||||
@@ -926,7 +935,7 @@ public class ObjectInputStream extends InputStream
|
||||
return null;
|
||||
|
||||
ObjectStreamClass oclazz;
|
||||
oclazz = (ObjectStreamClass)classLookupTable.get(clazz);
|
||||
oclazz = classLookupTable.get(clazz);
|
||||
if (oclazz == null)
|
||||
return ObjectStreamClass.lookup(clazz);
|
||||
else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* ObjectOutputStream.java -- Class used to write serialized objects
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
@@ -363,10 +363,22 @@ public class ObjectOutputStream extends OutputStream
|
||||
|
||||
if (obj instanceof String)
|
||||
{
|
||||
realOutput.writeByte(TC_STRING);
|
||||
if (shared)
|
||||
assignNewHandle(obj);
|
||||
realOutput.writeUTF((String)obj);
|
||||
String s = (String)obj;
|
||||
long l = realOutput.getUTFlength(s, 0, 0);
|
||||
if (l <= 65535)
|
||||
{
|
||||
realOutput.writeByte(TC_STRING);
|
||||
if (shared)
|
||||
assignNewHandle(obj);
|
||||
realOutput.writeUTFShort(s, (int)l);
|
||||
}
|
||||
else
|
||||
{
|
||||
realOutput.writeByte(TC_LONGSTRING);
|
||||
if (shared)
|
||||
assignNewHandle(obj);
|
||||
realOutput.writeUTFLong(s, l);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ObjectStreamClass implements Serializable
|
||||
if (cl == null)
|
||||
return null;
|
||||
|
||||
ObjectStreamClass osc = (ObjectStreamClass) classLookupTable.get(cl);
|
||||
ObjectStreamClass osc = classLookupTable.get(cl);
|
||||
|
||||
if (osc != null)
|
||||
return osc;
|
||||
@@ -830,7 +830,7 @@ outer:
|
||||
}
|
||||
|
||||
if (loadedByBootOrApplicationClassLoader(cl))
|
||||
uidCache.put(cl,new Long(result));
|
||||
uidCache.put(cl,Long.valueOf(result));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1074,7 +1074,7 @@ outer:
|
||||
|
||||
try
|
||||
{
|
||||
return (Externalizable)constructor.newInstance(null);
|
||||
return (Externalizable)constructor.newInstance();
|
||||
}
|
||||
catch(Exception x)
|
||||
{
|
||||
|
||||
@@ -91,17 +91,17 @@ public class OutputStreamWriter extends Writer
|
||||
/**
|
||||
* The charset encoder.
|
||||
*/
|
||||
private CharsetEncoder encoder;
|
||||
private final CharsetEncoder encoder;
|
||||
|
||||
/**
|
||||
* java.io canonical name of the encoding.
|
||||
*/
|
||||
private String encodingName;
|
||||
private final String encodingName;
|
||||
|
||||
/**
|
||||
* Buffer output before character conversion as it has costly overhead.
|
||||
*/
|
||||
private CharBuffer outputBuffer;
|
||||
private final CharBuffer outputBuffer;
|
||||
private final static int BUFFER_SIZE = 1024;
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,11 @@ public class OutputStreamWriter extends Writer
|
||||
public OutputStreamWriter (OutputStream out, String encoding_scheme)
|
||||
throws UnsupportedEncodingException
|
||||
{
|
||||
CharsetEncoder encoder;
|
||||
String encodingName;
|
||||
this.out = out;
|
||||
outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
|
||||
|
||||
try
|
||||
{
|
||||
// Don't use NIO if avoidable
|
||||
@@ -128,44 +132,44 @@ public class OutputStreamWriter extends Writer
|
||||
{
|
||||
encodingName = "ISO8859_1";
|
||||
encoder = null;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Workraround for encodings with a byte-order-mark.
|
||||
* We only want to write it once per stream.
|
||||
*/
|
||||
try
|
||||
{
|
||||
if(encoding_scheme.equalsIgnoreCase("UnicodeBig") ||
|
||||
encoding_scheme.equalsIgnoreCase("UTF-16") ||
|
||||
encoding_scheme.equalsIgnoreCase("UTF16"))
|
||||
{
|
||||
encoding_scheme = "UTF-16BE";
|
||||
out.write((byte)0xFE);
|
||||
out.write((byte)0xFF);
|
||||
}
|
||||
else if(encoding_scheme.equalsIgnoreCase("UnicodeLittle")){
|
||||
encoding_scheme = "UTF-16LE";
|
||||
out.write((byte)0xFF);
|
||||
out.write((byte)0xFE);
|
||||
}
|
||||
}
|
||||
catch(IOException ioe)
|
||||
{
|
||||
}
|
||||
|
||||
outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
|
||||
|
||||
Charset cs = EncodingHelper.getCharset(encoding_scheme);
|
||||
if(cs == null)
|
||||
throw new UnsupportedEncodingException("Encoding "+encoding_scheme+
|
||||
" unknown");
|
||||
encoder = cs.newEncoder();
|
||||
encodingName = EncodingHelper.getOldCanonical(cs.name());
|
||||
|
||||
encoder.onMalformedInput(CodingErrorAction.REPLACE);
|
||||
encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Workaround for encodings with a byte-order-mark.
|
||||
* We only want to write it once per stream.
|
||||
*/
|
||||
try
|
||||
{
|
||||
if(encoding_scheme.equalsIgnoreCase("UnicodeBig") ||
|
||||
encoding_scheme.equalsIgnoreCase("UTF-16") ||
|
||||
encoding_scheme.equalsIgnoreCase("UTF16"))
|
||||
{
|
||||
encoding_scheme = "UTF-16BE";
|
||||
out.write((byte)0xFE);
|
||||
out.write((byte)0xFF);
|
||||
}
|
||||
else if(encoding_scheme.equalsIgnoreCase("UnicodeLittle"))
|
||||
{
|
||||
encoding_scheme = "UTF-16LE";
|
||||
out.write((byte)0xFF);
|
||||
out.write((byte)0xFE);
|
||||
}
|
||||
}
|
||||
catch(IOException ioe)
|
||||
{
|
||||
}
|
||||
|
||||
Charset cs = EncodingHelper.getCharset(encoding_scheme);
|
||||
if(cs == null)
|
||||
throw new UnsupportedEncodingException("Encoding "+encoding_scheme+
|
||||
" unknown");
|
||||
encoder = cs.newEncoder();
|
||||
encodingName = EncodingHelper.getOldCanonical(cs.name());
|
||||
|
||||
encoder.onMalformedInput(CodingErrorAction.REPLACE);
|
||||
encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
|
||||
}
|
||||
}
|
||||
catch(RuntimeException e)
|
||||
{
|
||||
@@ -174,6 +178,8 @@ public class OutputStreamWriter extends Writer
|
||||
encoder = null;
|
||||
encodingName = "ISO8859_1";
|
||||
}
|
||||
this.encoder = encoder;
|
||||
this.encodingName = encodingName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,8 +190,10 @@ public class OutputStreamWriter extends Writer
|
||||
*/
|
||||
public OutputStreamWriter (OutputStream out)
|
||||
{
|
||||
CharsetEncoder encoder;
|
||||
String encodingName;
|
||||
this.out = out;
|
||||
outputBuffer = null;
|
||||
outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
|
||||
try
|
||||
{
|
||||
String encoding = System.getProperty("file.encoding");
|
||||
@@ -203,8 +211,9 @@ public class OutputStreamWriter extends Writer
|
||||
{
|
||||
encoder.onMalformedInput(CodingErrorAction.REPLACE);
|
||||
encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
|
||||
outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
|
||||
}
|
||||
this.encoder = encoder;
|
||||
this.encodingName = encodingName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,7 +354,7 @@ public class OutputStreamWriter extends Writer
|
||||
{
|
||||
byte[] b = new byte[count];
|
||||
for(int i=0;i<count;i++)
|
||||
b[i] = (byte)((buf[offset+i] <= 0xFF)?buf[offset+i]:'?');
|
||||
b[i] = nullConversion(buf[offset+i]);
|
||||
out.write(b);
|
||||
} else {
|
||||
try {
|
||||
@@ -369,6 +378,10 @@ public class OutputStreamWriter extends Writer
|
||||
}
|
||||
}
|
||||
|
||||
private byte nullConversion(char c) {
|
||||
return (byte)((c <= 0xFF)?c:'?');
|
||||
}
|
||||
|
||||
/**
|
||||
* This method writes <code>count</code> bytes from the specified
|
||||
* <code>String</code> starting at position <code>offset</code> into the
|
||||
@@ -398,7 +411,20 @@ public class OutputStreamWriter extends Writer
|
||||
*/
|
||||
public void write (int ch) throws IOException
|
||||
{
|
||||
write(new char[]{ (char)ch }, 0, 1);
|
||||
// No buffering, no encoding ... just pass through
|
||||
if (encoder == null && outputBuffer == null) {
|
||||
out.write(nullConversion((char)ch));
|
||||
} else {
|
||||
if (outputBuffer != null) {
|
||||
if (outputBuffer.remaining() == 0) {
|
||||
writeConvert(outputBuffer.array(), 0, BUFFER_SIZE);
|
||||
outputBuffer.clear();
|
||||
}
|
||||
outputBuffer.put((char)ch);
|
||||
} else {
|
||||
writeConvert(new char[]{ (char)ch }, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // class OutputStreamWriter
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class PipedInputStream extends InputStream
|
||||
* This is the internal circular buffer used for storing bytes written
|
||||
* to the pipe and from which bytes are read by this stream
|
||||
*/
|
||||
protected byte[] buffer = new byte[PIPE_SIZE];
|
||||
protected byte[] buffer = null;
|
||||
|
||||
/**
|
||||
* The index into buffer where the next byte from the connected
|
||||
@@ -107,8 +107,25 @@ public class PipedInputStream extends InputStream
|
||||
*/
|
||||
public PipedInputStream()
|
||||
{
|
||||
this(PIPE_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>PipedInputStream</code> of the given size that is not
|
||||
* connected to a <code>PipedOutputStream</code>.
|
||||
* It must be connected before bytes can be read from this stream.
|
||||
*
|
||||
* @since 1.6
|
||||
* @since IllegalArgumentException If pipeSize <= 0.
|
||||
*/
|
||||
public PipedInputStream(int pipeSize) throws IllegalArgumentException
|
||||
{
|
||||
if (pipeSize <= 0)
|
||||
throw new IllegalArgumentException("pipeSize must be > 0");
|
||||
|
||||
this.buffer = new byte[pipeSize];
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor creates a new <code>PipedInputStream</code> and connects
|
||||
* it to the passed in <code>PipedOutputStream</code>. The stream is then
|
||||
@@ -121,9 +138,28 @@ public class PipedInputStream extends InputStream
|
||||
*/
|
||||
public PipedInputStream(PipedOutputStream source) throws IOException
|
||||
{
|
||||
this();
|
||||
connect(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor creates a new <code>PipedInputStream</code> of the given
|
||||
* size and connects it to the passed in <code>PipedOutputStream</code>.
|
||||
* The stream is then ready for reading.
|
||||
*
|
||||
* @param source The <code>PipedOutputStream</code> to connect this
|
||||
* stream to
|
||||
*
|
||||
* @since 1.6
|
||||
* @exception IOException If <code>source</code> is already connected.
|
||||
*/
|
||||
public PipedInputStream(PipedOutputStream source, int pipeSize)
|
||||
throws IOException
|
||||
{
|
||||
this(pipeSize);
|
||||
connect(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method connects this stream to the passed in
|
||||
* <code>PipedOutputStream</code>.
|
||||
|
||||
@@ -76,7 +76,7 @@ public class PrintStream extends FilterOutputStream implements Appendable
|
||||
/**
|
||||
* Encoding name
|
||||
*/
|
||||
private String encoding;
|
||||
private final String encoding;
|
||||
|
||||
/**
|
||||
* This boolean indicates whether or not an error has ever occurred
|
||||
@@ -88,7 +88,7 @@ public class PrintStream extends FilterOutputStream implements Appendable
|
||||
* This is <code>true</code> if auto-flush is enabled,
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
private boolean auto_flush;
|
||||
private final boolean auto_flush;
|
||||
|
||||
/**
|
||||
* This method initializes a new <code>PrintStream</code> object to write
|
||||
@@ -185,16 +185,17 @@ public class PrintStream extends FilterOutputStream implements Appendable
|
||||
public PrintStream (OutputStream out, boolean auto_flush)
|
||||
{
|
||||
super (out);
|
||||
|
||||
String encoding;
|
||||
try {
|
||||
this.encoding = SystemProperties.getProperty("file.encoding");
|
||||
encoding = SystemProperties.getProperty("file.encoding");
|
||||
} catch (SecurityException e){
|
||||
this.encoding = "ISO8859_1";
|
||||
encoding = "ISO8859_1";
|
||||
} catch (IllegalArgumentException e){
|
||||
this.encoding = "ISO8859_1";
|
||||
encoding = "ISO8859_1";
|
||||
} catch (NullPointerException e){
|
||||
this.encoding = "ISO8859_1";
|
||||
encoding = "ISO8859_1";
|
||||
}
|
||||
this.encoding = encoding;
|
||||
this.auto_flush = auto_flush;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Class.java -- Representation of a Java class.
|
||||
Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006
|
||||
Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
@@ -66,7 +66,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
|
||||
/**
|
||||
@@ -596,7 +596,7 @@ public final class Class<T>
|
||||
*/
|
||||
private Field[] internalGetFields()
|
||||
{
|
||||
HashSet<Field> set = new HashSet<Field>();
|
||||
LinkedHashSet<Field> set = new LinkedHashSet<Field>();
|
||||
set.addAll(Arrays.asList(getDeclaredFields(true)));
|
||||
Class[] interfaces = getInterfaces();
|
||||
for (int i = 0; i < interfaces.length; i++)
|
||||
@@ -1151,7 +1151,7 @@ public final class Class<T>
|
||||
}
|
||||
try
|
||||
{
|
||||
return constructor.newInstance(null);
|
||||
return constructor.newInstance();
|
||||
}
|
||||
catch (InvocationTargetException e)
|
||||
{
|
||||
|
||||
@@ -518,7 +518,10 @@ public final class Double extends Number implements Comparable<Double>
|
||||
*/
|
||||
public static long doubleToLongBits(double value)
|
||||
{
|
||||
return VMDouble.doubleToLongBits(value);
|
||||
if (isNaN(value))
|
||||
return 0x7ff8000000000000L;
|
||||
else
|
||||
return VMDouble.doubleToRawLongBits(value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -587,16 +590,25 @@ public final class Double extends Number implements Comparable<Double>
|
||||
*/
|
||||
public static int compare(double x, double y)
|
||||
{
|
||||
if (isNaN(x))
|
||||
return isNaN(y) ? 0 : 1;
|
||||
if (isNaN(y))
|
||||
return -1;
|
||||
// recall that 0.0 == -0.0, so we convert to infinites and try again
|
||||
if (x == 0 && y == 0)
|
||||
return (int) (1 / x - 1 / y);
|
||||
if (x == y)
|
||||
return 0;
|
||||
// handle the easy cases:
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
|
||||
return x > y ? 1 : -1;
|
||||
// handle equality respecting that 0.0 != -0.0 (hence not using x == y):
|
||||
long lx = doubleToRawLongBits(x);
|
||||
long ly = doubleToRawLongBits(y);
|
||||
if (lx == ly)
|
||||
return 0;
|
||||
|
||||
// handle NaNs:
|
||||
if (x != x)
|
||||
return (y != y) ? 0 : 1;
|
||||
else if (y != y)
|
||||
return -1;
|
||||
|
||||
// handle +/- 0.0
|
||||
return (lx < ly) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,7 +526,10 @@ public final class Float extends Number implements Comparable<Float>
|
||||
*/
|
||||
public static int floatToIntBits(float value)
|
||||
{
|
||||
return VMFloat.floatToIntBits(value);
|
||||
if (isNaN(value))
|
||||
return 0x7fc00000;
|
||||
else
|
||||
return VMFloat.floatToRawIntBits(value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -594,16 +597,25 @@ public final class Float extends Number implements Comparable<Float>
|
||||
*/
|
||||
public static int compare(float x, float y)
|
||||
{
|
||||
if (isNaN(x))
|
||||
return isNaN(y) ? 0 : 1;
|
||||
if (isNaN(y))
|
||||
return -1;
|
||||
// recall that 0.0 == -0.0, so we convert to infinities and try again
|
||||
if (x == 0 && y == 0)
|
||||
return (int) (1 / x - 1 / y);
|
||||
if (x == y)
|
||||
return 0;
|
||||
// handle the easy cases:
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
|
||||
return x > y ? 1 : -1;
|
||||
// handle equality respecting that 0.0 != -0.0 (hence not using x == y):
|
||||
int ix = floatToRawIntBits(x);
|
||||
int iy = floatToRawIntBits(y);
|
||||
if (ix == iy)
|
||||
return 0;
|
||||
|
||||
// handle NaNs:
|
||||
if (x != x)
|
||||
return (y != y) ? 0 : 1;
|
||||
else if (y != y)
|
||||
return -1;
|
||||
|
||||
// handle +/- 0.0
|
||||
return (ix < iy) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,16 +705,19 @@ public final class Integer extends Number implements Comparable<Integer>
|
||||
if (len == 0)
|
||||
throw new NumberFormatException("string length is null");
|
||||
int ch = str.charAt(index);
|
||||
if (ch == '-' || ch == '+')
|
||||
if (ch == '-')
|
||||
{
|
||||
if (len == 1)
|
||||
if (ch == '-')
|
||||
throw new NumberFormatException("pure '-'");
|
||||
else if (ch == '+')
|
||||
throw new NumberFormatException("pure '+'");
|
||||
throw new NumberFormatException("pure '-'");
|
||||
isNeg = true;
|
||||
ch = str.charAt(++index);
|
||||
}
|
||||
else if (ch == '+')
|
||||
{
|
||||
if (len == 1)
|
||||
throw new NumberFormatException("pure '+'");
|
||||
ch = str.charAt(++index);
|
||||
}
|
||||
if (decode)
|
||||
{
|
||||
if (ch == '0')
|
||||
|
||||
@@ -296,7 +296,7 @@ public final class Long extends Number implements Comparable<Long>
|
||||
* @return the <code>Long</code>
|
||||
* @since 1.5
|
||||
*/
|
||||
public static synchronized Long valueOf(long val)
|
||||
public static Long valueOf(long val)
|
||||
{
|
||||
// We aren't required to cache here. We could, though perhaps we
|
||||
// ought to consider that as an empirical question.
|
||||
|
||||
@@ -202,7 +202,7 @@ public final class StackTraceElement implements Serializable
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (declaringClass != null)
|
||||
{
|
||||
sb.append(declaringClass);
|
||||
|
||||
@@ -1303,13 +1303,13 @@ public final class String
|
||||
break;
|
||||
if (i < 0)
|
||||
return this;
|
||||
char[] newStr = (char[]) value.clone();
|
||||
newStr[x] = newChar;
|
||||
char[] newStr = toCharArray();
|
||||
newStr[x - offset] = newChar;
|
||||
while (--i >= 0)
|
||||
if (value[++x] == oldChar)
|
||||
newStr[x] = newChar;
|
||||
newStr[x - offset] = newChar;
|
||||
// Package constructor avoids an array copy.
|
||||
return new String(newStr, offset, count, true);
|
||||
return new String(newStr, 0, count, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1430,6 +1430,47 @@ public final class String
|
||||
return Pattern.compile(regex).split(this, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert string to lower case for a Turkish locale that requires special
|
||||
* handling of '\u0049'
|
||||
*/
|
||||
private String toLowerCaseTurkish()
|
||||
{
|
||||
// First, see if the current string is already lower case.
|
||||
int i = count;
|
||||
int x = offset - 1;
|
||||
while (--i >= 0)
|
||||
{
|
||||
char ch = value[++x];
|
||||
if ((ch == '\u0049') || ch != Character.toLowerCase(ch))
|
||||
break;
|
||||
}
|
||||
if (i < 0)
|
||||
return this;
|
||||
|
||||
// Now we perform the conversion. Fortunately, there are no multi-character
|
||||
// lowercase expansions in Unicode 3.0.0.
|
||||
char[] newStr = new char[count];
|
||||
VMSystem.arraycopy(value, offset, newStr, 0, x - offset);
|
||||
do
|
||||
{
|
||||
char ch = value[x];
|
||||
// Hardcoded special case.
|
||||
if (ch != '\u0049')
|
||||
{
|
||||
newStr[x - offset] = Character.toLowerCase(ch);
|
||||
}
|
||||
else
|
||||
{
|
||||
newStr[x - offset] = '\u0131';
|
||||
}
|
||||
x++;
|
||||
}
|
||||
while (--i >= 0);
|
||||
// Package constructor avoids an array copy.
|
||||
return new String(newStr, 0, count, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lowercases this String according to a particular locale. This uses
|
||||
* Unicode's special case mappings, as applied to the given Locale, so the
|
||||
@@ -1444,32 +1485,40 @@ public final class String
|
||||
public String toLowerCase(Locale loc)
|
||||
{
|
||||
// First, see if the current string is already lower case.
|
||||
boolean turkish = "tr".equals(loc.getLanguage());
|
||||
int i = count;
|
||||
int x = offset - 1;
|
||||
while (--i >= 0)
|
||||
{
|
||||
char ch = value[++x];
|
||||
if ((turkish && ch == '\u0049')
|
||||
|| ch != Character.toLowerCase(ch))
|
||||
break;
|
||||
}
|
||||
if (i < 0)
|
||||
return this;
|
||||
|
||||
// Now we perform the conversion. Fortunately, there are no multi-character
|
||||
// lowercase expansions in Unicode 3.0.0.
|
||||
char[] newStr = (char[]) value.clone();
|
||||
do
|
||||
// Is loc turkish? String equality test is ok as Locale.language is interned
|
||||
if ("tr" == loc.getLanguage())
|
||||
{
|
||||
char ch = value[x];
|
||||
// Hardcoded special case.
|
||||
newStr[x++] = (turkish && ch == '\u0049') ? '\u0131'
|
||||
: Character.toLowerCase(ch);
|
||||
return toLowerCaseTurkish();
|
||||
}
|
||||
while (--i >= 0);
|
||||
// Package constructor avoids an array copy.
|
||||
return new String(newStr, offset, count, true);
|
||||
else
|
||||
{
|
||||
int i = count;
|
||||
int x = offset - 1;
|
||||
while (--i >= 0)
|
||||
{
|
||||
char ch = value[++x];
|
||||
if (ch != Character.toLowerCase(ch))
|
||||
break;
|
||||
}
|
||||
if (i < 0)
|
||||
return this;
|
||||
|
||||
// Now we perform the conversion. Fortunately, there are no
|
||||
// multi-character lowercase expansions in Unicode 3.0.0.
|
||||
char[] newStr = new char[count];
|
||||
VMSystem.arraycopy(value, offset, newStr, 0, x - offset);
|
||||
do
|
||||
{
|
||||
char ch = value[x];
|
||||
// Hardcoded special case.
|
||||
newStr[x - offset] = Character.toLowerCase(ch);
|
||||
x++;
|
||||
}
|
||||
while (--i >= 0);
|
||||
// Package constructor avoids an array copy.
|
||||
return new String(newStr, 0, count, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1487,21 +1536,12 @@ public final class String
|
||||
}
|
||||
|
||||
/**
|
||||
* Uppercases this String according to a particular locale. This uses
|
||||
* Unicode's special case mappings, as applied to the given Locale, so the
|
||||
* resulting string may be a different length.
|
||||
*
|
||||
* @param loc locale to use
|
||||
* @return new uppercased String, or this if no characters were uppercased
|
||||
* @throws NullPointerException if loc is null
|
||||
* @see #toLowerCase(Locale)
|
||||
* @since 1.1
|
||||
* Uppercase this string for a Turkish locale
|
||||
*/
|
||||
public String toUpperCase(Locale loc)
|
||||
private String toUpperCaseTurkish()
|
||||
{
|
||||
// First, see how many characters we have to grow by, as well as if the
|
||||
// current string is already upper case.
|
||||
boolean turkish = "tr".equals(loc.getLanguage());
|
||||
int expand = 0;
|
||||
boolean unchanged = true;
|
||||
int i = count;
|
||||
@@ -1511,7 +1551,7 @@ public final class String
|
||||
char ch = value[--x];
|
||||
expand += upperCaseExpansion(ch);
|
||||
unchanged = (unchanged && expand == 0
|
||||
&& ! (turkish && ch == '\u0069')
|
||||
&& ch != '\u0069'
|
||||
&& ch == Character.toUpperCase(ch));
|
||||
}
|
||||
if (unchanged)
|
||||
@@ -1521,16 +1561,24 @@ public final class String
|
||||
i = count;
|
||||
if (expand == 0)
|
||||
{
|
||||
char[] newStr = (char[]) value.clone();
|
||||
char[] newStr = new char[count];
|
||||
VMSystem.arraycopy(value, offset, newStr, 0, count - (x - offset));
|
||||
while (--i >= 0)
|
||||
{
|
||||
char ch = value[x];
|
||||
// Hardcoded special case.
|
||||
newStr[x++] = (turkish && ch == '\u0069') ? '\u0130'
|
||||
: Character.toUpperCase(ch);
|
||||
if (ch != '\u0069')
|
||||
{
|
||||
newStr[x - offset] = Character.toUpperCase(ch);
|
||||
}
|
||||
else
|
||||
{
|
||||
newStr[x - offset] = '\u0130';
|
||||
}
|
||||
x++;
|
||||
}
|
||||
// Package constructor avoids an array copy.
|
||||
return new String(newStr, offset, count, true);
|
||||
return new String(newStr, 0, count, true);
|
||||
}
|
||||
|
||||
// Expansion is necessary.
|
||||
@@ -1540,7 +1588,7 @@ public final class String
|
||||
{
|
||||
char ch = value[x++];
|
||||
// Hardcoded special case.
|
||||
if (turkish && ch == '\u0069')
|
||||
if (ch == '\u0069')
|
||||
{
|
||||
newStr[j++] = '\u0130';
|
||||
continue;
|
||||
@@ -1559,6 +1607,79 @@ public final class String
|
||||
return new String(newStr, 0, newStr.length, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uppercases this String according to a particular locale. This uses
|
||||
* Unicode's special case mappings, as applied to the given Locale, so the
|
||||
* resulting string may be a different length.
|
||||
*
|
||||
* @param loc locale to use
|
||||
* @return new uppercased String, or this if no characters were uppercased
|
||||
* @throws NullPointerException if loc is null
|
||||
* @see #toLowerCase(Locale)
|
||||
* @since 1.1
|
||||
*/
|
||||
public String toUpperCase(Locale loc)
|
||||
{
|
||||
// First, see how many characters we have to grow by, as well as if the
|
||||
// current string is already upper case.
|
||||
|
||||
// Is loc turkish? String equality test is ok as Locale.language is interned
|
||||
if ("tr" == loc.getLanguage())
|
||||
{
|
||||
return toUpperCaseTurkish();
|
||||
}
|
||||
else
|
||||
{
|
||||
int expand = 0;
|
||||
boolean unchanged = true;
|
||||
int i = count;
|
||||
int x = i + offset;
|
||||
while (--i >= 0)
|
||||
{
|
||||
char ch = value[--x];
|
||||
expand += upperCaseExpansion(ch);
|
||||
unchanged = (unchanged && expand == 0
|
||||
&& ch == Character.toUpperCase(ch));
|
||||
}
|
||||
if (unchanged)
|
||||
return this;
|
||||
|
||||
// Now we perform the conversion.
|
||||
i = count;
|
||||
if (expand == 0)
|
||||
{
|
||||
char[] newStr = new char[count];
|
||||
VMSystem.arraycopy(value, offset, newStr, 0, count - (x - offset));
|
||||
while (--i >= 0)
|
||||
{
|
||||
char ch = value[x];
|
||||
newStr[x - offset] = Character.toUpperCase(ch);
|
||||
x++;
|
||||
}
|
||||
// Package constructor avoids an array copy.
|
||||
return new String(newStr, 0, count, true);
|
||||
}
|
||||
|
||||
// Expansion is necessary.
|
||||
char[] newStr = new char[count + expand];
|
||||
int j = 0;
|
||||
while (--i >= 0)
|
||||
{
|
||||
char ch = value[x++];
|
||||
expand = upperCaseExpansion(ch);
|
||||
if (expand > 0)
|
||||
{
|
||||
int index = upperCaseIndex(ch);
|
||||
while (expand-- >= 0)
|
||||
newStr[j++] = upperExpand[index++];
|
||||
}
|
||||
else
|
||||
newStr[j++] = Character.toUpperCase(ch);
|
||||
}
|
||||
// Package constructor avoids an array copy.
|
||||
return new String(newStr, 0, newStr.length, true);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Uppercases this String. This uses Unicode's special case mappings, as
|
||||
* applied to the platform's default Locale, so the resulting string may
|
||||
@@ -1617,9 +1738,6 @@ public final class String
|
||||
*/
|
||||
public char[] toCharArray()
|
||||
{
|
||||
if (count == value.length)
|
||||
return (char[]) value.clone();
|
||||
|
||||
char[] copy = new char[count];
|
||||
VMSystem.arraycopy(value, offset, copy, 0, count);
|
||||
return copy;
|
||||
|
||||
@@ -832,7 +832,7 @@ public final class System
|
||||
* Blocks the retention of all elements in the specified
|
||||
* collection from the collection.
|
||||
*
|
||||
* @param c the collection of elements to retain.
|
||||
* @param coll the collection of elements to retain.
|
||||
* @return true if the other elements were removed.
|
||||
* @throws NullPointerException if the collection is null.
|
||||
* @throws NullPointerException if any collection entry is null.
|
||||
|
||||
@@ -411,7 +411,7 @@ public class Throwable implements Serializable
|
||||
// different threads to get mixed up when written to the same PrintWriter.
|
||||
private String stackTraceString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// Main stacktrace
|
||||
StackTraceElement[] stack = getStackTrace();
|
||||
@@ -455,7 +455,7 @@ public class Throwable implements Serializable
|
||||
|
||||
// Adds to the given StringBuffer a line containing the name and
|
||||
// all stacktrace elements minus the last equal ones.
|
||||
private static void stackTraceStringBuffer(StringBuffer sb, String name,
|
||||
private static void stackTraceStringBuffer(StringBuilder sb, String name,
|
||||
StackTraceElement[] stack, int equal)
|
||||
{
|
||||
String nl = StaticData.nl;
|
||||
|
||||
@@ -190,134 +190,6 @@ public class ThreadInfo
|
||||
*/
|
||||
private static CompositeType seType;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link ThreadInfo} corresponding
|
||||
* to the thread specified.
|
||||
*
|
||||
* @param thread the thread on which the new instance
|
||||
* will be based.
|
||||
* @param blockedCount the number of times the thread
|
||||
* has been blocked.
|
||||
* @param blockedTime the accumulated number of milliseconds
|
||||
* the specified thread has been blocked
|
||||
* (only used with contention monitoring enabled)
|
||||
* @param lock the monitor lock the thread is waiting for
|
||||
* (only used if blocked)
|
||||
* @param lockOwner the thread which owns the monitor lock, or
|
||||
* <code>null</code> if it doesn't have an owner
|
||||
* (only used if blocked)
|
||||
* @param waitedCount the number of times the thread has been in a
|
||||
* waiting state.
|
||||
* @param waitedTime the accumulated number of milliseconds the
|
||||
* specified thread has been waiting
|
||||
* (only used with contention monitoring enabled)
|
||||
* @param isInNative true if the thread is in a native method.
|
||||
* @param isSuspended true if the thread is suspended.
|
||||
* @param trace the stack trace of the thread to a pre-determined
|
||||
* depth (see VMThreadMXBeanImpl)
|
||||
*/
|
||||
private ThreadInfo(Thread thread, long blockedCount, long blockedTime,
|
||||
Object lock, Thread lockOwner, long waitedCount,
|
||||
long waitedTime, boolean isInNative, boolean isSuspended,
|
||||
StackTraceElement[] trace)
|
||||
{
|
||||
this(thread, blockedCount, blockedTime, lock, lockOwner, waitedCount,
|
||||
waitedTime, isInNative, isSuspended, trace, new MonitorInfo[]{},
|
||||
new LockInfo[]{});
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link ThreadInfo} corresponding
|
||||
* to the thread specified.
|
||||
*
|
||||
* @param thread the thread on which the new instance
|
||||
* will be based.
|
||||
* @param blockedCount the number of times the thread
|
||||
* has been blocked.
|
||||
* @param blockedTime the accumulated number of milliseconds
|
||||
* the specified thread has been blocked
|
||||
* (only used with contention monitoring enabled)
|
||||
* @param lock the monitor lock the thread is waiting for
|
||||
* (only used if blocked)
|
||||
* @param lockOwner the thread which owns the monitor lock, or
|
||||
* <code>null</code> if it doesn't have an owner
|
||||
* (only used if blocked)
|
||||
* @param waitedCount the number of times the thread has been in a
|
||||
* waiting state.
|
||||
* @param waitedTime the accumulated number of milliseconds the
|
||||
* specified thread has been waiting
|
||||
* (only used with contention monitoring enabled)
|
||||
* @param isInNative true if the thread is in a native method.
|
||||
* @param isSuspended true if the thread is suspended.
|
||||
* @param trace the stack trace of the thread to a pre-determined
|
||||
* depth (see VMThreadMXBeanImpl)
|
||||
* @param lockedMonitors an array of {@link MonitorInfo} objects
|
||||
* representing locks held on object monitors
|
||||
* by the thread.
|
||||
* @param lockedSynchronizers an array of {@link LockInfo} objects
|
||||
* representing locks held on ownable
|
||||
* synchronizers by the thread.
|
||||
* @since 1.6
|
||||
*/
|
||||
private ThreadInfo(Thread thread, long blockedCount, long blockedTime,
|
||||
Object lock, Thread lockOwner, long waitedCount,
|
||||
long waitedTime, boolean isInNative, boolean isSuspended,
|
||||
StackTraceElement[] trace, MonitorInfo[] lockedMonitors,
|
||||
LockInfo[] lockedSynchronizers)
|
||||
{
|
||||
this(thread.getId(), thread.getName(), thread.getState(), blockedCount, blockedTime,
|
||||
lock == null ? null : lock.getClass().getName() + "@" +
|
||||
Integer.toHexString(System.identityHashCode(lock)),
|
||||
lockOwner == null ? -1 : lockOwner.getId(),
|
||||
lockOwner == null ? null : lockOwner.getName(),
|
||||
waitedCount, waitedTime, isInNative, isSuspended,
|
||||
trace, lockedMonitors, lockedSynchronizers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link ThreadInfo} corresponding
|
||||
* to the thread details specified.
|
||||
*
|
||||
* @param threadId the id of the thread on which this
|
||||
* new instance will be based.
|
||||
* @param threadName the name of the thread on which
|
||||
* this new instance will be based.
|
||||
* @param threadState the state of the thread on which
|
||||
* this new instance will be based.
|
||||
* @param blockedCount the number of times the thread
|
||||
* has been blocked.
|
||||
* @param blockedTime the accumulated number of milliseconds
|
||||
* the specified thread has been blocked
|
||||
* (only used with contention monitoring enabled)
|
||||
* @param lockName the name of the monitor lock the thread is waiting for
|
||||
* (only used if blocked)
|
||||
* @param lockOwnerId the id of the thread which owns the monitor
|
||||
* lock, or <code>-1</code> if it doesn't have an owner
|
||||
* (only used if blocked)
|
||||
* @param lockOwnerName the name of the thread which owns the monitor
|
||||
* lock, or <code>null</code> if it doesn't have an
|
||||
* owner (only used if blocked)
|
||||
* @param waitedCount the number of times the thread has been in a
|
||||
* waiting state.
|
||||
* @param waitedTime the accumulated number of milliseconds the
|
||||
* specified thread has been waiting
|
||||
* (only used with contention monitoring enabled)
|
||||
* @param isInNative true if the thread is in a native method.
|
||||
* @param isSuspended true if the thread is suspended.
|
||||
* @param trace the stack trace of the thread to a pre-determined
|
||||
* depth (see VMThreadMXBeanImpl)
|
||||
*/
|
||||
private ThreadInfo(long threadId, String threadName, Thread.State threadState,
|
||||
long blockedCount, long blockedTime, String lockName,
|
||||
long lockOwnerId, String lockOwnerName, long waitedCount,
|
||||
long waitedTime, boolean isInNative, boolean isSuspended,
|
||||
StackTraceElement[] trace)
|
||||
{
|
||||
this(threadId, threadName, threadState, blockedCount, blockedTime,
|
||||
lockName, lockOwnerId, lockOwnerName, waitedCount, waitedTime,
|
||||
isInNative, isSuspended, trace, new MonitorInfo[]{}, new LockInfo[]{});
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link ThreadInfo} corresponding
|
||||
* to the thread details specified.
|
||||
|
||||
@@ -209,19 +209,19 @@ public final class Array
|
||||
if (array instanceof boolean[])
|
||||
return ((boolean[]) array)[index] ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (array instanceof byte[])
|
||||
return new Byte(((byte[]) array)[index]);
|
||||
return Byte.valueOf(((byte[]) array)[index]);
|
||||
if (array instanceof char[])
|
||||
return new Character(((char[]) array)[index]);
|
||||
return Character.valueOf(((char[]) array)[index]);
|
||||
if (array instanceof short[])
|
||||
return new Short(((short[]) array)[index]);
|
||||
return Short.valueOf(((short[]) array)[index]);
|
||||
if (array instanceof int[])
|
||||
return new Integer(((int[]) array)[index]);
|
||||
return Integer.valueOf(((int[]) array)[index]);
|
||||
if (array instanceof long[])
|
||||
return new Long(((long[]) array)[index]);
|
||||
return Long.valueOf(((long[]) array)[index]);
|
||||
if (array instanceof float[])
|
||||
return new Float(((float[]) array)[index]);
|
||||
return Float.valueOf(((float[]) array)[index]);
|
||||
if (array instanceof double[])
|
||||
return new Double(((double[]) array)[index]);
|
||||
return Double.valueOf(((double[]) array)[index]);
|
||||
if (array == null)
|
||||
throw new NullPointerException();
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
@@ -471,9 +471,9 @@ public class Proxy implements Serializable
|
||||
.getMethod("equals",
|
||||
new Class[] {Object.class}));
|
||||
coreMethods.put(sig, sig);
|
||||
sig = new ProxySignature(Object.class.getMethod("hashCode", null));
|
||||
sig = new ProxySignature(Object.class.getMethod("hashCode"));
|
||||
coreMethods.put(sig, sig);
|
||||
sig = new ProxySignature(Object.class.getMethod("toString", null));
|
||||
sig = new ProxySignature(Object.class.getMethod("toString"));
|
||||
coreMethods.put(sig, sig);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -1033,7 +1033,7 @@ public class Proxy implements Serializable
|
||||
code_length += 9; // new, dup_x1, swap, invokespecial, athrow
|
||||
}
|
||||
int handler_pc = code_length - 1;
|
||||
StringBuffer signature = new StringBuffer("(");
|
||||
StringBuilder signature = new StringBuilder("(");
|
||||
for (int j = 0; j < paramtypes.length; j++)
|
||||
signature.append(TypeSignature.getEncodingOfClass(paramtypes[j]));
|
||||
signature.append(")").append(TypeSignature.getEncodingOfClass(ret_type));
|
||||
@@ -1261,8 +1261,8 @@ public class Proxy implements Serializable
|
||||
// we're in the same package.
|
||||
m.flag = true;
|
||||
|
||||
Object[] args = {loader, qualName, bytecode, new Integer(0),
|
||||
new Integer(bytecode.length),
|
||||
Object[] args = {loader, qualName, bytecode, Integer.valueOf(0),
|
||||
Integer.valueOf(bytecode.length),
|
||||
Object.class.getProtectionDomain() };
|
||||
Class clazz = (Class) m.invoke(null, args);
|
||||
|
||||
@@ -1492,7 +1492,7 @@ public class Proxy implements Serializable
|
||||
if (i == len)
|
||||
return str;
|
||||
|
||||
final StringBuffer sb = new StringBuffer(str);
|
||||
final StringBuilder sb = new StringBuilder(str);
|
||||
sb.setLength(i);
|
||||
for ( ; i < len; i++)
|
||||
{
|
||||
@@ -1533,7 +1533,7 @@ public class Proxy implements Serializable
|
||||
int size = poolEntries.size() + 1;
|
||||
if (size >= 65535)
|
||||
throw new IllegalArgumentException("exceeds VM limitations");
|
||||
i = new Integer(size);
|
||||
i = Integer.valueOf(size);
|
||||
poolEntries.put(sequence, i);
|
||||
pool.append(sequence);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* java.math.BigInteger -- Arbitary precision integers
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -1313,7 +1313,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>
|
||||
int b = pMinus1.getLowestSetBit();
|
||||
|
||||
// Set m such that this = 1 + 2^b * m.
|
||||
BigInteger m = pMinus1.divide(valueOf(2L << b - 1));
|
||||
BigInteger m = pMinus1.divide(valueOf(2L).pow(b));
|
||||
|
||||
// The HAC (Handbook of Applied Cryptography), Alfred Menezes & al. Note
|
||||
// 4.49 (controlling the error probability) gives the number of trials
|
||||
|
||||
@@ -403,7 +403,7 @@ public class DatagramSocket
|
||||
if (timeout < 0)
|
||||
throw new IllegalArgumentException("Invalid timeout: " + timeout);
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
|
||||
getImpl().setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -450,7 +450,7 @@ public class DatagramSocket
|
||||
if (size < 0)
|
||||
throw new IllegalArgumentException("Buffer size is less than 0");
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size));
|
||||
getImpl().setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(size));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -497,7 +497,7 @@ public class DatagramSocket
|
||||
if (size < 0)
|
||||
throw new IllegalArgumentException("Buffer size is less than 0");
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
|
||||
getImpl().setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -916,7 +916,7 @@ public class DatagramSocket
|
||||
if (tc < 0 || tc > 255)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc));
|
||||
getImpl().setOption(SocketOptions.IP_TOS, Integer.valueOf(tc));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,7 @@ class ResolverCache
|
||||
/**
|
||||
* Return the hostname for the specified IP address.
|
||||
*
|
||||
* @param ip The IP address as a byte array
|
||||
* @param addr The IP address as a byte array
|
||||
*
|
||||
* @return The hostname
|
||||
*
|
||||
@@ -116,7 +116,7 @@ class ResolverCache
|
||||
public static String getHostByAddr(byte[] addr) throws UnknownHostException
|
||||
{
|
||||
Object key = makeHashableAddress(addr);
|
||||
Entry entry = (Entry) get(key);
|
||||
Entry entry = get(key);
|
||||
if (entry != null)
|
||||
{
|
||||
if (entry.value == null)
|
||||
@@ -149,7 +149,7 @@ class ResolverCache
|
||||
public static byte[][] getHostByName(String hostname)
|
||||
throws UnknownHostException
|
||||
{
|
||||
Entry entry = (Entry) get(hostname);
|
||||
Entry entry = get(hostname);
|
||||
if (entry != null)
|
||||
{
|
||||
if (entry.value == null)
|
||||
|
||||
@@ -469,7 +469,7 @@ public class ServerSocket
|
||||
if (timeout < 0)
|
||||
throw new IllegalArgumentException("SO_TIMEOUT value must be >= 0");
|
||||
|
||||
impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
|
||||
impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -556,7 +556,7 @@ public class ServerSocket
|
||||
if (size <= 0)
|
||||
throw new IllegalArgumentException("SO_RCVBUF value must be > 0");
|
||||
|
||||
impl.setOption(SocketOptions.SO_RCVBUF, new Integer(size));
|
||||
impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -844,7 +844,7 @@ public class Socket
|
||||
if (timeout < 0)
|
||||
throw new IllegalArgumentException("SO_TIMEOUT value must be >= 0");
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
|
||||
getImpl().setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -896,7 +896,7 @@ public class Socket
|
||||
if (size <= 0)
|
||||
throw new IllegalArgumentException("SO_SNDBUF value must be > 0");
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size));
|
||||
getImpl().setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(size));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -943,7 +943,7 @@ public class Socket
|
||||
if (size <= 0)
|
||||
throw new IllegalArgumentException("SO_RCVBUF value must be > 0");
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
|
||||
getImpl().setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1211,7 +1211,7 @@ public class Socket
|
||||
if (tc < 0 || tc > 255)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc));
|
||||
getImpl().setOption(SocketOptions.IP_TOS, Integer.valueOf(tc));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -483,7 +483,7 @@ public final class URI
|
||||
*/
|
||||
private static String quote(String str, String legalCharacters)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer(str.length());
|
||||
StringBuilder sb = new StringBuilder(str.length());
|
||||
for (int i = 0; i < str.length(); i++)
|
||||
{
|
||||
char c = str.charAt(i);
|
||||
@@ -778,8 +778,8 @@ public final class URI
|
||||
This follows the algorithm in section 5.2.4. of RFC3986,
|
||||
but doesn't modify the input buffer.
|
||||
*/
|
||||
StringBuffer input = new StringBuffer(relativePath);
|
||||
StringBuffer output = new StringBuffer();
|
||||
StringBuilder input = new StringBuilder(relativePath);
|
||||
StringBuilder output = new StringBuilder();
|
||||
int start = 0;
|
||||
while (start < input.length())
|
||||
{
|
||||
@@ -853,7 +853,7 @@ public final class URI
|
||||
*
|
||||
* @param buffer the buffer containing the path.
|
||||
*/
|
||||
private void removeLastSegment(StringBuffer buffer)
|
||||
private void removeLastSegment(StringBuilder buffer)
|
||||
{
|
||||
int lastSlash = buffer.lastIndexOf("/");
|
||||
if (lastSlash == -1)
|
||||
@@ -899,7 +899,7 @@ public final class URI
|
||||
path = "";
|
||||
if (! (path.startsWith("/")))
|
||||
{
|
||||
StringBuffer basepath = new StringBuffer(this.path);
|
||||
StringBuilder basepath = new StringBuilder(this.path);
|
||||
int i = this.path.lastIndexOf('/');
|
||||
|
||||
if (i >= 0)
|
||||
@@ -1321,7 +1321,8 @@ public final class URI
|
||||
int hCompare = host.compareTo(uri.getHost());
|
||||
if (hCompare != 0)
|
||||
return hCompare;
|
||||
return new Integer(port).compareTo(new Integer(uri.getPort()));
|
||||
int uriPort = uri.getPort();
|
||||
return (uriPort == port) ? 0 : (uriPort > port) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
if (rawPath == null && uri.getRawPath() != null)
|
||||
@@ -1387,8 +1388,8 @@ public final class URI
|
||||
{
|
||||
String strRep = toString();
|
||||
boolean inNonAsciiBlock = false;
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuffer encBuffer = null;
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
StringBuilder encBuffer = null;
|
||||
for (int i = 0; i < strRep.length(); i++)
|
||||
{
|
||||
char c = strRep.charAt(i);
|
||||
@@ -1405,7 +1406,7 @@ public final class URI
|
||||
{
|
||||
if (!inNonAsciiBlock)
|
||||
{
|
||||
encBuffer = new StringBuffer();
|
||||
encBuffer = new StringBuilder();
|
||||
inNonAsciiBlock = true;
|
||||
}
|
||||
encBuffer.append(c);
|
||||
@@ -1427,7 +1428,7 @@ public final class URI
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// this is far from optimal, but it works
|
||||
byte[] utf8 = str.getBytes("utf-8");
|
||||
for (int j = 0; j < utf8.length; j++)
|
||||
|
||||
@@ -452,7 +452,7 @@ public class URLClassLoader extends SecureClassLoader
|
||||
{
|
||||
// Compute the name of the package as it may appear in the
|
||||
// Manifest.
|
||||
StringBuffer xform = new StringBuffer(name);
|
||||
StringBuilder xform = new StringBuilder(name);
|
||||
for (int i = xform.length () - 1; i >= 0; --i)
|
||||
if (xform.charAt(i) == '.')
|
||||
xform.setCharAt(i, '/');
|
||||
@@ -641,7 +641,7 @@ public class URLClassLoader extends SecureClassLoader
|
||||
{
|
||||
if (thisString == null)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(this.getClass().getName());
|
||||
sb.append("{urls=[" );
|
||||
URL[] thisURLs = getURLs();
|
||||
|
||||
@@ -113,7 +113,7 @@ public class URLEncoder
|
||||
int start = 0;
|
||||
int i = 0;
|
||||
|
||||
StringBuffer result = new StringBuffer(length);
|
||||
StringBuilder result = new StringBuilder(length);
|
||||
while (true)
|
||||
{
|
||||
while (i < length && isSafe(s.charAt(i)))
|
||||
|
||||
@@ -234,7 +234,7 @@ public abstract class Charset implements Comparable<Charset>
|
||||
{
|
||||
for (Iterator<Charset> i = providers[j].charsets(); i.hasNext(); )
|
||||
{
|
||||
Charset cs = (Charset) i.next();
|
||||
Charset cs = i.next();
|
||||
charsets.put(cs.name(), cs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class CoderResult
|
||||
if (length <= 0)
|
||||
throw new IllegalArgumentException ("Non-positive length");
|
||||
|
||||
Integer len = new Integer (length);
|
||||
Integer len = Integer.valueOf (length);
|
||||
CoderResult cr = null;
|
||||
Object o;
|
||||
if ((o = cache.get (len)) != null)
|
||||
|
||||
@@ -37,8 +37,6 @@ exception statement from your version. */
|
||||
|
||||
package java.security;
|
||||
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -113,7 +111,7 @@ public class SecureClassLoader extends ClassLoader
|
||||
{
|
||||
synchronized (protectionDomainCache)
|
||||
{
|
||||
protectionDomain = (ProtectionDomain)protectionDomainCache.get(cs);
|
||||
protectionDomain = protectionDomainCache.get(cs);
|
||||
}
|
||||
|
||||
if (protectionDomain == null)
|
||||
@@ -122,8 +120,7 @@ public class SecureClassLoader extends ClassLoader
|
||||
= new ProtectionDomain(cs, getPermissions(cs), this, null);
|
||||
synchronized (protectionDomainCache)
|
||||
{
|
||||
ProtectionDomain domain
|
||||
= (ProtectionDomain)protectionDomainCache.get(cs);
|
||||
ProtectionDomain domain = protectionDomainCache.get(cs);
|
||||
if (domain == null)
|
||||
protectionDomainCache.put(cs, protectionDomain);
|
||||
else
|
||||
|
||||
@@ -702,7 +702,7 @@ public final class Security
|
||||
return true;
|
||||
|
||||
// assume value is a number. cehck for greater-than-or-equal
|
||||
return (new Integer(val).intValue() >= new Integer(realVal).intValue());
|
||||
return (Integer.parseInt(val) >= Integer.parseInt(realVal));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ import gnu.java.security.Engine;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.Provider;
|
||||
|
||||
@@ -55,12 +55,12 @@ public class RSAKeyGenParameterSpec implements AlgorithmParameterSpec
|
||||
/**
|
||||
Public Exponent F0 = 3
|
||||
*/
|
||||
public static final BigInteger F0 = new BigInteger("3");
|
||||
public static final BigInteger F0 = BigInteger.valueOf(3);
|
||||
|
||||
/**
|
||||
Public Exponent F4 = 3
|
||||
*/
|
||||
public static final BigInteger F4 = new BigInteger("65537");
|
||||
public static final BigInteger F4 = BigInteger.valueOf(65537L);
|
||||
|
||||
/**
|
||||
Create a new RSAKeyGenParameterSpec to store the RSA key's keysize
|
||||
|
||||
@@ -114,10 +114,10 @@ public class ChoiceFormat extends NumberFormat
|
||||
|
||||
if (index == max)
|
||||
throw new IllegalArgumentException ("unexpected end of text");
|
||||
Double d = new Double (newPattern.substring(dstart, index));
|
||||
Double d = Double.valueOf (newPattern.substring(dstart, index));
|
||||
|
||||
if (newPattern.charAt(index) == '<')
|
||||
d = new Double (nextDouble (d.doubleValue()));
|
||||
d = Double.valueOf (nextDouble (d.doubleValue()));
|
||||
|
||||
limitVec.addElement(d);
|
||||
|
||||
@@ -404,11 +404,11 @@ public class ChoiceFormat extends NumberFormat
|
||||
if (sourceStr.startsWith(choiceFormats[i], index))
|
||||
{
|
||||
pos.setIndex(index + choiceFormats[i].length());
|
||||
return new Double (choiceLimits[i]);
|
||||
return Double.valueOf (choiceLimits[i]);
|
||||
}
|
||||
}
|
||||
pos.setErrorIndex(index);
|
||||
return new Double (Double.NaN);
|
||||
return Double.valueOf (Double.NaN);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,7 +73,7 @@ public final class CollationElementIterator
|
||||
/**
|
||||
* This is the String that is being iterated over.
|
||||
*/
|
||||
String text;
|
||||
CharacterIterator text;
|
||||
|
||||
/**
|
||||
* This is the index into the collation decomposition where we are currently scanning.
|
||||
@@ -111,6 +111,21 @@ public final class CollationElementIterator
|
||||
setText (text);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes a new instance of <code>CollationElementIterator</code>
|
||||
* to iterate over the specified <code>String</code> using the rules in the
|
||||
* specified <code>RuleBasedCollator</code>.
|
||||
*
|
||||
* @param collator The <code>RuleBasedCollation</code> used for calculating collation values
|
||||
* @param text The character iterator to iterate over.
|
||||
*/
|
||||
CollationElementIterator(RuleBasedCollator collator, CharacterIterator text)
|
||||
{
|
||||
this.collator = collator;
|
||||
|
||||
setText (text);
|
||||
}
|
||||
|
||||
RuleBasedCollator.CollationElement nextBlock()
|
||||
{
|
||||
if (index >= text_decomposition.length)
|
||||
@@ -246,7 +261,7 @@ public final class CollationElementIterator
|
||||
int alreadyExpanded = 0;
|
||||
int idxToMove = 0;
|
||||
|
||||
this.text = text;
|
||||
this.text = new StringCharacterIterator(text);
|
||||
this.index = 0;
|
||||
|
||||
String work_text = text.intern();
|
||||
@@ -440,7 +455,7 @@ public final class CollationElementIterator
|
||||
if (offset < 0)
|
||||
throw new IllegalArgumentException("Negative offset: " + offset);
|
||||
|
||||
if (offset > (text.length() - 1))
|
||||
if (offset > (text.getEndIndex() - 1))
|
||||
throw new IllegalArgumentException("Offset too large: " + offset);
|
||||
|
||||
for (index = 0; index < text_decomposition.length; index++)
|
||||
|
||||
@@ -716,15 +716,15 @@ public class DecimalFormat extends NumberFormat
|
||||
if (this.parseBigDecimal)
|
||||
{
|
||||
if (isNegative)
|
||||
return new BigDecimal(Double.NEGATIVE_INFINITY);
|
||||
return BigDecimal.valueOf(Double.NEGATIVE_INFINITY);
|
||||
|
||||
return new BigDecimal(Double.POSITIVE_INFINITY);
|
||||
return BigDecimal.valueOf(Double.POSITIVE_INFINITY);
|
||||
}
|
||||
|
||||
if (isNegative)
|
||||
return new Double(Double.NEGATIVE_INFINITY);
|
||||
return Double.valueOf(Double.NEGATIVE_INFINITY);
|
||||
|
||||
return new Double(Double.POSITIVE_INFINITY);
|
||||
return Double.valueOf(Double.POSITIVE_INFINITY);
|
||||
}
|
||||
|
||||
// no number...
|
||||
@@ -771,21 +771,21 @@ public class DecimalFormat extends NumberFormat
|
||||
|
||||
// want integer?
|
||||
if (this.parseIntegerOnly)
|
||||
return new Long(bigDecimal.longValue());
|
||||
return Long.valueOf(bigDecimal.longValue());
|
||||
|
||||
// 3th special case -0.0
|
||||
if (isNegative && (bigDecimal.compareTo(BigDecimal.ZERO) == 0))
|
||||
return new Double(-0.0);
|
||||
return Double.valueOf(-0.0);
|
||||
|
||||
try
|
||||
{
|
||||
BigDecimal integer
|
||||
= bigDecimal.setScale(0, BigDecimal.ROUND_UNNECESSARY);
|
||||
return new Long(integer.longValue());
|
||||
return Long.valueOf(integer.longValue());
|
||||
}
|
||||
catch (ArithmeticException e)
|
||||
{
|
||||
return new Double(bigDecimal.doubleValue());
|
||||
return Double.valueOf(bigDecimal.doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1787,7 +1787,7 @@ public class DecimalFormat extends NumberFormat
|
||||
int endIndexFract = 0;
|
||||
|
||||
// compute the multiplier to use with percent and similar
|
||||
number = number.multiply(new BigDecimal(_multiplier));
|
||||
number = number.multiply(BigDecimal.valueOf(_multiplier));
|
||||
|
||||
// XXX: special case, not sure if it belongs here or if it is
|
||||
// correct at all. There may be other special cases as well
|
||||
|
||||
@@ -498,7 +498,7 @@ public class MessageFormat extends Format
|
||||
int position = output_iterator.getEndIndex();
|
||||
|
||||
hash_argument.put (MessageFormat.Field.ARGUMENT,
|
||||
new Integer(elements[i].argNumber));
|
||||
Integer.valueOf(elements[i].argNumber));
|
||||
|
||||
|
||||
if (iterator != null)
|
||||
@@ -630,7 +630,7 @@ public class MessageFormat extends Format
|
||||
// have recursive formatting.
|
||||
ChoiceFormat cf = (ChoiceFormat) formatter;
|
||||
String[] formats = (String[]) cf.getFormats();
|
||||
double[] limits = (double[]) cf.getLimits();
|
||||
double[] limits = cf.getLimits();
|
||||
MessageFormat subfmt = new MessageFormat ();
|
||||
subfmt.setLocale(locale);
|
||||
ParsePosition subpos = new ParsePosition (index);
|
||||
|
||||
@@ -923,17 +923,8 @@ element_loop:
|
||||
* @return A <code>CollationElementIterator</code> for the specified <code>String</code>.
|
||||
*/
|
||||
public CollationElementIterator getCollationElementIterator(CharacterIterator source)
|
||||
throws NotImplementedException // Because decomposeCharacter does not work
|
||||
{
|
||||
StringBuffer expand = new StringBuffer("");
|
||||
|
||||
// Right now we assume that we will read from the beginning of the string.
|
||||
for (char c = source.first();
|
||||
c != CharacterIterator.DONE;
|
||||
c = source.next())
|
||||
decomposeCharacter(c, expand);
|
||||
|
||||
return getCollationElementIterator(expand.toString());
|
||||
return new CollationElementIterator(this, source);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -139,9 +139,9 @@ public class SimpleDateFormat extends DateFormat
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer builder;
|
||||
StringBuilder builder;
|
||||
|
||||
builder = new StringBuffer(getClass().getName());
|
||||
builder = new StringBuilder(getClass().getName());
|
||||
builder.append("[field=");
|
||||
builder.append(field);
|
||||
builder.append(", size=");
|
||||
@@ -322,7 +322,7 @@ public class SimpleDateFormat extends DateFormat
|
||||
// Look for the terminating quote. However, if we
|
||||
// see a '', that represents a literal quote and
|
||||
// we must iterate.
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
int oldPos = i + 1;
|
||||
do
|
||||
{
|
||||
@@ -346,7 +346,7 @@ public class SimpleDateFormat extends DateFormat
|
||||
else
|
||||
{
|
||||
// A special character
|
||||
tokens.add(new Character(thisChar));
|
||||
tokens.add(Character.valueOf(thisChar));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -372,7 +372,7 @@ public class SimpleDateFormat extends DateFormat
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer output = new StringBuffer(getClass().getName());
|
||||
StringBuilder output = new StringBuilder(getClass().getName());
|
||||
output.append("[tokens=");
|
||||
output.append(tokens);
|
||||
output.append(", formatData=");
|
||||
@@ -554,7 +554,7 @@ public class SimpleDateFormat extends DateFormat
|
||||
String oldChars, String newChars)
|
||||
{
|
||||
int len = pattern.length();
|
||||
StringBuffer buf = new StringBuffer(len);
|
||||
StringBuilder buf = new StringBuilder(len);
|
||||
boolean quoted = false;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
@@ -1279,12 +1279,12 @@ public class SimpleDateFormat extends DateFormat
|
||||
|
||||
// advance the index
|
||||
pos.setIndex(pos.getIndex() + matcher.end());
|
||||
return new Integer(offset);
|
||||
return Integer.valueOf(offset);
|
||||
}
|
||||
else if (zoneString.startsWith("GMT"))
|
||||
{
|
||||
pos.setIndex(pos.getIndex() + 3);
|
||||
return new Integer(0);
|
||||
return Integer.valueOf(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -524,7 +524,7 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
|
||||
public String toString()
|
||||
{
|
||||
Iterator<Map.Entry<K, V>> entries = entrySet().iterator();
|
||||
StringBuffer r = new StringBuffer("{");
|
||||
StringBuilder r = new StringBuilder("{");
|
||||
for (int pos = size(); pos > 0; pos--)
|
||||
{
|
||||
Map.Entry<K, V> entry = entries.next();
|
||||
|
||||
@@ -572,7 +572,7 @@ public abstract class Calendar
|
||||
* Cache of locale->calendar-class mappings. This avoids having to do a ResourceBundle
|
||||
* lookup for every getInstance call.
|
||||
*/
|
||||
private static HashMap<Locale,Class> cache = new HashMap<Locale,Class>();
|
||||
private static final HashMap<Locale,Class> cache = new HashMap<Locale,Class>();
|
||||
|
||||
/** Preset argument types for calendar-class constructor lookup. */
|
||||
private static Class[] ctorArgTypes = new Class[]
|
||||
@@ -1266,7 +1266,7 @@ public abstract class Calendar
|
||||
|
||||
/**
|
||||
* Compares the time of two calendar instances.
|
||||
* @param calendar the calendar to which the time should be compared.
|
||||
* @param cal the calendar to which the time should be compared.
|
||||
* @return 0 if the two calendars are set to the same time,
|
||||
* less than 0 if the time of this calendar is before that of
|
||||
* <code>cal</code>, or more than 0 if the time of this calendar is after
|
||||
@@ -1328,8 +1328,8 @@ public abstract class Calendar
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(getClass().getName()).append('[');
|
||||
StringBuilder sb = new StringBuilder(getClass().getName());
|
||||
sb.append('[');
|
||||
sb.append("time=");
|
||||
if (isTimeSet)
|
||||
sb.append(time);
|
||||
|
||||
@@ -6167,7 +6167,7 @@ public class Collections
|
||||
* correct type.
|
||||
*
|
||||
* @param index the index at which to place the new element.
|
||||
* @param c the collections of objects to add.
|
||||
* @param coll the collections of objects to add.
|
||||
* @throws ClassCastException if the type of any element in c is not a
|
||||
* valid type for the underlying collection.
|
||||
*/
|
||||
@@ -6870,7 +6870,7 @@ public class Collections
|
||||
* Adds all pairs within the supplied map to the underlying map,
|
||||
* provided they are all have the correct key and value types.
|
||||
*
|
||||
* @param m the map, the entries of which should be added
|
||||
* @param map the map, the entries of which should be added
|
||||
* to the underlying map.
|
||||
* @throws ClassCastException if the type of a key or value is
|
||||
* not a valid type for the underlying map.
|
||||
|
||||
@@ -722,7 +722,7 @@ public class Date
|
||||
boolean localTimezone = true;
|
||||
|
||||
// Trim out any nested stuff in parentheses now to make parsing easier.
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
int parenNesting = 0;
|
||||
int len = string.length();
|
||||
for (int i = 0; i < len; i++)
|
||||
|
||||
@@ -291,7 +291,7 @@ public final class Formatter
|
||||
* If the locale is <code>null</code>, then no localization is
|
||||
* applied.
|
||||
*
|
||||
* @param file the output stream.
|
||||
* @param out the output stream.
|
||||
* @param charset the character set to use for output.
|
||||
* @param loc the locale to use.
|
||||
* @throws UnsupportedEncodingException if the supplied character
|
||||
@@ -1427,7 +1427,7 @@ public final class Formatter
|
||||
* Outputs a formatted string based on the supplied specification,
|
||||
* <code>fmt</code>, and its arguments using the formatter's locale.
|
||||
*
|
||||
* @param fmt the format specification.
|
||||
* @param format the format specification.
|
||||
* @param args the arguments to apply to the specification.
|
||||
* @throws IllegalFormatException if there is a problem with
|
||||
* the syntax of the format
|
||||
|
||||
@@ -579,7 +579,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
|
||||
// would repeatedly re-lock/release the monitor, we directly use the
|
||||
// unsynchronized EntryIterator instead.
|
||||
Iterator<Map.Entry<K, V>> entries = new EntryIterator();
|
||||
StringBuffer r = new StringBuffer("{");
|
||||
StringBuilder r = new StringBuilder("{");
|
||||
for (int pos = size; pos > 0; pos--)
|
||||
{
|
||||
r.append(entries.next());
|
||||
@@ -1088,7 +1088,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
|
||||
* <code>next()</code> gives a different result, by returning just
|
||||
* the key rather than the whole element.
|
||||
*/
|
||||
private EntryIterator iterator;
|
||||
private final EntryIterator iterator;
|
||||
|
||||
/**
|
||||
* Construct a new KeyIterator
|
||||
@@ -1153,7 +1153,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
|
||||
* <code>next()</code> gives a different result, by returning just
|
||||
* the value rather than the whole element.
|
||||
*/
|
||||
private EntryIterator iterator;
|
||||
private final EntryIterator iterator;
|
||||
|
||||
/**
|
||||
* Construct a new KeyIterator
|
||||
@@ -1294,7 +1294,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
|
||||
* <code>nextElement()</code> gives a different result, by returning just
|
||||
* the key rather than the whole element.
|
||||
*/
|
||||
private EntryEnumerator enumerator;
|
||||
private final EntryEnumerator enumerator;
|
||||
|
||||
/**
|
||||
* Construct a new KeyEnumerator
|
||||
@@ -1355,7 +1355,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
|
||||
* <code>nextElement()</code> gives a different result, by returning just
|
||||
* the value rather than the whole element.
|
||||
*/
|
||||
private EntryEnumerator enumerator;
|
||||
private final EntryEnumerator enumerator;
|
||||
|
||||
/**
|
||||
* Construct a new ValueEnumerator
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* LinkedHashSet.java -- a set backed by a LinkedHashMap, for linked
|
||||
list traversal.
|
||||
Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -98,7 +98,7 @@ public class LinkedHashSet<T> extends HashSet<T>
|
||||
|
||||
/**
|
||||
* Construct a new, empty HashSet whose backing HashMap has the default
|
||||
* capacity (11) and loadFacor (0.75).
|
||||
* capacity (11) and loadFactor (0.75).
|
||||
*/
|
||||
public LinkedHashSet()
|
||||
{
|
||||
|
||||
@@ -178,21 +178,21 @@ public final class Locale implements Serializable, Cloneable
|
||||
*
|
||||
* @serial the languange, possibly ""
|
||||
*/
|
||||
private String language;
|
||||
private final String language;
|
||||
|
||||
/**
|
||||
* The country code, as returned by getCountry().
|
||||
*
|
||||
* @serial the country, possibly ""
|
||||
*/
|
||||
private String country;
|
||||
private final String country;
|
||||
|
||||
/**
|
||||
* The variant code, as returned by getVariant().
|
||||
*
|
||||
* @serial the variant, possibly ""
|
||||
*/
|
||||
private String variant;
|
||||
private final String variant;
|
||||
|
||||
/**
|
||||
* This is the cached hashcode. When writing to stream, we write -1.
|
||||
@@ -324,13 +324,12 @@ public final class Locale implements Serializable, Cloneable
|
||||
// default locale.
|
||||
if (defaultLocale != null)
|
||||
{
|
||||
language = convertLanguage(language).intern();
|
||||
country = country.toUpperCase().intern();
|
||||
variant = variant.intern();
|
||||
language = convertLanguage(language);
|
||||
country = country.toUpperCase();
|
||||
}
|
||||
this.language = language;
|
||||
this.country = country;
|
||||
this.variant = variant;
|
||||
this.language = language.intern();
|
||||
this.country = country.intern();
|
||||
this.variant = variant.intern();
|
||||
hashcode = language.hashCode() ^ country.hashCode() ^ variant.hashCode();
|
||||
}
|
||||
|
||||
@@ -1022,9 +1021,6 @@ public final class Locale implements Serializable, Cloneable
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
s.defaultReadObject();
|
||||
language = language.intern();
|
||||
country = country.intern();
|
||||
variant = variant.intern();
|
||||
hashcode = language.hashCode() ^ country.hashCode() ^ variant.hashCode();
|
||||
}
|
||||
} // class Locale
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -138,7 +138,7 @@ public class Manifest implements Cloneable
|
||||
*/
|
||||
public Attributes getAttributes(String entryName)
|
||||
{
|
||||
return (Attributes) getEntries().get(entryName);
|
||||
return getEntries().get(entryName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -357,7 +357,7 @@ public class ZipEntry implements ZipConstants, Cloneable
|
||||
| (extra[pos+2] & 0xff) << 8
|
||||
| (extra[pos+3] & 0xff) << 16
|
||||
| (extra[pos+4] & 0xff) << 24);
|
||||
setTime(time);
|
||||
setTime(time*1000);
|
||||
}
|
||||
}
|
||||
pos += len;
|
||||
|
||||
Reference in New Issue
Block a user