If the font has a type 4 cmap for the Unicode platform
* (encoding 0, 1, 2, 3 or 4), or a type 4 cmap for the Microsoft
* platform (encodings 1 or 10), that table is used to map Unicode
@@ -132,7 +132,7 @@ public abstract class CharGlyphMap
version = buf.getChar();
if (version != 0)
return null;
-
+
numTables = buf.getChar();
for (int i = 0; i < numTables; i++)
{
@@ -229,8 +229,8 @@ public abstract class CharGlyphMap
return 0;
}
}
-
-
+
+
/**
* A mapping from Unicode code points to glyph IDs through CMAP Type
* 0 tables. These tables have serious limitations: Only the first
@@ -255,8 +255,8 @@ public abstract class CharGlyphMap
* Unicode code point of glyph i in the font.
*/
private char[] glyphToUCS2 = new char[256];
-
-
+
+
/**
* A String whose charAt(i) is the Unicode character
* that corresponds to the codepoint i + 127 in the
@@ -562,7 +562,7 @@ public abstract class CharGlyphMap
/* The CMAP version must be 0. */
if (buf.getChar() != 0)
throw new IllegalStateException();
-
+
numTables = buf.getChar();
for (int i = 0; i < numTables; i++)
{
@@ -705,7 +705,7 @@ public abstract class CharGlyphMap
return null;
}
}
-
+
/**
* A mapping from Unicode code points to glyph IDs through CMAP Type
@@ -805,7 +805,7 @@ public abstract class CharGlyphMap
buf.position(pos);
idRangeOffset_glyphID = buf.asCharBuffer();
-
+
endCode.limit(segCount);
startCode.limit(segCount);
idDelta.limit(segCount);
@@ -856,7 +856,7 @@ public abstract class CharGlyphMap
segStart = firstChar.get(segment);
if ((c < segStart) || (c > lastChar.get(segment)))
return 0;
-
+
/*
* System.out.println("seg " + segment
* + ", range=" + (int) rangeID[segment]
@@ -912,8 +912,8 @@ public abstract class CharGlyphMap
{
int numGroups;
IntBuffer data;
-
-
+
+
/**
* Determines whether this implementation supports a combination
* of platform and encoding for a type 12 cmap table.
@@ -964,8 +964,8 @@ public abstract class CharGlyphMap
numGroups = buf.getInt();
data = buf.asIntBuffer();
}
-
-
+
+
/**
* Determines the glyph index for a given Unicode codepoint. Users
* should be aware that the character-to-glyph mapping not not
@@ -993,7 +993,7 @@ public abstract class CharGlyphMap
startCharCode = data.get(3 * mid);
endCharCode = data.get(3 * mid + 1);
-
+
/*
System.out.println("group " + mid + " (U+"
+ Integer.toHexString(startCharCode)
@@ -1005,7 +1005,7 @@ public abstract class CharGlyphMap
return ucs4
- startCharCode
+ /* startGlyphID */ data.get(mid * 3 + 2);
-
+
if (endCharCode < ucs4)
min = mid + 1;
else
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/GlyphNamer.java b/libjava/classpath/gnu/java/awt/font/opentype/GlyphNamer.java
index c2b009d..72cecb5 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/GlyphNamer.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/GlyphNamer.java
@@ -411,7 +411,7 @@ final class GlyphNamer
readPost();
}
-
+
/**
* Sets up the information which allows to retrieve the information
@@ -625,7 +625,7 @@ final class GlyphNamer
* print " private static final String %s" % name
* for i in range(0, len(s), 60):
* print ' + "%s"' % s[i:i+60]
- *
+ *
* glyphs = {}
* for line in open('aglfn13.txt', 'r').readlines():
* if line[0] == '#': continue
@@ -1009,7 +1009,7 @@ final class GlyphNamer
*/
min = 0;
max = AGLFN_GLYPHS.length() - 1;
- mid = max >> 1;
+ mid = max >> 1;
midChar = AGLFN_GLYPHS.charAt(mid);
do
{
@@ -1023,7 +1023,7 @@ final class GlyphNamer
midChar = AGLFN_GLYPHS.charAt(mid);
}
while (min < max);
-
+
if (midChar != c)
return null;
@@ -1078,7 +1078,7 @@ final class GlyphNamer
if (name != null)
return name;
}
-
+
CPStringBuilder buf = new CPStringBuilder(numChars * 8);
for (int i = 0; i < numChars; i++)
{
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/MacResourceFork.java b/libjava/classpath/gnu/java/awt/font/opentype/MacResourceFork.java
index 8115e04..c0f3de8 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/MacResourceFork.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/MacResourceFork.java
@@ -123,7 +123,7 @@ final class MacResourceFork
}
}
}
-
+
public Resource[] getResources(int type)
{
@@ -137,7 +137,7 @@ final class MacResourceFork
}
return null;
}
-
+
public Resource getResource(int type, short id)
{
@@ -149,7 +149,7 @@ final class MacResourceFork
{
if (types[i] != type)
continue;
-
+
res = resources[i];
for (int j = 0; j < res.length; j++)
if (res[j].getID() == id)
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/NameDecoder.java b/libjava/classpath/gnu/java/awt/font/opentype/NameDecoder.java
index e4ea202..1f1d50a 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/NameDecoder.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/NameDecoder.java
@@ -139,20 +139,20 @@ public class NameDecoder
nameLen = nameTable.getShort();
nameStart = offset + nameTable.getShort();
-
+
if (nameID != name)
continue;
// Handle PS seperately as it can be only ASCII, although
// possibly encoded as UTF-16BE
if ( name == NAME_POSTSCRIPT )
- {
- if( nameTable.get(nameStart) == 0 ) // Peek at top byte
- result = decodeName("UTF-16BE", nameTable, nameStart, nameLen);
- else
- result = decodeName("ASCII", nameTable, nameStart, nameLen);
- return result;
- }
+ {
+ if( nameTable.get(nameStart) == 0 ) // Peek at top byte
+ result = decodeName("UTF-16BE", nameTable, nameStart, nameLen);
+ else
+ result = decodeName("ASCII", nameTable, nameStart, nameLen);
+ return result;
+ }
match = false;
switch (namePlatform)
@@ -186,7 +186,7 @@ public class NameDecoder
break;
}
-
+
if (match)
{
result = decodeName(namePlatform, nameEncoding, nameLanguage,
@@ -316,7 +316,7 @@ public class NameDecoder
if (loc == null)
return -1;
-
+
code = findLanguageCode(loc.getLanguage(), macLanguageCodes);
switch (code)
{
@@ -333,10 +333,10 @@ public class NameDecoder
// know what do do about them. See the method documentation for
// details.
}
-
+
return code;
}
-
+
/**
* Maps a Java Locale into a Microsoft language code.
@@ -348,7 +348,7 @@ public class NameDecoder
if (locale == null)
return -1;
-
+
isoCode = locale.getLanguage();
code = findLanguageCode(isoCode, microsoftLanguageCodes);
if (code == -1)
@@ -572,7 +572,7 @@ public class NameDecoder
}
}
-
+
/**
* Maps a Microsoft locale ID (LCID) to the name of the
* corresponding Java Charset.
@@ -664,7 +664,7 @@ public class NameDecoder
case 3: /* Microsoft Windows */
return getWindowsLocale(language);
-
+
default:
return null;
}
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java b/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java
index 6c2193b..f46addc 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java
@@ -83,7 +83,7 @@ public final class OpenTypeFont
static final int TAG_TRUE = 0x74727565; // 'true'
static final int TAG_TTCF = 0x74746366; // 'ttcf'
static final int TAG_ZAPF = 0x5a617066; // 'Zapf'
-
+
/**
* A buffer containing the font data. Note that this may well be an
@@ -112,7 +112,7 @@ public final class OpenTypeFont
*/
private int version;
-
+
/**
* The number of font units per em. For fonts with TrueType
* outlines, this is usually a power of two (such as 2048). For
@@ -133,7 +133,7 @@ public final class OpenTypeFont
* The scaler to which the actual scaling work is delegated.
*/
private Scaler scaler;
-
+
/**
* A delegate object for mapping Unicode UCS-4 codepoints to glyph
@@ -277,8 +277,8 @@ public final class OpenTypeFont
return i;
return -1;
}
-
-
+
+
/**
* Returns the name of the family to which this font face belongs,
@@ -352,8 +352,8 @@ public final class OpenTypeFont
return name;
}
-
-
+
+
/**
* Returns the full name of this font face, for example
@@ -404,7 +404,7 @@ public final class OpenTypeFont
*/
return numGlyphs;
}
-
+
/**
* Returns the index of the glyph which gets displayed if the font
@@ -489,7 +489,7 @@ public final class OpenTypeFont
result.limit(len);
return result;
}
-
+
/**
* Returns the size of one of the tables in the font,
@@ -508,7 +508,7 @@ public final class OpenTypeFont
{
if (cmap != null)
return cmap;
-
+
synchronized (this)
{
if (cmap == null)
@@ -545,7 +545,7 @@ public final class OpenTypeFont
return getCharGlyphMap().getGlyph(ucs4);
}
-
+
/**
* Creates a GlyphVector by mapping each character in a
* CharacterIterator to the corresponding glyph.
@@ -584,7 +584,7 @@ public final class OpenTypeFont
// Initialize hinter if necessary.
checkHinter(FontDelegate.FLAG_FITTED);
- CharGlyphMap cmap;
+ CharGlyphMap cmap;
int numGlyphs;
int[] glyphs;
int glyph;
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFontFactory.java b/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFontFactory.java
index 3a00dfb..32c4828 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFontFactory.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFontFactory.java
@@ -126,7 +126,7 @@ public final class OpenTypeFontFactory
rsrc = fork.getResources(OpenTypeFont.TAG_SFNT);
fonts = new OpenTypeFont[rsrc.length];
- for (int i = 0; i < fonts.length; i++)
+ for (int i = 0; i < fonts.length; i++)
fonts[i] = new OpenTypeFont(rsrc[i].getContent(), 0);
return fonts;
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLoader.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLoader.java
index 249a87d..8a3c566 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLoader.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLoader.java
@@ -71,8 +71,8 @@ final class GlyphLoader
* glyph.
*/
private final GlyphMeasurer glyphMeasurer;
-
-
+
+
/**
* The virtual machine for executing TrueType bytecodes.
*/
@@ -157,7 +157,7 @@ final class GlyphLoader
yMin = glyph.getChar();
xMax = glyph.getChar();
yMax = glyph.getChar();
-
+
if (numContours >= 0)
loadSimpleGlyph(glyphIndex, pointSize, transform, antialias,
@@ -272,13 +272,13 @@ final class GlyphLoader
if ((flags & WE_HAVE_A_SCALE) != 0)
{
a = d = getDouble214(glyph);
- b = c = 0.0;
+ b = c = 0.0;
}
else if ((flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0)
{
a = getDouble214(glyph);
d = getDouble214(glyph);
- b = c = 0.0;
+ b = c = 0.0;
}
else if ((flags & WE_HAVE_A_TWO_BY_TWO) != 0)
{
@@ -310,7 +310,7 @@ final class GlyphLoader
if (Math.abs(Math.abs(c) - Math.abs(d)) <= 33.0/65536.0)
n = n * 2;
-
+
if ((flags & ARGS_ARE_XY_VALUES) != 0)
{
e = m * arg1;
@@ -320,14 +320,14 @@ final class GlyphLoader
e = f = 0.0;
componentTransform.setTransform(a, b, c, d, 0.0, 0.0);
-
+
// System.out.println("componentTransform = " + componentTransform
// + ", e=" + e + ", f=" + f);
componentTransform.concatenate(transform);
int pos = glyph.position();
int lim = glyph.limit();
-
+
loadSubGlyph(subGlyphIndex, pointSize, componentTransform,
antialias, subGlyphZone,
Math.round((float) e + preTranslateX),
@@ -431,7 +431,7 @@ final class GlyphLoader
glyphMeasurer.getAdvanceWidth(glyphIndex, true));
glyphZone.setOriginalY(numPoints + 1,
glyphMeasurer.getAdvanceHeight(glyphIndex, true));
-
+
/* Phantom point 2: Vertical origin. */
int vertX = glyphMeasurer.getAscent(/* vertical */ false);
int vertY = glyphMeasurer.getAscent(/* horizontal */ true);
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLocator.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLocator.java
index a2db8ac..fc2256b 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLocator.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLocator.java
@@ -94,7 +94,7 @@ abstract class GlyphLocator
case 1:
return new GlyphLocator.FourByte(loca, glyf);
-
+
default:
throw new FontFormatException("unsupported loca format");
}
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java
index bbd0b9b..452456d 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java
@@ -69,7 +69,7 @@ final class GlyphMeasurer
* font’s vmtx table as shorts.
*/
private final ShortBuffer verticalGlyphMetrics;
-
+
private final int numLongHorizontalMetricsEntries;
private final int numLongVerticalMetricsEntries;
@@ -82,7 +82,7 @@ final class GlyphMeasurer
private final int horizontalLineGap;
-
+
/**
* Constructs a GlyphMeasurer from TrueType/OpenType font tables.
*
@@ -145,7 +145,7 @@ final class GlyphMeasurer
{
return horizontal ? horizontalAscent : verticalAscent;
}
-
+
/**
* Returns the distance from the baseline to the lowest descender.
@@ -156,7 +156,7 @@ final class GlyphMeasurer
* @return the maximal descent, in font units.
*/
public int getDescent(boolean horizontal)
- {
+ {
return horizontal ? horizontalDescent : verticalDescent;
}
@@ -188,7 +188,7 @@ final class GlyphMeasurer
* @return the advance width, in font units.
*/
public int getAdvanceWidth(int glyphIndex, boolean horizontal)
- {
+ {
if (!horizontal)
return 0;
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/Point.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/Point.java
index 31c1203..438eb65 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/Point.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/Point.java
@@ -53,7 +53,7 @@ public class Point
public static final short FLAG_INFLECTION = 32;
public static final short FLAG_DONE_X = 64;
public static final short FLAG_DONE_Y = 128;
-
+
/**
* Right direction.
*/
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java
index 5f5cc00..1d5c53f 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java
@@ -137,7 +137,7 @@ public final class TrueTypeScaler
ByteBuffer htmx,
ByteBuffer vhea,
ByteBuffer vtmx,
- ByteBuffer maxp,
+ ByteBuffer maxp,
ByteBuffer controlValueTable,
ByteBuffer fpgm,
int locaFormat, ByteBuffer loca,
@@ -254,7 +254,7 @@ public final class TrueTypeScaler
advance.setLocation(
scaleFactor * glyphMeasurer.getAdvanceWidth(glyphIndex, horizontal),
scaleFactor * glyphMeasurer.getAdvanceHeight(glyphIndex, horizontal));
-
+
transform.transform(advance, advance);
}
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java
index c88d4c6..512c39f 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java
@@ -70,7 +70,7 @@ import java.nio.ShortBuffer;
* obtained from Apple Computer to use the patented technology inside
* the United States. For other countries, different dates might
* apply, or no license might be needed.
- *
+ *
*
The default build of this class does not use the patented
* algorithms. If you have obtained a license from Apple, or if the
* patent protection has expired, or if no license is required for
@@ -348,7 +348,7 @@ class VirtualMachine
/* Read the contents of the Control Value Table. */
if (controlValueTable != null)
this.controlValueTable = controlValueTable.asShortBuffer();
-
+
maxInstructionDefs = maxp.getChar(22);
maxStackElements = maxp.getChar(24);
storage = new int[maxStorage];
@@ -356,7 +356,7 @@ class VirtualMachine
this.preProgram = preProgram;
numTwilightPoints = maxp.getChar(16);
}
-
+
/**
* Sets the graphics state to default values.
@@ -462,7 +462,7 @@ class VirtualMachine
changeCTM = ((pointSize_Fixed != this.pointSize)
|| !deviceTransform.equals(this.deviceTransform)
|| (antialiased != this.antialiased));
-
+
if (changeCTM)
{
this.pointSize = pointSize_Fixed;
@@ -489,7 +489,7 @@ class VirtualMachine
return executeGlyphInstructions;
}
-
+
/**
* Executes a stream of TrueType instructions.
@@ -577,7 +577,7 @@ class VirtualMachine
sbuf.append(getHex(inst.get(pc + 1 + i)));
}
}
-
+
while (sbuf.length() < 30)
sbuf.append(' ');
sbuf.append('|');
@@ -814,7 +814,7 @@ class VirtualMachine
case 0x16: // SZPS, Set Zone PointerS
zp0 = zp1 = zp2 = getZone(stack[sp--]);
break;
-
+
case 0x17: // SLOOP, Set LOOP variable
loop = stack[sp--];
break;
@@ -837,7 +837,7 @@ class VirtualMachine
/* illegal: --, -- */ -1, -1,
/* handle nested if clauses */ true);
break;
-
+
case 0x1C: // JMPR, JuMP Relative
inst.position(inst.position() - 1 + stack[sp--]);
break;
@@ -905,7 +905,7 @@ class VirtualMachine
execute(fdefBuffer[i], fdefEntryPoint[i]);
inst.position(e1);
break;
-
+
case 0x2C: // FDEF, Function DEFinition
i = stack[sp--];
fdefBuffer[i] = inst;
@@ -1170,7 +1170,7 @@ class VirtualMachine
sp -= 2 * count;
deltaC(stack, sp + 1, count, 32);
break;
-
+
case 0x76: // SROUND, Super ROUND
setRoundingMode(Fixed.ONE, stack[sp--]);
break;
@@ -1198,7 +1198,7 @@ class VirtualMachine
break;
case 0x7c: // RUTG, Round Up To Grid
- setRoundingMode(Fixed.ONE, 0x40);
+ setRoundingMode(Fixed.ONE, 0x40);
break;
case 0x7d: // RDTG, Round Down To Grid
@@ -1279,7 +1279,7 @@ class VirtualMachine
break;
}
break;
-
+
case 0xb0: // PUSHB[0]
case 0xb1: // PUSHB[1]
case 0xb2: // PUSHB[2]
@@ -1424,7 +1424,7 @@ class VirtualMachine
delta = (arg & 15) - 8;
if (delta >= 0)
++delta;
-
+
rightShift = deltaShift - 6;
if (rightShift > 0)
delta = delta >> rightShift;
@@ -1570,7 +1570,7 @@ class VirtualMachine
org_a = getOriginalProjection(zp0, rp1);
cur_a = getProjection(zp0, rp1);
- org_b = getOriginalProjection(zp1, rp2);
+ org_b = getOriginalProjection(zp1, rp2);
cur_b = getProjection(zp1, rp2);
while (--loop >= 0)
@@ -1643,7 +1643,7 @@ class VirtualMachine
{
result = compensation - roundPhase + roundThreshold - distance;
result &= -roundPeriod;
- return Math.max(-result, 0) - roundPhase;
+ return Math.max(-result, 0) - roundPhase;
}
}
@@ -1694,7 +1694,7 @@ class VirtualMachine
{
cachedPixelsPerEM = Fixed.intValue(Fixed.vectorLength(
applyCTM_x(projX >> 8, projY >> 8),
- applyCTM_y(projX >> 8, projY >> 8)));
+ applyCTM_y(projX >> 8, projY >> 8)));
}
return cachedPixelsPerEM;
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/Zone.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/Zone.java
index 7c25a0a..b0559e0 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/Zone.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/Zone.java
@@ -229,7 +229,7 @@ public final class Zone
System.out.print('.');
else
System.out.print('c');
- if (isContourEnd(i))
+ if (isContourEnd(i))
System.out.print('E');
System.out.println();
if (isContourEnd(i))
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java
index 0f60828..f4534f3 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java
@@ -70,7 +70,7 @@ final class ZonePathIterator
*/
private static final int EMIT_CLOSE = 1;
-
+
/**
* If state has this value, currentSegment
* will emit a SEG_MOVETO segment to the first point in
@@ -115,7 +115,7 @@ final class ZonePathIterator
*/
private int contourStart;
-
+
private int type;
/**
@@ -152,7 +152,7 @@ final class ZonePathIterator
return (state != EMIT_CLOSE) && (curPoint >= numPoints);
}
-
+
public void next()
{
boolean onCurve;
@@ -231,7 +231,7 @@ final class ZonePathIterator
else
return p + 1;
}
-
+
/**
@@ -244,7 +244,7 @@ final class ZonePathIterator
{
case EMIT_CLOSE:
return PathIterator.SEG_CLOSE;
-
+
case EMIT_MOVETO:
return getStartSegment(curPoint, coords);
@@ -270,7 +270,7 @@ final class ZonePathIterator
if (floats == null)
floats = new float[6];
int result;
-
+
result = currentSegment(floats);
for (int i = 0; i < 6; i++)
coords[i] = floats[i];
@@ -362,7 +362,7 @@ final class ZonePathIterator
if (zone.isOnCurve(contourStart))
{
x = zone.getX(contourStart, type);
- y = zone.getY(contourStart, type);
+ y = zone.getY(contourStart, type);
}
else
{
diff --git a/libjava/classpath/gnu/java/awt/image/AsyncImage.java b/libjava/classpath/gnu/java/awt/image/AsyncImage.java
index 935601a..4fa3374 100644
--- a/libjava/classpath/gnu/java/awt/image/AsyncImage.java
+++ b/libjava/classpath/gnu/java/awt/image/AsyncImage.java
@@ -159,9 +159,9 @@ public class AsyncImage
g = r.getGraphics(); // Should we return some dummy graphics instead?
return g;
}
-
+
public boolean isComplete() {
- return complete;
+ return complete;
}
public int getHeight(ImageObserver observer)
diff --git a/libjava/classpath/gnu/java/awt/image/ImageConverter.java b/libjava/classpath/gnu/java/awt/image/ImageConverter.java
index f607b34..f9c6268 100644
--- a/libjava/classpath/gnu/java/awt/image/ImageConverter.java
+++ b/libjava/classpath/gnu/java/awt/image/ImageConverter.java
@@ -55,7 +55,7 @@ import java.util.Hashtable;
/**
* Convert an Image to a BufferedImage.
- *
+ *
* @author Roman Kennke (kennke@aicas.com)
*/
public class ImageConverter implements ImageConsumer
@@ -121,7 +121,7 @@ public class ImageConverter implements ImageConsumer
scansize, transparency);
}
else if (model instanceof IndexColorModel
- && targetColorModel.equals(ColorModel.getRGBdefault()))
+ && targetColorModel.equals(ColorModel.getRGBdefault()))
{
transparency = convertIndexColorModelToSRGB(x, y, w, h,
(IndexColorModel) model,
@@ -246,7 +246,7 @@ public class ImageConverter implements ImageConsumer
* @param offset the offset in the pixel array
* @param scansize the scanline size
* @param transparency the assumed transparency
- *
+ *
* @return the determined transparency
*/
private int transferPixels(int x, int y, int w, int h, ColorModel model,
@@ -281,7 +281,7 @@ public class ImageConverter implements ImageConsumer
* @param offset the offset in the pixel array
* @param scansize the scanline size
* @param transparency the assumed transparency
- *
+ *
* @return the determined transparency
*/
private int transferPixels(int x, int y, int w, int h, ColorModel model,
@@ -317,7 +317,7 @@ public class ImageConverter implements ImageConsumer
* @param offset the offset in the pixel array
* @param scansize the scanline size
* @param transparency the assumed transparency
- *
+ *
* @return the determined transparency
*/
private int convertPixels(int x, int y, int w, int h, ColorModel model,
@@ -356,7 +356,7 @@ public class ImageConverter implements ImageConsumer
* @param offset the offset in the pixel array
* @param scansize the scanline size
* @param transparency the assumed transparency
- *
+ *
* @return the determined transparency
*/
private int convertPixels(int x, int y, int w, int h, ColorModel model,
@@ -394,7 +394,7 @@ public class ImageConverter implements ImageConsumer
* @param offset the offset in the pixel array
* @param scansize the scanline size
* @param transparency the assumed transparency
- *
+ *
* @return the determined transparency
*/
private int convertIndexColorModelToSRGB(int x, int y, int w, int h,
@@ -447,7 +447,7 @@ public class ImageConverter implements ImageConsumer
* @param offset the offset in the pixel array
* @param scansize the scanline size
* @param transparency the assumed transparency
- *
+ *
* @return the determined transparency
*/
private int convertIndexColorModelToSRGB(int x, int y, int w, int h,
diff --git a/libjava/classpath/gnu/java/awt/image/ImageDecoder.java b/libjava/classpath/gnu/java/awt/image/ImageDecoder.java
index 8e8eecb..a572ea3 100644
--- a/libjava/classpath/gnu/java/awt/image/ImageDecoder.java
+++ b/libjava/classpath/gnu/java/awt/image/ImageDecoder.java
@@ -48,7 +48,7 @@ import java.io.InputStream;
import java.net.URL;
import java.util.Vector;
-public abstract class ImageDecoder implements ImageProducer
+public abstract class ImageDecoder implements ImageProducer
{
Vector consumers = new Vector ();
String filename;
@@ -94,7 +94,7 @@ public abstract class ImageDecoder implements ImageProducer
length = imagelength;
}
- public void addConsumer (ImageConsumer ic)
+ public void addConsumer (ImageConsumer ic)
{
consumers.addElement (ic);
}
@@ -103,7 +103,7 @@ public abstract class ImageDecoder implements ImageProducer
{
return consumers.contains (ic);
}
-
+
public void removeConsumer (ImageConsumer ic)
{
consumers.removeElement (ic);
@@ -115,20 +115,20 @@ public abstract class ImageDecoder implements ImageProducer
addConsumer(ic);
Vector list = (Vector) consumers.clone ();
- try
+ try
{
- // Create the input stream here rather than in the
- // ImageDecoder constructors so that exceptions cause
- // imageComplete to be called with an appropriate error
- // status.
+ // Create the input stream here rather than in the
+ // ImageDecoder constructors so that exceptions cause
+ // imageComplete to be called with an appropriate error
+ // status.
if (input == null)
{
- try
+ try
{
if (url != null)
input = url.openStream();
- else if (datainput != null)
- input = new DataInputStreamWrapper(datainput);
+ else if (datainput != null)
+ input = new DataInputStreamWrapper(datainput);
else
{
if (filename != null)
@@ -137,8 +137,8 @@ public abstract class ImageDecoder implements ImageProducer
input = new ByteArrayInputStream (data, offset, length);
}
produce (list, input);
- }
- finally
+ }
+ finally
{
input = null;
}
@@ -150,16 +150,16 @@ public abstract class ImageDecoder implements ImageProducer
}
catch (Exception e)
{
- for (int i = 0; i < list.size (); i++)
- {
- ImageConsumer ic2 = (ImageConsumer) list.elementAt (i);
- ic2.imageComplete (ImageConsumer.IMAGEERROR);
- }
+ for (int i = 0; i < list.size (); i++)
+ {
+ ImageConsumer ic2 = (ImageConsumer) list.elementAt (i);
+ ic2.imageComplete (ImageConsumer.IMAGEERROR);
+ }
}
}
- public void requestTopDownLeftRightResend (ImageConsumer ic)
- {
+ public void requestTopDownLeftRightResend (ImageConsumer ic)
+ {
}
public abstract void produce (Vector v, InputStream is) throws IOException;
@@ -176,13 +176,13 @@ public abstract class ImageDecoder implements ImageProducer
public int read() throws IOException
{
try
- {
- return datainput.readByte() & 0xFF;
- }
+ {
+ return datainput.readByte() & 0xFF;
+ }
catch (EOFException eofe)
- {
- return -1;
- }
+ {
+ return -1;
+ }
}
}
}
diff --git a/libjava/classpath/gnu/java/awt/image/XBMDecoder.java b/libjava/classpath/gnu/java/awt/image/XBMDecoder.java
index 0793d8e..35a3568 100644
--- a/libjava/classpath/gnu/java/awt/image/XBMDecoder.java
+++ b/libjava/classpath/gnu/java/awt/image/XBMDecoder.java
@@ -55,8 +55,8 @@ public class XBMDecoder extends ImageDecoder
static final ColorModel cm = ColorModel.getRGBdefault ();
static final int black = 0xff000000;
static final int transparent = 0x00000000;
- static final int masktable[] = { 0x01, 0x02, 0x04, 0x08,
- 0x10, 0x20, 0x40, 0x80 };
+ static final int masktable[] = { 0x01, 0x02, 0x04, 0x08,
+ 0x10, 0x20, 0x40, 0x80 };
public XBMDecoder (String filename)
{
@@ -75,27 +75,27 @@ public class XBMDecoder extends ImageDecoder
for (int i = 0; i < 2; i++)
{
- String line = reader.readLine ();
- StringTokenizer st = new StringTokenizer (line);
-
- st.nextToken (); // #define
- st.nextToken (); // name_[width|height]
- if (i == 0)
- width = Integer.parseInt (st.nextToken (), 10);
- else
- height = Integer.parseInt (st.nextToken (), 10);
+ String line = reader.readLine ();
+ StringTokenizer st = new StringTokenizer (line);
+
+ st.nextToken (); // #define
+ st.nextToken (); // name_[width|height]
+ if (i == 0)
+ width = Integer.parseInt (st.nextToken (), 10);
+ else
+ height = Integer.parseInt (st.nextToken (), 10);
}
for (int i = 0; i < v.size (); i++)
{
- ImageConsumer ic = (ImageConsumer) v.elementAt (i);
-
- ic.setDimensions (width, height);
- ic.setColorModel (cm);
- ic.setHints (ImageConsumer.COMPLETESCANLINES
- | ImageConsumer.SINGLEFRAME
- | ImageConsumer.SINGLEPASS
- | ImageConsumer.TOPDOWNLEFTRIGHT);
+ ImageConsumer ic = (ImageConsumer) v.elementAt (i);
+
+ ic.setDimensions (width, height);
+ ic.setColorModel (cm);
+ ic.setHints (ImageConsumer.COMPLETESCANLINES
+ | ImageConsumer.SINGLEFRAME
+ | ImageConsumer.SINGLEPASS
+ | ImageConsumer.TOPDOWNLEFTRIGHT);
}
/* skip to the byte array */
@@ -104,22 +104,22 @@ public class XBMDecoder extends ImageDecoder
/* loop through each scanline */
for (int line = 0; line < height; line++)
{
- int scanline[] = getScanline (reader, width);
+ int scanline[] = getScanline (reader, width);
- for (int i = 0; i < v.size (); i++)
- {
- ImageConsumer ic = (ImageConsumer) v.elementAt (i);
- ic.setPixels (0, 0 + line, width, 1, cm, scanline, 0, width);
- }
+ for (int i = 0; i < v.size (); i++)
+ {
+ ImageConsumer ic = (ImageConsumer) v.elementAt (i);
+ ic.setPixels (0, 0 + line, width, 1, cm, scanline, 0, width);
+ }
}
/* tell each ImageConsumer that we're finished */
for (int i = 0; i < v.size (); i++)
{
- ImageConsumer ic = (ImageConsumer) v.elementAt (i);
- ic.imageComplete (ImageConsumer.STATICIMAGEDONE);
+ ImageConsumer ic = (ImageConsumer) v.elementAt (i);
+ ic.imageComplete (ImageConsumer.STATICIMAGEDONE);
}
- }
+ }
public static int[] getScanline (Reader in, int len) throws IOException
{
@@ -129,25 +129,25 @@ public class XBMDecoder extends ImageDecoder
while (x < len)
{
- int ch = in.read ();
- if (ch == '0')
- {
- in.read (); // 'x'
-
- byteStr[0] = (char) in.read ();
- byteStr[1] = (char) in.read ();
-
- int byteVal = Integer.parseInt (new String (byteStr), 16);
-
- for (int i = 0; i < 8; i++, x++)
- {
- if (x == len) // condition occurs if bitmap is padded
- return scanline;
-
- scanline[x] = ((byteVal & masktable[i]) != 0) ?
- black : transparent;
- }
- }
+ int ch = in.read ();
+ if (ch == '0')
+ {
+ in.read (); // 'x'
+
+ byteStr[0] = (char) in.read ();
+ byteStr[1] = (char) in.read ();
+
+ int byteVal = Integer.parseInt (new String (byteStr), 16);
+
+ for (int i = 0; i < 8; i++, x++)
+ {
+ if (x == len) // condition occurs if bitmap is padded
+ return scanline;
+
+ scanline[x] = ((byteVal & masktable[i]) != 0) ?
+ black : transparent;
+ }
+ }
}
return scanline;
diff --git a/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java b/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
index 8504659..1334866 100644
--- a/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
@@ -166,7 +166,7 @@ public abstract class AbstractGraphics2D
*/
protected static final WeakHashMap> imageCache =
new WeakHashMap>();
-
+
/**
* Wether we use anti aliasing for rendering text by default or not.
*/
@@ -234,7 +234,7 @@ public abstract class AbstractGraphics2D
*/
private Color foreground = Color.BLACK;
private boolean isForegroundColorNull = true;
-
+
/**
* The current font.
*/
@@ -287,16 +287,16 @@ public abstract class AbstractGraphics2D
private static final HashMap STANDARD_HINTS;
static
{
-
+
HashMap hints = new HashMap();
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
hints.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_DEFAULT);
-
+
STANDARD_HINTS = hints;
}
-
+
/**
* Creates a new AbstractGraphics2D instance.
*/
@@ -398,8 +398,8 @@ public abstract class AbstractGraphics2D
*
* @param image the source buffered image
* @param op the filter to apply to the buffered image before rendering
- * @param x the x coordinate to render the image to
- * @param y the y coordinate to render the image to
+ * @param x the x coordinate to render the image to
+ * @param y the y coordinate to render the image to
*/
public void drawImage(BufferedImage image, BufferedImageOp op, int x, int y)
{
@@ -415,7 +415,7 @@ public abstract class AbstractGraphics2D
* transform is used to convert the image into user space. The transform
* of this AbstractGraphics2D object is used to transform from user space
* to device space.
- *
+ *
* The rendering is performed using the scanline algorithm that performs the
* rendering of other shapes and a custom Paint implementation, that supplies
* the pixel values of the rendered image.
@@ -438,7 +438,7 @@ public abstract class AbstractGraphics2D
* of this AbstractGraphics2D object is used to transform from user space
* to device space. Only the area specified by areaOfInterest
* is finally rendered to the target.
- *
+ *
* The rendering is performed using the scanline algorithm that performs the
* rendering of other shapes and a custom Paint implementation, that supplies
* the pixel values of the rendered image.
@@ -504,7 +504,7 @@ public abstract class AbstractGraphics2D
(int) image.getWidth(),
(int) image.getHeight());
drawRenderableImageImpl(image, xform, areaOfInterest);
-
+
}
/**
@@ -648,7 +648,7 @@ public abstract class AbstractGraphics2D
if (p != null)
{
paint = p;
-
+
if (! (paint instanceof Color))
{
isOptimized = false;
@@ -665,11 +665,11 @@ public abstract class AbstractGraphics2D
this.foreground = Color.BLACK;
isForegroundColorNull = true;
}
-
+
// free resources if needed, then put the paint context to null
if (this.paintContext != null)
this.paintContext.dispose();
-
+
this.paintContext = null;
}
@@ -745,7 +745,7 @@ public abstract class AbstractGraphics2D
* Translates the coordinate system by (x, y).
*
* @param x the translation X coordinate
- * @param y the translation Y coordinate
+ * @param y the translation Y coordinate
*/
public void translate(int x, int y)
{
@@ -775,7 +775,7 @@ public abstract class AbstractGraphics2D
* Translates the coordinate system by (tx, ty).
*
* @param tx the translation X coordinate
- * @param ty the translation Y coordinate
+ * @param ty the translation Y coordinate
*/
public void translate(double tx, double ty)
{
@@ -992,7 +992,7 @@ public abstract class AbstractGraphics2D
if (clip == null)
setClip(s);
- // This is so common, let's optimize this.
+ // This is so common, let's optimize this.
else if (clip instanceof Rectangle && s instanceof Rectangle)
{
Rectangle clipRect = (Rectangle) clip;
@@ -1076,8 +1076,8 @@ public abstract class AbstractGraphics2D
else
copy.clip = null;
- copy.renderingHints = new RenderingHints(null);
- copy.renderingHints.putAll(renderingHints);
+ copy.renderingHints = new RenderingHints(null);
+ copy.renderingHints.putAll(renderingHints);
copy.transform = new AffineTransform(transform);
// The remaining state is inmmutable and doesn't need to be copied.
return copy;
@@ -1097,7 +1097,7 @@ public abstract class AbstractGraphics2D
{
if (isForegroundColorNull)
return null;
-
+
return this.foreground;
}
@@ -1107,7 +1107,7 @@ public abstract class AbstractGraphics2D
* @param color the foreground to set
*/
public void setColor(Color color)
- {
+ {
this.setPaint(color);
}
@@ -1298,7 +1298,7 @@ public abstract class AbstractGraphics2D
/**
* Fills a rectangle with the current background color.
*
- * This implementation temporarily sets the foreground color to the
+ * This implementation temporarily sets the foreground color to the
* background and forwards the call to {@link #fillRect(int, int, int, int)}.
*
* @param x the upper left corner, X coordinate
@@ -1590,7 +1590,7 @@ public abstract class AbstractGraphics2D
int dy = Math.min(dy1, dy2);
int dw = Math.abs(dx1 - dx2);
int dh = Math.abs(dy1 - dy2);
-
+
AffineTransform t = new AffineTransform();
t.translate(sx - dx, sy - dy);
double scaleX = (double) sw / (double) dw;
@@ -1693,7 +1693,7 @@ public abstract class AbstractGraphics2D
*
* @param x0 the starting point, X coordinate
* @param y0 the starting point, Y coordinate
- * @param x1 the end point, X coordinate
+ * @param x1 the end point, X coordinate
* @param y1 the end point, Y coordinate
*/
protected void rawDrawLine(int x0, int y0, int x1, int y1)
@@ -1806,7 +1806,7 @@ public abstract class AbstractGraphics2D
public void renderScanline(int y, ScanlineCoverage c)
{
PaintContext pCtx = getPaintContext();
-
+
int x0 = c.getMinX();
int x1 = c.getMaxX();
Raster paintRaster = pCtx.getRaster(x0, y, x1 - x0, 1);
@@ -1842,7 +1842,7 @@ public abstract class AbstractGraphics2D
renderingHints);
WritableRaster raster = getDestinationRaster();
WritableRaster targetChild = raster.createWritableTranslatedChild(-x0, -y);
-
+
cCtx.compose(paintRaster, targetChild, targetChild);
updateRaster(raster, x0, y, x1 - x0, 1);
cCtx.dispose();
@@ -2042,7 +2042,7 @@ public abstract class AbstractGraphics2D
getTransform(),
getRenderingHints());
}
-
+
return this.paintContext;
}
diff --git a/libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java b/libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java
index 2e3690d..f1f082a 100644
--- a/libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java
+++ b/libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java
@@ -82,7 +82,7 @@ public class AlphaCompositeContext
/**
* Creates a new AlphaCompositeContext.
*
- * @param aComp the AlphaComposite object
+ * @param aComp the AlphaComposite object
* @param srcCM the source color model
* @param dstCM the destination color model
*/
@@ -93,7 +93,7 @@ public class AlphaCompositeContext
srcColorModel = srcCM;
dstColorModel = dstCM;
-
+
// Determine the blending factors according to the rule in the
// AlphaComposite. For some rules the factors must be determined
// dynamically because they depend on the actual pixel value.
@@ -301,7 +301,7 @@ public class AlphaCompositeContext
{
for (int i = 0; i < dstComponentsLength - 1; i++)
{
- dstComponents[i] = dstComponents[i] / dstAlpha;
+ dstComponents[i] = dstComponents[i] / dstAlpha;
}
}
diff --git a/libjava/classpath/gnu/java/awt/java2d/CubicSegment.java b/libjava/classpath/gnu/java/awt/java2d/CubicSegment.java
index bf66be8..8197c94 100644
--- a/libjava/classpath/gnu/java/awt/java2d/CubicSegment.java
+++ b/libjava/classpath/gnu/java/awt/java2d/CubicSegment.java
@@ -80,11 +80,11 @@ public class CubicSegment extends Segment
public Object clone()
{
CubicSegment segment = null;
-
+
try
{
segment = (CubicSegment) super.clone();
-
+
segment.P1 = (Point2D) P1.clone();
segment.P2 = (Point2D) P2.clone();
segment.cp1 = (Point2D) cp1.clone();
@@ -96,7 +96,7 @@ public class CubicSegment extends Segment
ie.initCause(cnse);
throw ie;
}
-
+
return segment;
}
@@ -161,7 +161,7 @@ public class CubicSegment extends Segment
return new Segment[] { segmentTop, segmentBottom };
}
-
+
public void reverse()
{
Point2D temp = P1;
@@ -174,11 +174,11 @@ public class CubicSegment extends Segment
public double[] cp1()
{
- return new double[]{cp1.getX(), cp1.getY()};
+ return new double[]{cp1.getX(), cp1.getY()};
}
public double[] cp2()
{
- return new double[]{cp2.getX(), cp2.getY()};
+ return new double[]{cp2.getX(), cp2.getY()};
}
} // class CubicSegment
diff --git a/libjava/classpath/gnu/java/awt/java2d/LineSegment.java b/libjava/classpath/gnu/java/awt/java2d/LineSegment.java
index 0395fd0..9040379 100644
--- a/libjava/classpath/gnu/java/awt/java2d/LineSegment.java
+++ b/libjava/classpath/gnu/java/awt/java2d/LineSegment.java
@@ -63,7 +63,7 @@ public class LineSegment extends Segment
public Object clone()
{
LineSegment segment = null;
-
+
try
{
segment = (LineSegment) super.clone();
@@ -76,7 +76,7 @@ public class LineSegment extends Segment
ie.initCause(cnse);
throw ie;
}
-
+
return segment;
}
@@ -108,11 +108,11 @@ public class LineSegment extends Segment
public double[] cp1()
{
- return new double[]{P2.getX(), P2.getY()};
+ return new double[]{P2.getX(), P2.getY()};
}
public double[] cp2()
{
- return new double[]{P1.getX(), P1.getY()};
+ return new double[]{P1.getX(), P1.getY()};
}
} // class LineSegment
diff --git a/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java b/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java
index c83ad1f..356021b 100644
--- a/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java
+++ b/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java
@@ -124,7 +124,7 @@ final class PixelCoverage
Bucket match = current;
while (match != null && match.xPos != x)
{
-
+
}
return match;
diff --git a/libjava/classpath/gnu/java/awt/java2d/QuadSegment.java b/libjava/classpath/gnu/java/awt/java2d/QuadSegment.java
index 97a5372..b8d0ff5 100644
--- a/libjava/classpath/gnu/java/awt/java2d/QuadSegment.java
+++ b/libjava/classpath/gnu/java/awt/java2d/QuadSegment.java
@@ -89,7 +89,7 @@ public class QuadSegment extends Segment
public Object clone()
{
QuadSegment segment = null;
-
+
try
{
segment = (QuadSegment) super.clone();
@@ -104,7 +104,7 @@ public class QuadSegment extends Segment
ie.initCause(cnse);
throw ie;
}
-
+
return segment;
}
@@ -135,10 +135,10 @@ public class QuadSegment extends Segment
return new Segment[]{s1, s2};
}
-
+
private QuadSegment offsetSubdivided(QuadCurve2D curve, boolean plus)
{
- double[] n1 = normal(curve.getX1(), curve.getY1(),
+ double[] n1 = normal(curve.getX1(), curve.getY1(),
curve.getCtrlX(), curve.getCtrlY());
double[] n2 = normal(curve.getCtrlX(), curve.getCtrlY(),
curve.getX2(), curve.getY2());
@@ -152,7 +152,7 @@ public class QuadSegment extends Segment
n2[0] = -n2[0];
n2[1] = -n2[1];
}
-
+
// Handle special cases where the control point is equal to an end point
// or end points are equal (ie, straight lines)
if (curve.getP1().equals(curve.getCtrlPt()))
@@ -179,7 +179,7 @@ public class QuadSegment extends Segment
double ratio = radius / length;
deltaX *= ratio;
deltaY *= ratio;
-
+
if (plus)
cp.setLocation(cp.getX() + deltaX, cp.getY() + deltaY);
else
@@ -192,16 +192,16 @@ public class QuadSegment extends Segment
}
else
{
- cp = lineIntersection(curve.getX1() + n1[0],
+ cp = lineIntersection(curve.getX1() + n1[0],
curve.getY1() + n1[1],
curve.getCtrlX() + n1[0],
curve.getCtrlY() + n1[1],
curve.getCtrlX() + n2[0],
curve.getCtrlY() + n2[1],
- curve.getX2() + n2[0],
+ curve.getX2() + n2[0],
curve.getY2() + n2[1], true);
}
-
+
s = new QuadSegment(curve.getX1() + n1[0], curve.getY1() + n1[1],
cp.getX(), cp.getY(),
curve.getX2() + n2[0], curve.getY2() + n2[1]);
@@ -209,9 +209,9 @@ public class QuadSegment extends Segment
return s;
}
- private Point2D lineIntersection(double X1, double Y1,
- double X2, double Y2,
- double X3, double Y3,
+ private Point2D lineIntersection(double X1, double Y1,
+ double X2, double Y2,
+ double X3, double Y3,
double X4, double Y4,
boolean infinite)
{
@@ -250,11 +250,11 @@ public class QuadSegment extends Segment
public double[] cp1()
{
- return new double[]{cp.getX(), cp.getY()};
+ return new double[]{cp.getX(), cp.getY()};
}
public double[] cp2()
{
- return new double[]{cp.getX(), cp.getY()};
+ return new double[]{cp.getX(), cp.getY()};
}
}
diff --git a/libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java b/libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java
index 04eb55e..193ea4c 100644
--- a/libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java
+++ b/libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java
@@ -77,10 +77,10 @@ public class RasterGraphics
{
if (y >= getDeviceBounds().width)
return;
-
+
super.renderScanline(y, c);
}
-
+
/**
* Returns the color model of this Graphics object.
*
diff --git a/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java b/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java
index b00a15c..2c3481b 100644
--- a/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java
+++ b/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java
@@ -206,7 +206,7 @@ public final class ScanlineConverter
// Ok, now we can perform the actual scanlining.
int realY = Fixed.intValue(FIXED_DIGITS, y + resolution);
boolean push = lastRealY != realY;
-
+
doScanline(p, y, push, haveClip);
// Remove obsolete active edges.
@@ -299,7 +299,7 @@ public final class ScanlineConverter
p.renderScanline(Fixed.intValue(FIXED_DIGITS, y), scanlineCoverage);
scanlineCoverage.clear();
}
- }
+ }
/**
diff --git a/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java b/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java
index deb603b..9ffb63e 100644
--- a/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java
+++ b/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java
@@ -199,7 +199,7 @@ public final class ScanlineCoverage
/**
* Returns the X start position (left) on the scanline. This value
* is considered to be in pixels and device space.
- *
+ *
* @return the X position on the scanline
*/
public int getXPos()
@@ -445,7 +445,7 @@ public final class ScanlineCoverage
* Returns the maximum coverage value for the scanline.
*
* @return the maximum coverage value for the scanline
- */
+ */
public int getMaxCoverage()
{
return maxCoverage;
@@ -574,7 +574,7 @@ public final class ScanlineCoverage
// Testpoint 6.
cov = new Coverage();
}
-
+
cov.xPos = x;
cov.covDelta = 0;
cov.pixelCoverage = 0;
diff --git a/libjava/classpath/gnu/java/awt/java2d/Segment.java b/libjava/classpath/gnu/java/awt/java2d/Segment.java
index df1f676..1d9a570 100644
--- a/libjava/classpath/gnu/java/awt/java2d/Segment.java
+++ b/libjava/classpath/gnu/java/awt/java2d/Segment.java
@@ -45,12 +45,12 @@ public abstract class Segment implements Cloneable
// Start and end points of THIS segment
public Point2D P1;
public Point2D P2;
-
+
// Segments can be linked together internally as a linked list
public Segment first;
public Segment next;
public Segment last;
-
+
// Half the stroke width
protected double radius;
@@ -116,7 +116,7 @@ public abstract class Segment implements Cloneable
{
dy = radius * ((dx > 0)?1:-1);
dx = 0;
- }
+ }
else if( dx == 0 )
{
dx = radius * ((dy > 0)?-1:1);
@@ -148,7 +148,7 @@ public abstract class Segment implements Cloneable
* for a line segment.
*/
public abstract double[] cp1();
-
+
/**
* Returns the coordinates of the second control point, or the end point
* for a line segment.
diff --git a/libjava/classpath/gnu/java/awt/java2d/TexturePaintContext.java b/libjava/classpath/gnu/java/awt/java2d/TexturePaintContext.java
index db0a2e6..2523d23 100644
--- a/libjava/classpath/gnu/java/awt/java2d/TexturePaintContext.java
+++ b/libjava/classpath/gnu/java/awt/java2d/TexturePaintContext.java
@@ -148,7 +148,7 @@ public class TexturePaintContext
* @param h the height
*
* @return the Raster that is used for painting
- *
+ *
*/
public Raster getRaster(int x1, int y1, int w, int h)
{
@@ -175,9 +175,9 @@ public class TexturePaintContext
int dy = (int) dest[1];
// The modulo operation gives us the replication effect.
- dx = ((dx - minX) % width) + minX;
+ dx = ((dx - minX) % width) + minX;
dy = ((dy - minY) % height) + minY;
-
+
// Handle possible negative values (replicating above the top-left)
if (dx < 0)
dx += width;
diff --git a/libjava/classpath/gnu/java/awt/peer/ClasspathDesktopPeer.java b/libjava/classpath/gnu/java/awt/peer/ClasspathDesktopPeer.java
index bef42dc..fd4f498 100644
--- a/libjava/classpath/gnu/java/awt/peer/ClasspathDesktopPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/ClasspathDesktopPeer.java
@@ -51,7 +51,7 @@ import java.util.prefs.Preferences;
/**
* Offers a common implementation for the Desktop peers, that enables
* access to default system application within java processes.
- *
+ *
* @author Mario Torre
*/
public class ClasspathDesktopPeer
@@ -59,39 +59,39 @@ public class ClasspathDesktopPeer
{
/** This is the fallback browser, if no desktop was detected. */
protected static final String _DEFAULT_BROWSER = "firefox";
-
+
/** gnu.java.awt.peer.Desktop.html.command */
protected static final String _BROWSE = "html";
-
+
/** gnu.java.awt.peer.Desktop.mail.command */
protected static final String _MAIL = "mail";
-
+
/** gnu.java.awt.peer.Desktop.edit.command */
protected static final String _EDIT = "edit";
-
+
/** gnu.java.awt.peer.Desktop.print.command */
protected static final String _PRINT = "print";
-
+
/** gnu.java.awt.peer.Desktop.open.command */
protected static final String _OPEN = "open";
-
+
/** */
protected static final KDEDesktopPeer kde = new KDEDesktopPeer();
-
+
/** */
protected static final GnomeDesktopPeer gnome = new GnomeDesktopPeer();
-
+
/** */
protected static final ClasspathDesktopPeer classpath =
- new ClasspathDesktopPeer();
-
+ new ClasspathDesktopPeer();
+
/**
* Preference subsystem. Packagers and users can override the default
* behaviour of this class via preferences and system properties.
*/
protected Preferences prefs =
Preferences.userNodeForPackage(ClasspathDesktopPeer.class).node("Desktop");
-
+
/**
* @param target
*/
@@ -103,131 +103,131 @@ public class ClasspathDesktopPeer
public boolean isSupported(Action action)
{
String check = null;
-
+
switch(action)
{
case BROWSE:
check = _BROWSE;
break;
-
+
case MAIL:
check = _MAIL;
break;
-
+
case EDIT:
check = _EDIT;
break;
-
+
case PRINT:
check = _PRINT;
break;
-
+
case OPEN: default:
check = _OPEN;
break;
}
-
+
return this.supportCommand(check);
}
public void browse(URI url) throws IOException
{
checkPermissions();
-
+
String browser = getCommand(_BROWSE);
-
+
if (browser == null)
throw new UnsupportedOperationException();
-
+
browser = browser + " " + url.toString();
-
+
Runtime.getRuntime().exec(browser);
}
public void edit(File file) throws IOException
{
checkPermissions(file, false);
-
+
String edit = getCommand(_EDIT);
-
+
if (edit == null)
throw new UnsupportedOperationException();
-
- edit = edit + " " + file.getAbsolutePath();
+
+ edit = edit + " " + file.getAbsolutePath();
Runtime.getRuntime().exec(edit);
}
public void mail(URI mailtoURL) throws IOException
{
checkPermissions();
-
+
String scheme = mailtoURL.getScheme();
if (scheme == null || !scheme.equalsIgnoreCase("mailto"))
throw new IllegalArgumentException("URI Scheme not of type mailto");
-
+
String mail = getCommand(_MAIL);
-
+
if (mail == null)
throw new UnsupportedOperationException();
-
+
mail = mail + " " + mailtoURL.toString();
-
+
Runtime.getRuntime().exec(mail);
}
public void mail() throws IOException
{
checkPermissions();
-
+
String mail = getCommand(_MAIL);
-
+
if (mail == null)
throw new UnsupportedOperationException();
-
+
Runtime.getRuntime().exec(mail);
}
-
+
public void open(File file) throws IOException
{
checkPermissions(file, true);
-
+
String open = getCommand(_OPEN);
-
+
if (open == null)
throw new UnsupportedOperationException();
-
- open = open + " " + file.getAbsolutePath();
+
+ open = open + " " + file.getAbsolutePath();
Runtime.getRuntime().exec(open);
}
public void print(File file) throws IOException
{
checkPrintPermissions(file);
-
+
String print = getCommand(_PRINT);
-
+
if (print == null)
throw new UnsupportedOperationException();
-
- print = print + " " + file.getAbsolutePath();
+
+ print = print + " " + file.getAbsolutePath();
Runtime.getRuntime().exec(print);
}
-
+
protected String getCommand(String action)
{
// check if a system property exist
String command =
System.getProperty("gnu.java.awt.peer.Desktop." + action + ".command");
-
+
// otherwise, get it from preferences, if any
if (command == null)
{
command = prefs.node(action).get("command", null);
}
-
+
return command;
}
-
+
/**
* Note: Checks for AWTPermission("showWindowWithoutWarningBanner") only.
*/
@@ -238,22 +238,22 @@ public class ClasspathDesktopPeer
sm.checkPermission(new AWTPermission("showWindowWithoutWarningBanner"));
}
}
-
+
/**
- * Calls checkPermissions() and checks for SecurityManager.checkRead()
- * and, if readOnly is false, for SecurityManager.checkWrite()
+ * Calls checkPermissions() and checks for SecurityManager.checkRead()
+ * and, if readOnly is false, for SecurityManager.checkWrite()
*/
protected void checkPermissions(File file, boolean readOnly)
{
checkPermissions();
-
+
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkRead(file.toString());
if (!readOnly) sm.checkWrite(file.toString());
}
}
-
+
/**
* Calls checkPermissions(file, true) and checks for
* SecurityManager.checkPrintJobAccess()
@@ -261,13 +261,13 @@ public class ClasspathDesktopPeer
protected void checkPrintPermissions(File file)
{
checkPermissions(file, true);
-
+
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPrintJobAccess();
- }
+ }
}
-
+
/**
* @param check
* @return
@@ -276,7 +276,7 @@ public class ClasspathDesktopPeer
{
return ((this.getCommand(check) != null) ? true : false);
}
-
+
/**
* @return
*/
@@ -285,7 +285,7 @@ public class ClasspathDesktopPeer
// check if we are under Gnome or KDE or anything else
String desktopSession = System.getenv("GNOME_DESKTOP_SESSION_ID");
if (desktopSession == null)
- {
+ {
desktopSession = System.getenv("KDE_FULL_SESSION");
if (desktopSession != null)
return kde;
@@ -294,7 +294,7 @@ public class ClasspathDesktopPeer
{
return gnome;
}
-
+
// revert to this class for default values
return classpath;
}
diff --git a/libjava/classpath/gnu/java/awt/peer/ClasspathFontPeer.java b/libjava/classpath/gnu/java/awt/peer/ClasspathFontPeer.java
index e43e5f2..96677a4 100644
--- a/libjava/classpath/gnu/java/awt/peer/ClasspathFontPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/ClasspathFontPeer.java
@@ -68,7 +68,7 @@ import java.util.Map;
* object in the default implementation. If you wish to share peers between
* fonts, you will need to subclass both ClasspathFontPeer and
* {@link ClasspathToolKit}.
- *
+ *
*
Thread Safety: Methods of this interface may be called
* from arbitrary threads at any time. Implementations of the
* ClasspathFontPeer interface are required to perform
@@ -85,11 +85,11 @@ public abstract class ClasspathFontPeer
{
/*************************************************************************/
-
+
/*
* Instance Variables
*/
-
+
/**
* The 3 names of this font. all fonts have 3 names, some of which
* may be equal:
@@ -98,19 +98,19 @@ public abstract class ClasspathFontPeer
* family -- a designer or brand name (Helvetica)
* face -- specific instance of a design (Helvetica Regular)
*
- * @see isLogicalFontName
+ * @see isLogicalFontName
*/
-
+
protected String logicalName;
protected String familyName;
protected String faceName;
-
+
/**
* The font style, which is a combination (by OR-ing) of the font style
* constants PLAIN, BOLD and ITALIC, in this class.
*/
protected int style;
-
+
/**
* The font point size. A point is 1/72 of an inch.
*/
@@ -143,13 +143,13 @@ public abstract class ClasspathFontPeer
return (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
}
- /*
+ /*
* Confusingly, a Logical Font is a concept unrelated to
- * a Font's Logical Name.
+ * a Font's Logical Name.
*
* A Logical Font is one of 6 built-in, abstract font types
* which must be supported by any java environment: SansSerif,
- * Serif, Monospaced, Dialog, and DialogInput.
+ * Serif, Monospaced, Dialog, and DialogInput.
*
* A Font's Logical Name is the name the font was constructed
* from. This might be the name of a Logical Font, or it might
@@ -209,32 +209,32 @@ public abstract class ClasspathFontPeer
if (fam != null)
attrs.put (TextAttribute.FAMILY, fam);
}
-
+
public static void copySizeToAttrs (float size, Map attrs)
{
attrs.put (TextAttribute.SIZE, new Float (size));
}
-
+
protected static void copyTransformToAttrs (AffineTransform trans, Map attrs)
{
if (trans != null)
{
- TransformAttribute ta;
+ TransformAttribute ta;
synchronized(transCache)
{
- ta = transCache.get(trans);
- if (ta == null)
- {
- ta = new TransformAttribute(trans);
- transCache.put(trans, ta);
- }
- }
- attrs.put(TextAttribute.TRANSFORM, ta);
+ ta = transCache.get(trans);
+ if (ta == null)
+ {
+ ta = new TransformAttribute(trans);
+ transCache.put(trans, ta);
+ }
+ }
+ attrs.put(TextAttribute.TRANSFORM, ta);
}
}
- protected void setStandardAttributes (String name, String family, int style,
+ protected void setStandardAttributes (String name, String family, int style,
float size, AffineTransform trans)
{
this.logicalName = name;
@@ -248,7 +248,7 @@ public abstract class ClasspathFontPeer
this.familyName = family;
else
this.familyName = faceNameToFamilyName (faceName);
-
+
this.style = style;
this.size = size;
this.transform = trans;
@@ -296,16 +296,16 @@ public abstract class ClasspathFontPeer
if (attribs.containsKey (TextAttribute.TRANSFORM))
{
- TransformAttribute ta = (TransformAttribute)
+ TransformAttribute ta = (TransformAttribute)
attribs.get(TextAttribute.TRANSFORM);
- trans = ta.getTransform ();
+ trans = ta.getTransform ();
}
setStandardAttributes (name, family, style, size, trans);
}
protected void getStandardAttributes (Map attrs)
- {
+ {
copyFamilyToAttrs (this.familyName, attrs);
copySizeToAttrs (this.size, attrs);
copyStyleToAttrs (this.style, attrs);
@@ -322,11 +322,11 @@ public abstract class ClasspathFontPeer
public ClasspathFontPeer (String name, int style, int size)
{
- setStandardAttributes (name, (String)null, style,
+ setStandardAttributes (name, (String)null, style,
(float)size, (AffineTransform)null);
}
- /**
+ /**
* Implementation of {@link Font#getName}
*
* @param font the font this peer is being called from. This may be
@@ -334,12 +334,12 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public String getName (Font font)
- {
- return logicalName;
+ public String getName (Font font)
+ {
+ return logicalName;
}
- /**
+ /**
* Implementation of {@link Font#getFamily()}
*
* @param font the font this peer is being called from. This may be
@@ -347,12 +347,12 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public String getFamily (Font font)
- {
- return familyName;
+ public String getFamily (Font font)
+ {
+ return familyName;
}
- /**
+ /**
* Implementation of {@link Font#getFamily(Locale)}
*
* @param font the font this peer is being called from. This may be
@@ -360,12 +360,12 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public String getFamily (Font font, Locale lc)
- {
- return familyName;
+ public String getFamily (Font font, Locale lc)
+ {
+ return familyName;
}
- /**
+ /**
* Implementation of {@link Font#getFontName()}
*
* @param font the font this peer is being called from. This may be
@@ -373,12 +373,12 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public String getFontName (Font font)
- {
- return faceName;
+ public String getFontName (Font font)
+ {
+ return faceName;
}
- /**
+ /**
* Implementation of {@link Font#getFontName(Locale)}
*
* @param font the font this peer is being called from. This may be
@@ -386,12 +386,12 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public String getFontName (Font font, Locale lc)
- {
- return faceName;
+ public String getFontName (Font font, Locale lc)
+ {
+ return faceName;
}
- /**
+ /**
* Implementation of {@link Font#getSize}
*
* @param font the font this peer is being called from. This may be
@@ -399,38 +399,38 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public float getSize (Font font)
- {
- return size;
+ public float getSize (Font font)
+ {
+ return size;
}
- /**
+ /**
* Implementation of {@link Font#isPlain}
*
* @param font the font this peer is being called from. This may be
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
- public boolean isPlain (Font font)
- {
- return style == Font.PLAIN;
+
+ public boolean isPlain (Font font)
+ {
+ return style == Font.PLAIN;
}
- /**
+ /**
* Implementation of {@link Font#isBold}
*
* @param font the font this peer is being called from. This may be
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
- public boolean isBold (Font font)
- {
- return ((style & Font.BOLD) == Font.BOLD);
+
+ public boolean isBold (Font font)
+ {
+ return ((style & Font.BOLD) == Font.BOLD);
}
- /**
+ /**
* Implementation of {@link Font#isItalic}
*
* @param font the font this peer is being called from. This may be
@@ -438,12 +438,12 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public boolean isItalic (Font font)
- {
- return ((style & Font.ITALIC) == Font.ITALIC);
+ public boolean isItalic (Font font)
+ {
+ return ((style & Font.ITALIC) == Font.ITALIC);
}
- /**
+ /**
* Implementation of {@link Font#deriveFont(int, float)}
*
* @param font the font this peer is being called from. This may be
@@ -460,7 +460,7 @@ public abstract class ClasspathFontPeer
return tk().getFont (logicalName, attrs);
}
- /**
+ /**
* Implementation of {@link Font#deriveFont(float)}
*
* @param font the font this peer is being called from. This may be
@@ -476,7 +476,7 @@ public abstract class ClasspathFontPeer
return tk().getFont (logicalName, attrs);
}
- /**
+ /**
* Implementation of {@link Font#deriveFont(int)}
*
* @param font the font this peer is being called from. This may be
@@ -492,7 +492,7 @@ public abstract class ClasspathFontPeer
return tk().getFont (logicalName, attrs);
}
- /**
+ /**
* Implementation of {@link Font#deriveFont(int, AffineTransform)}
*
* @param font the font this peer is being called from. This may be
@@ -509,7 +509,7 @@ public abstract class ClasspathFontPeer
return tk().getFont (logicalName, attrs);
}
- /**
+ /**
* Implementation of {@link Font#deriveFont(AffineTransform)}
*
* @param font the font this peer is being called from. This may be
@@ -525,7 +525,7 @@ public abstract class ClasspathFontPeer
return tk().getFont (logicalName, attrs);
}
- /**
+ /**
* Implementation of {@link Font#deriveFont(Map)}
*
* @param font the font this peer is being called from. This may be
@@ -538,7 +538,7 @@ public abstract class ClasspathFontPeer
return tk().getFont (logicalName, attrs);
}
- /**
+ /**
* Implementation of {@link Font#getAttributes()}
*
* @param font the font this peer is being called from. This may be
@@ -553,7 +553,7 @@ public abstract class ClasspathFontPeer
return h;
}
- /**
+ /**
* Implementation of {@link Font#getAvailableAttributes()}
*
* @param font the font this peer is being called from. This may be
@@ -563,7 +563,7 @@ public abstract class ClasspathFontPeer
public AttributedCharacterIterator.Attribute[] getAvailableAttributes(Font font)
{
- AttributedCharacterIterator.Attribute a[] =
+ AttributedCharacterIterator.Attribute a[] =
new AttributedCharacterIterator.Attribute[5];
a[0] = TextAttribute.FAMILY;
a[1] = TextAttribute.SIZE;
@@ -573,7 +573,7 @@ public abstract class ClasspathFontPeer
return a;
}
- /**
+ /**
* Implementation of {@link Font#getTransform()}
*
* @param font the font this peer is being called from. This may be
@@ -588,7 +588,7 @@ public abstract class ClasspathFontPeer
return transform;
}
- /**
+ /**
* Implementation of {@link Font#isTransformed()}
*
* @param font the font this peer is being called from. This may be
@@ -601,7 +601,7 @@ public abstract class ClasspathFontPeer
return ! transform.isIdentity ();
}
- /**
+ /**
* Implementation of {@link Font#getItalicAngle()}
*
* @param font the font this peer is being called from. This may be
@@ -618,7 +618,7 @@ public abstract class ClasspathFontPeer
}
- /**
+ /**
* Implementation of {@link Font#getStyle()}
*
* @param font the font this peer is being called from. This may be
@@ -626,9 +626,9 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public int getStyle (Font font)
- {
- return style;
+ public int getStyle (Font font)
+ {
+ return style;
}
@@ -636,7 +636,7 @@ public abstract class ClasspathFontPeer
/* Remaining methods are abstract */
- /**
+ /**
* Implementation of {@link Font#canDisplay(char)}
*
* @param font the font this peer is being called from. This may be
@@ -646,7 +646,7 @@ public abstract class ClasspathFontPeer
public abstract boolean canDisplay (Font font, int c);
- /**
+ /**
* Implementation of {@link Font#canDisplay(String)},
* {@link Font#canDisplay(char [], int, int)}, and
* {@link Font#canDisplay(CharacterIterator, int, int)}.
@@ -678,9 +678,9 @@ public abstract class ClasspathFontPeer
*/
public abstract String getSubFamilyName (Font font, Locale locale);
-
- /**
+
+ /**
* Implementation of {@link Font#getPSName()}
*
* @param font the font this peer is being called from. This may be
@@ -691,7 +691,7 @@ public abstract class ClasspathFontPeer
public abstract String getPostScriptName (Font font);
- /**
+ /**
* Implementation of {@link Font#getNumGlyphs()}
*
* @param font the font this peer is being called from. This may be
@@ -702,7 +702,7 @@ public abstract class ClasspathFontPeer
public abstract int getNumGlyphs (Font font);
- /**
+ /**
* Implementation of {@link Font#getMissingGlyphCode()}
*
* @param font the font this peer is being called from. This may be
@@ -713,7 +713,7 @@ public abstract class ClasspathFontPeer
public abstract int getMissingGlyphCode (Font font);
- /**
+ /**
* Implementation of {@link Font#getBaselineFor(char)}
*
* @param font the font this peer is being called from. This may be
@@ -767,7 +767,7 @@ public abstract class ClasspathFontPeer
public abstract String getGlyphName (Font font, int glyphIndex);
- /**
+ /**
* Implementation of {@link
* Font#createGlyphVector(FontRenderContext, String)}, {@link
* Font#createGlyphVector(FontRenderContext, char[])}, and {@link
@@ -782,9 +782,9 @@ public abstract class ClasspathFontPeer
public abstract GlyphVector createGlyphVector (Font font,
FontRenderContext frc,
CharacterIterator ci);
-
- /**
+
+ /**
* Implementation of {@link Font#createGlyphVector(FontRenderContext,
* int[])}.
*
@@ -794,12 +794,12 @@ public abstract class ClasspathFontPeer
* not with font peers.
*/
- public abstract GlyphVector createGlyphVector (Font font,
- FontRenderContext ctx,
+ public abstract GlyphVector createGlyphVector (Font font,
+ FontRenderContext ctx,
int[] glyphCodes);
- /**
+ /**
* Implementation of {@link Font#layoutGlyphVector(FontRenderContext,
* char[], int, int, int)}.
*
@@ -809,13 +809,13 @@ public abstract class ClasspathFontPeer
* not with font peers.
*/
- public abstract GlyphVector layoutGlyphVector (Font font,
- FontRenderContext frc,
- char[] chars, int start,
+ public abstract GlyphVector layoutGlyphVector (Font font,
+ FontRenderContext frc,
+ char[] chars, int start,
int limit, int flags);
- /**
+ /**
* Implementation of {@link Font#getFontMetrics()}
*
* @param font the font this peer is being called from. This may be
@@ -826,7 +826,7 @@ public abstract class ClasspathFontPeer
public abstract FontMetrics getFontMetrics (Font font);
- /**
+ /**
* Implementation of {@link Font#hasUniformLineMetrics()}
*
* @param font the font this peer is being called from. This may be
@@ -837,7 +837,7 @@ public abstract class ClasspathFontPeer
public abstract boolean hasUniformLineMetrics (Font font);
- /**
+ /**
* Implementation of {@link Font#getLineMetrics(CharacterIterator, int,
* int, FontRenderContext)}
*
@@ -846,12 +846,12 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public abstract LineMetrics getLineMetrics (Font font,
- CharacterIterator ci,
- int begin, int limit,
+ public abstract LineMetrics getLineMetrics (Font font,
+ CharacterIterator ci,
+ int begin, int limit,
FontRenderContext rc);
- /**
+ /**
* Implementation of {@link Font#getMaxCharBounds(FontRenderContext)}
*
* @param font the font this peer is being called from. This may be
@@ -859,7 +859,7 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
- public abstract Rectangle2D getMaxCharBounds (Font font,
+ public abstract Rectangle2D getMaxCharBounds (Font font,
FontRenderContext rc);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java b/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java
index bf40bf3..fe128c2 100644
--- a/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java
@@ -71,7 +71,7 @@ import java.awt.peer.LightweightPeer;
* Lightweight components are painted directly onto their parent
* containers through an Image object provided by the toolkit.
*/
-public class GLightweightPeer
+public class GLightweightPeer
implements LightweightPeer, ContainerPeer
{
public GLightweightPeer()
@@ -80,39 +80,39 @@ public class GLightweightPeer
}
// -------- java.awt.peer.ContainerPeer implementation:
-
+
public Insets insets()
{
// Nothing to do here for lightweights.
return null;
}
-
+
public Insets getInsets()
{
// Nothing to do here for lightweights.
return null;
}
-
+
public void beginValidate()
{
// Nothing to do here for lightweights.
}
-
+
public void endValidate()
{
// Nothing to do here for lightweights.
}
-
+
public void beginLayout()
{
// Nothing to do here for lightweights.
}
-
+
public void endLayout()
{
// Nothing to do here for lightweights.
}
-
+
public boolean isPaintPending()
{
// Nothing to do here for lightweights.
@@ -235,7 +235,7 @@ public class GLightweightPeer
// Nothing to do here for lightweights.
}
- public boolean isFocusable()
+ public boolean isFocusable()
{
// Nothing to do here for lightweights.
return false;
@@ -263,7 +263,7 @@ public class GLightweightPeer
}
public boolean prepareImage(Image img, int width, int height,
- ImageObserver o)
+ ImageObserver o)
{
// Nothing to do here for lightweights.
return false;
@@ -373,10 +373,10 @@ public class GLightweightPeer
// Nothing to do here for lightweights.
}
- public VolatileImage createVolatileImage(int width, int height)
- {
+ public VolatileImage createVolatileImage(int width, int height)
+ {
// Nothing to do here for lightweights.
- return null;
+ return null;
}
public boolean handlesWheelScrolling()
@@ -385,7 +385,7 @@ public class GLightweightPeer
return false;
}
- public void createBuffers(int x, BufferCapabilities capabilities)
+ public void createBuffers(int x, BufferCapabilities capabilities)
throws AWTException
{
// Nothing to do here for lightweights.
diff --git a/libjava/classpath/gnu/java/awt/peer/GnomeDesktopPeer.java b/libjava/classpath/gnu/java/awt/peer/GnomeDesktopPeer.java
index cc41f74..2347371 100644
--- a/libjava/classpath/gnu/java/awt/peer/GnomeDesktopPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/GnomeDesktopPeer.java
@@ -60,13 +60,13 @@ public class GnomeDesktopPeer
{
// check if a command already exists
String command = super.getCommand(action);
-
+
if (command == null)
{
try
{
if (action == _BROWSE)
- {
+ {
command = execQuery(BROWSER_QUERY_GNOME);
}
else if (action == _PRINT)
@@ -83,46 +83,46 @@ public class GnomeDesktopPeer
command = null;
}
}
-
+
return command;
}
-
+
public void browse(URI url) throws IOException
{
checkPermissions();
-
+
String browser = getCommand(_BROWSE);
-
+
if (browser == null)
throw new UnsupportedOperationException();
-
+
browser = browser + " " + url.toString();
-
+
Runtime.getRuntime().exec(browser);
}
protected boolean supportCommand(String check)
{
if (check == _PRINT)
- {
+ {
return super.supportCommand(check);
}
-
+
return true;
}
public void mail() throws IOException
{
checkPermissions();
-
+
String mail = getCommand(_MAIL);
-
+
if (mail == null)
throw new UnsupportedOperationException();
-
+
Runtime.getRuntime().exec(mail + " mailto:");
}
-
+
protected String execQuery(String command) throws IOException
{
InputStream in = null;
@@ -149,7 +149,7 @@ public class GnomeDesktopPeer
// remove %s from the string, leave only the command line
int index = output.indexOf("%s");
output.delete(index, index + 1);
-
+
return output.toString().trim();
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java b/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java
index 8bc3e65..44a5084 100644
--- a/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java
@@ -56,16 +56,16 @@ public class KDEDesktopPeer
"gconftool-2 -g /desktop/gnome/url-handlers/http/command";
protected String getCommand(String action)
- {
+ {
// check if a command already exists
String command = super.getCommand(action);
-
+
if (command == null)
{
try
{
if (action == _MAIL)
- {
+ {
command = "kfmclient exec";
}
else if (action == _PRINT)
@@ -82,27 +82,27 @@ public class KDEDesktopPeer
command = null;
}
}
-
+
return command;
}
-
+
protected boolean supportCommand(String check)
{
return true;
}
-
+
public void mail() throws IOException
{
checkPermissions();
-
+
String mail = getCommand(_MAIL);
-
+
if (mail == null)
throw new UnsupportedOperationException();
-
+
Runtime.getRuntime().exec(mail + " 'mailto: '");
}
-
+
protected String execQuery(String command) throws IOException
{
InputStream in = null;
@@ -129,7 +129,7 @@ public class KDEDesktopPeer
// remove %s from the string, leave only the command line
int index = output.indexOf("%s");
output.delete(index, index + 1);
-
+
return output.toString().trim();
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/AsyncImage.java b/libjava/classpath/gnu/java/awt/peer/gtk/AsyncImage.java
index dad537a..786dcf2 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/AsyncImage.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/AsyncImage.java
@@ -98,7 +98,7 @@ public class AsyncImage
ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
}
}
-
+
}
/**
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java
index 31c5e64..f9609bf 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java
@@ -64,7 +64,7 @@ import java.util.WeakHashMap;
/**
* Implementation of Graphics2D on a Cairo surface.
*
- * Simutanously maintains a CairoSurface and updates the
+ * Simutanously maintains a CairoSurface and updates the
* BufferedImage from that after each drawing operation.
*/
public class BufferedImageGraphics extends CairoGraphics2D
@@ -73,7 +73,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
* the buffered Image.
*/
private BufferedImage image, buffer;
-
+
/**
* Image size.
*/
@@ -104,7 +104,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
this.image = bi;
imageWidth = bi.getWidth();
imageHeight = bi.getHeight();
-
+
if (!(image.getSampleModel() instanceof SinglePixelPackedSampleModel))
hasFastCM = false;
else if(bi.getColorModel().equals(CairoSurface.cairoCM_opaque))
@@ -151,11 +151,11 @@ public class BufferedImageGraphics extends CairoGraphics2D
{
int[] pixels2 = new int[imageWidth * imageHeight];
int scanline = sm.getScanlineStride();
-
+
for (int i = 0; i < imageHeight; i++)
System.arraycopy(pixels, (i - minY) * scanline - minX, pixels2,
i * imageWidth, imageWidth);
-
+
pixels = pixels2;
}
@@ -172,11 +172,11 @@ public class BufferedImageGraphics extends CairoGraphics2D
System.arraycopy(pixels, 0, surface.getData(),
0, pixels.length);
}
-
+
setup( cairo_t );
setClip(0, 0, imageWidth, imageHeight);
}
-
+
BufferedImageGraphics(BufferedImageGraphics copyFrom)
{
image = copyFrom.image;
@@ -184,7 +184,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
cairo_t = surface.newCairoContext();
imageWidth = copyFrom.imageWidth;
imageHeight = copyFrom.imageHeight;
-
+
hasFastCM = copyFrom.hasFastCM;
hasAlpha = copyFrom.hasAlpha;
@@ -195,7 +195,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
* Update a rectangle of the bufferedImage. This can be improved upon a lot.
*/
private void updateBufferedImage(int x, int y, int width, int height)
- {
+ {
Rectangle bounds = new Rectangle(x, y, width, height);
bounds = getTransformedBounds(bounds, transform).getBounds();
x = bounds.x;
@@ -207,7 +207,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
if( x > imageWidth || y > imageHeight )
return;
-
+
// Deal with negative width/height.
if (height < 0)
{
@@ -219,44 +219,44 @@ public class BufferedImageGraphics extends CairoGraphics2D
x += width;
width = -width;
}
-
+
// Clip edges.
if( x < 0 )
x = 0;
if( y < 0 )
y = 0;
-
- if( x + width > imageWidth )
+
+ if( x + width > imageWidth )
width = imageWidth - x;
- if( y + height > imageHeight )
+ if( y + height > imageHeight )
height = imageHeight - y;
-
+
if(!hasFastCM)
{
- image.setRGB(x, y, width, height, pixels,
+ image.setRGB(x, y, width, height, pixels,
x + y * imageWidth, imageWidth);
// The setRGB method assumes (or should assume) that pixels are NOT
// alpha-premultiplied, but Cairo stores data with premultiplication
// (thus the pixels returned in getPixels are premultiplied).
// This is ignored for consistency, however, since in
// CairoGrahpics2D.drawImage we also use non-premultiplied data
-
+
}
else
{
int[] db = ((DataBufferInt)image.getRaster().getDataBuffer()).
getData();
-
+
// This should not fail, as we check the image sample model when we
// set the hasFastCM flag
SinglePixelPackedSampleModel sm = (SinglePixelPackedSampleModel)image.getSampleModel() ;
-
+
int minX = image.getRaster().getSampleModelTranslateX();
int minY = image.getRaster().getSampleModelTranslateY();
-
- if (sm.getScanlineStride() == imageWidth && minX == 0)
+
+ if (sm.getScanlineStride() == imageWidth && minX == 0)
{
- System.arraycopy(pixels, y * imageWidth,
+ System.arraycopy(pixels, y * imageWidth,
db, (y - minY) * imageWidth,
height * imageWidth);
}
@@ -266,19 +266,19 @@ public class BufferedImageGraphics extends CairoGraphics2D
for (int i = y; i < (height + y); i++)
System.arraycopy(pixels, i * imageWidth + x, db,
(i - minY) * scanline + x - minX, width);
-
+
}
}
}
/**
* Abstract methods.
- */
+ */
public Graphics create()
{
return new BufferedImageGraphics(this);
}
-
+
public GraphicsConfiguration getDeviceConfiguration()
{
return null;
@@ -288,7 +288,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
{
return new Rectangle2D.Double(0.0, 0.0, imageWidth, imageHeight);
}
-
+
public void copyAreaImpl(int x, int y, int width, int height, int dx, int dy)
{
surface.copyAreaNative(x, y, width, height, dx, dy, surface.width);
@@ -296,7 +296,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
}
/**
- * Overloaded methods that do actual drawing need to enter the gdk threads
+ * Overloaded methods that do actual drawing need to enter the gdk threads
* and also do certain things before and after.
*/
public void draw(Shape s)
@@ -308,7 +308,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
r.width++;
r.height++;
}
-
+
// Do the drawing
if (comp == null || comp instanceof AlphaComposite)
{
@@ -318,13 +318,13 @@ public class BufferedImageGraphics extends CairoGraphics2D
else
{
createBuffer();
-
+
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setStroke(this.getStroke());
g2d.setColor(this.getColor());
g2d.setTransform(transform);
g2d.draw(s);
-
+
drawComposite(r.getBounds2D(), null);
}
}
@@ -340,13 +340,13 @@ public class BufferedImageGraphics extends CairoGraphics2D
else
{
createBuffer();
-
+
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setPaint(this.getPaint());
g2d.setColor(this.getColor());
g2d.setTransform(transform);
g2d.fill(s);
-
+
drawComposite(s.getBounds2D(), null);
}
}
@@ -366,14 +366,14 @@ public class BufferedImageGraphics extends CairoGraphics2D
g2d.setRenderingHints(this.getRenderingHints());
g2d.setTransform(transform);
g2d.drawRenderedImage(image, xform);
-
+
drawComposite(buffer.getRaster().getBounds(), null);
}
}
protected boolean drawImage(Image img, AffineTransform xform,
- Color bgcolor, ImageObserver obs)
+ Color bgcolor, ImageObserver obs)
{
if (comp == null || comp instanceof AlphaComposite)
{
@@ -392,16 +392,16 @@ public class BufferedImageGraphics extends CairoGraphics2D
img = Toolkit.getDefaultToolkit().createImage(source);
}
BufferedImage bImg = (BufferedImage) img;
-
+
// Find translated bounds
Rectangle2D bounds = new Rectangle(bImg.getMinX(), bImg.getMinY(),
bImg.getWidth(), bImg.getHeight());
if (xform != null)
bounds = getTransformedBounds(bounds, xform);
-
+
// Create buffer and draw image
createBuffer();
-
+
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setRenderingHints(this.getRenderingHints());
g2d.drawImage(img, xform, obs);
@@ -413,20 +413,20 @@ public class BufferedImageGraphics extends CairoGraphics2D
public void drawGlyphVector(GlyphVector gv, float x, float y)
{
- // Find absolute bounds, in user-space, of this glyph vector
+ // Find absolute bounds, in user-space, of this glyph vector
Rectangle2D bounds = gv.getLogicalBounds();
bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(),
bounds.getWidth(), bounds.getHeight());
-
+
// Perform draw operation
if (comp == null || comp instanceof AlphaComposite)
{
super.drawGlyphVector(gv, x, y);
-
+
// this returns an integer-based Rectangle (rather than a
// Rectangle2D), which takes care of any necessary rounding for us.
bounds = bounds.getBounds();
-
+
updateBufferedImage((int)bounds.getX(), (int)bounds.getY(),
(int)bounds.getWidth(), (int)bounds.getHeight());
}
@@ -439,17 +439,17 @@ public class BufferedImageGraphics extends CairoGraphics2D
g2d.setStroke(this.getStroke());
g2d.setTransform(transform);
g2d.drawGlyphVector(gv, x, y);
-
+
drawComposite(bounds, null);
}
}
-
+
/**
* Perform composite drawing from the buffer onto the main image.
- *
+ *
* The image to be composited should already be drawn into the buffer, in the
* proper place, after all necessary transforms have been applied.
- *
+ *
* @param bounds The bounds to draw, in user-space.
* @param observer The image observer, if any (may be null).
* @return True on success, false on failure.
@@ -465,7 +465,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
devClip = new Rectangle(buffer.getMinX(), buffer.getMinY(),
buffer.getWidth(), buffer.getHeight());
Rectangle2D.intersect(bounds, devClip, bounds);
-
+
// Round bounds as needed, but be careful in our rounding
// (otherwise it may leave unpainted stripes)
double x = bounds.getX();
@@ -475,7 +475,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
x = Math.round(x);
y = Math.round(y);
bounds.setRect(x, y, Math.round(maxX - x), Math.round(maxY - y));
-
+
// Find subimage of internal buffer for updating
BufferedImage buffer2 = buffer;
if (!bounds.equals(buffer2.getRaster().getBounds()))
@@ -492,12 +492,12 @@ public class BufferedImageGraphics extends CairoGraphics2D
// Perform actual composite operation
compCtx.compose(buffer2.getRaster(), current.getRaster(),
current.getRaster());
-
+
// Set cairo's composite to direct SRC, since we've already done our own
- // compositing
+ // compositing
Composite oldcomp = comp;
setComposite(AlphaComposite.Src);
-
+
// This MUST call directly into the "action" method in CairoGraphics2D,
// not one of the wrappers, to ensure that the composite isn't processed
// more than once!
@@ -509,7 +509,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
updateColor();
return rv;
}
-
+
private void createBuffer()
{
if (buffer == null)
@@ -520,20 +520,19 @@ public class BufferedImageGraphics extends CairoGraphics2D
else
{
Graphics2D g2d = ((Graphics2D)buffer.getGraphics());
-
+
g2d.setBackground(new Color(0,0,0,0));
g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight());
}
}
-
+
protected ColorModel getNativeCM()
{
return image.getColorModel();
}
-
+
protected ColorModel getBufferCM()
{
return ColorModel.getRGBdefault();
}
}
-
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
index 8f8d7ea..05d35c5 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
@@ -101,7 +101,7 @@ import java.util.HashMap;
import java.util.Map;
/**
- * This is an abstract implementation of Graphics2D on Cairo.
+ * This is an abstract implementation of Graphics2D on Cairo.
*
* It should be subclassed for different Cairo contexts.
*
@@ -112,7 +112,7 @@ import java.util.Map;
* GraphicsConfiguration getDeviceConfiguration()
* copyArea(int x, int y, int width, int height, int dx, int dy)
*
- * Also, dispose() must be overloaded to free any native datastructures
+ * Also, dispose() must be overloaded to free any native datastructures
* used by subclass and in addition call super.dispose() to free the
* native cairographics2d structure and cairo_t.
*
@@ -120,7 +120,7 @@ import java.util.Map;
*/
public abstract class CairoGraphics2D extends Graphics2D
{
- static
+ static
{
if (true) // GCJ LOCAL
{
@@ -177,7 +177,7 @@ public abstract class CairoGraphics2D extends Graphics2D
* Rendering hint map.
*/
private RenderingHints hints;
-
+
/**
* Status of the anti-alias flag in cairo.
*/
@@ -187,7 +187,7 @@ public abstract class CairoGraphics2D extends Graphics2D
/**
* Some operations (drawing rather than filling) require that their
* coords be shifted to land on 0.5-pixel boundaries, in order to land on
- * "middle of pixel" coordinates and light up complete pixels.
+ * "middle of pixel" coordinates and light up complete pixels.
*/
protected boolean shiftDrawCalls = false;
@@ -203,8 +203,8 @@ public abstract class CairoGraphics2D extends Graphics2D
private static BasicStroke draw3DRectStroke = new BasicStroke();
static ColorModel rgb32 = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF);
- static ColorModel argb32 = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF,
- 0xFF000000);
+ static ColorModel argb32 = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF,
+ 0xFF000000);
/**
* Native constants for interpolation methods.
@@ -217,7 +217,7 @@ public abstract class CairoGraphics2D extends Graphics2D
ALPHA_INTERPOLATION_QUALITY = 3,
ALPHA_INTERPOLATION_DEFAULT = 4;
// TODO: Does ALPHA_INTERPOLATION really correspond to CAIRO_FILTER_FAST/BEST/GOOD?
-
+
/**
* Constructor does nothing.
*/
@@ -230,7 +230,7 @@ public abstract class CairoGraphics2D extends Graphics2D
* @param cairo_t_pointer a native pointer to a cairo_t of the context.
*/
public void setup(long cairo_t_pointer)
- {
+ {
nativePointer = init(cairo_t_pointer);
setRenderingHints(new RenderingHints(getDefaultHints()));
setFont(new Font("SansSerif", Font.PLAIN, 12));
@@ -251,7 +251,7 @@ public abstract class CairoGraphics2D extends Graphics2D
paint = g.paint;
stroke = g.stroke;
setRenderingHints(g.hints);
-
+
Color foreground;
if (g.fg.getAlpha() != -1)
@@ -286,7 +286,7 @@ public abstract class CairoGraphics2D extends Graphics2D
setTransformImpl(transform);
setClip(clip);
setComposite(comp);
-
+
antialias = !g.antialias;
setAntialias(g.antialias);
}
@@ -300,9 +300,9 @@ public abstract class CairoGraphics2D extends Graphics2D
}
/**
- * Disposes the native cairographics2d structure, including the
- * cairo_t and any gradient stuff, if allocated.
- * Subclasses should of course overload and call this if
+ * Disposes the native cairographics2d structure, including the
+ * cairo_t and any gradient stuff, if allocated.
+ * Subclasses should of course overload and call this if
* they have additional native structures.
*/
public void dispose()
@@ -332,7 +332,7 @@ public abstract class CairoGraphics2D extends Graphics2D
/**
* Find the bounds of this graphics context, in device space.
- *
+ *
* @return the bounds in device-space
*/
protected abstract Rectangle2D getRealBounds();
@@ -359,7 +359,7 @@ public abstract class CairoGraphics2D extends Graphics2D
double x2, double y2,
int r1, int g1, int b1, int a1, int r2,
int g2, int b2, int a2, boolean cyclic);
-
+
protected native void setPaintPixels(long pointer, int[] pixels, int w,
int h, int stride, boolean repeat,
int x, int y);
@@ -368,7 +368,7 @@ public abstract class CairoGraphics2D extends Graphics2D
* Set the current transform matrix
*/
protected native void cairoSetMatrix(long pointer, double[] m);
-
+
/**
* Scaling method
*/
@@ -406,8 +406,8 @@ public abstract class CairoGraphics2D extends Graphics2D
/*
* Draws a Glyph Vector
*/
- protected native void cairoDrawGlyphVector(long pointer, GdkFontPeer font,
- float x, float y, int n,
+ protected native void cairoDrawGlyphVector(long pointer, GdkFontPeer font,
+ float x, float y, int n,
int[] codes, float[] positions, long[] fontset);
/**
@@ -420,7 +420,7 @@ public abstract class CairoGraphics2D extends Graphics2D
*/
protected native void cairoRectangle(long pointer, double x, double y,
double width, double height);
-
+
/**
* Appends an arc to the current path
*/
@@ -438,7 +438,7 @@ public abstract class CairoGraphics2D extends Graphics2D
*/
protected native void cairoNewPath(long pointer);
- /**
+ /**
* Close current path
*/
protected native void cairoClosePath(long pointer);
@@ -464,16 +464,16 @@ public abstract class CairoGraphics2D extends Graphics2D
*/
protected native void cairoFill(long pointer, double alpha);
- /**
+ /**
* Clip current path
*/
protected native void cairoClip(long pointer);
- /**
+ /**
* Clear clip
*/
protected native void cairoResetClip(long pointer);
-
+
/**
* Set antialias.
*/
@@ -483,7 +483,7 @@ public abstract class CairoGraphics2D extends Graphics2D
///////////////////////// TRANSFORMS ///////////////////////////////////
/**
* Set the current transform
- */
+ */
public void setTransform(AffineTransform tx)
{
// Transform clip into target space using the old transform.
@@ -588,7 +588,7 @@ public abstract class CairoGraphics2D extends Graphics2D
setTransformImpl(transform);
}
-
+
public void translate(int x, int y)
{
translate((double) x, (double) y);
@@ -670,13 +670,13 @@ public abstract class CairoGraphics2D extends Graphics2D
setColor((Color) paint);
customPaint = false;
}
-
+
else if (paint instanceof TexturePaint)
{
TexturePaint tp = (TexturePaint) paint;
BufferedImage img = tp.getImage();
- // map the image to the anchor rectangle
+ // map the image to the anchor rectangle
int width = (int) tp.getAnchorRect().getWidth();
int height = (int) tp.getAnchorRect().getHeight();
@@ -690,7 +690,7 @@ public abstract class CairoGraphics2D extends Graphics2D
setPaintPixels(nativePointer, pixels, width, height, width, true, 0, 0);
customPaint = false;
}
-
+
else if (paint instanceof GradientPaint)
{
GradientPaint gp = (GradientPaint) paint;
@@ -707,12 +707,12 @@ public abstract class CairoGraphics2D extends Graphics2D
else
{
customPaint = true;
- }
+ }
}
-
+
/**
* Sets a custom paint
- *
+ *
* @param bounds the bounding box, in user space
*/
protected void setCustomPaint(Rectangle bounds)
@@ -720,12 +720,12 @@ public abstract class CairoGraphics2D extends Graphics2D
if (paint instanceof Color || paint instanceof TexturePaint
|| paint instanceof GradientPaint)
return;
-
+
int userX = bounds.x;
int userY = bounds.y;
int userWidth = bounds.width;
int userHeight = bounds.height;
-
+
// Find bounds in device space
Rectangle2D bounds2D = getTransformedBounds(bounds, transform);
int deviceX = (int)bounds2D.getX();
@@ -740,14 +740,14 @@ public abstract class CairoGraphics2D extends Graphics2D
deviceHeight),
bounds,
transform, hints);
-
+
Raster raster = pc.getRaster(deviceX, deviceY, deviceWidth,
deviceHeight);
-
+
// Clear the transform matrix in Cairo, since the raster returned by the
// PaintContext is already in device-space
AffineTransform oldTx = new AffineTransform(transform);
- setTransformImpl(new AffineTransform());
+ setTransformImpl(new AffineTransform());
// Set pixels in cairo, aligning the top-left of the background image
// to the top-left corner in device space
@@ -762,7 +762,7 @@ public abstract class CairoGraphics2D extends Graphics2D
deviceWidth, deviceHeight, deviceWidth, false,
deviceX, deviceY);
}
-
+
else if (pc.getColorModel().equals(CairoSurface.cairoCM_opaque)
&& raster.getSampleModel().getTransferType() == DataBuffer.TYPE_INT)
{
@@ -770,36 +770,36 @@ public abstract class CairoGraphics2D extends Graphics2D
// but without an alpha channel; we just add the alpha
int[] pixels = (int[])raster.getDataElements(0, 0, deviceWidth,
deviceHeight, null);
-
+
for (int i = 0; i < pixels.length; i++)
pixels[i] = 0xff000000 | (pixels[i] & 0x00ffffff);
-
+
setPaintPixels(nativePointer, pixels, deviceWidth, deviceHeight,
deviceWidth, false, deviceX, deviceY);
}
-
+
else
{
- // Fall back on wrapping the raster in a BufferedImage, and
- // use BufferedImage.getRGB() to do color-model conversion
+ // Fall back on wrapping the raster in a BufferedImage, and
+ // use BufferedImage.getRGB() to do color-model conversion
WritableRaster wr = Raster.createWritableRaster(raster.getSampleModel(),
new Point(raster.getMinX(),
raster.getMinY()));
wr.setRect(raster);
-
+
BufferedImage img2 = new BufferedImage(pc.getColorModel(), wr,
pc.getColorModel().isAlphaPremultiplied(),
null);
-
+
setPaintPixels(nativePointer,
img2.getRGB(0, 0, deviceWidth, deviceHeight, null, 0,
deviceWidth),
deviceWidth, deviceHeight, deviceWidth, false,
deviceX, deviceY);
}
-
+
// Restore transform
- setTransformImpl(oldTx);
+ setTransformImpl(oldTx);
}
public Stroke getStroke()
@@ -813,7 +813,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if (stroke instanceof BasicStroke)
{
BasicStroke bs = (BasicStroke) stroke;
- cairoSetLine(nativePointer, bs.getLineWidth(), bs.getEndCap(),
+ cairoSetLine(nativePointer, bs.getLineWidth(), bs.getEndCap(),
bs.getLineJoin(), bs.getMiterLimit());
float[] dashes = bs.getDashArray();
@@ -822,7 +822,7 @@ public abstract class CairoGraphics2D extends Graphics2D
double[] double_dashes = new double[dashes.length];
for (int i = 0; i < dashes.length; i++)
double_dashes[i] = dashes[i];
-
+
cairoSetDash(nativePointer, double_dashes, double_dashes.length,
(double) bs.getDashPhase());
}
@@ -833,14 +833,14 @@ public abstract class CairoGraphics2D extends Graphics2D
/**
* Utility method to find the bounds of a shape, including the stroke width.
- *
+ *
* @param s the shape
* @return the bounds of the shape, including stroke width
*/
protected Rectangle findStrokedBounds(Shape s)
{
Rectangle r = s.getBounds();
-
+
if (stroke instanceof BasicStroke)
{
int strokeWidth = (int)Math.ceil(((BasicStroke)stroke).getLineWidth());
@@ -854,7 +854,7 @@ public abstract class CairoGraphics2D extends Graphics2D
Shape s2 = stroke.createStrokedShape(s);
r = s2.getBounds();
}
-
+
return r;
}
@@ -877,7 +877,7 @@ public abstract class CairoGraphics2D extends Graphics2D
paint = c;
updateColor();
}
-
+
/**
* Set the current fg value as the cairo color.
*/
@@ -885,7 +885,7 @@ public abstract class CairoGraphics2D extends Graphics2D
{
if (fg == null)
fg = Color.BLACK;
-
+
cairoSetRGBAColor(nativePointer, fg.getRed() / 255.0,
fg.getGreen() / 255.0,fg.getBlue() / 255.0,
fg.getAlpha() / 255.0);
@@ -951,9 +951,9 @@ public abstract class CairoGraphics2D extends Graphics2D
public void setClip(Shape s)
{
- // The first time the clip is set, save it as the original clip
- // to reset to on s == null. We can rely on this being non-null
- // because the constructor in subclasses is expected to set the
+ // The first time the clip is set, save it as the original clip
+ // to reset to on s == null. We can rely on this being non-null
+ // because the constructor in subclasses is expected to set the
// initial clip properly.
if( firstClip )
{
@@ -975,7 +975,7 @@ public abstract class CairoGraphics2D extends Graphics2D
}
else
walkPath(clip.getPathIterator(null), false);
-
+
cairoClip(nativePointer);
}
}
@@ -1010,7 +1010,7 @@ public abstract class CairoGraphics2D extends Graphics2D
{
if (this.comp == comp)
return;
-
+
this.comp = comp;
if (compCtx != null)
compCtx.dispose();
@@ -1021,11 +1021,11 @@ public abstract class CairoGraphics2D extends Graphics2D
AlphaComposite a = (AlphaComposite) comp;
cairoSetOperator(nativePointer, a.getRule());
}
-
+
else
{
cairoSetOperator(nativePointer, AlphaComposite.SRC_OVER);
-
+
if (comp != null)
{
// FIXME: this check is only required "if this Graphics2D
@@ -1033,24 +1033,24 @@ public abstract class CairoGraphics2D extends Graphics2D
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new AWTPermission("readDisplayPixels"));
-
+
compCtx = comp.createContext(getBufferCM(), getNativeCM(), hints);
}
}
}
-
+
/**
* Returns the Colour Model describing the native, raw image data for this
* specific peer.
- *
+ *
* @return ColorModel the ColorModel of native data in this peer
*/
protected abstract ColorModel getNativeCM();
-
+
/**
* Returns the Color Model describing the buffer that this peer uses
* for custom composites.
- *
+ *
* @return ColorModel the ColorModel of the composite buffer in this peer.
*/
protected ColorModel getBufferCM()
@@ -1107,7 +1107,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if (s instanceof Rectangle2D)
{
Rectangle2D r = (Rectangle2D) s;
-
+
// Pixels need to be shifted in draw operations to ensure that they
// light up entire pixels, but we also need to make sure the rectangle
// does not get distorted by this shifting operation
@@ -1117,7 +1117,7 @@ public abstract class CairoGraphics2D extends Graphics2D
double h = Math.round(r.getHeight());
cairoRectangle(nativePointer, x, y, w, h);
}
-
+
// Lines are easy too
else if (s instanceof Line2D)
{
@@ -1170,7 +1170,7 @@ public abstract class CairoGraphics2D extends Graphics2D
/**
* Note that the rest of the drawing methods go via fill() or draw() for the drawing,
- * although subclasses may with to overload these methods where context-specific
+ * although subclasses may with to overload these methods where context-specific
* optimizations are possible (e.g. bitmaps and fillRect(int, int, int, int)
*/
@@ -1274,17 +1274,17 @@ public abstract class CairoGraphics2D extends Graphics2D
}
/**
- * CopyArea - performs clipping to the native surface as a convenience
+ * CopyArea - performs clipping to the native surface as a convenience
* (requires getRealBounds). Then calls copyAreaImpl.
*/
- public void copyArea(int ox, int oy, int owidth, int oheight,
- int odx, int ody)
+ public void copyArea(int ox, int oy, int owidth, int oheight,
+ int odx, int ody)
{
// FIXME: does this handle a rotation transform properly?
// (the width/height might not be correct)
Point2D pos = transform.transform(new Point2D.Double(ox, oy),
(Point2D) null);
- Point2D dim = transform.transform(new Point2D.Double(ox + owidth,
+ Point2D dim = transform.transform(new Point2D.Double(ox + owidth,
oy + oheight),
(Point2D) null);
Point2D p2 = transform.transform(new Point2D.Double(ox + odx, oy + ody),
@@ -1307,7 +1307,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if( x + dx + width < r.getX() || y + dy + height < r.getY() )
return;
- // Clip edges if necessary
+ // Clip edges if necessary
if( x + dx < r.getX() ) // left
{
width = x + dx + width;
@@ -1348,10 +1348,10 @@ public abstract class CairoGraphics2D extends Graphics2D
{
this.hints = new RenderingHints(getDefaultHints());
this.hints.putAll(hints);
-
+
shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE)
|| hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT);
-
+
if (compCtx != null)
{
compCtx.dispose();
@@ -1368,7 +1368,7 @@ public abstract class CairoGraphics2D extends Graphics2D
{
return hints;
}
-
+
private int getInterpolation()
{
if (this.hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
@@ -1392,18 +1392,18 @@ public abstract class CairoGraphics2D extends Graphics2D
// Do bilinear interpolation as default
return INTERPOLATION_BILINEAR;
}
-
+
/**
* Set antialias if needed. If the ignoreAA flag is set, this method will
* return without doing anything.
- *
+ *
* @param needAA RenderingHints.VALUE_ANTIALIAS_ON or RenderingHints.VALUE_ANTIALIAS_OFF
*/
private void setAntialias(boolean needAA)
{
if (ignoreAA)
return;
-
+
if (needAA != antialias)
{
antialias = !antialias;
@@ -1425,8 +1425,8 @@ public abstract class CairoGraphics2D extends Graphics2D
// In this case, xform is an AffineTransform that transforms bounding
// box of the specified image from image space to user space. However
// when we pass this transform to cairo, cairo will use this transform
- // to map "user coordinates" to "pixel" coordinates, which is the
- // other way around. Therefore to get the "user -> pixel" transform
+ // to map "user coordinates" to "pixel" coordinates, which is the
+ // other way around. Therefore to get the "user -> pixel" transform
// that cairo wants from "image -> user" transform that we currently
// have, we will need to invert the transformation matrix.
AffineTransform invertedXform;
@@ -1459,10 +1459,10 @@ public abstract class CairoGraphics2D extends Graphics2D
double[] i2u = new double[6];
int width = b.getWidth();
int height = b.getHeight();
-
- // If this BufferedImage has a BufferedImageGraphics object,
+
+ // If this BufferedImage has a BufferedImageGraphics object,
// use the cached CairoSurface that BIG is drawing onto
-
+
if( BufferedImageGraphics.bufferedImages.get( b ) != null )
raster = BufferedImageGraphics.bufferedImages.get( b );
else
@@ -1481,18 +1481,18 @@ public abstract class CairoGraphics2D extends Graphics2D
updateColor();
return true;
}
-
+
if( bgcolor != null )
{
Color oldColor = bg;
setBackground(bgcolor);
-
+
Rectangle2D bounds = new Rectangle2D.Double(0, 0, width, height);
bounds = getTransformedBounds(bounds, xform);
-
+
clearRect((int)bounds.getX(), (int)bounds.getY(),
(int)bounds.getWidth(), (int)bounds.getHeight());
-
+
setBackground(oldColor);
}
@@ -1500,7 +1500,7 @@ public abstract class CairoGraphics2D extends Graphics2D
// FIXME: The above method returns data in the standard ARGB colorspace,
// meaning data should NOT be alpha pre-multiplied; however Cairo expects
// data to be premultiplied.
-
+
cairoSave(nativePointer);
Rectangle2D bounds = new Rectangle2D.Double(0, 0, width, height);
bounds = getTransformedBounds(bounds, xform);
@@ -1510,7 +1510,7 @@ public abstract class CairoGraphics2D extends Graphics2D
drawPixels(nativePointer, pixels, width, height, width, i2u, alpha,
getInterpolation());
-
+
cairoRestore(nativePointer);
// Cairo seems to lose the current color which must be restored.
@@ -1585,7 +1585,7 @@ public abstract class CairoGraphics2D extends Graphics2D
int destWidth = dx2 - dx1;
int destHeight = dy2 - dy1;
- if(destWidth == 0 || destHeight == 0 || sourceWidth == 0 ||
+ if(destWidth == 0 || destHeight == 0 || sourceWidth == 0 ||
sourceHeight == 0)
return true;
@@ -1593,18 +1593,18 @@ public abstract class CairoGraphics2D extends Graphics2D
double scaleY = destHeight / (double) sourceHeight;
// FIXME: Avoid using an AT if possible here - it's at least twice as slow.
-
+
Shape oldClip = getClip();
int cx, cy, cw, ch;
- if( dx1 < dx2 )
+ if( dx1 < dx2 )
{ cx = dx1; cw = dx2 - dx1; }
else
{ cx = dx2; cw = dx1 - dx2; }
- if( dy1 < dy2 )
+ if( dy1 < dy2 )
{ cy = dy1; ch = dy2 - dy1; }
else
{ cy = dy2; ch = dy1 - dy2; }
-
+
clipRect( cx, cy, cw, ch );
AffineTransform tx = new AffineTransform();
@@ -1622,10 +1622,10 @@ public abstract class CairoGraphics2D extends Graphics2D
{
return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, observer);
}
-
+
/**
* Optimized method for drawing a CairoSurface onto this graphics context.
- *
+ *
* @param surface The surface to draw.
* @param tx The transformation matrix (cannot be null).
* @param alpha The alpha value to paint with ( 0 <= alpha <= 1).
@@ -1642,19 +1642,19 @@ public abstract class CairoGraphics2D extends Graphics2D
Point2D origin = new Point2D.Double(0, 0);
Point2D offset = new Point2D.Double(surface.getSampleModelTranslateX(),
surface.getSampleModelTranslateY());
-
+
tx.transform(origin, origin);
tx.transform(offset, offset);
-
+
tx.translate(offset.getX() - origin.getX(),
offset.getY() - origin.getY());
}
-
+
// Find dimensions of this surface relative to the root parent surface
Rectangle bounds = new Rectangle(-surface.getSampleModelTranslateX(),
-surface.getSampleModelTranslateY(),
surface.width, surface.height);
-
+
// Clip to the translated image
// We use direct cairo methods to avoid the overhead of maintaining a
// java copy of the clip, since we will be reverting it immediately
@@ -1663,7 +1663,7 @@ public abstract class CairoGraphics2D extends Graphics2D
cairoSave(nativePointer);
walkPath(newBounds.getPathIterator(null), false);
cairoClip(nativePointer);
-
+
// Draw the surface
try
{
@@ -1677,7 +1677,7 @@ public abstract class CairoGraphics2D extends Graphics2D
// This should never happen(?), so we don't need to do anything here.
;
}
-
+
// Restore clip
cairoRestore(nativePointer);
}
@@ -1696,13 +1696,13 @@ public abstract class CairoGraphics2D extends Graphics2D
tl = new TextLayout( str, getFont(), getFontRenderContext() );
fontPeer.textLayoutCache.put(str, tl);
}
-
+
// Set antialias to text_antialiasing, and set the ignoreAA flag so that
// the setting doesn't get overridden in a draw() or fill() call.
setAntialias(!hints.get(RenderingHints.KEY_TEXT_ANTIALIASING)
.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF));
ignoreAA = true;
-
+
tl.draw(this, x, y);
ignoreAA = false;
}
@@ -1726,14 +1726,14 @@ public abstract class CairoGraphics2D extends Graphics2D
if (customPaint)
setCustomPaint(gv.getOutline().getBounds());
-
+
if (comp instanceof AlphaComposite)
alpha = ((AlphaComposite) comp).getAlpha();
-
+
setAntialias(!hints.get(RenderingHints.KEY_TEXT_ANTIALIASING)
.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF));
ignoreAA = true;
-
+
if (gv instanceof FreetypeGlyphVector && alpha == 1.0
&& !((FreetypeGlyphVector)gv).hasTransforms())
{
@@ -1744,8 +1744,8 @@ public abstract class CairoGraphics2D extends Graphics2D
setFont (gv.getFont ());
GdkFontPeer fontPeer = (GdkFontPeer) font.getPeer();
- synchronized (fontPeer)
- {
+ synchronized (fontPeer)
+ {
cairoDrawGlyphVector(nativePointer, fontPeer,
x, y, n, codes, positions, fontset);
}
@@ -1756,7 +1756,7 @@ public abstract class CairoGraphics2D extends Graphics2D
fill(gv.getOutline());
translate(-x, -y);
}
-
+
ignoreAA = false;
}
@@ -1767,7 +1767,7 @@ public abstract class CairoGraphics2D extends Graphics2D
}
/**
- * Should perhaps be contexct dependent, but this is left for now as an
+ * Should perhaps be contexct dependent, but this is left for now as an
* overloadable default implementation.
*/
public FontRenderContext getFontRenderContext()
@@ -1799,10 +1799,10 @@ public abstract class CairoGraphics2D extends Graphics2D
if (f.getPeer() instanceof GdkFontPeer)
font = f;
else
- font =
+ font =
((ClasspathToolkit)(Toolkit.getDefaultToolkit()))
- .getFont(f.getName(), f.getAttributes());
-
+ .getFont(f.getName(), f.getAttributes());
+
GdkFontPeer fontpeer = (GdkFontPeer) getFont().getPeer();
synchronized (fontpeer)
{
@@ -1824,11 +1824,11 @@ public abstract class CairoGraphics2D extends Graphics2D
if( onStroke )
{
Shape stroked = stroke.createStrokedShape( s );
- return stroked.intersects( (double)rect.x, (double)rect.y,
+ return stroked.intersects( (double)rect.x, (double)rect.y,
(double)rect.width, (double)rect.height );
}
- return s.intersects( (double)rect.x, (double)rect.y,
- (double)rect.width, (double)rect.height );
+ return s.intersects( (double)rect.x, (double)rect.y,
+ (double)rect.width, (double)rect.height );
}
public String toString()
@@ -1836,7 +1836,7 @@ public abstract class CairoGraphics2D extends Graphics2D
return (getClass().getName()
+ "[font=" + getFont().toString()
+ ",color=" + fg.toString()
- + "]");
+ + "]");
}
///////////////////////// PRIVATE METHODS ///////////////////////////////////
@@ -1845,7 +1845,7 @@ public abstract class CairoGraphics2D extends Graphics2D
* All the drawImage() methods eventually get delegated here if the image
* is not a Cairo surface.
*
- * @param bgcolor - if non-null draws the background color before
+ * @param bgcolor - if non-null draws the background color before
* drawing the image.
*/
private boolean drawRaster(ColorModel cm, Raster r,
@@ -1881,7 +1881,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if (pixels == null)
{
// FIXME: I don't think this code will work correctly with a non-RGB
- // MultiPixelPackedSampleModel. Although this entire method should
+ // MultiPixelPackedSampleModel. Although this entire method should
// probably be rewritten to better utilize Cairo's different supported
// data formats.
if (sm instanceof MultiPixelPackedSampleModel)
@@ -1917,13 +1917,13 @@ public abstract class CairoGraphics2D extends Graphics2D
double alpha = 1.0;
if (comp instanceof AlphaComposite)
alpha = ((AlphaComposite) comp).getAlpha();
-
+
drawPixels(nativePointer, pixels, r.getWidth(), r.getHeight(),
r.getWidth(), i2u, alpha, getInterpolation());
// Cairo seems to lose the current color which must be restored.
updateColor();
-
+
return true;
}
@@ -2112,7 +2112,7 @@ public abstract class CairoGraphics2D extends Graphics2D
{
if (! (clip instanceof GeneralPath))
clip = new GeneralPath(clip);
-
+
GeneralPath p = (GeneralPath) clip;
p.transform(t);
}
@@ -2138,7 +2138,7 @@ public abstract class CairoGraphics2D extends Graphics2D
return rect;
}
-
+
static Rectangle2D getTransformedBounds(Rectangle2D bounds, AffineTransform tx)
{
double x1 = bounds.getX();
@@ -2149,10 +2149,10 @@ public abstract class CairoGraphics2D extends Graphics2D
double y2 = y1;
double y3 = bounds.getY() + bounds.getHeight();
double y4 = y3;
-
+
double[] points = new double[] {x1, y1, x2, y2, x3, y3, x4, y4};
tx.transform(points, 0, points, 0, 4);
-
+
double minX = points[0];
double maxX = minX;
double minY = points[1];
@@ -2164,13 +2164,13 @@ public abstract class CairoGraphics2D extends Graphics2D
if (points[i] > maxX)
maxX = points[i];
i++;
-
+
if (points[i] < minY)
minY = points[i];
if (points[i] > maxY)
maxY = points[i];
}
-
+
return new Rectangle2D.Double(minX, minY, (maxX - minX), (maxY - minY));
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java
index 6c8a30d..71f6638 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java
@@ -68,7 +68,7 @@ public class CairoSurface extends WritableRaster
int width = -1, height = -1;
/**
- * The native pointer to the Cairo surface.
+ * The native pointer to the Cairo surface.
*/
long surfacePointer;
@@ -93,8 +93,8 @@ public class CairoSurface extends WritableRaster
0xFF000000,
true,
Buffers.smallestAppropriateTransferType(32));
-
- // This CM corresponds to the CAIRO_FORMAT_RGB24 type in Cairo
+
+ // This CM corresponds to the CAIRO_FORMAT_RGB24 type in Cairo
static ColorModel cairoCM_opaque = new DirectColorModel(24, 0x00FF0000,
0x0000FF00,
0x000000FF);
@@ -112,7 +112,7 @@ public class CairoSurface extends WritableRaster
private native void destroy(long surfacePointer, int[] buf);
/**
- * Draws this image to a given CairoGraphics context,
+ * Draws this image to a given CairoGraphics context,
* with an affine transform given by i2u.
*/
public native void nativeDrawSurface(long surfacePointer, long contextPointer,
@@ -122,23 +122,23 @@ public class CairoSurface extends WritableRaster
/**
* Synchronizes the image's data buffers, copying any changes made in the
* Java array into the native array.
- *
+ *
* This method should only be called if (sharedBuffers == false).
*/
native void syncNativeToJava(long surfacePointer, int[] buffer);
-
+
/**
* Synchronizes the image's data buffers, copying any changes made in the
* native array into the Java array.
- *
+ *
* This method should only be called if (sharedBuffers == false).
*/
native void syncJavaToNative(long surfacePointer, int[] buffer);
-
+
/**
* Return the buffer, with the sample values of each pixel reversed
- * (ie, in ABGR instead of ARGB).
- *
+ * (ie, in ABGR instead of ARGB).
+ *
* @return A pointer to a flipped buffer. The memory is allocated in native
* code, and must be explicitly freed when it is no longer needed.
*/
@@ -146,21 +146,21 @@ public class CairoSurface extends WritableRaster
/**
* Create a cairo_surface_t with specified width and height.
- * The format will be ARGB32 with premultiplied alpha and native bit
+ * The format will be ARGB32 with premultiplied alpha and native bit
* and word ordering.
*/
public CairoSurface(int width, int height)
{
this(0, 0, width, height);
}
-
+
public CairoSurface(int x, int y, int width, int height)
{
super(createCairoSampleModel(width, height), null, new Point(x, y));
if(width <= 0 || height <= 0)
throw new IllegalArgumentException("Image must be at least 1x1 pixels.");
-
+
this.width = width;
this.height = height;
dataBuffer = new DataBufferInt(width * height);
@@ -169,7 +169,7 @@ public class CairoSurface extends WritableRaster
if(surfacePointer == 0)
throw new Error("Could not allocate bitmap.");
}
-
+
/**
* Create a Cairo Surface that is a subimage of another Cairo Surface
*/
@@ -177,7 +177,7 @@ public class CairoSurface extends WritableRaster
Point origin)
{
super(sm, parent.dataBuffer, bounds, origin, parent);
-
+
this.width = super.width;
this.height = super.height;
this.surfacePointer = parent.surfacePointer;
@@ -258,10 +258,10 @@ public class CairoSurface extends WritableRaster
{
return new GtkImage(width, height, getFlippedBuffer(surfacePointer));
}
-
+
/**
* Convenience method to quickly grab the data array backing this Raster.
- *
+ *
* @return The array behind the databuffer.
*/
public int[] getData()
@@ -271,16 +271,16 @@ public class CairoSurface extends WritableRaster
/**
* Returns a BufferedImage backed by a Cairo surface.
- */
+ */
public static BufferedImage getBufferedImage(int width, int height)
{
return getBufferedImage(new CairoSurface(width, height));
}
/**
- * Returns a BufferedImage backed by a Cairo surface,
+ * Returns a BufferedImage backed by a Cairo surface,
* created from a GtkImage.
- */
+ */
public static BufferedImage getBufferedImage(GtkImage image)
{
return getBufferedImage(new CairoSurface(image));
@@ -288,7 +288,7 @@ public class CairoSurface extends WritableRaster
/**
* Returns a BufferedImage backed by a Cairo surface.
- */
+ */
public static BufferedImage getBufferedImage(CairoSurface surface)
{
return new BufferedImage(cairoColorModel, surface,
@@ -302,7 +302,7 @@ public class CairoSurface extends WritableRaster
public Graphics2D getGraphics()
{
return new CairoSurfaceGraphics(this);
- }
+ }
///// Methods used by CairoSurfaceGraphics /////
/**
@@ -319,7 +319,7 @@ public class CairoSurface extends WritableRaster
/**
* Copy a portion of this surface to another area on the surface. The given
* parameters must be within bounds - count on a segfault otherwise.
- *
+ *
* @param x The x coordinate of the area to be copied from.
* @param y The y coordinate of the area to be copied from.
* @param width The width of the area to be copied.
@@ -336,7 +336,7 @@ public class CairoSurface extends WritableRaster
native void copyAreaNative2(long surfacePointer,
int x, int y, int width, int height,
int dx, int dy, int stride);
-
+
/**
* Creates a SampleModel that matches Cairo's native format
*/
@@ -344,12 +344,12 @@ public class CairoSurface extends WritableRaster
{
return new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT, w, h,
new int[]{0x00FF0000, 0x0000FF00,
- 0x000000FF, 0xFF000000});
+ 0x000000FF, 0xFF000000});
}
-
+
/**
* Returns whether this ColorModel is compatible with Cairo's native types.
- *
+ *
* @param cm The color model to check.
* @return Whether it is compatible.
*/
@@ -358,10 +358,10 @@ public class CairoSurface extends WritableRaster
return (cm.equals(cairoCM_pre) || cm.equals(cairoCM_opaque) ||
cm.equals(cairoColorModel));
}
-
+
/**
* Returns whether this SampleModel is compatible with Cairo's native types.
- *
+ *
* @param sm The sample model to check.
* @return Whether it is compatible.
*/
@@ -381,23 +381,23 @@ public class CairoSurface extends WritableRaster
return createWritableChild(parentX, parentY, width, height,
childMinX, childMinY, bandList);
}
-
+
public WritableRaster createCompatibleWritableRaster()
{
return new CairoSurface(width, height);
}
-
+
public WritableRaster createCompatibleWritableRaster (int x, int y,
int w, int h)
{
return new CairoSurface(x, y, w, h);
}
-
+
public Raster createTranslatedChild(int childMinX, int childMinY)
{
return createWritableTranslatedChild(childMinX, childMinY);
}
-
+
public WritableRaster createWritableChild(int parentX, int parentY,
int w, int h, int childMinX,
int childMinY, int[] bandList)
@@ -405,7 +405,7 @@ public class CairoSurface extends WritableRaster
if (parentX < minX || parentX + w > minX + width
|| parentY < minY || parentY + h > minY + height)
throw new RasterFormatException("Child raster extends beyond parent");
-
+
SampleModel sm = (bandList == null) ?
sampleModel :
sampleModel.createSubsetSampleModel(bandList);
@@ -415,12 +415,12 @@ public class CairoSurface extends WritableRaster
new Point(sampleModelTranslateX + childMinX - parentX,
sampleModelTranslateY + childMinY - parentY));
}
-
+
public WritableRaster createWritableTranslatedChild(int x, int y)
{
int tcx = sampleModelTranslateX - minX + x;
int tcy = sampleModelTranslateY - minY + y;
-
+
return new CairoSurface(sampleModel, this,
new Rectangle(x, y, width, height),
new Point(tcx, tcy));
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java
index 35b015f..a0c6caa 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java
@@ -67,7 +67,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
protected CairoSurface surface;
private BufferedImage buffer;
private long cairo_t;
-
+
/**
* Create a graphics context from a cairo surface
*/
@@ -82,24 +82,24 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
/**
* Creates another context from a surface.
* Used by create().
- */
+ */
private CairoSurfaceGraphics(CairoSurfaceGraphics copyFrom)
{
surface = copyFrom.surface;
cairo_t = surface.newCairoContext();
copy( copyFrom, cairo_t );
}
-
+
public Graphics create()
{
return new CairoSurfaceGraphics(this);
}
-
+
public GraphicsConfiguration getDeviceConfiguration()
{
return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
}
-
+
protected Rectangle2D getRealBounds()
{
return new Rectangle2D.Double(0.0, 0.0, surface.width, surface.height);
@@ -109,7 +109,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
{
surface.copyAreaNative(x, y, width, height, dx, dy, surface.width);
}
-
+
/**
* Overloaded methods that do actual drawing need to account for custom
* composites
@@ -118,7 +118,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
{
if (!surface.sharedBuffer)
surface.syncJavaToNative(surface.surfacePointer, surface.getData());
-
+
// Find total bounds of shape
Rectangle r = findStrokedBounds(s);
if (shiftDrawCalls)
@@ -126,24 +126,24 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
r.width++;
r.height++;
}
-
+
// Do the drawing
if (comp == null || comp instanceof AlphaComposite)
super.draw(s);
-
+
else
{
createBuffer();
-
+
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setStroke(this.getStroke());
g2d.setColor(this.getColor());
g2d.setTransform(transform);
g2d.draw(s);
-
+
drawComposite(r.getBounds2D(), null);
}
-
+
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
}
@@ -152,23 +152,23 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
{
if (!surface.sharedBuffer)
surface.syncJavaToNative(surface.surfacePointer, surface.getData());
-
+
if (comp == null || comp instanceof AlphaComposite)
super.fill(s);
-
+
else
{
createBuffer();
-
+
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setPaint(this.getPaint());
g2d.setColor(this.getColor());
g2d.setTransform(transform);
g2d.fill(s);
-
+
drawComposite(s.getBounds2D(), null);
}
-
+
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
}
@@ -177,10 +177,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
{
if (!surface.sharedBuffer)
surface.syncJavaToNative(surface.surfacePointer, surface.getData());
-
+
if (comp == null || comp instanceof AlphaComposite)
super.drawRenderedImage(image, xform);
-
+
else
{
createBuffer();
@@ -189,10 +189,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
g2d.setRenderingHints(this.getRenderingHints());
g2d.setTransform(transform);
g2d.drawRenderedImage(image, xform);
-
+
drawComposite(buffer.getRaster().getBounds(), null);
}
-
+
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
}
@@ -206,7 +206,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
boolean ret;
if (comp == null || comp instanceof AlphaComposite)
ret = super.drawImage(img, xform, bgcolor, obs);
-
+
else
{
// Get buffered image of source
@@ -218,16 +218,16 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
img = Toolkit.getDefaultToolkit().createImage(source);
}
BufferedImage bImg = (BufferedImage) img;
-
+
// Find translated bounds
Rectangle2D bounds = new Rectangle(bImg.getMinX(), bImg.getMinY(),
bImg.getWidth(), bImg.getHeight());
if (xform != null)
bounds = getTransformedBounds(bounds, xform);
-
+
// Create buffer and draw image
createBuffer();
-
+
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setRenderingHints(this.getRenderingHints());
g2d.drawImage(img, xform, obs);
@@ -235,10 +235,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
// Perform compositing
ret = drawComposite(bounds, obs);
}
-
+
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
-
+
return ret;
}
@@ -246,10 +246,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
{
if (!surface.sharedBuffer)
surface.syncJavaToNative(surface.surfacePointer, surface.getData());
-
+
if (comp == null || comp instanceof AlphaComposite)
super.drawGlyphVector(gv, x, y);
-
+
else
{
createBuffer();
@@ -258,17 +258,17 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
g2d.setPaint(this.getPaint());
g2d.setStroke(this.getStroke());
g2d.drawGlyphVector(gv, x, y);
-
+
Rectangle2D bounds = gv.getLogicalBounds();
bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(),
bounds.getWidth(), bounds.getHeight());
drawComposite(bounds, null);
}
-
+
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
}
-
+
private boolean drawComposite(Rectangle2D bounds, ImageObserver observer)
{
// Find bounds in device space
@@ -280,7 +280,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
devClip = new Rectangle(buffer.getMinX(), buffer.getMinY(),
buffer.getWidth(), buffer.getHeight());
Rectangle2D.intersect(bounds, devClip, bounds);
-
+
// Round bounds as needed, but be careful in our rounding
// (otherwise it may leave unpainted stripes)
double x = bounds.getX();
@@ -290,7 +290,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
x = Math.round(x);
y = Math.round(y);
bounds.setRect(x, y, Math.round(maxX - x), Math.round(maxY - y));
-
+
// Find subimage of internal buffer for updating
BufferedImage buffer2 = buffer;
if (!bounds.equals(buffer2.getRaster().getBounds()))
@@ -307,12 +307,12 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
// Perform actual composite operation
compCtx.compose(buffer2.getRaster(), current.getRaster(),
buffer2.getRaster());
-
+
// Set cairo's composite to direct SRC, since we've already done our own
- // compositing
+ // compositing
Composite oldcomp = comp;
setComposite(AlphaComposite.Src);
-
+
// This MUST call directly into the "action" method in CairoGraphics2D,
// not one of the wrappers, to ensure that the composite isn't processed
// more than once!
@@ -324,7 +324,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
updateColor();
return rv;
}
-
+
private void createBuffer()
{
if (buffer == null)
@@ -337,17 +337,17 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
else
{
Graphics2D g2d = ((Graphics2D)buffer.getGraphics());
-
+
g2d.setBackground(new Color(0,0,0,0));
g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight());
}
}
-
+
protected ColorModel getNativeCM()
{
return CairoSurface.cairoCM_pre;
}
-
+
protected ColorModel getBufferCM()
{
return CairoSurface.cairoColorModel;
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
index bfa3bc9..50161b2 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
@@ -83,7 +83,7 @@ public class ComponentGraphics extends CairoGraphics2D
ComponentGraphics()
{
}
-
+
private ComponentGraphics(GtkComponentPeer component)
{
this.component = component;
@@ -114,7 +114,7 @@ public class ComponentGraphics extends CairoGraphics2D
/**
* Obtain and hold a GDK lock, which is required for all drawing operations
* in this graphics context (since it is backed by an X surface).
- *
+ *
* This method causes the GDK locking behaviour to be re-entrant. No race
* conditions are caused since a ThreadLocal is used and each thread has its
* own lock counter.
@@ -176,11 +176,11 @@ public class ComponentGraphics extends CairoGraphics2D
*/
private static native Pointer nativeGrab(GtkComponentPeer component);
- private native void copyAreaNative(GtkComponentPeer component, int x, int y,
+ private native void copyAreaNative(GtkComponentPeer component, int x, int y,
int width, int height, int dx, int dy);
private native void drawVolatile(GtkComponentPeer component,
- long vimg, int x, int y,
+ long vimg, int x, int y,
int width, int height, int cx, int cy,
int cw, int ch);
@@ -193,7 +193,7 @@ public class ComponentGraphics extends CairoGraphics2D
}
/**
- * Returns a Graphics2D object for a component, either an instance of this
+ * Returns a Graphics2D object for a component, either an instance of this
* class (if xrender is supported), or a context which copies.
*/
public static Graphics2D getComponentGraphics(GtkComponentPeer component)
@@ -214,7 +214,7 @@ public class ComponentGraphics extends CairoGraphics2D
{
return new ComponentGraphics(this);
}
-
+
protected Rectangle2D getRealBounds()
{
return component.awtComponent.getBounds();
@@ -226,23 +226,23 @@ public class ComponentGraphics extends CairoGraphics2D
}
/**
- * Overloaded methods that do actual drawing need to enter the gdk threads
+ * Overloaded methods that do actual drawing need to enter the gdk threads
* and also do certain things before and after.
*/
public void draw(Shape s)
{
if (comp == null || comp instanceof AlphaComposite)
super.draw(s);
-
+
else
{
createBuffer();
-
+
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setStroke(this.getStroke());
g2d.setColor(this.getColor());
g2d.draw(s);
-
+
drawComposite(s.getBounds2D(), null);
}
}
@@ -251,16 +251,16 @@ public class ComponentGraphics extends CairoGraphics2D
{
if (comp == null || comp instanceof AlphaComposite)
super.fill(s);
-
+
else
{
createBuffer();
-
+
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setPaint(this.getPaint());
g2d.setColor(this.getColor());
g2d.fill(s);
-
+
drawComposite(s.getBounds2D(), null);
}
}
@@ -269,7 +269,7 @@ public class ComponentGraphics extends CairoGraphics2D
{
if (comp == null || comp instanceof AlphaComposite)
super.drawRenderedImage(image, xform);
-
+
else
{
createBuffer();
@@ -277,18 +277,18 @@ public class ComponentGraphics extends CairoGraphics2D
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setRenderingHints(this.getRenderingHints());
g2d.drawRenderedImage(image, xform);
-
+
drawComposite(buffer.getRaster().getBounds(), null);
}
}
protected boolean drawImage(Image img, AffineTransform xform,
- Color bgcolor, ImageObserver obs)
+ Color bgcolor, ImageObserver obs)
{
boolean rv;
if (comp == null || comp instanceof AlphaComposite)
rv = super.drawImage(img, xform, bgcolor, obs);
-
+
else
{
// Get buffered image of source
@@ -300,7 +300,7 @@ public class ComponentGraphics extends CairoGraphics2D
img = Toolkit.getDefaultToolkit().createImage(source);
}
BufferedImage bImg = (BufferedImage) img;
-
+
// Find translated bounds
Point2D origin = new Point2D.Double(bImg.getMinX(), bImg.getMinY());
Point2D pt = new Point2D.Double(bImg.getWidth() + bImg.getMinX(),
@@ -310,10 +310,10 @@ public class ComponentGraphics extends CairoGraphics2D
origin = xform.transform(origin, origin);
pt = xform.transform(pt, pt);
}
-
+
// Create buffer and draw image
createBuffer();
-
+
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setRenderingHints(this.getRenderingHints());
g2d.drawImage(img, xform, obs);
@@ -331,7 +331,7 @@ public class ComponentGraphics extends CairoGraphics2D
{
if (comp == null || comp instanceof AlphaComposite)
super.drawGlyphVector(gv, x, y);
-
+
else
{
createBuffer();
@@ -340,14 +340,14 @@ public class ComponentGraphics extends CairoGraphics2D
g2d.setPaint(this.getPaint());
g2d.setStroke(this.getStroke());
g2d.drawGlyphVector(gv, x, y);
-
+
Rectangle2D bounds = gv.getLogicalBounds();
bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(),
bounds.getWidth(), bounds.getHeight());
drawComposite(bounds, null);
}
}
-
+
public boolean drawImage(Image img, int x, int y, ImageObserver observer)
{
// If it is a GtkVolatileImage with an "easy" transform then
@@ -390,7 +390,7 @@ public class ComponentGraphics extends CairoGraphics2D
}
return super.drawImage(bimg, x, y, observer);
}
-
+
public boolean drawImage(Image img, int x, int y, int width, int height,
ImageObserver observer)
{
@@ -446,41 +446,41 @@ public class ComponentGraphics extends CairoGraphics2D
clip = new Rectangle(buffer.getMinX(), buffer.getMinY(),
buffer.getWidth(), buffer.getHeight());
Rectangle2D.intersect(bounds, clip, bounds);
-
+
BufferedImage buffer2 = buffer;
if (!bounds.equals(buffer2.getRaster().getBounds()))
buffer2 = buffer2.getSubimage((int)bounds.getX(), (int)bounds.getY(),
(int)bounds.getWidth(),
(int)bounds.getHeight());
-
+
// Get destination clip to bounds
double[] points = new double[] {bounds.getX(), bounds.getY(),
bounds.getMaxX(), bounds.getMaxY()};
transform.transform(points, 0, points, 0, 2);
-
+
Rectangle2D deviceBounds = new Rectangle2D.Double(points[0], points[1],
points[2] - points[0],
points[3] - points[1]);
-
+
Rectangle2D.intersect(deviceBounds, this.getClipInDevSpace(), deviceBounds);
-
+
// Get current image on the component
GtkImage img = grab(component);
Graphics gr = componentBuffer.createGraphics();
gr.drawImage(img, 0, 0, null);
gr.dispose();
-
+
BufferedImage cBuffer = componentBuffer;
if (!deviceBounds.equals(cBuffer.getRaster().getBounds()))
cBuffer = cBuffer.getSubimage((int)deviceBounds.getX(),
(int)deviceBounds.getY(),
(int)deviceBounds.getWidth(),
(int)deviceBounds.getHeight());
-
+
// Perform actual composite operation
compCtx.compose(buffer2.getRaster(), cBuffer.getRaster(),
cBuffer.getRaster());
-
+
// This MUST call directly into the "action" method in CairoGraphics2D,
// not one of the wrappers, to ensure that the composite isn't processed
// more than once!
@@ -490,7 +490,7 @@ public class ComponentGraphics extends CairoGraphics2D
null, null);
return rv;
}
-
+
private void createBuffer()
{
if (buffer == null)
@@ -499,7 +499,7 @@ public class ComponentGraphics extends CairoGraphics2D
rst = Raster.createWritableRaster(GtkVolatileImage.createGdkSampleModel(component.awtComponent.getWidth(),
component.awtComponent.getHeight()),
new Point(0,0));
-
+
buffer = new BufferedImage(GtkVolatileImage.gdkColorModel, rst,
GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(),
new Hashtable());
@@ -507,60 +507,60 @@ public class ComponentGraphics extends CairoGraphics2D
else
{
Graphics2D g2d = ((Graphics2D)buffer.getGraphics());
-
+
g2d.setBackground(new Color(0,0,0,0));
g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight());
}
-
+
if (componentBuffer == null)
{
WritableRaster rst;
rst = Raster.createWritableRaster(GtkVolatileImage.createGdkSampleModel(component.awtComponent.getWidth(),
component.awtComponent.getHeight()),
new Point(0,0));
-
+
componentBuffer = new BufferedImage(GtkVolatileImage.gdkColorModel, rst,
GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(),
new Hashtable());
}
}
-
+
protected ColorModel getNativeCM()
{
return GtkVolatileImage.gdkColorModel;
}
-
+
/* --- START OVERRIDDEN NATIVE METHODS ----
* All native methods in CairoGraphics2D should be overridden here and
* enclosed in locks, since the cairo surface is backed by an X surface
* in this graphics context and the X surface requires external locking.
- *
+ *
* We lock everything "just in case", since it's difficult to know which
* calls are and aren't thread-safe. Overriding and locking the native
- * methods allows superclass code in CairoGraphics2D to execute properly,
+ * methods allows superclass code in CairoGraphics2D to execute properly,
* without the need to override every single method.
- *
+ *
* CAVEAT: if native code obtains a lock (using gdk_threads_enter(), not the
* lock() method provided here) and then calls back into Java and one of these
* methods ends up being called, we will deadlock. The lock is only reentrant
- * when called via our lock() method.
+ * when called via our lock() method.
*/
-
+
/* These methods are already locked in the superclass CairoGraphics2D
* so they do not need to be overridden:
- *
+ *
* public void disposeNative
*
* protected void cairoDrawGlyphVector
- *
+ *
* protected void cairoSetFont
*/
-
+
@Override
protected long init(long pointer)
{
long ret;
-
+
try
{
lock();
@@ -570,10 +570,10 @@ public class ComponentGraphics extends CairoGraphics2D
{
unlock();
}
-
+
return ret;
}
-
+
@Override
protected void drawPixels(long pointer, int[] pixels, int w, int h,
int stride, double[] i2u, double alpha,
@@ -590,10 +590,10 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
- protected void setGradient(long pointer, double x1, double y1,
- double x2, double y2,
+ protected void setGradient(long pointer, double x1, double y1,
+ double x2, double y2,
int r1, int g1, int b1, int a1,
int r2, int g2, int b2, int a2, boolean cyclic)
{
@@ -608,7 +608,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void setPaintPixels(long pointer, int[] pixels, int w, int h,
int stride, boolean repeat, int x, int y)
@@ -623,7 +623,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoSetMatrix(long pointer, double[] m)
{
@@ -637,7 +637,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoScale(long pointer, double x, double y)
{
@@ -651,7 +651,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoSetOperator(long pointer, int cairoOperator)
{
@@ -665,7 +665,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoSetRGBAColor(long pointer, double red, double green,
double blue, double alpha)
@@ -680,7 +680,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoSetFillRule(long pointer, int cairoFillRule)
{
@@ -694,7 +694,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoSetLine(long pointer, double width, int cap, int join,
double miterLimit)
@@ -709,9 +709,9 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
- protected void cairoSetDash(long pointer, double[] dashes, int ndash,
+ protected void cairoSetDash(long pointer, double[] dashes, int ndash,
double offset)
{
try
@@ -739,9 +739,9 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
- protected void cairoArc(long pointer, double x, double y,
+ protected void cairoArc(long pointer, double x, double y,
double radius, double angle1, double angle2)
{
try
@@ -754,7 +754,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoSave(long pointer)
{
@@ -768,7 +768,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoRestore(long pointer)
{
@@ -782,7 +782,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoNewPath(long pointer)
{
@@ -796,7 +796,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoClosePath(long pointer)
{
@@ -810,7 +810,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoMoveTo(long pointer, double x, double y)
{
@@ -824,7 +824,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoLineTo(long pointer, double x, double y)
{
@@ -838,7 +838,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoCurveTo(long pointer, double x1, double y1, double x2,
double y2, double x3, double y3)
@@ -853,7 +853,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoStroke(long pointer)
{
@@ -867,7 +867,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoFill(long pointer, double alpha)
{
@@ -881,7 +881,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoClip(long pointer)
{
@@ -895,7 +895,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoResetClip(long pointer)
{
@@ -909,7 +909,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void cairoSetAntialias(long pointer, boolean aa)
{
@@ -923,7 +923,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-
+
@Override
protected void drawCairoSurface(CairoSurface surface, AffineTransform tx,
double alpha, int interpolation)
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java
index 2216d45..a73012d 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java
@@ -48,7 +48,7 @@ import java.awt.image.RenderedImage;
import java.awt.image.ImageObserver;
/**
- * Implementation of Graphics2D for Components for servers which
+ * Implementation of Graphics2D for Components for servers which
* do not have xrender.
*
* A mirrored GtkImage of the component is stored in memory
@@ -62,17 +62,17 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics
* GtkImage sharing its data buffer with this Cairo surface.
*/
private GtkImage gtkimage;
-
+
private int width, height;
native void getPixbuf( GtkComponentPeer component, GtkImage image );
- native void copyPixbuf( GtkComponentPeer component, GtkImage image,
- int x, int y, int w, int h );
+ native void copyPixbuf( GtkComponentPeer component, GtkImage image,
+ int x, int y, int w, int h );
- public ComponentGraphicsCopy(int width, int height,
- GtkComponentPeer component)
- {
+ public ComponentGraphicsCopy(int width, int height,
+ GtkComponentPeer component)
+ {
super( new CairoSurface( width, height ) );
this.component = component;
this.width = width;
@@ -82,7 +82,7 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics
}
/**
- * Overloaded methods that do actual drawing need to enter the gdk threads
+ * Overloaded methods that do actual drawing need to enter the gdk threads
* and also do certain things before and after.
*/
public void draw(Shape s)
@@ -106,7 +106,7 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics
}
protected boolean drawImage(Image img, AffineTransform xform,
- Color bgcolor, ImageObserver obs)
+ Color bgcolor, ImageObserver obs)
{
boolean rv = super.drawImage(img, xform, bgcolor, obs);
copyPixbuf(component, gtkimage, 0, 0, width, height);
@@ -120,4 +120,3 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics
copyPixbuf(component, gtkimage, r.x, r.y, r.width, r.height);
}
}
-
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java b/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
index af975f3..8fd7347 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
@@ -81,7 +81,7 @@ public class FreetypeGlyphVector extends GlyphVector
* The glyph codes
*/
private int[] glyphCodes;
-
+
/**
* The set of fonts used in this glyph vector.
*/
@@ -89,22 +89,22 @@ public class FreetypeGlyphVector extends GlyphVector
/**
* Glyph transforms. Supports all transform operations.
- *
+ *
* The identity transform should not be stored in this array; use a null
* instead (will result in performance improvements).
*/
private AffineTransform[] glyphTransforms;
private GlyphMetrics[] metricsCache;
-
+
private native void dispose(long[] fonts);
-
+
/**
* Returns a pointer to the native PangoFcFont object.
- *
+ *
* The object will be referenced with g_object_ref n times before being
* returned, and must be unreferenced a corresponding number of times.
- *
+ *
* @param n Number of times to reference the object.
* @return Pointer to the native default font.
*/
@@ -158,19 +158,19 @@ public class FreetypeGlyphVector extends GlyphVector
glyphCodes = new int[ codes.length ];
System.arraycopy(codes, 0, glyphCodes, 0, codes.length);
nGlyphs = glyphCodes.length;
-
+
if (fontSet == null)
{
fontSet = new long[nGlyphs];
Arrays.fill(fontSet, getNativeFontPointer(nGlyphs));
}
-
+
performDefaultLayout();
}
/**
* Cloning constructor
- */
+ */
private FreetypeGlyphVector( FreetypeGlyphVector gv )
{
font = gv.font;
@@ -191,7 +191,7 @@ public class FreetypeGlyphVector extends GlyphVector
glyphPositions = new float[(nGlyphs + 1) * 2];
glyphTransforms = new AffineTransform[ nGlyphs ];
Arrays.fill(glyphTransforms, null);
-
+
for(int i = 0; i < nGlyphs; i++ )
{
if (gv.glyphTransforms[i] != null)
@@ -203,7 +203,7 @@ public class FreetypeGlyphVector extends GlyphVector
System.arraycopy(gv.glyphCodes, 0, glyphCodes, 0, nGlyphs);
System.arraycopy(gv.fontSet, 0, fontSet, 0, nGlyphs);
}
-
+
public void finalize()
{
dispose(fontSet);
@@ -247,8 +247,8 @@ public class FreetypeGlyphVector extends GlyphVector
/**
* Returns the kerning of a glyph pair
*/
- private native void getKerning(int leftGlyph, int rightGlyph, long font,
- float[] p);
+ private native void getKerning(int leftGlyph, int rightGlyph, long font,
+ float[] p);
private native double[] getMetricsNative(int glyphCode, long font);
@@ -268,9 +268,9 @@ public class FreetypeGlyphVector extends GlyphVector
if( ! (gv instanceof FreetypeGlyphVector) )
return false;
- return (((FreetypeGlyphVector)gv).font.equals(font) &&
- ((FreetypeGlyphVector)gv).frc.equals(frc)
- && ((FreetypeGlyphVector)gv).s.equals(s));
+ return (((FreetypeGlyphVector)gv).font.equals(font) &&
+ ((FreetypeGlyphVector)gv).frc.equals(frc)
+ && ((FreetypeGlyphVector)gv).s.equals(s));
}
/**
@@ -323,19 +323,19 @@ public class FreetypeGlyphVector extends GlyphVector
}
glyphPositions[nGlyphs * 2] = x;
glyphPositions[nGlyphs * 2 + 1] = y;
-
+
// Apply any transform that may be in the font's attributes
TransformAttribute ta;
ta = (TransformAttribute)font.getAttributes().get(TextAttribute.TRANSFORM);
if (ta != null)
{
AffineTransform tx = ta.getTransform();
-
+
// Transform glyph positions
tx.transform(glyphPositions, 0, glyphPositions, 0,
glyphPositions.length / 2);
-
- // Also store per-glyph scale/shear/rotate (but not translation)
+
+ // Also store per-glyph scale/shear/rotate (but not translation)
double[] matrix = new double[4];
tx.getMatrix(matrix);
AffineTransform deltaTx = new AffineTransform(matrix);
@@ -355,7 +355,7 @@ public class FreetypeGlyphVector extends GlyphVector
/**
* Returns multiple glyphcodes.
*/
- public int[] getGlyphCodes(int beginGlyphIndex, int numEntries,
+ public int[] getGlyphCodes(int beginGlyphIndex, int numEntries,
int[] codeReturn)
{
int[] rval;
@@ -364,7 +364,7 @@ public class FreetypeGlyphVector extends GlyphVector
rval = new int[ numEntries ];
else
rval = codeReturn;
-
+
System.arraycopy(glyphCodes, beginGlyphIndex, rval, 0, numEntries);
return rval;
@@ -372,10 +372,10 @@ public class FreetypeGlyphVector extends GlyphVector
/**
* Returns pointers to the fonts used in this glyph vector.
- *
+ *
* The array index matches that of the glyph vector itself.
*/
- protected long[] getGlyphFonts(int beginGlyphIndex, int numEntries,
+ protected long[] getGlyphFonts(int beginGlyphIndex, int numEntries,
long[] codeReturn)
{
long[] rval;
@@ -384,7 +384,7 @@ public class FreetypeGlyphVector extends GlyphVector
rval = new long[ numEntries ];
else
rval = codeReturn;
-
+
System.arraycopy(fontSet, beginGlyphIndex, rval, 0, numEntries);
return rval;
@@ -394,18 +394,18 @@ public class FreetypeGlyphVector extends GlyphVector
{
GlyphMetrics gm = getGlyphMetrics( glyphIndex );
if( gm == null )
- return null;
+ return null;
Rectangle2D r = gm.getBounds2D();
Point2D p = getGlyphPosition( glyphIndex );
-
+
double[] bounds = new double[] {p.getX() + r.getX() - gm.getLSB(),
p.getY() + r.getY(),
p.getX() + r.getX() - gm.getLSB() + gm.getAdvanceX(),
p.getY() + r.getY() + r.getHeight()};
-
+
if (glyphTransforms[glyphIndex] != null)
glyphTransforms[glyphIndex].transform(bounds, 0, bounds, 0, 2);
-
+
return new Rectangle2D.Double(bounds[0], bounds[1], bounds[2] - bounds[0],
bounds[3] - bounds[1]);
}
@@ -428,10 +428,10 @@ public class FreetypeGlyphVector extends GlyphVector
gm = null;
else
{
- gm = new GlyphMetrics(true,
- (float)val[1],
- (float)val[2],
- new Rectangle2D.Double(val[3], val[4],
+ gm = new GlyphMetrics(true,
+ (float)val[1],
+ (float)val[2],
+ new Rectangle2D.Double(val[3], val[4],
val[5], val[6] ),
GlyphMetrics.STANDARD );
peer.putGlyphMetrics( glyphCodes[ i ], gm );
@@ -454,7 +454,7 @@ public class FreetypeGlyphVector extends GlyphVector
/**
* Returns the outline of a single glyph.
- *
+ *
* Despite what the Sun API says, this method returns the glyph relative to
* the origin of the *entire string*, not each individual glyph.
*/
@@ -462,7 +462,7 @@ public class FreetypeGlyphVector extends GlyphVector
{
GeneralPath gp = getGlyphOutlineNative(glyphCodes[glyphIndex],
fontSet[glyphIndex]);
-
+
AffineTransform tx = AffineTransform.getTranslateInstance(glyphPositions[glyphIndex*2],
glyphPositions[glyphIndex*2+1]);
if (glyphTransforms[glyphIndex] != null)
@@ -484,12 +484,12 @@ public class FreetypeGlyphVector extends GlyphVector
/**
* Returns the positions of multiple glyphs.
*/
- public float[] getGlyphPositions(int beginGlyphIndex, int numEntries,
- float[] positionReturn)
+ public float[] getGlyphPositions(int beginGlyphIndex, int numEntries,
+ float[] positionReturn)
{
if (positionReturn == null || positionReturn.length < (numEntries * 2))
positionReturn = new float[numEntries*2];
-
+
System.arraycopy(glyphPositions, beginGlyphIndex*2, positionReturn, 0,
numEntries*2);
return positionReturn;
@@ -502,7 +502,7 @@ public class FreetypeGlyphVector extends GlyphVector
{
return glyphTransforms[glyphIndex];
}
-
+
/**
* Checks whether any transform has been set on any glyphs.
*/
@@ -511,10 +511,10 @@ public class FreetypeGlyphVector extends GlyphVector
for (int i = 0; i < glyphTransforms.length; i++)
if (glyphTransforms[i] != null)
return true;
-
+
return false;
}
-
+
/**
* Returns the visual bounds of a glyph
* May be off by a pixel or two due to hinting/rasterization.
@@ -538,7 +538,7 @@ public class FreetypeGlyphVector extends GlyphVector
for( int i = 1; i < nGlyphs; i++ )
{
Rectangle2D r2 = (Rectangle2D)getGlyphLogicalBounds( i );
-
+
rect = rect.createUnion( r2 );
}
@@ -566,9 +566,9 @@ public class FreetypeGlyphVector extends GlyphVector
}
/**
- * TODO:
- * FreeType does not currently have an API for the JSTF table. We should
- * probably get the table ourselves from FT and pass it to some parser
+ * TODO:
+ * FreeType does not currently have an API for the JSTF table. We should
+ * probably get the table ourselves from FT and pass it to some parser
* which the native font peers will need.
*/
public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex)
@@ -615,14 +615,14 @@ public class FreetypeGlyphVector extends GlyphVector
// using and checking for nulls can be much faster.
if (newTX != null && newTX.isIdentity())
newTX = null;
-
+
// If the old and new transforms are identical, bail
if (glyphTransforms[glyphIndex] == null && newTX == null)
return;
-
+
if (newTX != null && newTX.equals(glyphTransforms[glyphIndex]))
return;
-
+
// Invalidate bounds cache and set new transform
logicalBounds = null;
glyphTransforms[glyphIndex] = newTX;
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
index 826cfbe..6b09906 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
@@ -78,7 +78,7 @@ public class GdkFontPeer extends ClasspathFontPeer
{
public GdkFontMetrics (Font font)
- {
+ {
super(initFont(font));
}
@@ -167,7 +167,7 @@ public class GdkFontPeer extends ClasspathFontPeer
GdkFontMetrics metrics;
- static
+ static
{
if (true) // GCJ LOCAL
{
@@ -204,7 +204,7 @@ public class GdkFontPeer extends ClasspathFontPeer
dispose ();
}
- /*
+ /*
* Helpers for the 3-way overloading that this class seems to suffer
* from. Remove them if you feel like they're a performance bottleneck,
* for the time being I prefer my code not be written and debugged in
@@ -214,7 +214,7 @@ public class GdkFontPeer extends ClasspathFontPeer
private String buildString(CharacterIterator iter)
{
CPStringBuilder sb = new CPStringBuilder();
- for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next())
+ for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next())
sb.append(c);
return sb.toString();
}
@@ -223,7 +223,7 @@ public class GdkFontPeer extends ClasspathFontPeer
{
CPStringBuilder sb = new CPStringBuilder();
int i = 0;
- for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next(), i++)
+ for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next(), i++)
{
if (begin <= i)
sb.append(c);
@@ -232,7 +232,7 @@ public class GdkFontPeer extends ClasspathFontPeer
}
return sb.toString();
}
-
+
private String buildString(char[] chars, int begin, int limit)
{
return new String(chars, begin, limit - begin);
@@ -247,8 +247,8 @@ public class GdkFontPeer extends ClasspathFontPeer
}
public GdkFontPeer (String name, int style, int size)
- {
- super(name, style, size);
+ {
+ super(name, style, size);
initState ();
setFont (this.familyName, this.style, (int)this.size);
metricsCache = new HashMap();
@@ -299,14 +299,14 @@ public class GdkFontPeer extends ClasspathFontPeer
/**
* Unneeded, but implemented anyway.
- */
+ */
public String getSubFamilyName(Font font, Locale locale)
{
String name;
-
+
if (locale == null)
locale = Locale.getDefault();
-
+
name = getName(NameDecoder.NAME_SUBFAMILY, locale);
if (name == null)
{
@@ -322,20 +322,20 @@ public class GdkFontPeer extends ClasspathFontPeer
* Returns the bytes belonging to a TrueType/OpenType table,
* Parameters n,a,m,e identify the 4-byte ASCII tag of the table.
*
- * Returns null if the font is not TT, the table is nonexistant,
+ * Returns null if the font is not TT, the table is nonexistant,
* or if some other unexpected error occured.
*
*/
private native byte[] getTrueTypeTable(byte n, byte a, byte m, byte e);
/**
- * Returns the PostScript name of the font, defaults to the familyName if
+ * Returns the PostScript name of the font, defaults to the familyName if
* a PS name could not be retrieved.
*/
public String getPostScriptName(Font font)
{
- String name = getName(NameDecoder.NAME_POSTSCRIPT,
- /* any language */ null);
+ String name = getName(NameDecoder.NAME_POSTSCRIPT,
+ /* any language */ null);
if( name == null )
return this.familyName;
@@ -356,7 +356,7 @@ public class GdkFontPeer extends ClasspathFontPeer
{
if (nameTable == null)
{
- byte[] data = getTrueTypeTable((byte)'n', (byte) 'a',
+ byte[] data = getTrueTypeTable((byte)'n', (byte) 'a',
(byte) 'm', (byte) 'e');
if( data == null )
return null;
@@ -378,16 +378,16 @@ public class GdkFontPeer extends ClasspathFontPeer
// FIXME: inquire with pango
return -1;
}
-
- public GlyphVector createGlyphVector (Font font,
- FontRenderContext ctx,
+
+ public GlyphVector createGlyphVector (Font font,
+ FontRenderContext ctx,
CharacterIterator i)
{
return new FreetypeGlyphVector(font, buildString (i), ctx);
}
- public GlyphVector createGlyphVector (Font font,
- FontRenderContext ctx,
+ public GlyphVector createGlyphVector (Font font,
+ FontRenderContext ctx,
int[] glyphCodes)
{
return new FreetypeGlyphVector(font, glyphCodes, ctx);
@@ -411,32 +411,32 @@ public class GdkFontPeer extends ClasspathFontPeer
{
return ascent;
}
-
+
public int getBaselineIndex()
- {
+ {
// FIXME
return Font.ROMAN_BASELINE;
}
-
+
public float[] getBaselineOffsets()
{
return new float[3];
}
-
+
public float getDescent()
{
return descent;
}
-
+
public float getHeight()
{
return height;
}
-
+
public float getLeading()
{
return height - (ascent + descent);
- }
+ }
public int getNumChars()
{
@@ -447,13 +447,13 @@ public class GdkFontPeer extends ClasspathFontPeer
{
// FreeType doesn't seem to provide a value here.
return ascent / 2;
- }
+ }
public float getStrikethroughThickness()
{
// FreeType doesn't seem to provide a value here.
return 1.f;
- }
+ }
public float getUnderlineOffset()
{
@@ -467,7 +467,7 @@ public class GdkFontPeer extends ClasspathFontPeer
}
- public LineMetrics getLineMetrics (Font font, CharacterIterator ci,
+ public LineMetrics getLineMetrics (Font font, CharacterIterator ci,
int begin, int limit, FontRenderContext rc)
{
return new GdkFontLineMetrics (this, limit - begin);
@@ -490,12 +490,12 @@ public class GdkFontPeer extends ClasspathFontPeer
public int getNumGlyphs (Font font)
{
- byte[] data = getTrueTypeTable((byte)'m', (byte) 'a',
- (byte)'x', (byte) 'p');
+ byte[] data = getTrueTypeTable((byte)'m', (byte) 'a',
+ (byte)'x', (byte) 'p');
if( data == null )
return -1;
- ByteBuffer buf = ByteBuffer.wrap( data );
+ ByteBuffer buf = ByteBuffer.wrap( data );
return buf.getShort(4);
}
@@ -504,15 +504,15 @@ public class GdkFontPeer extends ClasspathFontPeer
return true;
}
- public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc,
- char[] chars, int start, int limit,
+ public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc,
+ char[] chars, int start, int limit,
int flags)
{
return new FreetypeGlyphVector(font, chars, start, limit - start,
frc, flags);
}
- public LineMetrics getLineMetrics (Font font, String str,
+ public LineMetrics getLineMetrics (Font font, String str,
FontRenderContext frc)
{
return new GdkFontLineMetrics (this, str.length ());
@@ -536,7 +536,7 @@ public class GdkFontPeer extends ClasspathFontPeer
/**
* Put a GlyphMetrics object in the cache.
- */
+ */
void putGlyphMetrics( int glyphCode, GlyphMetrics metrics )
{
metricsCache.put( new Integer( glyphCode ), metrics );
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
index 147f8f3..40474ff 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
@@ -51,21 +51,21 @@ import java.awt.image.ColorModel;
import java.awt.image.DirectColorModel;
import java.awt.image.VolatileImage;
-public class GdkGraphicsConfiguration
+public class GdkGraphicsConfiguration
extends GraphicsConfiguration
{
GdkScreenGraphicsDevice gdkScreenGraphicsDevice;
-
+
ColorModel opaqueColorModel;
ColorModel bitmaskColorModel;
ColorModel translucentColorModel;
-
+
public GdkGraphicsConfiguration(GdkScreenGraphicsDevice dev)
{
gdkScreenGraphicsDevice = dev;
-
+
opaqueColorModel = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, 0);
bitmaskColorModel = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, 0x1000000);
translucentColorModel = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, 0xFF000000);
@@ -81,7 +81,7 @@ public class GdkGraphicsConfiguration
return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
}
- public BufferedImage createCompatibleImage(int w, int h,
+ public BufferedImage createCompatibleImage(int w, int h,
int transparency)
{
return createCompatibleImage(w, h);
@@ -137,7 +137,7 @@ public class GdkGraphicsConfiguration
public BufferCapabilities getBufferCapabilities()
{
- return new BufferCapabilities(getImageCapabilities(),
+ return new BufferCapabilities(getImageCapabilities(),
getImageCapabilities(),
BufferCapabilities.FlipContents.UNDEFINED);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
index dd62994..d931f44 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
@@ -58,9 +58,9 @@ import gnu.classpath.Pointer;
public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
{
private final int native_state = GtkGenericPeer.getUniqueInteger ();
-
+
private GdkScreenGraphicsDevice defaultDevice;
-
+
private GdkScreenGraphicsDevice[] devices;
/**
@@ -81,14 +81,14 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
GtkToolkit.initializeGlobalIDs();
initIDs();
}
-
+
private static native void initIDs();
-
+
public GdkGraphicsEnvironment ()
{
nativeInitState();
}
-
+
native void nativeInitState();
public GraphicsDevice[] getScreenDevices ()
@@ -97,17 +97,17 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
{
devices = nativeGetScreenDevices();
}
-
+
return (GraphicsDevice[]) devices.clone();
}
-
+
private native GdkScreenGraphicsDevice[] nativeGetScreenDevices();
public GraphicsDevice getDefaultScreenDevice ()
{
if (GraphicsEnvironment.isHeadless ())
throw new HeadlessException ();
-
+
synchronized (GdkGraphicsEnvironment.class)
{
if (defaultDevice == null)
@@ -115,10 +115,10 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
defaultDevice = nativeGetDefaultScreenDevice();
}
}
-
+
return defaultDevice;
}
-
+
private native GdkScreenGraphicsDevice nativeGetDefaultScreenDevice();
public Graphics2D createGraphics (BufferedImage image)
@@ -129,7 +129,7 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
return new BufferedImageGraphics( image );
}
-
+
private native int nativeGetNumFontFamilies();
private native void nativeGetFontFamilies(String[] family_names);
@@ -157,10 +157,10 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
/**
* Used by GtkMouseInfoPeer.
- */
+ */
native int[] getMouseCoordinates();
native boolean isWindowUnderMouse(GtkWindowPeer windowPeer);
-
+
public WritableRaster createRaster(ColorModel cm, SampleModel sm)
{
if (CairoSurface.isCompatibleSampleModel(sm)
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
index 9b02695..1b247c6 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
@@ -73,7 +73,7 @@ import gnu.classpath.Pointer;
public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
{
- static
+ static
{
if (true) // GCJ LOCAL
{
@@ -82,7 +82,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
initStaticState ();
}
-
+
/**
* Lock that should be held for all gdkpixbuf operations. We don't use
* the global gdk_threads_enter/leave functions since gdkpixbuf
@@ -124,9 +124,9 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
boolean hasAlpha, GdkPixbufWriter writer);
// gdk-pixbuf provids data in RGBA format
- static final ColorModel cm = new DirectColorModel (32, 0xff000000,
- 0x00ff0000,
- 0x0000ff00,
+ static final ColorModel cm = new DirectColorModel (32, 0xff000000,
+ 0x00ff0000,
+ 0x0000ff00,
0x000000ff);
public GdkPixbufDecoder (DataInput datainput)
{
@@ -142,7 +142,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
{
super (filename);
}
-
+
public GdkPixbufDecoder (URL url)
{
super (url);
@@ -168,21 +168,21 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
ic.setHints (ImageConsumer.RANDOMPIXELORDER);
}
}
-
+
// called back by native side: area_updated_cb
- void areaUpdated (int x, int y, int width, int height,
+ void areaUpdated (int x, int y, int width, int height,
int pixels[], int scansize)
{
if (curr == null)
return;
-
+
for (int i = 0; i < curr.size (); i++)
{
ImageConsumer ic = (ImageConsumer) curr.elementAt (i);
ic.setPixels (x, y, width, height, cm, pixels, 0, scansize);
}
}
-
+
// called from an async image loader of one sort or another, this method
// repeatedly reads bytes from the input stream and passes them through a
// GdkPixbufLoader using the native method pumpBytes. pumpBytes in turn
@@ -217,7 +217,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
}
needsClose = false;
-
+
for (int i = 0; i < curr.size (); i++)
{
ImageConsumer ic = (ImageConsumer) curr.elementAt (i);
@@ -239,7 +239,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
public static class ImageFormatSpec
{
public String name;
- public boolean writable = false;
+ public boolean writable = false;
public ArrayList mimeTypes = new ArrayList();
public ArrayList extensions = new ArrayList();
@@ -257,12 +257,12 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
public synchronized void addExtension(String e)
{
extensions.add(e);
- }
+ }
}
static ArrayList imageFormatSpecs;
- public static ImageFormatSpec registerFormat(String name, boolean writable)
+ public static ImageFormatSpec registerFormat(String name, boolean writable)
{
ImageFormatSpec ifs = new ImageFormatSpec(name, writable);
synchronized(GdkPixbufDecoder.class)
@@ -277,7 +277,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
static String[] getFormatNames(boolean writable)
{
ArrayList names = new ArrayList();
- synchronized (imageFormatSpecs)
+ synchronized (imageFormatSpecs)
{
Iterator i = imageFormatSpecs.iterator();
while (i.hasNext())
@@ -287,10 +287,10 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
continue;
names.add(ifs.name);
- /*
+ /*
* In order to make the filtering code work, we need to register
* this type under every "format name" likely to be used as a synonym.
- * This generally means "all the extensions people might use".
+ * This generally means "all the extensions people might use".
*/
Iterator j = ifs.extensions.iterator();
@@ -304,7 +304,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
static String[] getFormatExtensions(boolean writable)
{
ArrayList extensions = new ArrayList();
- synchronized (imageFormatSpecs)
+ synchronized (imageFormatSpecs)
{
Iterator i = imageFormatSpecs.iterator();
while (i.hasNext())
@@ -323,7 +323,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
static String[] getFormatMimeTypes(boolean writable)
{
ArrayList mimeTypes = new ArrayList();
- synchronized (imageFormatSpecs)
+ synchronized (imageFormatSpecs)
{
Iterator i = imageFormatSpecs.iterator();
while (i.hasNext())
@@ -339,7 +339,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
return mimeTypes.toArray(new String[mimeTypes.size()]);
}
-
+
static String findFormatName(Object ext, boolean needWritable)
{
if (ext == null)
@@ -361,7 +361,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
if (ifs.name.equals(str))
return str;
- Iterator j = ifs.extensions.iterator();
+ Iterator j = ifs.extensions.iterator();
while (j.hasNext())
{
String extension = j.next();
@@ -369,14 +369,14 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
return ifs.name;
}
- j = ifs.mimeTypes.iterator();
+ j = ifs.mimeTypes.iterator();
while (j.hasNext())
{
String mimeType = j.next();
if (mimeType.equals(str))
return ifs.name;
}
- }
+ }
throw new IllegalArgumentException("unknown extension '" + str + "'");
}
@@ -397,7 +397,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
return writerSpi;
}
- public static void registerSpis(IIORegistry reg)
+ public static void registerSpis(IIORegistry reg)
{
reg.registerServiceProvider(getReaderSpi(), ImageReaderSpi.class);
reg.registerServiceProvider(getWriterSpi(), ImageWriterSpi.class);
@@ -405,11 +405,11 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
public static class GdkPixbufWriterSpi extends ImageWriterSpi
{
- public GdkPixbufWriterSpi()
- {
+ public GdkPixbufWriterSpi()
+ {
super("GdkPixbuf", "2.x",
- GdkPixbufDecoder.getFormatNames(true),
- GdkPixbufDecoder.getFormatExtensions(true),
+ GdkPixbufDecoder.getFormatNames(true),
+ GdkPixbufDecoder.getFormatExtensions(true),
GdkPixbufDecoder.getFormatMimeTypes(true),
"gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufWriter",
new Class[] { ImageOutputStream.class },
@@ -437,11 +437,11 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
public static class GdkPixbufReaderSpi extends ImageReaderSpi
{
- public GdkPixbufReaderSpi()
- {
+ public GdkPixbufReaderSpi()
+ {
super("GdkPixbuf", "2.x",
- GdkPixbufDecoder.getFormatNames(false),
- GdkPixbufDecoder.getFormatExtensions(false),
+ GdkPixbufDecoder.getFormatNames(false),
+ GdkPixbufDecoder.getFormatExtensions(false),
GdkPixbufDecoder.getFormatMimeTypes(false),
"gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufReader",
new Class[] { ImageInputStream.class },
@@ -450,9 +450,9 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
false, null, null, null, null);
}
- public boolean canDecodeInput(Object obj)
- {
- return true;
+ public boolean canDecodeInput(Object obj)
+ {
+ return true;
}
public ImageReader createReaderInstance(Object ext)
@@ -489,7 +489,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
return null;
}
- public IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType,
+ public IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType,
ImageWriteParam param)
{
return null;
@@ -509,7 +509,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
int height = ras.getHeight();
ColorModel model = image.getColorModel();
int[] pixels = CairoGraphics2D.findSimpleIntegerArray (image.getColorModel(), ras);
-
+
if (pixels == null)
{
BufferedImage img;
@@ -520,7 +520,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
for (int y = 0; y < height; ++y)
for (int x = 0; x < width; ++x)
img.setRGB(x, y, model.getRGB(ras.getPixel(x, y, pix)));
- pixels = CairoGraphics2D.findSimpleIntegerArray (img.getColorModel(),
+ pixels = CairoGraphics2D.findSimpleIntegerArray (img.getColorModel(),
img.getRaster());
model = img.getColorModel();
}
@@ -530,7 +530,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
processImageStarted(1);
synchronized(pixbufLock)
{
- streamImage(pixels, this.ext, width, height, model.hasAlpha(),
+ streamImage(pixels, this.ext, width, height, model.hasAlpha(),
this);
}
synchronized(data)
@@ -555,7 +555,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
throw exception;
processImageComplete();
- }
+ }
/**
* Object marking end of data from native streamImage code.
@@ -627,7 +627,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
}
}
- private static class GdkPixbufReader
+ private static class GdkPixbufReader
extends ImageReader
implements ImageConsumer
{
@@ -638,7 +638,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
int width;
int height;
String ext;
-
+
public GdkPixbufReader(GdkPixbufReaderSpi ownerSpi, Object ext)
{
super(ownerSpi);
@@ -658,29 +658,29 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
width = w;
height = h;
}
-
+
public void setProperties(Hashtable props) {}
- public void setColorModel(ColorModel model)
+ public void setColorModel(ColorModel model)
{
defaultModel = model;
}
public void setHints(int flags) {}
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels,
+ public void setPixels(int x, int y, int w, int h,
+ ColorModel model, byte[] pixels,
int offset, int scansize)
{
- }
+ }
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels,
+ public void setPixels(int x, int y, int w, int h,
+ ColorModel model, int[] pixels,
int offset, int scansize)
{
if (model == null)
model = defaultModel;
-
+
if (bufferedImage == null)
{
if(model != null && model.hasAlpha())
@@ -709,7 +709,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
processImageProgress(y / (height == 0 ? 1 : height));
}
- public void imageComplete(int status)
+ public void imageComplete(int status)
{
processImageComplete();
}
@@ -729,7 +729,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
return 1;
}
- public IIOMetadata getImageMetadata(int i)
+ public IIOMetadata getImageMetadata(int i)
{
return null;
}
@@ -748,7 +748,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
vec.add(new ImageTypeSpecifier(img));
return vec.iterator();
}
-
+
public int getHeight(int imageIndex)
throws IOException
{
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java
index d3e9774..2609bad 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java
@@ -53,9 +53,9 @@ public class GdkRobotPeer implements RobotPeer
{
// gdk-pixbuf provides data in RGBA format
static final ColorModel cm = new DirectColorModel (32, 0xff000000,
- 0x00ff0000,
- 0x0000ff00,
- 0x000000ff);
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff);
public GdkRobotPeer (GraphicsDevice screen) throws AWTException
{
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
index 58b5834..1c849df 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
@@ -52,28 +52,28 @@ import gnu.classpath.Pointer;
class GdkScreenGraphicsDevice extends GraphicsDevice
{
private final int native_state = GtkGenericPeer.getUniqueInteger ();
-
+
private Window fullscreenWindow;
-
+
private boolean oldWindowDecorationState;
-
+
private Rectangle oldWindowBounds;
-
+
private Rectangle bounds;
-
+
private GdkGraphicsConfiguration[] configurations;
-
+
/** The GdkGraphicsEnvironment instance that created this
* GdkScreenGraphicsDevice. This is only needed for native
* methods which need to access the 'native_state' field storing a pointer
* to a GdkDisplay object.
- */
+ */
GdkGraphicsEnvironment env;
-
+
/** An identifier that is created by Gdk
*/
String idString;
-
+
/** The display modes supported by this GdkScreenGraphicsDevice.
* If the array is nullnativeGetDisplayModes has
* to be called.
@@ -85,7 +85,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
* is still null afterwards, the XRandR extension is available
* and display mode changes are possible. If it is non-null XRandR is not
* available, no display mode changes are possible and no other native
- * method must be called.
+ * method must be called.
*/
DisplayMode fixedDisplayMode;
@@ -107,14 +107,14 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
GtkToolkit.initializeGlobalIDs();
initIDs();
}
-
+
static native void initIDs();
-
+
GdkScreenGraphicsDevice (GdkGraphicsEnvironment e)
{
super();
env = e;
-
+
configurations = new GdkGraphicsConfiguration[1];
configurations[0] = new GdkGraphicsConfiguration(this);
}
@@ -126,13 +126,13 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
{
fixedDisplayMode = nativeGetFixedDisplayMode(env);
}
-
+
/** Depending on the availability of the XRandR extension the method returns
* the screens' non-changeable display mode or null, meaning that XRandR can
* handle display mode changes.
*/
native DisplayMode nativeGetFixedDisplayMode(GdkGraphicsEnvironment env);
-
+
public int getType ()
{
// Gdk manages only raster screens.
@@ -143,17 +143,17 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
{
if (idString == null)
idString = nativeGetIDString();
-
+
return idString;
}
-
- private native String nativeGetIDString();
+
+ private native String nativeGetIDString();
public GraphicsConfiguration[] getConfigurations ()
{
return (GraphicsConfiguration[]) configurations.clone();
}
-
+
public GraphicsConfiguration getDefaultConfiguration ()
{
return configurations[0];
@@ -172,7 +172,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
{
if (fixedDisplayMode != null)
return fixedDisplayMode;
-
+
synchronized (this)
{
if (displayModes == null)
@@ -181,28 +181,28 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
int index = nativeGetDisplayModeIndex(env);
int rate = nativeGetDisplayModeRate(env);
-
+
return new DisplayMode(displayModes[index].width,
displayModes[index].height,
DisplayMode.BIT_DEPTH_MULTI,
rate);
}
-
+
native int nativeGetDisplayModeIndex(GdkGraphicsEnvironment env);
-
+
native int nativeGetDisplayModeRate(GdkGraphicsEnvironment env);
-
+
public DisplayMode[] getDisplayModes()
{
if (fixedDisplayMode != null)
return new DisplayMode[] { fixedDisplayMode };
-
+
synchronized (this)
{
if (displayModes == null)
displayModes = nativeGetDisplayModes(env);
}
-
+
ArrayList list = new ArrayList();
for(int i=0;i properties)
+ public void setImage(int width, int height,
+ int[] pixels, Hashtable,?> properties)
{
this.width = width;
this.height = height;
@@ -392,12 +392,12 @@ public class GtkImage extends Image
return width;
}
-
+
public synchronized int getHeight (ImageObserver observer)
{
if (addObserver(observer))
return -1;
-
+
return height;
}
@@ -405,7 +405,7 @@ public class GtkImage extends Image
{
if (addObserver(observer))
return UndefinedProperty;
-
+
Object value = props.get (name);
return (value == null) ? UndefinedProperty : value;
}
@@ -426,7 +426,7 @@ public class GtkImage extends Image
else
return null;
}
- return new MemoryImageSource(width, height, nativeModel, pixels,
+ return new MemoryImageSource(width, height, nativeModel, pixels,
0, width);
}
@@ -438,7 +438,7 @@ public class GtkImage extends Image
throw new IllegalAccessError("This method only works for off-screen"
+" Images.");
}
-
+
/**
* Returns a scaled instance of this pixbuf.
*/
@@ -454,7 +454,7 @@ public class GtkImage extends Image
}
/**
- * If the image is loaded and comes from an ImageProducer,
+ * If the image is loaded and comes from an ImageProducer,
* regenerate the image from there.
*
* I have no idea if this is ever actually used. Since GtkImage can't be
@@ -468,9 +468,9 @@ public class GtkImage extends Image
observers = new Vector();
isLoaded = false;
synchronized(pixbufLock)
- {
- freePixbuf();
- }
+ {
+ freePixbuf();
+ }
source.startProduction(new GtkImageConsumer(this, source));
}
}
@@ -510,7 +510,7 @@ public class GtkImage extends Image
*/
private void deliver()
{
- int flags = ImageObserver.HEIGHT |
+ int flags = ImageObserver.HEIGHT |
ImageObserver.WIDTH |
ImageObserver.PROPERTIES |
ImageObserver.ALLBITS;
@@ -522,7 +522,7 @@ public class GtkImage extends Image
observers = null;
}
-
+
/**
* Adds an observer, if we need to.
* @return true if an observer was added.
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java
index 44cfaf9..65cae7a 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java
@@ -92,11 +92,11 @@ public class GtkImageConsumer implements ImageConsumer
public synchronized void setHints (int flags)
{
// This method informs us in which order the pixels are
- // delivered, for progressive-loading support, etc.
+ // delivered, for progressive-loading support, etc.
// Since we wait until it's all loaded, we can ignore the hints.
}
- public synchronized void setPixels (int x, int y, int width, int height,
+ public synchronized void setPixels (int x, int y, int width, int height,
ColorModel cm, byte[] pixels,
int offset, int scansize)
{
@@ -158,7 +158,7 @@ public class GtkImageConsumer implements ImageConsumer
for (int i = 0; i < pixels.length; i++)
ret[i] = pixels[i] & 0xFF;
-
+
return ret;
}
@@ -167,5 +167,3 @@ public class GtkImageConsumer implements ImageConsumer
this.properties = props;
}
}
-
-
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java
index 76f8e5f..0bdacbf 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java
@@ -74,7 +74,7 @@ public class GtkLabelPeer extends GtkComponentPeer
if (text != null)
setNativeText(text);
}
-
+
public GtkLabelPeer (Label l)
{
super (l);
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkListPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkListPeer.java
index f943a75..b1cc6e5 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkListPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkListPeer.java
@@ -73,7 +73,7 @@ public class GtkListPeer extends GtkComponentPeer
public GtkListPeer (List list)
{
super (list);
-
+
setMultipleMode (list.isMultipleMode ());
if (list.getItemCount () > 0)
@@ -83,20 +83,20 @@ public class GtkListPeer extends GtkComponentPeer
native void append (String items[]);
public native void add (String item, int index);
-
+
public void addItem (String item, int index)
{
add (item, index);
}
-
+
public void clear ()
{
removeAll ();
}
-
+
public native void delItems (int start, int end);
public native void deselect (int index);
-
+
public Dimension getMinimumSize (int rows)
{
return minimumSize (rows);
@@ -106,7 +106,7 @@ public class GtkListPeer extends GtkComponentPeer
{
return preferredSize (rows);
}
-
+
public native int[] getSelectedIndexes ();
public native void makeVisible (int index);
@@ -158,7 +158,7 @@ public class GtkListPeer extends GtkComponentPeer
// Double-click only generates an Action event if
// something is selected.
if (selectedItem != null)
- postActionEvent (((List) awtComponent).getSelectedItem (),
+ postActionEvent (((List) awtComponent).getSelectedItem (),
me.getModifiersEx ());
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
index 1e37cef..78f6403 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
@@ -60,7 +60,7 @@ public abstract class GtkMenuComponentPeer extends GtkGenericPeer
{
MenuComponent mc = ((MenuComponent) awtWidget);
Font f = mc.getFont();
-
+
if (f == null)
{
MenuContainer parent = mc.getParent ();
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java
index ff6bdca..c553473 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java
@@ -57,7 +57,7 @@ public class GtkMenuPeer extends GtkMenuItemPeer
protected native void create (String label);
private native void addItem(MenuItemPeer item, int key,
- boolean shiftModifier);
+ boolean shiftModifier);
/** XXX - Document this and the override in GtkPopupMenuPeer. */
native void setupAccelGroup (GtkGenericPeer container);
@@ -75,7 +75,7 @@ public class GtkMenuPeer extends GtkMenuItemPeer
public GtkMenuPeer (Menu menu)
{
super (menu);
-
+
if (menu.isTearOff())
addTearOff();
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java
index 7407744..55c9146 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java
@@ -49,18 +49,17 @@ import java.awt.peer.MouseInfoPeer;
public class GtkMouseInfoPeer implements MouseInfoPeer
{
private static GdkGraphicsEnvironment gde = new GdkGraphicsEnvironment();
-
+
public int fillPointWithCoords(Point p)
{
int[] coords = gde.getMouseCoordinates();
- p.x = coords[1];
+ p.x = coords[1];
p.y = coords[2];
return coords[0];
}
-
+
public boolean isWindowUnderMouse(Window w)
{
return gde.isWindowUnderMouse((GtkWindowPeer) w.getPeer());
}
}
-
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java
index e0053f7..00b506c 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java
@@ -59,7 +59,7 @@ public class GtkPanelPeer extends GtkContainerPeer
if (id == MouseEvent.MOUSE_PRESSED)
awtComponent.requestFocusInWindow();
-
+
super.handleEvent(event);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
index 4d66a3f..1b0ec8e 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
@@ -60,7 +60,7 @@ public class GtkPopupMenuPeer extends GtkMenuPeer
Point abs = origin.getLocationOnScreen ();
show (abs.x + x, abs.y + y, 0);
}
-
+
public void show (Event e)
{
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
index c29706f..d3f160c 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
@@ -50,7 +50,7 @@ public class GtkScrollbarPeer extends GtkComponentPeer
Scrollbar sb = (Scrollbar) awtComponent;
create (sb.getOrientation (), sb.getValue (),
- sb.getMinimum (), sb.getMaximum (),
+ sb.getMinimum (), sb.getMaximum (),
sb.getUnitIncrement (), sb.getBlockIncrement (),
sb.getVisibleAmount ());
}
@@ -85,7 +85,7 @@ public class GtkScrollbarPeer extends GtkComponentPeer
protected void postAdjustmentEvent (int type, int value)
{
Scrollbar bar = (Scrollbar) awtComponent;
- q().postEvent(new AdjustmentEvent(bar,
+ q().postEvent(new AdjustmentEvent(bar,
AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
type, value, true));
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkSelection.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkSelection.java
index 967a2ed..78ed696 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkSelection.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkSelection.java
@@ -87,7 +87,7 @@ public class GtkSelection implements Transferable
* mimeTypesDelivered is true.
*/
private DataFlavor[] dataFlavors;
-
+
/**
* Indicates a requestText() call was made and the corresponding
* textAvailable() callback was triggered.
@@ -100,7 +100,7 @@ public class GtkSelection implements Transferable
* is true.
*/
private String text;
-
+
/**
* Indicates a requestImage() call was made and the corresponding
* imageAvailable() callback was triggered.
@@ -228,7 +228,7 @@ public class GtkSelection implements Transferable
// extra element.
ArrayList flavorsList =
new ArrayList(mimeTypes.length + 1);
-
+
for (int i = 0; i < mimeTypes.length; i++)
{
try
@@ -262,7 +262,7 @@ public class GtkSelection implements Transferable
npe.printStackTrace();
}
}
-
+
dataFlavors = new DataFlavor[flavorsList.size()];
flavorsList.toArray(dataFlavors);
}
@@ -406,10 +406,10 @@ public class GtkSelection implements Transferable
}
requestInProgress = false;
}
-
+
if (imagePointer != null)
image = new GtkImage(imagePointer);
-
+
imagePointer = null;
result = image;
if (! GtkClipboard.canCache)
@@ -572,7 +572,7 @@ public class GtkSelection implements Transferable
bytes = null;
bytesDelivered = false;
requestInProgress = false;
-
+
requestLock.notifyAll();
}
return result;
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
index 3b11446..1506565 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
@@ -182,10 +182,10 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
*/
initializeGlobalIDs();
- int portableNativeSync;
- String portNatSyncProp =
+ int portableNativeSync;
+ String portNatSyncProp =
System.getProperty("gnu.classpath.awt.gtk.portable.native.sync");
-
+
if (portNatSyncProp == null)
portableNativeSync = -1; // unset
else if (Boolean.valueOf(portNatSyncProp).booleanValue())
@@ -204,12 +204,12 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public native void beep();
private native void getScreenSizeDimensions(int[] xy);
-
- public int checkImage (Image image, int width, int height,
- ImageObserver observer)
+
+ public int checkImage (Image image, int width, int height,
+ ImageObserver observer)
{
- int status = ImageObserver.ALLBITS
- | ImageObserver.WIDTH
+ int status = ImageObserver.ALLBITS
+ | ImageObserver.WIDTH
| ImageObserver.HEIGHT;
if (image instanceof GtkImage)
@@ -223,17 +223,17 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
-1, -1,
image.getWidth (observer),
image.getHeight (observer));
-
+
return status;
}
- /**
+ /**
* Helper to return either a Image -- the argument -- or a
* GtkImage with the errorLoading flag set if the argument is null.
*/
static Image imageOrError(Image b)
{
- if (b == null)
+ if (b == null)
return GtkImage.getErrorImage();
else
return b;
@@ -243,7 +243,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
{
if (filename.length() == 0)
return new GtkImage ();
-
+
Image image;
try
{
@@ -261,11 +261,11 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
return new AsyncImage(url);
}
- public Image createImage (ImageProducer producer)
+ public Image createImage (ImageProducer producer)
{
if (producer == null)
return null;
-
+
Image image;
try
{
@@ -279,7 +279,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
}
public Image createImage (byte[] imagedata, int imageoffset,
- int imagelength)
+ int imagelength)
{
Image image;
try
@@ -294,13 +294,13 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
}
return imageOrError(image);
}
-
+
/**
* Creates an ImageProducer from the specified URL. The image is assumed
- * to be in a recognised format.
+ * to be in a recognised format.
*
* @param url URL to read image data from.
- */
+ */
public ImageProducer createImageProducer(URL url)
{
return createImage( url ).getSource();
@@ -308,29 +308,29 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
/**
* Returns the native color model (which isn't the same as the default
- * ARGB color model, but doesn't have to be).
+ * ARGB color model, but doesn't have to be).
*/
- public ColorModel getColorModel ()
+ public ColorModel getColorModel ()
{
/* Return the GDK-native ABGR format */
- return new DirectColorModel(32,
+ return new DirectColorModel(32,
0x000000FF,
0x0000FF00,
0x00FF0000,
0xFF000000);
}
- public String[] getFontList ()
+ public String[] getFontList ()
{
- return (new String[] { "Dialog",
- "DialogInput",
- "Monospaced",
+ return (new String[] { "Dialog",
+ "DialogInput",
+ "Monospaced",
"Serif",
"SansSerif" });
}
static class LRUCache extends LinkedHashMap
- {
+ {
int max_entries;
public LRUCache(int max)
{
@@ -347,12 +347,12 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
new LRUCache
- *
+ *
*
The class resolution is always the last step when serializing a tree
* of objects. Due to the recursive nature of the algorithm we need a way
* to end the recursion. This is achieved by the implementation of this
@@ -52,8 +52,8 @@ import java.beans.PersistenceDelegate;
* we call getClass() on a String.class instance.
* This in turn lead to the resolution of the String class which is always
* encoded as "".getClass(). Finally the Encoder
- * treats strings in a special way so that the recursion ends here.
- *
+ * treats strings in a special way so that the recursion ends here.
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
public class ClassPersistenceDelegate extends PersistenceDelegate
@@ -62,7 +62,7 @@ public class ClassPersistenceDelegate extends PersistenceDelegate
protected Expression instantiate(Object oldInstance, Encoder out)
{
Class oldClass = (Class) oldInstance;
-
+
// Due to the special handling of String instances in the Encoder
// this Expression does not lead to further class resolutions.
if (oldClass == String.class)
@@ -72,7 +72,7 @@ public class ClassPersistenceDelegate extends PersistenceDelegate
if (oldClass == Class.class)
return new Expression(oldClass, String.class, "getClass", null);
- // This Expression will lead to the class resolution of Class.class.
+ // This Expression will lead to the class resolution of Class.class.
return new Expression(oldClass, Class.class, "forName",
new Object[] { oldClass.getName() });
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/CollectionPersistenceDelegate.java b/libjava/classpath/gnu/java/beans/encoder/CollectionPersistenceDelegate.java
index f1375d2..bdf6fda 100644
--- a/libjava/classpath/gnu/java/beans/encoder/CollectionPersistenceDelegate.java
+++ b/libjava/classpath/gnu/java/beans/encoder/CollectionPersistenceDelegate.java
@@ -7,7 +7,7 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -49,10 +49,10 @@ import java.util.Iterator;
/**
A PersistenceDelegate implementation that calls
* the no-argument constructor to create the Collection instance and
* uses an iterator to add all the objects it reaches through it.
- *
+ *
*
It is used for Set and List
* implementations.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
public class CollectionPersistenceDelegate extends PersistenceDelegate
diff --git a/libjava/classpath/gnu/java/beans/encoder/Context.java b/libjava/classpath/gnu/java/beans/encoder/Context.java
index 9126d49..8acc490 100644
--- a/libjava/classpath/gnu/java/beans/encoder/Context.java
+++ b/libjava/classpath/gnu/java/beans/encoder/Context.java
@@ -41,20 +41,20 @@ package gnu.java.beans.encoder;
/** A Contect object describes the current state
* and the call number while processing the original object
* tree in the {@link ScanEngine}.
- *
+ *
*
The class allows to distinguish the different calling states
* and is neccessary for the child element skipping feature of
- * the {@link GenericScannerState}.
- *
+ * the {@link GenericScannerState}.
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
public class Context
{
private String state;
-
+
private int call;
-
+
Context(String newState, int newCall)
{
state = newState;
@@ -66,21 +66,21 @@ public class Context
int hc = 7;
hc = 31 * hc + state.hashCode();
hc = 31 * hc + call;
-
+
return hc;
}
-
+
public boolean equals(Object o)
{
if (!(o instanceof Context))
return false;
-
+
Context that = (Context) o;
-
+
return state.equals(that.state)
&& call == that.call;
}
-
+
public String toString()
{
return "Context [state=" + state + ", call=" + call + "]";
diff --git a/libjava/classpath/gnu/java/beans/encoder/GenericScannerState.java b/libjava/classpath/gnu/java/beans/encoder/GenericScannerState.java
index 3c3f8a3..b07771d 100644
--- a/libjava/classpath/gnu/java/beans/encoder/GenericScannerState.java
+++ b/libjava/classpath/gnu/java/beans/encoder/GenericScannerState.java
@@ -60,12 +60,12 @@ import gnu.java.beans.encoder.elements.StringReference;
* This class is a {@link ScannerState} implementation that creates
* suitable {@link gnu.java.beans.encoder.elements.Element} instances
* for each transition variant.
- *
+ *
*
Furthermore it can optionally skip a certain number of child
- * elements. The algorithm can cope with the fact that one
+ * elements. The algorithm can cope with the fact that one
* GenericScannerState instance may be called at
* different levels of recursions.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
class GenericScannerState extends ScannerState
@@ -89,19 +89,19 @@ class GenericScannerState extends ScannerState
if (skipElements > 0)
skipValues = new HashMap();
}
-
+
protected void enterImpl(Context ctx)
{
if (skipValues != null)
{
Integer skip = (Integer) skipValues.get(ctx);
-
+
if (skip == null)
{
skip = Integer.valueOf(initialSkipElements);
skipValues.put(ctx, skip);
}
-
+
skipElements = skip.intValue();
}
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/IgnoringScannerState.java b/libjava/classpath/gnu/java/beans/encoder/IgnoringScannerState.java
index 054f1f0..3ec78cd 100644
--- a/libjava/classpath/gnu/java/beans/encoder/IgnoringScannerState.java
+++ b/libjava/classpath/gnu/java/beans/encoder/IgnoringScannerState.java
@@ -40,7 +40,7 @@ package gnu.java.beans.encoder;
/** A special {@link ScannerState} implementation that ignores all child
* elements.
- *
+ *
*
When the ignoring state is active one can filter the elements of
* one level. One has to set up the state machine that a transition
* via "class resolution" from a state that was reached via "object
* instantation" reaches an IgnoringScannerState.
- *
+ *
*
Setting the default successor of a IgnoringScannerState
* to itself causes all elements of the call hierarchy to be skipped
- * until another state is reached by going back.
- *
+ * until another state is reached by going back.
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
@@ -125,9 +125,9 @@ class IgnoringScannerState extends ScannerState
void objectReference(ObjectId id)
{
}
-
+
void end()
{
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/MapPersistenceDelegate.java b/libjava/classpath/gnu/java/beans/encoder/MapPersistenceDelegate.java
index 84cdce9..9ffdb56 100644
--- a/libjava/classpath/gnu/java/beans/encoder/MapPersistenceDelegate.java
+++ b/libjava/classpath/gnu/java/beans/encoder/MapPersistenceDelegate.java
@@ -8,7 +8,7 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/libjava/classpath/gnu/java/beans/encoder/ObjectId.java b/libjava/classpath/gnu/java/beans/encoder/ObjectId.java
index eca5c3d..13d75d6 100644
--- a/libjava/classpath/gnu/java/beans/encoder/ObjectId.java
+++ b/libjava/classpath/gnu/java/beans/encoder/ObjectId.java
@@ -45,7 +45,7 @@ import java.util.HashMap;
* ObjectId provides an object identification mechanism which gives each object
* a name in the form <class><Nameindex>.
*
- *
+ *
*
* Each id can be in an unused state which means that only one instance of the
* object is in use and a special id is not needed. Certain {@link
@@ -57,7 +57,7 @@ import java.util.HashMap;
* The second user should then invoke the {@link #init} method to generate the
* identification string and bring the id in the 'used' state.
*
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
public class ObjectId
diff --git a/libjava/classpath/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java b/libjava/classpath/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java
index 8cb3705..55626b5 100644
--- a/libjava/classpath/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java
+++ b/libjava/classpath/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,7 +44,7 @@ import java.beans.PersistenceDelegate;
/**
* A shared PersistenceDelegate implementation for all primitive types.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
public class PrimitivePersistenceDelegate extends PersistenceDelegate
@@ -70,5 +70,5 @@ public class PrimitivePersistenceDelegate extends PersistenceDelegate
out.writeExpression(new Expression(oldInstance, oldInstance.getClass(), "new",
new Object[] { oldInstance.toString() }));
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/ReportingScannerState.java b/libjava/classpath/gnu/java/beans/encoder/ReportingScannerState.java
index fb6e061..c91bb15 100644
--- a/libjava/classpath/gnu/java/beans/encoder/ReportingScannerState.java
+++ b/libjava/classpath/gnu/java/beans/encoder/ReportingScannerState.java
@@ -42,7 +42,7 @@ package gnu.java.beans.encoder;
* A ScannerState implementation that prints useful details
* about its arguments. Use it when the XML encoding does not work correctly
* and you want to find out how things relate to each other.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
class ReportingScannerState extends ScannerState
@@ -50,12 +50,12 @@ class ReportingScannerState extends ScannerState
void methodInvocation(String methodName)
{
- System.out.println("methodInvocation: " + methodName + "()");
+ System.out.println("methodInvocation: " + methodName + "()");
}
void staticMethodInvocation(String className, String methodName)
{
- System.out.println("staticMethodInvocation: " + className + "." + methodName + "()");
+ System.out.println("staticMethodInvocation: " + className + "." + methodName + "()");
}
void staticFieldAccess(String className, String fieldName)
@@ -65,17 +65,17 @@ class ReportingScannerState extends ScannerState
void classResolution(String className)
{
- System.out.println("classResolution: " + className);
+ System.out.println("classResolution: " + className);
}
void objectInstantiation(String className, ObjectId objectId)
{
- System.out.println("objectInstantiation: " + className);
+ System.out.println("objectInstantiation: " + className);
}
void primitiveInstantiation(String primitiveName, String valueAsString)
{
- System.out.println("primitiveInstantiation: (" + primitiveName + ") " + valueAsString);
+ System.out.println("primitiveInstantiation: (" + primitiveName + ") " + valueAsString);
}
void objectArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId)
@@ -90,27 +90,27 @@ class ReportingScannerState extends ScannerState
void arraySet(String indexAsString)
{
- System.out.println("arraySet: " + indexAsString);
+ System.out.println("arraySet: " + indexAsString);
}
void arrayGet(String indexAsString)
{
- System.out.println("arrayGet: " + indexAsString);
+ System.out.println("arrayGet: " + indexAsString);
}
void listGet()
{
- System.out.println("listGet");
+ System.out.println("listGet");
}
void listSet()
{
- System.out.println("listSet");
+ System.out.println("listSet");
}
void nullObject()
{
- System.out.println("nullObject");
+ System.out.println("nullObject");
}
void stringReference(String string)
@@ -125,7 +125,7 @@ class ReportingScannerState extends ScannerState
void end()
{
- System.out.println("-close");
+ System.out.println("-close");
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/Root.java b/libjava/classpath/gnu/java/beans/encoder/Root.java
index f4eade1..a6410d7 100644
--- a/libjava/classpath/gnu/java/beans/encoder/Root.java
+++ b/libjava/classpath/gnu/java/beans/encoder/Root.java
@@ -46,14 +46,14 @@ import gnu.java.beans.encoder.elements.Element;
/**
Root provides a simple interface to a tree of
* objects.
- *
+ *
*
Using an instance of this class a logical representation of
* the real object tree that is serialized can be built. When the
* actual data should be written as XML Root and
* {@link gnu.java.beans.encoder.elements.Element} class can provide
* context information which is used to write the best fitting
* XML representation.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
public class Root
@@ -61,7 +61,7 @@ public class Root
private Stack parents = new Stack();
private Element rootElement, current;
-
+
private boolean started;
public Root()
@@ -70,10 +70,10 @@ public class Root
}
/**
Adds another child element to the tree.
- *
+ *
*
The new element automatically becomes the current
* element.
- *
+ *
* @param elem The new child element.
*/
public void addChild(Element elem)
@@ -88,7 +88,7 @@ public class Root
*
Marks that the end of the current element
* is reached and that no more childs are added to
* it.
- *
+ *
*
The behavior is to return to the nearest parent
* element.
*/
@@ -100,7 +100,7 @@ public class Root
/**
*
Goes back to the nearest parent element but
* deletes the just created child.
- *
+ *
*
This is used if something went wrong while
* processing the child element's {@link java.beans.Expression}
* or {@link java.beans.Statement}.
@@ -117,9 +117,9 @@ public class Root
*
Traverses the elements in the object tree
* and creates their XML representation in the output
* stream of the given {@link Writer}.
- *
+ *
*
Finally the Writer is flushed.
- *
+ *
* @param writer The Writer instance that generates the XML representation.
*/
public void traverse(Writer writer)
@@ -130,16 +130,16 @@ public class Root
rootElement.writeStart(writer);
}
started = true;
-
+
traverse(writer, rootElement.iterator());
-
+
rootElement.clear();
-
+
writer.flush();
}
/** Writes the closing element and closes the {@link Writer}
- *
+ *
* @param writer The Writer instance that generates the XML representation.
*/
public void close(Writer writer)
@@ -149,7 +149,7 @@ public class Root
}
/** Recursively traverses the object tree.
- *
+ *
* @param writer The Writer instance that generates the XML representation.
* @param ite An Iterator returning Element instances.
*/
@@ -163,19 +163,19 @@ public class Root
traverse(writer, e.iterator());
e.writeEnd(writer);
-
+
e.clear();
}
}
/**
A special Element implementation that represents the
* encoder's context.
- *
+ *
*
This element is written only once per Writer.
- *
+ *
*
It is assumed that this element is never empty to simplify
* the implementation.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org);
*
*/
@@ -187,7 +187,7 @@ public class Root
new String[] { System.getProperty("java.version"),
XMLEncoder.class.getName() }, false);
}
-
+
public void writeEnd(Writer writer)
{
writer.writeEnd(false);
diff --git a/libjava/classpath/gnu/java/beans/encoder/ScanEngine.java b/libjava/classpath/gnu/java/beans/encoder/ScanEngine.java
index b78a814..9ced143 100644
--- a/libjava/classpath/gnu/java/beans/encoder/ScanEngine.java
+++ b/libjava/classpath/gnu/java/beans/encoder/ScanEngine.java
@@ -1,4 +1,4 @@
-/* ScanEngine.java
+/* ScanEngine.java
-- Scans the input and generates an object tree that can be written as XML.
Copyright (C) 2005 Free Software Foundation, Inc.
@@ -54,7 +54,7 @@ import java.util.Stack;
* {@link #writeObject} method and feeds it to a state machine. The
* state machine then constructs and object tree which is finally
* written as XML by a {@link Writer} implementation.
- *
+ *
*
How does it work?
*
The ScanEngine sits below the {@link java.beans.XMLEncoder}
* class and is called by it exclusively. The XMLEncoder sends
@@ -65,7 +65,7 @@ import java.util.Stack;
* Furthermore the meaning of certain Expressions differs
* depending on the enclosing elements or the inner elements have to be
* simply discarded.
- *
+ *
*
To cope with this state dependant nature the ScanEngine
* contains a state machine which is programmed statically (no adjustments are
* needed, all ScanEngine engines use the same setup). The
@@ -83,7 +83,7 @@ import java.util.Stack;
* the current state and then the event method is called in the new current
* state. The last step allows the state instance to do something meaningful
* to the object tree.
- *
+ *
*
The state machine knows the concept of returning to the previous
* state. This is done using a stack of states which is popped every
* time a call to writeStatement, writeExpression
@@ -93,7 +93,7 @@ import java.util.Stack;
* ScanEngine itself to decide when an expression or statement
* ended. This can only be done in case of {@link #writeObject} calls because
* they are not nested.
- *
+ *
*
When the XML persistence mechanism reaches an object twice (and more)
* it should generate an XML element using the "idref" attribute and add
* an "id" attribute to its first instantiation. This complicates things a bit
@@ -106,12 +106,12 @@ import java.util.Stack;
* instance is stored in the ScanEngine and gets cleared whenever
* the {@link #flush} method is called. This method also writes the currently
* built object tree and generates the XML representation.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
public class ScanEngine
{
-
+
/** Change this to true to let the ScanEngine print state transition
* information.
*/
@@ -145,7 +145,7 @@ public class ScanEngine
/** Stores the relationship between objects and their {@link ObjectId} instance.
*/
IdentityHashMap objects = new IdentityHashMap();
-
+
public ScanEngine(OutputStream os)
{
// TODO: Provide another Writer implementation (e.g. one that does not use
@@ -182,7 +182,7 @@ public class ScanEngine
"newObj0");
conf = register("newObj0", new GenericScannerState(root));
conf.setDefaultSuccessor("ignoreAll");
-
+
// Simply use the start state to encode method invocations inside of
// objects.
conf.putSuccessor(ScannerState.TRANSITION_METHOD_INVOCATION, "start");
@@ -203,14 +203,14 @@ public class ScanEngine
conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll");
conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
"ignoreAll");
-
+
// Get here when a value is set in the array.
register("newOArrayGet",
conf = new GenericScannerState(root));
-
+
conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
"newOArrayGet_ignoreFirstInteger");
-
+
// "newArrayGet_ignoreFirstInteger" is set up mostly identical like the "start"
// state. Otherwise things would not behave the same when done inside
// arrays.
@@ -223,21 +223,21 @@ public class ScanEngine
"newPrimitiveArray");
conf.putSuccessor(ScannerState.TRANSITION_OBJECT_ARRAY_INSTANTIATION,
"newObjectArray");
-
+
conf = register("newOArrayGet_ignoreFirstInteger",
new GenericScannerState(root, 1));
-
+
// In non-int primitive arrays class resolutions can happen
// but they should be ignored.
conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll");
-
+
// Spurious object and string references occur when setting array
// elements. This suppresses them.
conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
"ignoreAll");
conf.putSuccessor(ScannerState.TRANSITION_OBJECT_REFERENCE, "ignoreAll");
conf.putSuccessor(ScannerState.TRANSITION_STRING_REFERENCE, "ignoreAll");
-
+
conf.setDefaultSuccessor("start");
// Primitive arrays use the ARRAY_SET transition to create setting the
@@ -252,11 +252,11 @@ public class ScanEngine
conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll");
conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
"ignoreAll");
-
+
conf = register("newPArraySet", new GenericScannerState(root));
conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
"newPArraySet_ignoreFirstInteger");
-
+
// Primitive arrays ignore all kinds of non-primitive object information.
conf.putSuccessor(ScannerState.TRANSITION_OBJECT_REFERENCE,
"ignoreAll");
@@ -271,11 +271,11 @@ public class ScanEngine
conf = register("newPArraySet_ignoreFirstInteger",
new GenericScannerState(root, 1));
-
+
// In non-int primitive arrays class resolutions can happen
// but they should be ignored.
conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll");
-
+
// Spurious object and string references occur when setting array
// elements. This suppresses them.
conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
@@ -287,7 +287,7 @@ public class ScanEngine
}
/** Registers a ScannerState under a certain name.
- *
+ *
* @param name Name of the state
* @param state The ScannerState instance.
* @return The second argument.
@@ -295,26 +295,26 @@ public class ScanEngine
private ScannerState register(String name, ScannerState state)
{
state.init(name);
-
+
states.put(name, state);
return state;
}
-
+
/** Generates or returns an id for the given object which can be activated
* later if the object is suitable.
- *
+ *
*
Objects are unsuitable if they are an instance of a primitive wrapper
* or String.
- *
- * @param value The object to retrieve an id for.
+ *
+ * @param value The object to retrieve an id for.
* @return The id for the object or null.
*/
private ObjectId retrieveId(Object value)
{
Class valueClass = value.getClass();
ObjectId id = null;
-
+
// Although multiple accesses to Class objects are not handled
// through ids we generate one for them, too. This allows us to detect
// second time references to such objects in the writeObject method
@@ -329,13 +329,13 @@ public class ScanEngine
objects.put(value, id);
}
}
-
+
return id;
}
/** Scans the argument and calls one of event methods. See
* the introduction of this class for details.
- *
+ *
* @param expr The expression to serialize.
*/
public void writeExpression(Expression expr)
@@ -344,7 +344,7 @@ public class ScanEngine
Object[] args = expr.getArguments();
Object target = expr.getTarget();
Object value = null;
-
+
try
{
value = expr.getValue();
@@ -366,9 +366,9 @@ public class ScanEngine
if (methodName.equals("newInstance"))
{
id = retrieveId(value);
-
+
Class ct = (Class) args[0];
-
+
if (ct.isPrimitive() || ct == Boolean.class || ct == Byte.class
|| ct == Short.class || ct == Integer.class || ct == Long.class
|| ct == Float.class || ct == Double.class)
@@ -379,7 +379,7 @@ public class ScanEngine
objectArrayInstantiation(ct.getName(),
args[1].toString(),
id);
-
+
return;
}
else if (methodName.equals("get"))
@@ -398,7 +398,7 @@ public class ScanEngine
objectReference(id);
end();
}
-
+
return;
}
else if (methodName.equals("set"))
@@ -407,7 +407,7 @@ public class ScanEngine
return;
}
}
-
+
id = retrieveId(value);
if (target instanceof Class)
@@ -517,7 +517,7 @@ public class ScanEngine
/** Scans the argument and calls one of event methods. See
* the introduction of this class for details.
- *
+ *
* @param stmt The statement to serialize.
*/
public void writeStatement(Statement stmt)
@@ -553,7 +553,7 @@ public class ScanEngine
/** Scans the argument and calls one of event methods. See
* the introduction of this class for details.
- *
+ *
* @param o The object to serialize.
*/
public boolean writeObject(Object o)
@@ -585,9 +585,9 @@ public class ScanEngine
end();
return false;
}
-
+
// If our object has a corresponding ObjectId instance
- // then generate an objectReference. This will
+ // then generate an objectReference. This will
// initialize the id (= brings it in the "used" state)
// when this is the first referal.
objectReference(id);
@@ -622,10 +622,10 @@ public class ScanEngine
/**
* Does a transition from one state to another using the given event.
- *
+ *
*
This involves saving the current state, retrieving it's
* successor and setting it as the current state.
- *
+ *
* @param transition One of {@link ScannerStates]'s transition constants.
*/
private void transition(int transition)
@@ -633,7 +633,7 @@ public class ScanEngine
parents.push(current);
String stateName = current.getSuccessor(transition);
-
+
if (DEBUG)
{
System.err.println("from state: " + current.getName() + "\n\troute: "
@@ -641,9 +641,9 @@ public class ScanEngine
+ "\n\t\tto state: "
+ stateName);
}
-
+
ScannerState newState = (ScannerState) states.get(stateName);
-
+
newState.enter(new Context(current.getName(), current.getCalls()));
assert (newState != null) : "State '" + stateName + "' was not defined.";
@@ -655,7 +655,7 @@ public class ScanEngine
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param methodName The name of the method which is called.
*/
void methodInvocation(String methodName)
@@ -669,7 +669,7 @@ public class ScanEngine
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param methodName The name of the method which is called.
* @param className The name of the class in which the method is called.
*/
@@ -684,7 +684,7 @@ public class ScanEngine
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param fieldName The name of the field whose value is retrieved.
* @param className The name of the class in which the method is called.
*/
@@ -699,7 +699,7 @@ public class ScanEngine
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param className The name of the class in which the method is called.
*/
void classResolution(String className)
@@ -713,7 +713,7 @@ public class ScanEngine
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param className The name of the class in which the method is called.
* @param objectId An ObjectId instance which can be activated later.
*/
@@ -728,7 +728,7 @@ public class ScanEngine
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param primitiveName One of "boolean, "byte", "short", "int", "long"
* , "float" or "double"
* @param valueAsString The value of the primitive as a String.
@@ -744,7 +744,7 @@ public class ScanEngine
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param arrayClassName The array's class name.
* @param objectId An ObjectId instance which can be activated later.
* @param lengthAsString The array's length as String.
@@ -761,7 +761,7 @@ public class ScanEngine
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param arrayClassName The array's class name.
* @param objectId An ObjectId instance which can be activated later.
* @param lengthAsString The array's length as String.
@@ -773,12 +773,12 @@ public class ScanEngine
current.objectArrayInstantiation(arrayClassName, lengthAsString, objectId);
}
-
+
/** Event method that denotes the setting of a value in an array.
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param indexAsString The index to as a String.
*/
void arraySet(String indexAsString)
@@ -792,7 +792,7 @@ public class ScanEngine
*
*
More details about this method can be found in this
* class' introduction.
- *
+ *
* @param indexAsString The index to as a String.
*/
void arrayGet(String indexAsString)
@@ -836,7 +836,7 @@ public class ScanEngine
}
/** Event method that denotes a string.
- *
+ *
* @param string The string that should be written.
*/
void stringReference(String string)
@@ -847,7 +847,7 @@ public class ScanEngine
}
/** Event method that denotes a reference to an existing object.
- *
+ *
* @param id The ObjectId to be used.
*/
void objectReference(ObjectId id)
diff --git a/libjava/classpath/gnu/java/beans/encoder/ScannerState.java b/libjava/classpath/gnu/java/beans/encoder/ScannerState.java
index 888478a..14d6305 100644
--- a/libjava/classpath/gnu/java/beans/encoder/ScannerState.java
+++ b/libjava/classpath/gnu/java/beans/encoder/ScannerState.java
@@ -42,12 +42,12 @@ import java.util.HashMap;
/**
Provides the infrastructure for the state machine and the transition
* mechanism.
- *
+ *
*
Each states knows a set of successor. There can be one successor for
* every transition variant. Furthermore a state knows about a default
* successor which is taken when there is no special setup for a
* transition.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
@@ -105,42 +105,42 @@ public abstract class ScannerState
* transition->successor's state name.
*/
HashMap transitions = new HashMap();
-
+
int calls;
-
+
Context context;
-
+
String name;
-
+
final void init(String newName)
{
assert (name == null);
-
+
name = newName;
}
-
+
final String getName()
{
return name;
}
-
+
final void enter(Context ctx)
{
calls++;
context = ctx;
-
+
enterImpl(ctx);
}
-
+
protected void enterImpl(Context ctx)
{
}
-
+
final Context context()
{
return context;
}
-
+
final int getCalls()
{
return calls;
@@ -148,10 +148,10 @@ public abstract class ScannerState
/**
*
Stores a successor's state name for a certain transition.
- *
+ *
*
This method is only used at the configuration time of the state
* machine.
- *
+ *
* @param transition One of the transition constants.
* @param stateName The state name of the successor.
*/
@@ -165,10 +165,10 @@ public abstract class ScannerState
/**
Retrieves a the state name of a successor for the given transition
* constant.
- *
+ *
*
Returns the default successor's state name if no special setup was
* prepared.
- *
+ *
* @param transition One of the transition constants.
* @return The state name of the successor.
*/
@@ -181,7 +181,7 @@ public abstract class ScannerState
/**
* Sets the name for the default successor state.
- *
+ *
* @param newDefaultSuccessor The default successor's state name.
*/
final void setDefaultSuccessor(String newDefaultSuccessor)
@@ -203,7 +203,7 @@ public abstract class ScannerState
String valueAsString);
abstract void objectArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId);
-
+
abstract void primitiveArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId);
abstract void arraySet(String indexAsString);
@@ -222,7 +222,7 @@ public abstract class ScannerState
/**
*
A special event that does not provoke a direct transition.
- *
+ *
*
Instead the transition is done by the ScanEngine: It goes
* back to the previous state and just uses this method to inform the state
* about this happening.
@@ -232,5 +232,5 @@ public abstract class ScannerState
void enter()
{
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/StAXWriter.java b/libjava/classpath/gnu/java/beans/encoder/StAXWriter.java
index fdb5f7d..da88c53 100644
--- a/libjava/classpath/gnu/java/beans/encoder/StAXWriter.java
+++ b/libjava/classpath/gnu/java/beans/encoder/StAXWriter.java
@@ -45,7 +45,7 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
/** A {@link Writer} implementation based on the StAX API.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
@@ -54,7 +54,7 @@ public class StAXWriter implements Writer
XMLStreamWriter writer;
int indent = 0;
-
+
public StAXWriter(OutputStream os)
{
try
@@ -71,7 +71,7 @@ public class StAXWriter implements Writer
}
}
-
+
public void flush()
{
if (writer != null)
@@ -138,7 +138,7 @@ public class StAXWriter implements Writer
}
}
-
+
public void writeEndNoChildren()
{
try
diff --git a/libjava/classpath/gnu/java/beans/encoder/Writer.java b/libjava/classpath/gnu/java/beans/encoder/Writer.java
index 57203d2..e08c786 100644
--- a/libjava/classpath/gnu/java/beans/encoder/Writer.java
+++ b/libjava/classpath/gnu/java/beans/encoder/Writer.java
@@ -40,20 +40,20 @@ package gnu.java.beans.encoder;
/** A Writer represents a simplified interface to an XML
* writer that is used for the XML persistence mechanism.
- *
+ *
*
Its sole purpose is to allow multiple backends which may remove
* the need to have certain APIs in the classpath. Eg. it is possible
* to write a stripped down XML Writer that does not rely on SAX, StAX
* or DOM APIs.
- *
+ *
*
The caller may assume that every action is done immediately. However
* it is possible that the underlying implementation uses buffering streams.
* To make sure the data is written call the {@link flush} method.
- *
+ *
*
The Writer implementation should care about the formatting
* of the XML stream making it possible to generate three types of formats using
* a special method invocation chain.
- *
+ *
*
Write
*
* <element/>
@@ -61,13 +61,13 @@ package gnu.java.beans.encoder;
* by issuing write("element", true) (or any of the other
* write-variants that allows specifying the isEmpty argument)
* and writeEnd(true).
- *
+ *
*
Write
*
* <element>body</element>
*
* by issuing writeNoChildren("element", "body") and writeNoChildrenEnd().
- *
+ *
*
* Write
*
@@ -80,7 +80,7 @@ package gnu.java.beans.encoder;
* by issuing write("element", false) (or any of the other
* write-variants that allows specifying the isEmpty argument)
* and writeEnd(false).
- *
+ *
*
Note: It is important that the values of isEmpty and
* wasEmpty match. Otherwise strange things might happen to
* the layout.
@@ -90,40 +90,40 @@ package gnu.java.beans.encoder;
*/
public interface Writer
{
- // TODO: This interface's design is not the best. Feel free to
+ // TODO: This interface's design is not the best. Feel free to
// improve it as you like.
/** Writes the XML preamble. */
void writePreamble();
/** Writes the end of an XML tag.
- *
+ *
*
If your tag has not generated any body text or child
* elements provide true as the argument to generate
- * more space efficient variant of the tag.>/p>
- *
+ * more space efficient variant of the tag.>/p>
+ *
* @param wasEmpty Whether the tag was empty or not.
*/
void writeEnd(boolean wasEmpty);
- /** Writes an XML tag without any attributes.
- *
+ /** Writes an XML tag without any attributes.
+ *
* @param tagName The name of the tag to write.
* @param empty Whether the element has child elements.
*/
void write(String tagName, boolean empty);
/** Writes an XML tag with one attribute name and value.
- *
+ *
* @param tagName The name of the tag to write.
- * @param attributeName The name of attribute.
+ * @param attributeName The name of attribute.
* @param attributeValue The attribute's value.
* @param empty Whether the element has child elements.
*/
void write(String tagName, String attributeName, String attributeValue, boolean empty);
/** Writes an XML tag with multiple attributes and a body text.
- *
+ *
* @param tagName The name of the tag to write.
* @param value The element's body content.
* @param attributeNames A set of attribute names.
@@ -134,7 +134,7 @@ public interface Writer
String[] attributeValues, boolean empty);
/** Writes an XML tag with multiple attributes without a body text.
- *
+ *
* @param tagName The name of the tag to write.
* @param attributeNames A set of attribute names.
* @param attributeValues A set of attribute values.
@@ -144,7 +144,7 @@ public interface Writer
/** Writes an XML tag with no attributes but with a body text
* that may have child elements.
- *
+ *
* @param tagName The name of the tag to write.
* @param value The element's body content.
*/
@@ -152,14 +152,14 @@ public interface Writer
/** Writes an XML tag with no attributes but with a body text
* that does not have child elements.
- *
+ *
* @param tagName The name of the tag to write.
* @param value The element's body content.
*/
void writeNoChildren(String tagName, String value);
-
+
/** Writes the end of an XML tag that has no child elements.
- *
+ *
*
Must be used in combination with {@link writeNoChildren} only.
*/
void writeEndNoChildren();
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/ArrayInstantiation.java b/libjava/classpath/gnu/java/beans/encoder/elements/ArrayInstantiation.java
index a9aef89..51e00c3 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/ArrayInstantiation.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/ArrayInstantiation.java
@@ -42,7 +42,7 @@ import gnu.java.beans.encoder.ObjectId;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting the instantiation of an array.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/Array_Get.java b/libjava/classpath/gnu/java/beans/encoder/elements/Array_Get.java
index ca2ce0f..912eceb 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/Array_Get.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/Array_Get.java
@@ -42,7 +42,7 @@ import gnu.java.beans.encoder.Writer;
/**
* Generates an XML element denoting the retrieval of an array value.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
public class Array_Get extends Element
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/ClassResolution.java b/libjava/classpath/gnu/java/beans/encoder/elements/ClassResolution.java
index 8e640d1..cb736d5 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/ClassResolution.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/ClassResolution.java
@@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting the resolution of a class.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
@@ -58,7 +58,7 @@ public class ClassResolution extends Element
{
writer.writeNoChildren("class", className);
}
-
+
public void writeEnd(Writer writer)
{
writer.writeEndNoChildren();
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/Element.java b/libjava/classpath/gnu/java/beans/encoder/elements/Element.java
index 5681d2b..a8c0ecd 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/Element.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/Element.java
@@ -45,11 +45,11 @@ import gnu.java.beans.encoder.ObjectId;
import gnu.java.beans.encoder.Writer;
/** Element is the base class for the object tree elements.
- *
+ *
*
It provides the neccessary infrastructure every element subclass
* needs in order to interact with the {@link gnu.java.beans.encoder.Root}
* class.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*/
public abstract class Element
@@ -58,100 +58,100 @@ public abstract class Element
* Stores the child elements.
*/
private LinkedList children = new LinkedList();
-
+
/**
* An optional ObjectId instance which is needed for certain subclasses
* only.
*/
private ObjectId objectId;
-
+
/** Sets an {@link gnu.java.beans.encoder.ObjectId} instance in this
* Element.
- *
+ *
*
This can only be done once.
- *
+ *
* @param objectId An ObjectId instance.
*/
public final void initId(ObjectId objectId)
{
assert (this.objectId == null);
assert (objectId != null);
-
+
this.objectId = objectId;
}
/** Adds a child element to this Element.
- *
+ *
* @param elem The new child.
*/
public final void addChild(Element elem)
{
children.add(elem);
}
-
+
/** Removes the child element added last.
*/
public final void removeLast()
{
children.removeLast();
}
-
+
/** Provides access to the child elements via an iterator.
- *
+ *
* @return An iterator for the child elements.
*/
public final Iterator iterator(){
return children.iterator();
}
-
+
/** Clears all the stored child elements.
- *
+ *
*/
public final void clear()
{
- children.clear();
+ children.clear();
}
-
+
/** Returns whether this element contains child elements.
- *
+ *
*
This method is useful to decide which formatting variant
* for the XML element can be chosen.
- *
+ *
* @return Whether the element has child elements.
*/
public final boolean isEmpty()
{
- return children.isEmpty();
+ return children.isEmpty();
}
-
+
/** Retrieves the element's {@link gnu.java.beans.encoder.ObjectId} instance
* if it has one.
- *
+ *
* @return The ObjectId instance or null.
*/
public final ObjectId getId()
{
return objectId;
}
-
+
/** Writes the opening XML tag.
- *
+ *
* @param writer The writer to be used for XML writing.
*/
public abstract void writeStart(Writer writer);
-
+
/** Writes the closing XML tag.
- *
+ *
*
By default this does writer.writeEnd(children.isEmpty()).
* Override if neccessary, for example when using the
* {@link gnu.java.beans.encoder.Writer#writeNoChildren} method
- * variants.
- *
+ * variants.
+ *
* @param writer The writer to be used for XML writing.
*/
public void writeEnd(Writer writer)
{
writer.writeEnd(children.isEmpty());
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/List_Get.java b/libjava/classpath/gnu/java/beans/encoder/elements/List_Get.java
index e73afa8..c14ab91 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/List_Get.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/List_Get.java
@@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting the retrieval of a list's element.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
@@ -52,5 +52,5 @@ public class List_Get extends Element
{
writer.write("object", "get");
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/List_Set.java b/libjava/classpath/gnu/java/beans/encoder/elements/List_Set.java
index 03c73fd..3e7cca6 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/List_Set.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/List_Set.java
@@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting the setting of a list's element.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
@@ -52,5 +52,5 @@ public class List_Set extends Element
{
writer.write("object", "set");
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/MethodInvocation.java b/libjava/classpath/gnu/java/beans/encoder/elements/MethodInvocation.java
index d5b3174..1de5bb6 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/MethodInvocation.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/MethodInvocation.java
@@ -41,22 +41,22 @@ package gnu.java.beans.encoder.elements;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting a non-static method call.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
public class MethodInvocation extends Element
{
final String methodName;
-
+
public MethodInvocation(String newMethodName)
{
methodName = newMethodName;
}
-
+
public void writeStart(Writer writer)
{
writer.write("void", "method", methodName, isEmpty());
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/NullObject.java b/libjava/classpath/gnu/java/beans/encoder/elements/NullObject.java
index 599c4d8..211e2a7 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/NullObject.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/NullObject.java
@@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting the null value.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/ObjectInstantiation.java b/libjava/classpath/gnu/java/beans/encoder/elements/ObjectInstantiation.java
index 692227d..9861480 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/ObjectInstantiation.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/ObjectInstantiation.java
@@ -42,7 +42,7 @@ import gnu.java.beans.encoder.ObjectId;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting the instantiation of an object.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/ObjectReference.java b/libjava/classpath/gnu/java/beans/encoder/elements/ObjectReference.java
index a44c2ee..13a597a 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/ObjectReference.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/ObjectReference.java
@@ -42,7 +42,7 @@ import gnu.java.beans.encoder.ObjectId;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting referencing an existing object.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
@@ -53,7 +53,7 @@ public class ObjectReference extends Element
public ObjectReference(ObjectId newId)
{
id = newId;
-
+
// Initializing the Id here is making sure it gets
// actually used. This step modifies the Id instance
// in other elements.
@@ -64,5 +64,5 @@ public class ObjectReference extends Element
{
writer.write("object", "idref", id.toString(), isEmpty());
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java b/libjava/classpath/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java
index db08edb..ae34b9d 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java
@@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting a primitive data value.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/StaticFieldAccess.java b/libjava/classpath/gnu/java/beans/encoder/elements/StaticFieldAccess.java
index 7ed935d..7fcbf52 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/StaticFieldAccess.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/StaticFieldAccess.java
@@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements;
import gnu.java.beans.encoder.Writer;
/** Generates an XML element denoting a static method call.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/StaticMethodInvocation.java b/libjava/classpath/gnu/java/beans/encoder/elements/StaticMethodInvocation.java
index 40c46a5..92d49dc 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/StaticMethodInvocation.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/StaticMethodInvocation.java
@@ -42,26 +42,26 @@ package gnu.java.beans.encoder.elements;
import gnu.java.beans.encoder.Writer;
/**
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
*
*/
public class StaticMethodInvocation extends Element
{
final String className;
-
+
final String methodName;
-
+
public StaticMethodInvocation(String newClassName, String newMethodName)
{
className = newClassName;
methodName = newMethodName;
}
-
+
public void writeStart(Writer writer)
{
writer.write("void", new String[] { "class", "method" },
new String[] { className, methodName }, isEmpty());
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/encoder/elements/StringReference.java b/libjava/classpath/gnu/java/beans/encoder/elements/StringReference.java
index c368e65..7e6787d 100644
--- a/libjava/classpath/gnu/java/beans/encoder/elements/StringReference.java
+++ b/libjava/classpath/gnu/java/beans/encoder/elements/StringReference.java
@@ -54,7 +54,7 @@ public class StringReference extends Element
{
writer.writeNoChildren("string", string);
}
-
+
public void writeEnd(Writer writer)
{
writer.writeEndNoChildren();
diff --git a/libjava/classpath/gnu/java/io/ASN1ParsingException.java b/libjava/classpath/gnu/java/io/ASN1ParsingException.java
index 5d2c64a..9cf98ab 100644
--- a/libjava/classpath/gnu/java/io/ASN1ParsingException.java
+++ b/libjava/classpath/gnu/java/io/ASN1ParsingException.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,13 +44,13 @@ package gnu.java.io;
public class ASN1ParsingException extends java.io.IOException
{
- public ASN1ParsingException()
- {
- super();
- }
+ public ASN1ParsingException()
+ {
+ super();
+ }
- public ASN1ParsingException(String msg)
- {
- super(msg);
- }
+ public ASN1ParsingException(String msg)
+ {
+ super(msg);
+ }
}
diff --git a/libjava/classpath/gnu/java/io/Base64InputStream.java b/libjava/classpath/gnu/java/io/Base64InputStream.java
index 1f5d220..1105b60 100644
--- a/libjava/classpath/gnu/java/io/Base64InputStream.java
+++ b/libjava/classpath/gnu/java/io/Base64InputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -57,7 +57,7 @@ public class Base64InputStream extends FilterInputStream
// ------------------------------------------------------------------------
/** Base-64 digits. */
- private static final String BASE_64 =
+ private static final String BASE_64 =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/** Base-64 padding character. */
diff --git a/libjava/classpath/gnu/java/io/ClassLoaderObjectInputStream.java b/libjava/classpath/gnu/java/io/ClassLoaderObjectInputStream.java
index 238ab26..e3f3d4c 100644
--- a/libjava/classpath/gnu/java/io/ClassLoaderObjectInputStream.java
+++ b/libjava/classpath/gnu/java/io/ClassLoaderObjectInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -52,22 +52,22 @@ import java.io.StreamCorruptedException;
*/
public class ClassLoaderObjectInputStream extends ObjectInputStream {
- ClassLoader myClassLoader;
+ ClassLoader myClassLoader;
- /** Create the new ClassLoaderObjectInputStream.
- * @param in the InputStream to read the Objects from.
- * @param myClassLoader the ClassLoader to load classes
- * with.
- */
- public ClassLoaderObjectInputStream(InputStream in, ClassLoader myClassLoader) throws IOException,StreamCorruptedException {
- super(in);
- this.myClassLoader = myClassLoader;
- }
+ /** Create the new ClassLoaderObjectInputStream.
+ * @param in the InputStream to read the Objects from.
+ * @param myClassLoader the ClassLoader to load classes
+ * with.
+ */
+ public ClassLoaderObjectInputStream(InputStream in, ClassLoader myClassLoader) throws IOException,StreamCorruptedException {
+ super(in);
+ this.myClassLoader = myClassLoader;
+ }
- /** Overriden method to use the loadClass() method from
- * the ClassLoader.
- */
- public Class resolveClass(String name) throws IOException, ClassNotFoundException {
- return myClassLoader.loadClass(name);
- }
+ /** Overriden method to use the loadClass() method from
+ * the ClassLoader.
+ */
+ public Class resolveClass(String name) throws IOException, ClassNotFoundException {
+ return myClassLoader.loadClass(name);
+ }
}
diff --git a/libjava/classpath/gnu/java/io/NullOutputStream.java b/libjava/classpath/gnu/java/io/NullOutputStream.java
index 526bd26..603a2d3 100644
--- a/libjava/classpath/gnu/java/io/NullOutputStream.java
+++ b/libjava/classpath/gnu/java/io/NullOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/libjava/classpath/gnu/java/io/ObjectIdentityMap2Int.java b/libjava/classpath/gnu/java/io/ObjectIdentityMap2Int.java
index 08f089d..ed62e83 100644
--- a/libjava/classpath/gnu/java/io/ObjectIdentityMap2Int.java
+++ b/libjava/classpath/gnu/java/io/ObjectIdentityMap2Int.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,7 +50,7 @@ package gnu.java.io;
* @author Fridtjof Siebert (siebert@aicas.com)
*/
public class ObjectIdentityMap2Int
-{
+{
/**
@@ -58,7 +58,7 @@ public class ObjectIdentityMap2Int
* prime number since the delta used for conflict resulution must
* not have any common divisors with the length.
*/
- private static final int[] PRIMES = {
+ private static final int[] PRIMES = {
0x1f,
0x3d,
0x7f,
@@ -93,7 +93,7 @@ public class ObjectIdentityMap2Int
*/
private static final Object NIL = new Object();
-
+
/**
* The objects in this map:
*
@@ -118,13 +118,13 @@ public class ObjectIdentityMap2Int
* invariant
* size < limit
*/
- private int size = 0;
+ private int size = 0;
/**
* The index in primes of the size of the tables.
*/
- private int cap = 0;
+ private int cap = 0;
/**
@@ -133,7 +133,7 @@ public class ObjectIdentityMap2Int
* invariant
* limit = PRIMES[cap] / 4 * 3;
*/
- private int limit = 0;
+ private int limit = 0;
/**
@@ -148,7 +148,7 @@ public class ObjectIdentityMap2Int
/**
* Helper function to alloc the object and int array for the given
* capacity. Set limit, reset size to 0.
- *
+ *
* No elements will be stored in the newly allocated arrays.
*
* @param c the capacity: this is an index in PRIMES, PRIMES[c]
@@ -161,8 +161,8 @@ public class ObjectIdentityMap2Int
*/
private void alloc(int c)
{
- if (c >= PRIMES.length)
- throw new InternalError("Hash table size overflow");
+ if (c >= PRIMES.length)
+ throw new InternalError("Hash table size overflow");
cap = c;
int len = PRIMES[c];
@@ -170,7 +170,7 @@ public class ObjectIdentityMap2Int
intTable = new int[len];
limit = len / 4 * 3;
- size = 0;
+ size = 0;
}
@@ -180,7 +180,7 @@ public class ObjectIdentityMap2Int
* ensures
* (get(o) == i);
*
- * @param o object reference or null that is to be mapped.
+ * @param o object reference or null that is to be mapped.
*
* @param i the integer id to be associated with o
*
@@ -189,9 +189,9 @@ public class ObjectIdentityMap2Int
* @throws InternalError if hash tables has grown to more then
* 0x7fffffff entries (ie., size >= 0x7fffffff*3/4).
*/
- public void put(Object o, int i)
+ public void put(Object o, int i)
{
- if (i < 0)
+ if (i < 0)
throw new IllegalArgumentException("int argument must be postive: "+i);
o = (o == null) ? NIL : o;
@@ -200,8 +200,8 @@ public class ObjectIdentityMap2Int
intTable[s] = i;
if (objectTable[s] == null)
{
- objectTable[s] = o;
- size++;
+ objectTable[s] = o;
+ size++;
if (size >= limit)
{
rehash();
@@ -219,14 +219,14 @@ public class ObjectIdentityMap2Int
*
* @param o an object, must not be null.
*
- * @return an index of o
+ * @return an index of o
*/
private int slot(Object o)
{
Object[] ot = objectTable;
int hc = System.identityHashCode(o);
int len = ot.length;
- int result = hc % len;
+ int result = hc % len;
result = result < 0 ? -result : result;
int delta = 16 - (hc & 15);
Object existing = ot[result];
@@ -249,9 +249,9 @@ public class ObjectIdentityMap2Int
* ensure
* (cap == \old cap+1);
*/
- private void rehash()
+ private void rehash()
{
- Object[] ot = objectTable;
+ Object[] ot = objectTable;
int [] it = intTable;
alloc(cap + 1);
@@ -268,7 +268,7 @@ public class ObjectIdentityMap2Int
* @return the corresponding integer id for o or -1 if o has not
* been put into this map.
*/
- public int get(Object o)
+ public int get(Object o)
{
o = (o == null) ? NIL : o;
int s = slot(o);
@@ -281,10 +281,10 @@ public class ObjectIdentityMap2Int
* ensures
* ((size == 0) && \forall Object o: get(o) == -1)
*/
- public void clear()
+ public void clear()
{
- Object[] ot = objectTable;
- size = 0;
+ Object[] ot = objectTable;
+ size = 0;
for (int i = 0; i < ot.length; i++)
ot[i] = null;
}
diff --git a/libjava/classpath/gnu/java/io/ObjectIdentityWrapper.java b/libjava/classpath/gnu/java/io/ObjectIdentityWrapper.java
index 6db2e3a..53c9943 100644
--- a/libjava/classpath/gnu/java/io/ObjectIdentityWrapper.java
+++ b/libjava/classpath/gnu/java/io/ObjectIdentityWrapper.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/libjava/classpath/gnu/java/io/PlatformHelper.java b/libjava/classpath/gnu/java/io/PlatformHelper.java
index 96231e1..5452411 100644
--- a/libjava/classpath/gnu/java/io/PlatformHelper.java
+++ b/libjava/classpath/gnu/java/io/PlatformHelper.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -52,7 +52,7 @@ public class PlatformHelper
public static final char pathSeparatorChar = pathSeparator.charAt(0);
/**
- * On most platforms 260 is equal or greater than a max path value,
+ * On most platforms 260 is equal or greater than a max path value,
* so we can set the initial buffer size of StringBuffer to half of this value
* to improve performance.
*/
@@ -106,7 +106,7 @@ public class PlatformHelper
}
/**
- * This routine removes from input param "path" the tail separator if it exists,
+ * This routine removes from input param "path" the tail separator if it exists,
* and return the remain part.
*/
public static final String removeTailSeparator(String path)
@@ -118,7 +118,7 @@ public class PlatformHelper
}
/**
- * This routine returns last index of separator in input param "path",
+ * This routine returns last index of separator in input param "path",
* and return it.
*/
public static final int lastIndexOfSeparator(String path)
diff --git a/libjava/classpath/gnu/java/lang/CPStringBuilder.java b/libjava/classpath/gnu/java/lang/CPStringBuilder.java
index 27e7d2c..f42629d 100644
--- a/libjava/classpath/gnu/java/lang/CPStringBuilder.java
+++ b/libjava/classpath/gnu/java/lang/CPStringBuilder.java
@@ -215,13 +215,13 @@ public final class CPStringBuilder
/* If the StringBuffer's value just grew, then we know that
value is newly allocated and the region between count and
newLength is filled with '\0'. */
- count = newLength;
+ count = newLength;
}
else
{
- /* The StringBuffer's value doesn't need to grow. However,
- we should clear out any cruft that may exist. */
- while (count < newLength)
+ /* The StringBuffer's value doesn't need to grow. However,
+ we should clear out any cruft that may exist. */
+ while (count < newLength)
value[count++] = '\0';
}
}
@@ -290,7 +290,7 @@ public final class CPStringBuilder
* @see System#arraycopy(Object, int, Object, int, int)
*/
public void getChars(int srcOffset, int srcEnd,
- char[] dst, int dstOffset)
+ char[] dst, int dstOffset)
{
if (srcOffset < 0 || srcEnd > count || srcEnd < srcOffset)
throw new StringIndexOutOfBoundsException();
@@ -362,10 +362,10 @@ public final class CPStringBuilder
return append("null");
synchronized (stringBuffer)
{
- int len = stringBuffer.length();
- ensureCapacity(count + len);
- stringBuffer.getChars(0, len, value, count);
- count += len;
+ int len = stringBuffer.length();
+ ensureCapacity(count + len);
+ stringBuffer.getChars(0, len, value, count);
+ count += len;
}
return this;
}
@@ -466,9 +466,9 @@ public final class CPStringBuilder
return append("null");
if (end - start > 0)
{
- ensureCapacity(count + end - start);
- for (; start < end; ++start)
- value[count++] = seq.charAt(start);
+ ensureCapacity(count + end - start);
+ for (; start < end; ++start)
+ value[count++] = seq.charAt(start);
}
return this;
}
@@ -979,23 +979,23 @@ public final class CPStringBuilder
int count = 0;
while (start < end)
{
- char base = value[start];
- if (base < Character.MIN_HIGH_SURROGATE
- || base > Character.MAX_HIGH_SURROGATE
- || start == end
- || start == count
- || value[start + 1] < Character.MIN_LOW_SURROGATE
- || value[start + 1] > Character.MAX_LOW_SURROGATE)
- {
- // Nothing.
- }
- else
- {
- // Surrogate pair.
- ++start;
- }
- ++start;
- ++count;
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == end
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ ++count;
}
return count;
}
@@ -1015,22 +1015,22 @@ public final class CPStringBuilder
{
while (codePoints > 0)
{
- char base = value[start];
- if (base < Character.MIN_HIGH_SURROGATE
- || base > Character.MAX_HIGH_SURROGATE
- || start == count
- || value[start + 1] < Character.MIN_LOW_SURROGATE
- || value[start + 1] > Character.MAX_LOW_SURROGATE)
- {
- // Nothing.
- }
- else
- {
- // Surrogate pair.
- ++start;
- }
- ++start;
- --codePoints;
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ --codePoints;
}
return start;
}
@@ -1040,7 +1040,7 @@ public final class CPStringBuilder
* ensure that an expensive growing operation will not occur until either
* minimumCapacity is reached or the array has been allocated.
* The buffer is grown to either minimumCapacity * 2, if
- * the array has been allocated or the larger of minimumCapacity and
+ * the array has been allocated or the larger of minimumCapacity and
* capacity() * 2 + 2, if it is not already large enough.
*
* @param minimumCapacity the new capacity
@@ -1050,14 +1050,14 @@ public final class CPStringBuilder
{
if (allocated || minimumCapacity > value.length)
{
- if (minimumCapacity > value.length)
- {
- int max = value.length * 2 + 2;
- minimumCapacity = (minimumCapacity < max ? max : minimumCapacity);
- }
- else
- minimumCapacity *= 2;
- allocateArray(minimumCapacity);
+ if (minimumCapacity > value.length)
+ {
+ int max = value.length * 2 + 2;
+ minimumCapacity = (minimumCapacity < max ? max : minimumCapacity);
+ }
+ else
+ minimumCapacity *= 2;
+ allocateArray(minimumCapacity);
}
}
@@ -1076,7 +1076,7 @@ public final class CPStringBuilder
value = nb;
allocated = false;
}
-
+
/**
* Get the length of the String this StringBuilder
* would create. Not to be confused with the capacity of the
diff --git a/libjava/classpath/gnu/java/lang/CharData.java b/libjava/classpath/gnu/java/lang/CharData.java
index a84d94d..cb33035 100644
--- a/libjava/classpath/gnu/java/lang/CharData.java
+++ b/libjava/classpath/gnu/java/lang/CharData.java
@@ -58,7 +58,7 @@ package gnu.java.lang;
* attribute tables are much smaller than 0xffff entries; as many characters
* in Unicode share common attributes. Numbers that are too large to fit
* into NUM_VALUE as 16 bit chars are stored in LARGENUMS and a number N is
- * stored in NUM_VALUE such that (-N - 3) is the offset into LARGENUMS for
+ * stored in NUM_VALUE such that (-N - 3) is the offset into LARGENUMS for
* the particular character. The DIRECTION table also contains a field for
* detecting characters with multi-character uppercase expansions.
* Next, there is a listing for TITLE exceptions (most characters
@@ -81,7 +81,7 @@ public interface CharData
/**
* The character shift amount to look up the block offset. In other words,
- * (char) (BLOCKS.value[ch >> SHIFT[p]] + ch) is the index
+ * (char) (BLOCKS.value[ch >> SHIFT[p]] + ch) is the index
* where ch is described in DATA if ch
* is in Unicode plane p. Note that p is simply
* the integer division of ch and 0x10000.
diff --git a/libjava/classpath/gnu/java/lang/InstrumentationImpl.java b/libjava/classpath/gnu/java/lang/InstrumentationImpl.java
index 2425b35..a601baf 100644
--- a/libjava/classpath/gnu/java/lang/InstrumentationImpl.java
+++ b/libjava/classpath/gnu/java/lang/InstrumentationImpl.java
@@ -66,7 +66,7 @@ public final class InstrumentationImpl implements Instrumentation
private ArrayList transformers =
new ArrayList();
-
+
InstrumentationImpl()
{
}
@@ -76,7 +76,7 @@ public final class InstrumentationImpl implements Instrumentation
* to the instrumentation. Each time a class is defined
* or redefined, the transform method of the
* transformer object is called.
- *
+ *
* @param transformer the transformer to add
* @throws NullPointerException if transformer is null
*/
@@ -89,11 +89,11 @@ public final class InstrumentationImpl implements Instrumentation
transformers.add(transformer);
}
}
-
+
/**
* Removes the given transformer from the set of transformers
* this Instrumentation object has.
- *
+ *
* @param transformer the transformer to remove
* @return true if the transformer was found and removed, false if
* the transformer was not found
@@ -103,8 +103,8 @@ public final class InstrumentationImpl implements Instrumentation
{
if (transformer == null)
throw new NullPointerException();
-
- boolean result;
+
+ boolean result;
synchronized (transformers)
{
result = transformers.remove(transformer);
@@ -114,22 +114,22 @@ public final class InstrumentationImpl implements Instrumentation
/**
* Returns if the current JVM supports class redefinition
- *
+ *
* @return true if the current JVM supports class redefinition
*/
public boolean isRedefineClassesSupported()
{
return VMInstrumentationImpl.isRedefineClassesSupported();
}
-
+
/**
* Redefine classes present in the definitions array, with
* the corresponding class files.
*
* @param definitions an array of classes to redefine
- *
- * @throws ClassNotFoundException if a class cannot be found
- * @throws UnmodifiableClassException if a class cannot be modified
+ *
+ * @throws ClassNotFoundException if a class cannot be found
+ * @throws UnmodifiableClassException if a class cannot be modified
* @throws UnsupportedOperationException if the JVM does not support
* redefinition or the redefinition made unsupported changes
* @throws ClassFormatError if a class file is not valid
@@ -139,7 +139,7 @@ public final class InstrumentationImpl implements Instrumentation
* are unsupported
* @throws ClassCircularityError if circularity occured with the new
* classes
- * @throws LinkageError if a linkage error occurs
+ * @throws LinkageError if a linkage error occurs
* @throws NullPointerException if the definitions array is null, or any
* of its element
*
@@ -153,14 +153,14 @@ public final class InstrumentationImpl implements Instrumentation
{
if (!isRedefineClassesSupported())
throw new UnsupportedOperationException();
-
+
VMInstrumentationImpl.redefineClasses(this, definitions);
}
/**
* Get all the classes loaded by the JVM.
- *
+ *
* @return an array containing all the classes loaded by the JVM. The array
* is empty if no class is loaded.
*/
@@ -171,9 +171,9 @@ public final class InstrumentationImpl implements Instrumentation
/**
* Get all the classes loaded by a given class loader
- *
+ *
* @param loader the loader
- *
+ *
* @return an array containing all the classes loaded by the given loader.
* The array is empty if no class was loaded by the loader.
*/
@@ -184,7 +184,7 @@ public final class InstrumentationImpl implements Instrumentation
/**
* Get the size of an object.
- *
+ *
* @param objectToSize the object
* @return the size of the object
* @throws NullPointerException if objectToSize is null.
@@ -207,12 +207,12 @@ public final class InstrumentationImpl implements Instrumentation
* @param protectionDomain the protection domain of the class being defined
* or redefined
* @param classfileBuffer the input byte buffer in class file format
- *
+ *
* @return the new class file
*/
public byte[] callTransformers(ClassLoader loader, String className,
- Class> classBeingRedefined, ProtectionDomain protectionDomain,
- byte[] classfileBuffer)
+ Class> classBeingRedefined, ProtectionDomain protectionDomain,
+ byte[] classfileBuffer)
{
byte[] newBuffer = null;
byte[] oldBuffer = classfileBuffer;
@@ -227,13 +227,13 @@ public final class InstrumentationImpl implements Instrumentation
{
newBuffer = current.transform(loader, className,
classBeingRedefined, protectionDomain, oldBuffer);
- }
- catch (IllegalClassFormatException ignored)
- {
+ }
+ catch (IllegalClassFormatException ignored)
+ {
//IGNORED
- }
+ }
if (newBuffer != null)
- oldBuffer = newBuffer;
+ oldBuffer = newBuffer;
}
}
return oldBuffer;
diff --git a/libjava/classpath/gnu/java/lang/MainThread.java b/libjava/classpath/gnu/java/lang/MainThread.java
index 7ad70cd..a729564 100644
--- a/libjava/classpath/gnu/java/lang/MainThread.java
+++ b/libjava/classpath/gnu/java/lang/MainThread.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -58,7 +58,7 @@ public class MainThread
throws ClassNotFoundException, NoSuchMethodException
{
Class found = Class.forName(classname, true,
- ClassLoader.getSystemClassLoader());
+ ClassLoader.getSystemClassLoader());
Class[] argTypes = new Class[1];
argTypes[0] = args.getClass();
mainMethod = found.getMethod("main", argTypes);
@@ -69,15 +69,15 @@ public class MainThread
{
try
{
- mainMethod.invoke(null,(Object) args);
+ mainMethod.invoke(null,(Object) args);
}
catch(IllegalAccessException e)
{
- // Ignore.
+ // Ignore.
}
catch(InvocationTargetException e)
{
- // Ignore.
+ // Ignore.
}
}
}
diff --git a/libjava/classpath/gnu/java/lang/management/BeanImpl.java b/libjava/classpath/gnu/java/lang/management/BeanImpl.java
index a651e35..a7c2357 100644
--- a/libjava/classpath/gnu/java/lang/management/BeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/BeanImpl.java
@@ -116,66 +116,66 @@ public class BeanImpl
return;
try
{
- MBeanAttributeInfo[] oldA = info.getAttributes();
- OpenMBeanAttributeInfo[] attribs =
- new OpenMBeanAttributeInfoSupport[oldA.length];
- for (int a = 0; a < oldA.length; ++a)
- {
- OpenMBeanParameterInfo param = Translator.translate(oldA[a].getType());
- if (param.getMinValue() == null)
- {
- Object[] lv;
- if (param.getLegalValues() == null)
- lv = null;
- else
- lv = param.getLegalValues().toArray();
- attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
- oldA[a].getDescription(),
- ((OpenType)
- param.getOpenType()),
- oldA[a].isReadable(),
- oldA[a].isWritable(),
- oldA[a].isIs(),
- param.getDefaultValue(),
- lv);
- }
- else
- attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
- oldA[a].getDescription(),
- ((OpenType)
- param.getOpenType()),
- oldA[a].isReadable(),
- oldA[a].isWritable(),
- oldA[a].isIs(),
- param.getDefaultValue(),
- ((Comparable)
- param.getMinValue()),
- ((Comparable)
- param.getMaxValue()));
- }
- MBeanConstructorInfo[] oldC = info.getConstructors();
- OpenMBeanConstructorInfo[] cons = new OpenMBeanConstructorInfoSupport[oldC.length];
- for (int a = 0; a < oldC.length; ++a)
- cons[a] =
- new OpenMBeanConstructorInfoSupport(oldC[a].getName(),
- oldC[a].getDescription(),
- translateSignature(oldC[a].getSignature()));
- MBeanOperationInfo[] oldO = info.getOperations();
- OpenMBeanOperationInfo[] ops = new OpenMBeanOperationInfoSupport[oldO.length];
- for (int a = 0; a < oldO.length; ++a)
- ops[a] =
- new OpenMBeanOperationInfoSupport(oldO[a].getName(),
- oldO[a].getDescription(),
- translateSignature(oldO[a].getSignature()),
- Translator.translate(oldO[a].getReturnType()).getOpenType(),
- oldO[a].getImpact());
- openInfo = new OpenMBeanInfoSupport(info.getClassName(), info.getDescription(),
- attribs, cons, ops, info.getNotifications());
+ MBeanAttributeInfo[] oldA = info.getAttributes();
+ OpenMBeanAttributeInfo[] attribs =
+ new OpenMBeanAttributeInfoSupport[oldA.length];
+ for (int a = 0; a < oldA.length; ++a)
+ {
+ OpenMBeanParameterInfo param = Translator.translate(oldA[a].getType());
+ if (param.getMinValue() == null)
+ {
+ Object[] lv;
+ if (param.getLegalValues() == null)
+ lv = null;
+ else
+ lv = param.getLegalValues().toArray();
+ attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
+ oldA[a].getDescription(),
+ ((OpenType)
+ param.getOpenType()),
+ oldA[a].isReadable(),
+ oldA[a].isWritable(),
+ oldA[a].isIs(),
+ param.getDefaultValue(),
+ lv);
+ }
+ else
+ attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
+ oldA[a].getDescription(),
+ ((OpenType)
+ param.getOpenType()),
+ oldA[a].isReadable(),
+ oldA[a].isWritable(),
+ oldA[a].isIs(),
+ param.getDefaultValue(),
+ ((Comparable)
+ param.getMinValue()),
+ ((Comparable)
+ param.getMaxValue()));
+ }
+ MBeanConstructorInfo[] oldC = info.getConstructors();
+ OpenMBeanConstructorInfo[] cons = new OpenMBeanConstructorInfoSupport[oldC.length];
+ for (int a = 0; a < oldC.length; ++a)
+ cons[a] =
+ new OpenMBeanConstructorInfoSupport(oldC[a].getName(),
+ oldC[a].getDescription(),
+ translateSignature(oldC[a].getSignature()));
+ MBeanOperationInfo[] oldO = info.getOperations();
+ OpenMBeanOperationInfo[] ops = new OpenMBeanOperationInfoSupport[oldO.length];
+ for (int a = 0; a < oldO.length; ++a)
+ ops[a] =
+ new OpenMBeanOperationInfoSupport(oldO[a].getName(),
+ oldO[a].getDescription(),
+ translateSignature(oldO[a].getSignature()),
+ Translator.translate(oldO[a].getReturnType()).getOpenType(),
+ oldO[a].getImpact());
+ openInfo = new OpenMBeanInfoSupport(info.getClassName(), info.getDescription(),
+ attribs, cons, ops, info.getNotifications());
}
catch (OpenDataException e)
{
- throw (InternalError) (new InternalError("A problem occurred creating the open type " +
- "descriptors.").initCause(e));
+ throw (InternalError) (new InternalError("A problem occurred creating the open type " +
+ "descriptors.").initCause(e));
}
}
@@ -195,7 +195,7 @@ public class BeanImpl
public Object getAttribute(String attribute)
throws AttributeNotFoundException, MBeanException,
- ReflectionException
+ ReflectionException
{
Object value = super.getAttribute(attribute);
if (value instanceof Enum)
@@ -207,60 +207,60 @@ public class BeanImpl
String[] allowedTypes = OpenType.ALLOWED_CLASSNAMES;
for (int a = 0; a < allowedTypes.length; ++a)
if (cName.equals(allowedTypes[a]))
- return value;
+ return value;
OpenMBeanInfo info = (OpenMBeanInfo) getMBeanInfo();
MBeanAttributeInfo[] attribs =
(MBeanAttributeInfo[]) info.getAttributes();
OpenType type = null;
for (int a = 0; a < attribs.length; ++a)
if (attribs[a].getName().equals(attribute))
- type = ((OpenMBeanAttributeInfo) attribs[a]).getOpenType();
+ type = ((OpenMBeanAttributeInfo) attribs[a]).getOpenType();
if (value instanceof List)
{
- try
- {
- Class e =
- Class.forName(((ArrayType) type).getElementOpenType().getClassName());
- List l = (List) value;
- Object[] array = (Object[]) Array.newInstance(e, l.size());
- return l.toArray(array);
- }
- catch (ClassNotFoundException e)
- {
- throw (InternalError) (new InternalError("The class of the list " +
- "element type could not " +
- "be created").initCause(e));
- }
+ try
+ {
+ Class e =
+ Class.forName(((ArrayType) type).getElementOpenType().getClassName());
+ List l = (List) value;
+ Object[] array = (Object[]) Array.newInstance(e, l.size());
+ return l.toArray(array);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw (InternalError) (new InternalError("The class of the list " +
+ "element type could not " +
+ "be created").initCause(e));
+ }
}
if (value instanceof Map)
{
- TabularType ttype = (TabularType) type;
- TabularData data = new TabularDataSupport(ttype);
- Iterator it = ((Map) value).entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry) it.next();
- try
- {
- data.put(new CompositeDataSupport(ttype.getRowType(),
- new String[] {
- "key",
- "value"
- },
- new Object[] {
- entry.getKey(),
- entry.getValue()
- }));
- }
- catch (OpenDataException e)
- {
- throw (InternalError) (new InternalError("A problem occurred " +
- "converting the map " +
- "to a composite data " +
- "structure.").initCause(e));
- }
- }
- return data;
+ TabularType ttype = (TabularType) type;
+ TabularData data = new TabularDataSupport(ttype);
+ Iterator it = ((Map) value).entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) it.next();
+ try
+ {
+ data.put(new CompositeDataSupport(ttype.getRowType(),
+ new String[] {
+ "key",
+ "value"
+ },
+ new Object[] {
+ entry.getKey(),
+ entry.getValue()
+ }));
+ }
+ catch (OpenDataException e)
+ {
+ throw (InternalError) (new InternalError("A problem occurred " +
+ "converting the map " +
+ "to a composite data " +
+ "structure.").initCause(e));
+ }
+ }
+ return data;
}
CompositeType cType = (CompositeType) type;
Set names = cType.keySet();
@@ -268,51 +268,51 @@ public class BeanImpl
List values = new ArrayList(names.size());
while (it.hasNext())
{
- String field = (String) it.next();
- Method getter = null;
- try
- {
- getter = vClass.getMethod("get" + field);
- }
- catch (NoSuchMethodException e)
- {
- /* Ignored; the type tells us it's there. */
- }
- try
- {
- values.add(getter.invoke(value));
- }
- catch (IllegalAccessException e)
- {
- throw new ReflectionException(e, "Failed to retrieve " + field);
- }
- catch (IllegalArgumentException e)
- {
- throw new ReflectionException(e, "Failed to retrieve " + field);
- }
- catch (InvocationTargetException e)
- {
- throw new MBeanException((Exception) e.getCause(),
- "The getter of " + field +
- " threw an exception");
- }
+ String field = (String) it.next();
+ Method getter = null;
+ try
+ {
+ getter = vClass.getMethod("get" + field);
+ }
+ catch (NoSuchMethodException e)
+ {
+ /* Ignored; the type tells us it's there. */
+ }
+ try
+ {
+ values.add(getter.invoke(value));
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ReflectionException(e, "Failed to retrieve " + field);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new ReflectionException(e, "Failed to retrieve " + field);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new MBeanException((Exception) e.getCause(),
+ "The getter of " + field +
+ " threw an exception");
+ }
}
try
{
- return new CompositeDataSupport(cType,
- (String[])
- names.toArray(new String[names.size()]),
- values.toArray());
+ return new CompositeDataSupport(cType,
+ (String[])
+ names.toArray(new String[names.size()]),
+ values.toArray());
}
catch (OpenDataException e)
{
- throw (InternalError) (new InternalError("A problem occurred " +
- "converting the value " +
- "to a composite data " +
- "structure.").initCause(e));
+ throw (InternalError) (new InternalError("A problem occurred " +
+ "converting the value " +
+ "to a composite data " +
+ "structure.").initCause(e));
}
}
-
+
protected MBeanInfo getCachedMBeanInfo()
{
return (MBeanInfo) openInfo;
@@ -322,15 +322,15 @@ public class BeanImpl
* Override this method so as to prevent the description of a constructor's
* parameter being @code{null}. Open MBeans can not have @code{null} descriptions,
* but one will occur as the names of parameters aren't stored for reflection.
- *
+ *
* @param constructor the constructor whose parameter needs describing.
* @param parameter the parameter to be described.
* @param sequenceNo the number of the parameter to describe.
* @return a description of the constructor's parameter.
*/
protected String getDescription(MBeanConstructorInfo constructor,
- MBeanParameterInfo parameter,
- int sequenceNo)
+ MBeanParameterInfo parameter,
+ int sequenceNo)
{
String desc = parameter.getDescription();
if (desc == null)
@@ -343,15 +343,15 @@ public class BeanImpl
* Override this method so as to prevent the description of an operation's
* parameter being @code{null}. Open MBeans can not have @code{null} descriptions,
* but one will occur as the names of parameters aren't stored for reflection.
- *
+ *
* @param operation the operation whose parameter needs describing.
* @param parameter the parameter to be described.
* @param sequenceNo the number of the parameter to describe.
* @return a description of the operation's parameter.
*/
protected String getDescription(MBeanOperationInfo operation,
- MBeanParameterInfo parameter,
- int sequenceNo)
+ MBeanParameterInfo parameter,
+ int sequenceNo)
{
String desc = parameter.getDescription();
if (desc == null)
@@ -364,15 +364,15 @@ public class BeanImpl
* Override this method so as to prevent the name of a constructor's
* parameter being @code{null}. Open MBeans can not have @code{null} names,
* but one will occur as the names of parameters aren't stored for reflection.
- *
+ *
* @param constructor the constructor whose parameter needs a name.
* @param parameter the parameter to be named.
* @param sequenceNo the number of the parameter to name.
* @return a description of the constructor's parameter.
*/
protected String getParameterName(MBeanConstructorInfo constructor,
- MBeanParameterInfo parameter,
- int sequenceNo)
+ MBeanParameterInfo parameter,
+ int sequenceNo)
{
String name = parameter.getName();
if (name == null)
@@ -385,15 +385,15 @@ public class BeanImpl
* Override this method so as to prevent the name of an operation's
* parameter being @code{null}. Open MBeans can not have @code{null} names,
* but one will occur as the names of parameters aren't stored for reflection.
- *
+ *
* @param operation the operation whose parameter needs a name.
* @param parameter the parameter to be named.
* @param sequenceNo the number of the parameter to name.
* @return a description of the operation's parameter.
*/
protected String getParameterName(MBeanOperationInfo operation,
- MBeanParameterInfo parameter,
- int sequenceNo)
+ MBeanParameterInfo parameter,
+ int sequenceNo)
{
String name = parameter.getName();
if (name == null)
@@ -414,31 +414,31 @@ public class BeanImpl
OpenMBeanParameterInfo[] sig = new OpenMBeanParameterInfoSupport[oldS.length];
for (int a = 0; a < oldS.length; ++a)
{
- OpenMBeanParameterInfo param = Translator.translate(oldS[a].getType());
- if (param.getMinValue() == null)
- {
- Object[] lv;
- if (param.getLegalValues() == null)
- lv = null;
- else
- lv = param.getLegalValues().toArray();
- sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(),
- oldS[a].getDescription(),
- ((OpenType)
- param.getOpenType()),
- param.getDefaultValue(),
- lv);
- }
- else
- sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(),
- oldS[a].getDescription(),
- ((OpenType)
- param.getOpenType()),
- param.getDefaultValue(),
- ((Comparable)
- param.getMinValue()),
- ((Comparable)
- param.getMaxValue()));
+ OpenMBeanParameterInfo param = Translator.translate(oldS[a].getType());
+ if (param.getMinValue() == null)
+ {
+ Object[] lv;
+ if (param.getLegalValues() == null)
+ lv = null;
+ else
+ lv = param.getLegalValues().toArray();
+ sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(),
+ oldS[a].getDescription(),
+ ((OpenType)
+ param.getOpenType()),
+ param.getDefaultValue(),
+ lv);
+ }
+ else
+ sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(),
+ oldS[a].getDescription(),
+ ((OpenType)
+ param.getOpenType()),
+ param.getDefaultValue(),
+ ((Comparable)
+ param.getMinValue()),
+ ((Comparable)
+ param.getMaxValue()));
}
return sig;
}
diff --git a/libjava/classpath/gnu/java/lang/management/ClassLoadingMXBeanImpl.java b/libjava/classpath/gnu/java/lang/management/ClassLoadingMXBeanImpl.java
index 92e68ae..d98a396 100644
--- a/libjava/classpath/gnu/java/lang/management/ClassLoadingMXBeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/ClassLoadingMXBeanImpl.java
@@ -42,7 +42,7 @@ import java.lang.management.ClassLoadingMXBean;
import javax.management.NotCompliantMBeanException;
/**
- * Provides access to information about the class loading
+ * Provides access to information about the class loading
* behaviour of the current invocation of the virtual
* machine. Instances of this bean are obtained by calling
* {@link ManagementFactory#getClassLoadingMXBean()}.
@@ -96,4 +96,3 @@ public final class ClassLoadingMXBeanImpl
}
}
-
diff --git a/libjava/classpath/gnu/java/lang/management/CompilationMXBeanImpl.java b/libjava/classpath/gnu/java/lang/management/CompilationMXBeanImpl.java
index b3ad898..1b77edf 100644
--- a/libjava/classpath/gnu/java/lang/management/CompilationMXBeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/CompilationMXBeanImpl.java
@@ -44,7 +44,7 @@ import java.lang.management.CompilationMXBean;
import javax.management.NotCompliantMBeanException;
/**
- * Provides access to information about the JIT
+ * Provides access to information about the JIT
* compiler of the virtual machine, if one exists.
* Instances of this bean are obtained by calling
* {@link ManagementFactory#getCompilationMXBean()},
@@ -66,7 +66,7 @@ public final class CompilationMXBeanImpl
/**
* Constant for compilation time support.
*/
- private static final String COMPILATION_TIME_SUPPORT =
+ private static final String COMPILATION_TIME_SUPPORT =
"gnu.java.lang.management.CompilationTimeSupport";
/**
@@ -87,7 +87,7 @@ public final class CompilationMXBeanImpl
{
return SystemProperties.getProperty(COMPILER_NAME);
}
-
+
public boolean isCompilationTimeMonitoringSupported()
{
return SystemProperties.getProperty(COMPILATION_TIME_SUPPORT) != null;
@@ -99,7 +99,7 @@ public final class CompilationMXBeanImpl
return VMCompilationMXBeanImpl.getTotalCompilationTime();
else
throw new UnsupportedOperationException("Compilation time monitoring "
- + "is not supported");
+ + "is not supported");
}
}
diff --git a/libjava/classpath/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java b/libjava/classpath/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java
index b752e6b..7a2d762 100644
--- a/libjava/classpath/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java
@@ -42,7 +42,7 @@ import java.lang.management.GarbageCollectorMXBean;
import javax.management.NotCompliantMBeanException;
/**
- * Provides access to information about one of the garbage
+ * Provides access to information about one of the garbage
* collectors used by the current invocation of the
* virtual machine. An instance of this bean for each garbage
* collector is obtained by calling
diff --git a/libjava/classpath/gnu/java/lang/management/MemoryMXBeanImpl.java b/libjava/classpath/gnu/java/lang/management/MemoryMXBeanImpl.java
index 1e6c63a..10e6522 100644
--- a/libjava/classpath/gnu/java/lang/management/MemoryMXBeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/MemoryMXBeanImpl.java
@@ -63,7 +63,7 @@ import javax.management.openmbean.OpenType;
import javax.management.openmbean.SimpleType;
/**
- * Provides access to information about the memory
+ * Provides access to information about the memory
* management of the current invocation of the virtual
* machine. Instances of this bean are obtained by calling
* {@link ManagementFactory#getMemoryMXBean()}.
@@ -88,39 +88,39 @@ public final class MemoryMXBeanImpl
{
try
{
- CompositeType usageType =
- new CompositeType(MemoryUsage.class.getName(),
- "Describes the usage levels of a pool",
- new String[] { "init", "used",
- "committed", "max"
- },
- new String[] { "Initial level",
- "Used level",
- "Committed level",
- "Maximum level"
- },
- new OpenType[] {
- SimpleType.LONG, SimpleType.LONG,
- SimpleType.LONG, SimpleType.LONG
- });
- CompositeType notifType =
- new CompositeType(MemoryNotificationInfo.class.getName(),
- "Provides the notification info on memory usage",
- new String[] { "poolName", "usage", "count" },
- new String[] { "Name of the memory pool",
- "Usage level of the memory pool",
- "Number of times the threshold " +
- "has been crossed"
- },
- new OpenType[] {
- SimpleType.STRING, usageType, SimpleType.LONG
- });
- }
- catch (OpenDataException e)
- {
- throw new IllegalStateException("Something went wrong in creating " +
- "the composite data types.", e);
- }
+ CompositeType usageType =
+ new CompositeType(MemoryUsage.class.getName(),
+ "Describes the usage levels of a pool",
+ new String[] { "init", "used",
+ "committed", "max"
+ },
+ new String[] { "Initial level",
+ "Used level",
+ "Committed level",
+ "Maximum level"
+ },
+ new OpenType[] {
+ SimpleType.LONG, SimpleType.LONG,
+ SimpleType.LONG, SimpleType.LONG
+ });
+ CompositeType notifType =
+ new CompositeType(MemoryNotificationInfo.class.getName(),
+ "Provides the notification info on memory usage",
+ new String[] { "poolName", "usage", "count" },
+ new String[] { "Name of the memory pool",
+ "Usage level of the memory pool",
+ "Number of times the threshold " +
+ "has been crossed"
+ },
+ new OpenType[] {
+ SimpleType.STRING, usageType, SimpleType.LONG
+ });
+ }
+ catch (OpenDataException e)
+ {
+ throw new IllegalStateException("Something went wrong in creating " +
+ "the composite data types.", e);
+ }
}
/**
@@ -171,8 +171,8 @@ public final class MemoryMXBeanImpl
}
public void addNotificationListener(NotificationListener listener,
- NotificationFilter filter,
- Object passback)
+ NotificationFilter filter,
+ Object passback)
{
if (listener == null)
throw new IllegalArgumentException("Null listener added to bean.");
@@ -183,13 +183,13 @@ public final class MemoryMXBeanImpl
{
return new MBeanNotificationInfo[]
{
- new MBeanNotificationInfo(new String[]
- {
- MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
- MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED
- },
- Notification.class.getName(),
- "Memory Usage Notifications")
+ new MBeanNotificationInfo(new String[]
+ {
+ MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
+ MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED
+ },
+ Notification.class.getName(),
+ "Memory Usage Notifications")
};
}
@@ -200,82 +200,82 @@ public final class MemoryMXBeanImpl
boolean foundOne = false;
while (it.hasNext())
{
- ListenerData data = (ListenerData) it.next();
- if (data.getListener() == listener)
- {
- it.remove();
- foundOne = true;
- }
+ ListenerData data = (ListenerData) it.next();
+ if (data.getListener() == listener)
+ {
+ it.remove();
+ foundOne = true;
+ }
}
if (!foundOne)
throw new ListenerNotFoundException("The specified listener, " + listener +
- "is not registered with this bean.");
+ "is not registered with this bean.");
}
public void removeNotificationListener(NotificationListener listener,
- NotificationFilter filter,
- Object passback)
+ NotificationFilter filter,
+ Object passback)
throws ListenerNotFoundException
{
if (!(listeners.remove(new ListenerData(listener, filter, passback))))
{
- throw new ListenerNotFoundException("The specified listener, " + listener +
- " with filter " + filter +
- "and passback " + passback +
- ", is not registered with this bean.");
+ throw new ListenerNotFoundException("The specified listener, " + listener +
+ " with filter " + filter +
+ "and passback " + passback +
+ ", is not registered with this bean.");
}
}
void fireNotification(String type, String poolName, long init, long used,
- long committed, long max, long count)
+ long committed, long max, long count)
{
Notification notif = new Notification(type, this, notificationCount);
MemoryUsage usage = new MemoryUsage(init, used, committed, max);
CompositeData data;
try
{
- data = new CompositeDataSupport(notifType,
- new String[] {
- "poolName", "usage", "count"
- },
- new Object[] {
- poolName, usage, Long.valueOf(count)
- });
+ data = new CompositeDataSupport(notifType,
+ new String[] {
+ "poolName", "usage", "count"
+ },
+ new Object[] {
+ poolName, usage, Long.valueOf(count)
+ });
}
catch (OpenDataException e)
{
- throw new IllegalStateException("Something went wrong in creating " +
- "the composite data instance.", e);
+ throw new IllegalStateException("Something went wrong in creating " +
+ "the composite data instance.", e);
}
notif.setUserData(data);
Iterator it = listeners.iterator();
while (it.hasNext())
{
- ListenerData ldata = (ListenerData) it.next();
- NotificationFilter filter = ldata.getFilter();
- if (filter == null || filter.isNotificationEnabled(notif))
- ldata.getListener().handleNotification(notif, ldata.getPassback());
+ ListenerData ldata = (ListenerData) it.next();
+ NotificationFilter filter = ldata.getFilter();
+ if (filter == null || filter.isNotificationEnabled(notif))
+ ldata.getListener().handleNotification(notif, ldata.getPassback());
}
++notificationCount;
}
void fireThresholdExceededNotification(String poolName, long init,
- long used, long committed,
- long max, long count)
+ long used, long committed,
+ long max, long count)
{
fireNotification(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED,
- poolName, init, used, committed, max, count);
+ poolName, init, used, committed, max, count);
}
void fireCollectionThresholdExceededNotification(String poolName,
- long init,
- long used,
- long committed,
- long max,
- long count)
+ long init,
+ long used,
+ long committed,
+ long max,
+ long count)
{
fireNotification(MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
- poolName, init, used, committed, max, count);
+ poolName, init, used, committed, max, count);
}
}
diff --git a/libjava/classpath/gnu/java/lang/management/MemoryManagerMXBeanImpl.java b/libjava/classpath/gnu/java/lang/management/MemoryManagerMXBeanImpl.java
index 5766af9..51d0ed9 100644
--- a/libjava/classpath/gnu/java/lang/management/MemoryManagerMXBeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/MemoryManagerMXBeanImpl.java
@@ -42,7 +42,7 @@ import java.lang.management.MemoryManagerMXBean;
import javax.management.NotCompliantMBeanException;
/**
- * Provides access to information about one of the memory
+ * Provides access to information about one of the memory
* managers used by the current invocation of the
* virtual machine. An instance of this bean for each memory
* manager is obtained by calling
diff --git a/libjava/classpath/gnu/java/lang/management/MemoryPoolMXBeanImpl.java b/libjava/classpath/gnu/java/lang/management/MemoryPoolMXBeanImpl.java
index e314ca1..d92e670 100644
--- a/libjava/classpath/gnu/java/lang/management/MemoryPoolMXBeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/MemoryPoolMXBeanImpl.java
@@ -46,7 +46,7 @@ import java.lang.management.MemoryUsage;
import javax.management.NotCompliantMBeanException;
/**
- * Provides access to information about one of the memory
+ * Provides access to information about one of the memory
* resources or pools used by the current invocation of the
* virtual machine. An instance of this bean for each memory
* pool is obtained by calling
@@ -68,13 +68,13 @@ public final class MemoryPoolMXBeanImpl
/**
* Constant for collection usage threshold.
*/
- private static final String COLLECTION_USAGE_THRESHOLD =
+ private static final String COLLECTION_USAGE_THRESHOLD =
"gnu.java.lang.management.CollectionUsageThresholdSupport";
/**
* Constant for thread time support.
*/
- private static final String USAGE_THRESHOLD =
+ private static final String USAGE_THRESHOLD =
"gnu.java.lang.management.UsageThresholdSupport";
/**
@@ -104,7 +104,7 @@ public final class MemoryPoolMXBeanImpl
return VMMemoryPoolMXBeanImpl.getCollectionUsageThreshold(name);
else
throw new UnsupportedOperationException("A collection usage "+
- "threshold is not supported.");
+ "threshold is not supported.");
}
public long getCollectionUsageThresholdCount()
@@ -113,7 +113,7 @@ public final class MemoryPoolMXBeanImpl
return VMMemoryPoolMXBeanImpl.getCollectionUsageThresholdCount(name);
else
throw new UnsupportedOperationException("A collection usage "+
- "threshold is not supported.");
+ "threshold is not supported.");
}
public String[] getMemoryManagerNames()
@@ -136,7 +136,7 @@ public final class MemoryPoolMXBeanImpl
public MemoryType getType()
{
- return
+ return
MemoryType.valueOf(VMMemoryPoolMXBeanImpl.getType(name));
}
@@ -154,7 +154,7 @@ public final class MemoryPoolMXBeanImpl
return VMMemoryPoolMXBeanImpl.getUsageThreshold(name);
else
throw new UnsupportedOperationException("A usage threshold " +
- "is not supported.");
+ "is not supported.");
}
public long getUsageThresholdCount()
@@ -163,7 +163,7 @@ public final class MemoryPoolMXBeanImpl
return VMMemoryPoolMXBeanImpl.getUsageThresholdCount(name);
else
throw new UnsupportedOperationException("A usage threshold " +
- "is not supported.");
+ "is not supported.");
}
public boolean isCollectionUsageThresholdExceeded()
@@ -202,12 +202,12 @@ public final class MemoryPoolMXBeanImpl
checkControlPermissions();
if (threshold < 0)
throw new IllegalArgumentException("Threshold of " + threshold +
- "is less than zero.");
+ "is less than zero.");
if (isCollectionUsageThresholdSupported())
VMMemoryPoolMXBeanImpl.setCollectionUsageThreshold(name, threshold);
else
throw new UnsupportedOperationException("A collection usage "+
- "threshold is not supported.");
+ "threshold is not supported.");
}
public void setUsageThreshold(long threshold)
@@ -215,13 +215,12 @@ public final class MemoryPoolMXBeanImpl
checkControlPermissions();
if (threshold < 0)
throw new IllegalArgumentException("Threshold of " + threshold +
- "is less than zero.");
+ "is less than zero.");
if (isUsageThresholdSupported())
VMMemoryPoolMXBeanImpl.setUsageThreshold(name, threshold);
else
throw new UnsupportedOperationException("A usage threshold " +
- "is not supported.");
+ "is not supported.");
}
}
-
diff --git a/libjava/classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java b/libjava/classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java
index 07fb7bf..7f5a958 100644
--- a/libjava/classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java
@@ -43,7 +43,7 @@ import javax.management.NotCompliantMBeanException;
/**
* Provides access to information about the underlying operating
- * system.
+ * system.
*
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
@@ -91,5 +91,5 @@ public final class OperatingSystemMXBeanImpl
{
return System.getProperty("os.version");
}
-
+
}
diff --git a/libjava/classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java b/libjava/classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java
index e3ebd16..8db943b 100644
--- a/libjava/classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java
@@ -92,8 +92,8 @@ public final class RuntimeMXBeanImpl
return bootClassPath;
else
throw
- new UnsupportedOperationException("Retrieving the boot " +
- "classpath is not supported.");
+ new UnsupportedOperationException("Retrieving the boot " +
+ "classpath is not supported.");
}
public String getClassPath()
@@ -151,16 +151,16 @@ public final class RuntimeMXBeanImpl
Iterator entries = props.entrySet().iterator();
while (entries.hasNext())
{
- Map.Entry next = (Map.Entry) entries.next();
- Object key = next.getKey();
- Object value = next.getValue();
- if (key instanceof String &&
- value instanceof String)
- map.put(key, value);
+ Map.Entry next = (Map.Entry) entries.next();
+ Object key = next.getKey();
+ Object value = next.getValue();
+ if (key instanceof String &&
+ value instanceof String)
+ map.put(key, value);
}
return map;
}
-
+
public long getUptime()
{
return new Date().getTime() - getStartTime();
@@ -185,11 +185,11 @@ public final class RuntimeMXBeanImpl
{
if (bootClassPath == null)
{
- bootClassPath = SystemProperties.getProperty(JAVA_BOOT_CLASS_PATH);
- if (bootClassPath == null)
- bootClassPath = SystemProperties.getProperty(SUN_BOOT_CLASS_PATH);
- if (bootClassPath == null)
- bootClassPathSupported = false;
+ bootClassPath = SystemProperties.getProperty(JAVA_BOOT_CLASS_PATH);
+ if (bootClassPath == null)
+ bootClassPath = SystemProperties.getProperty(SUN_BOOT_CLASS_PATH);
+ if (bootClassPath == null)
+ bootClassPathSupported = false;
}
return bootClassPathSupported;
}
diff --git a/libjava/classpath/gnu/java/lang/management/ThreadMXBeanImpl.java b/libjava/classpath/gnu/java/lang/management/ThreadMXBeanImpl.java
index 5d02823..9704099 100644
--- a/libjava/classpath/gnu/java/lang/management/ThreadMXBeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/ThreadMXBeanImpl.java
@@ -45,7 +45,7 @@ import java.lang.management.ThreadMXBean;
import javax.management.NotCompliantMBeanException;
/**
- * Provides access to information about the threads
+ * Provides access to information about the threads
* of the virtual machine. An instance of this bean is
* obtained by calling
* {@link ManagementFactory#getThreadMXBean()}.
@@ -63,25 +63,25 @@ public final class ThreadMXBeanImpl
/**
* Constant for current thread time support.
*/
- private static final String CURRENT_THREAD_TIME_SUPPORT =
+ private static final String CURRENT_THREAD_TIME_SUPPORT =
"gnu.java.lang.management.CurrentThreadTimeSupport";
/**
* Constant for thread time support.
*/
- private static final String THREAD_TIME_SUPPORT =
+ private static final String THREAD_TIME_SUPPORT =
"gnu.java.lang.management.ThreadTimeSupport";
/**
* Constant for thread contention support.
*/
- private static final String CONTENTION_SUPPORT =
+ private static final String CONTENTION_SUPPORT =
"gnu.java.lang.management.ThreadContentionSupport";
/**
* Constant for initial value of thread time support.
*/
- private static final String TIME_ENABLED =
+ private static final String TIME_ENABLED =
"gnu.java.lang.management.ThreadTimeInitallyEnabled";
/**
@@ -125,10 +125,10 @@ public final class ThreadMXBeanImpl
}
public ThreadInfo[] dumpAllThreads(boolean lockedMonitors,
- boolean lockedSynchronizers)
+ boolean lockedSynchronizers)
{
return getThreadInfo(getAllThreadIds(), lockedMonitors,
- lockedSynchronizers);
+ lockedSynchronizers);
}
public long[] findDeadlockedThreads()
@@ -136,8 +136,8 @@ public final class ThreadMXBeanImpl
checkMonitorPermissions();
if (!isSynchronizerUsageSupported())
throw new UnsupportedOperationException("Ownable synchronizer usage " +
- "monitoring is not provided " +
- "by this VM.");
+ "monitoring is not provided " +
+ "by this VM.");
return VMThreadMXBeanImpl.findDeadlockedThreads();
}
@@ -157,7 +157,7 @@ public final class ThreadMXBeanImpl
{
if (!isCurrentThreadCpuTimeSupported())
throw new UnsupportedOperationException("Current thread CPU " +
- "time not supported.");
+ "time not supported.");
if (!timeEnabled)
return -1;
return VMThreadMXBeanImpl.getCurrentThreadCpuTime();
@@ -167,7 +167,7 @@ public final class ThreadMXBeanImpl
{
if (!isCurrentThreadCpuTimeSupported())
throw new UnsupportedOperationException("Current thread user " +
- "time not supported.");
+ "time not supported.");
if (!timeEnabled)
return -1;
return VMThreadMXBeanImpl.getCurrentThreadUserTime();
@@ -192,7 +192,7 @@ public final class ThreadMXBeanImpl
{
if (!isThreadCpuTimeSupported())
throw new UnsupportedOperationException("Thread CPU time not " +
- "supported.");
+ "supported.");
if (id <= 0)
throw new IllegalArgumentException("Invalid thread id: " + id);
if (!timeEnabled)
@@ -228,32 +228,32 @@ public final class ThreadMXBeanImpl
ThreadInfo[] infos = new ThreadInfo[ids.length];
for (int a = 0; a < ids.length; ++a)
{
- if (ids[a] <= 0)
- throw new IllegalArgumentException("Invalid thread id " + a +
- ": " + ids[a]);
- infos[a] = VMThreadMXBeanImpl.getThreadInfoForId(ids[a], maxDepth);
+ if (ids[a] <= 0)
+ throw new IllegalArgumentException("Invalid thread id " + a +
+ ": " + ids[a]);
+ infos[a] = VMThreadMXBeanImpl.getThreadInfoForId(ids[a], maxDepth);
}
return infos;
}
public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors,
- boolean lockedSynchronizers)
+ boolean lockedSynchronizers)
{
checkMonitorPermissions();
if (lockedMonitors && !isObjectMonitorUsageSupported())
throw new UnsupportedOperationException("Monitor usage monitoring is " +
- "not provided by this VM.");
+ "not provided by this VM.");
if (lockedSynchronizers && !isSynchronizerUsageSupported())
throw new UnsupportedOperationException("Ownable synchronizer usage " +
- "monitoring is not provided " +
- "by this VM.");
+ "monitoring is not provided " +
+ "by this VM.");
ThreadInfo[] infos = getThreadInfo(ids, Integer.MAX_VALUE);
if (lockedMonitors)
for (ThreadInfo info : infos)
- VMThreadMXBeanImpl.getMonitorInfo(info);
+ VMThreadMXBeanImpl.getMonitorInfo(info);
if (lockedSynchronizers)
for (ThreadInfo info : infos)
- VMThreadMXBeanImpl.getLockInfo(info);
+ VMThreadMXBeanImpl.getLockInfo(info);
return infos;
}
@@ -261,7 +261,7 @@ public final class ThreadMXBeanImpl
{
if (!isThreadCpuTimeSupported())
throw new UnsupportedOperationException("Thread user time not " +
- "supported.");
+ "supported.");
if (id <= 0)
throw new IllegalArgumentException("Invalid thread id: " + id);
if (!timeEnabled)
@@ -297,7 +297,7 @@ public final class ThreadMXBeanImpl
return contentionEnabled;
else
throw new UnsupportedOperationException("Contention monitoring " +
- "not supported.");
+ "not supported.");
}
public boolean isThreadContentionMonitoringSupported()
@@ -308,13 +308,13 @@ public final class ThreadMXBeanImpl
public boolean isThreadCpuTimeEnabled()
{
if (isThreadCpuTimeSupported() ||
- isCurrentThreadCpuTimeSupported())
+ isCurrentThreadCpuTimeSupported())
return timeEnabled;
else
throw new UnsupportedOperationException("Thread time not " +
- "supported.");
+ "supported.");
}
-
+
public boolean isThreadCpuTimeSupported()
{
return SystemProperties.getProperty(THREAD_TIME_SUPPORT) != null;
@@ -325,7 +325,7 @@ public final class ThreadMXBeanImpl
checkControlPermissions();
VMThreadMXBeanImpl.resetPeakThreadCount();
}
-
+
public void setThreadContentionMonitoringEnabled(boolean enable)
{
checkControlPermissions();
@@ -333,19 +333,18 @@ public final class ThreadMXBeanImpl
contentionEnabled = enable;
else
throw new UnsupportedOperationException("Contention monitoring " +
- "not supported.");
- }
-
+ "not supported.");
+ }
+
public void setThreadCpuTimeEnabled(boolean enable)
{
checkControlPermissions();
if (isThreadCpuTimeSupported() ||
- isCurrentThreadCpuTimeSupported())
+ isCurrentThreadCpuTimeSupported())
timeEnabled = enable;
else
throw new UnsupportedOperationException("Thread time not " +
- "supported.");
+ "supported.");
}
}
-
diff --git a/libjava/classpath/gnu/java/lang/reflect/TypeSignature.java b/libjava/classpath/gnu/java/lang/reflect/TypeSignature.java
index 612058d..c0a3ab0 100644
--- a/libjava/classpath/gnu/java/lang/reflect/TypeSignature.java
+++ b/libjava/classpath/gnu/java/lang/reflect/TypeSignature.java
@@ -176,7 +176,7 @@ public class TypeSignature
* @see #getClassForEncoding(String, boolean)
*/
public static Class getClassForEncoding(String type_code, boolean descriptor,
- ClassLoader loader)
+ ClassLoader loader)
throws ClassNotFoundException
{
if (descriptor)
diff --git a/libjava/classpath/gnu/java/locale/LocaleHelper.java b/libjava/classpath/gnu/java/locale/LocaleHelper.java
index f3aabbd..8b10876 100644
--- a/libjava/classpath/gnu/java/locale/LocaleHelper.java
+++ b/libjava/classpath/gnu/java/locale/LocaleHelper.java
@@ -85,7 +85,7 @@ public class LocaleHelper
int uscore = variant.indexOf('_');
if (uscore != -1)
return new Locale(language, country,
- variant.substring(0, uscore));
+ variant.substring(0, uscore));
if (!variant.isEmpty())
return new Locale(language, country, "");
if (!country.isEmpty())
@@ -95,7 +95,7 @@ public class LocaleHelper
/**
* Return an array of all the locales for which there is a
- * {@link Collator} instance. A new array is returned each time.
+ * {@link Collator} instance. A new array is returned each time.
*/
public static Locale[] getCollatorLocales()
{
@@ -145,4 +145,3 @@ public class LocaleHelper
return LocaleData.localeNames[n];
}
}
-
diff --git a/libjava/classpath/gnu/java/math/Fixed.java b/libjava/classpath/gnu/java/math/Fixed.java
index ed4150b..6b210de 100644
--- a/libjava/classpath/gnu/java/math/Fixed.java
+++ b/libjava/classpath/gnu/java/math/Fixed.java
@@ -45,7 +45,7 @@ public final class Fixed
{
/**
- * Private constructor to avoid instantiation.
+ * Private constructor to avoid instantiation.
*/
private Fixed()
{
@@ -138,7 +138,7 @@ public final class Fixed
/**
* Returns the fixed point value a with n digits
* as float.
- *
+ *
* @param n the number of digits
* @param a the fixed point value
*
@@ -152,7 +152,7 @@ public final class Fixed
/**
* Returns the fixed point value a with n digits
* as double.
- *
+ *
* @param n the number of digits
* @param a the fixed point value
*
@@ -194,7 +194,7 @@ public final class Fixed
/**
* Returns the integer value of the specified fixed point value
* a. This simply cuts of the digits (== floor(a)).
- *
+ *
* @param n the number of digits
* @param a the fixed point value
*
diff --git a/libjava/classpath/gnu/java/math/GMP.java b/libjava/classpath/gnu/java/math/GMP.java
index 6fb4936..4df790a 100644
--- a/libjava/classpath/gnu/java/math/GMP.java
+++ b/libjava/classpath/gnu/java/math/GMP.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -47,11 +47,11 @@ public final class GMP
{
private Pointer native_ptr;
private int refCount = 1;
-
+
public GMP()
{
super();
-
+
natInitialize();
}
@@ -59,30 +59,30 @@ public final class GMP
{
refCount++;
}
-
+
private synchronized void releaseRef()
{
refCount--;
if (refCount == 0)
{
- natFinalize();
- native_ptr = null;
+ natFinalize();
+ native_ptr = null;
}
}
-
+
protected void finalize()
{
releaseRef();
}
-
-
+
+
public void fromByteArray(byte[] v)
{
acquireRef();
natFromByteArray(v);
releaseRef();
}
-
+
public void fromBI(GMP x)
{
acquireRef();
@@ -91,14 +91,14 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void fromLong(long n)
{
acquireRef();
natFromLong(n);
releaseRef();
}
-
+
public int fromString(String s, int rdx)
{
acquireRef();
@@ -106,14 +106,14 @@ public final class GMP
releaseRef();
return result;
}
-
+
public void fromSignedMagnitude(byte[] m, boolean isNegative)
{
acquireRef();
natFromSignedMagnitude(m, isNegative);
releaseRef();
}
-
+
public String toString(int b)
{
acquireRef();
@@ -121,14 +121,14 @@ public final class GMP
releaseRef();
return result;
}
-
+
public void toByteArray(byte[] r)
{
acquireRef();
natToByteArray(r);
releaseRef();
}
-
+
public double doubleValue()
{
acquireRef();
@@ -136,7 +136,7 @@ public final class GMP
releaseRef();
return result;
}
-
+
public int absIntValue()
{
acquireRef();
@@ -144,7 +144,7 @@ public final class GMP
releaseRef();
return result;
}
-
+
public int compare(GMP x)
{
acquireRef();
@@ -154,7 +154,7 @@ public final class GMP
releaseRef();
return result;
}
-
+
public void add(GMP x, GMP r)
{
acquireRef();
@@ -165,7 +165,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void subtract(GMP x, GMP r)
{
acquireRef();
@@ -176,7 +176,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void multiply(GMP x, GMP r)
{
acquireRef();
@@ -187,7 +187,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void quotient(GMP x, GMP r)
{
acquireRef();
@@ -198,7 +198,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void remainder(GMP x, GMP r)
{
acquireRef();
@@ -209,7 +209,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void quotientAndRemainder(GMP x, GMP q, GMP r)
{
acquireRef();
@@ -222,7 +222,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void modulo(GMP x, GMP r)
{
acquireRef();
@@ -233,7 +233,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void pow(int n, GMP r)
{
acquireRef();
@@ -242,7 +242,7 @@ public final class GMP
r.releaseRef();
releaseRef();
}
-
+
public void modPow(GMP e, GMP m, GMP r)
{
acquireRef();
@@ -255,7 +255,7 @@ public final class GMP
e.releaseRef();
releaseRef();
}
-
+
public void modInverse(GMP m, GMP r)
{
acquireRef();
@@ -277,7 +277,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void shiftLeft(int n, GMP r)
{
acquireRef();
@@ -286,7 +286,7 @@ public final class GMP
r.releaseRef();
releaseRef();
}
-
+
public void shiftRight(int n, GMP r)
{
acquireRef();
@@ -295,7 +295,7 @@ public final class GMP
r.releaseRef();
releaseRef();
}
-
+
public void abs(GMP r)
{
acquireRef();
@@ -304,7 +304,7 @@ public final class GMP
r.releaseRef();
releaseRef();
}
-
+
public void negate(GMP r)
{
acquireRef();
@@ -313,7 +313,7 @@ public final class GMP
r.releaseRef();
releaseRef();
}
-
+
public int bitLength()
{
acquireRef();
@@ -321,7 +321,7 @@ public final class GMP
releaseRef();
return result;
}
-
+
public int bitCount()
{
acquireRef();
@@ -329,7 +329,7 @@ public final class GMP
releaseRef();
return result;
}
-
+
public void and(GMP x, GMP r)
{
acquireRef();
@@ -340,7 +340,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void or(GMP x, GMP r)
{
acquireRef();
@@ -351,7 +351,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void xor(GMP x, GMP r)
{
acquireRef();
@@ -362,7 +362,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void andNot(GMP x, GMP r)
{
acquireRef();
@@ -373,7 +373,7 @@ public final class GMP
x.releaseRef();
releaseRef();
}
-
+
public void not(GMP r)
{
acquireRef();
@@ -382,7 +382,7 @@ public final class GMP
r.releaseRef();
releaseRef();
}
-
+
public void flipBit(int n, GMP r)
{
acquireRef();
@@ -399,7 +399,7 @@ public final class GMP
releaseRef();
return result;
}
-
+
public void setBit(int n, boolean setIt, GMP r)
{
acquireRef();
@@ -408,7 +408,7 @@ public final class GMP
r.releaseRef();
releaseRef();
}
-
+
public int testPrimality(int certainty)
{
acquireRef();
@@ -416,7 +416,7 @@ public final class GMP
releaseRef();
return result;
}
-
+
public int lowestSetBit()
{
acquireRef();
@@ -424,25 +424,25 @@ public final class GMP
releaseRef();
return result;
}
-
+
// Native methods .........................................................
-
+
public static native void natInitializeLibrary();
-
+
private native void natInitialize();
private native void natFinalize();
-
+
private native void natFromLong(long n);
private native void natFromBI(Pointer x);
private native void natFromByteArray(byte[] v);
private native int natFromString(String s, int rdx);
private native void natFromSignedMagnitude(byte[] m, boolean isNegative);
-
+
private native String natToString(int base);
private native void natToByteArray(byte[] r);
private native int natAbsIntValue();
private native double natDoubleValue();
-
+
private native int natCompare(Pointer y);
private native void natAdd(Pointer x, Pointer r);
private native void natSubtract(Pointer x, Pointer r);
diff --git a/libjava/classpath/gnu/java/math/MPN.java b/libjava/classpath/gnu/java/math/MPN.java
index 05491bb..9143ef0 100644
--- a/libjava/classpath/gnu/java/math/MPN.java
+++ b/libjava/classpath/gnu/java/math/MPN.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -59,9 +59,9 @@ public class MPN
long carry = (long) y & 0xffffffffL;
for (int i = 0; i < size; i++)
{
- carry += ((long) x[i] & 0xffffffffL);
- dest[i] = (int) carry;
- carry >>= 32;
+ carry += ((long) x[i] & 0xffffffffL);
+ dest[i] = (int) carry;
+ carry >>= 32;
}
return (int) carry;
}
@@ -77,10 +77,10 @@ public class MPN
long carry = 0;
for (int i = 0; i < len; i++)
{
- carry += ((long) x[i] & 0xffffffffL)
- + ((long) y[i] & 0xffffffffL);
- dest[i] = (int) carry;
- carry >>>= 32;
+ carry += ((long) x[i] & 0xffffffffL)
+ + ((long) y[i] & 0xffffffffL);
+ dest[i] = (int) carry;
+ carry >>>= 32;
}
return (int) carry;
}
@@ -96,15 +96,15 @@ public class MPN
int cy = 0;
for (int i = 0; i < size; i++)
{
- int y = Y[i];
- int x = X[i];
- y += cy; /* add previous carry to subtrahend */
- // Invert the high-order bit, because: (unsigned) X > (unsigned) Y
- // iff: (int) (X^0x80000000) > (int) (Y^0x80000000).
- cy = (y^0x80000000) < (cy^0x80000000) ? 1 : 0;
- y = x - y;
- cy += (y^0x80000000) > (x ^ 0x80000000) ? 1 : 0;
- dest[i] = y;
+ int y = Y[i];
+ int x = X[i];
+ y += cy; /* add previous carry to subtrahend */
+ // Invert the high-order bit, because: (unsigned) X > (unsigned) Y
+ // iff: (int) (X^0x80000000) > (int) (Y^0x80000000).
+ cy = (y^0x80000000) < (cy^0x80000000) ? 1 : 0;
+ y = x - y;
+ cy += (y^0x80000000) > (x ^ 0x80000000) ? 1 : 0;
+ dest[i] = y;
}
return cy;
}
@@ -142,23 +142,23 @@ public class MPN
* This function is basically the same gmp's mpn_mul. */
public static void mul (int[] dest,
- int[] x, int xlen,
- int[] y, int ylen)
+ int[] x, int xlen,
+ int[] y, int ylen)
{
dest[xlen] = MPN.mul_1 (dest, x, xlen, y[0]);
for (int i = 1; i < ylen; i++)
{
- long yword = (long) y[i] & 0xffffffffL;
- long carry = 0;
- for (int j = 0; j < xlen; j++)
- {
- carry += ((long) x[j] & 0xffffffffL) * yword
- + ((long) dest[i+j] & 0xffffffffL);
- dest[i+j] = (int) carry;
- carry >>>= 32;
- }
- dest[i+xlen] = (int) carry;
+ long yword = (long) y[i] & 0xffffffffL;
+ long carry = 0;
+ for (int j = 0; j < xlen; j++)
+ {
+ carry += ((long) x[j] & 0xffffffffL) * yword
+ + ((long) dest[i+j] & 0xffffffffL);
+ dest[i+j] = (int) carry;
+ carry >>>= 32;
+ }
+ dest[i+xlen] = (int) carry;
}
}
@@ -174,71 +174,71 @@ public class MPN
long a0 = N & 0xffffffffL;
if (D >= 0)
{
- if (a1 < ((D - a1 - (a0 >>> 31)) & 0xffffffffL))
- {
- /* dividend, divisor, and quotient are nonnegative */
- q = N / D;
- r = N % D;
- }
- else
- {
- /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */
- long c = N - ((long) D << 31);
- /* Divide (c1*2^32 + c0) by d */
- q = c / D;
- r = c % D;
- /* Add 2^31 to quotient */
- q += 1 << 31;
- }
+ if (a1 < ((D - a1 - (a0 >>> 31)) & 0xffffffffL))
+ {
+ /* dividend, divisor, and quotient are nonnegative */
+ q = N / D;
+ r = N % D;
+ }
+ else
+ {
+ /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */
+ long c = N - ((long) D << 31);
+ /* Divide (c1*2^32 + c0) by d */
+ q = c / D;
+ r = c % D;
+ /* Add 2^31 to quotient */
+ q += 1 << 31;
+ }
}
else
{
- long b1 = D >>> 1; /* d/2, between 2^30 and 2^31 - 1 */
- //long c1 = (a1 >> 1); /* A/2 */
- //int c0 = (a1 << 31) + (a0 >> 1);
- long c = N >>> 1;
- if (a1 < b1 || (a1 >> 1) < b1)
- {
- if (a1 < b1)
- {
- q = c / b1;
- r = c % b1;
- }
- else /* c1 < b1, so 2^31 <= (A/2)/b1 < 2^32 */
- {
- c = ~(c - (b1 << 32));
- q = c / b1; /* (A/2) / (d/2) */
- r = c % b1;
- q = (~q) & 0xffffffffL; /* (A/2)/b1 */
- r = (b1 - 1) - r; /* r < b1 => new r >= 0 */
- }
- r = 2 * r + (a0 & 1);
- if ((D & 1) != 0)
- {
- if (r >= q) {
- r = r - q;
- } else if (q - r <= ((long) D & 0xffffffffL)) {
+ long b1 = D >>> 1; /* d/2, between 2^30 and 2^31 - 1 */
+ //long c1 = (a1 >> 1); /* A/2 */
+ //int c0 = (a1 << 31) + (a0 >> 1);
+ long c = N >>> 1;
+ if (a1 < b1 || (a1 >> 1) < b1)
+ {
+ if (a1 < b1)
+ {
+ q = c / b1;
+ r = c % b1;
+ }
+ else /* c1 < b1, so 2^31 <= (A/2)/b1 < 2^32 */
+ {
+ c = ~(c - (b1 << 32));
+ q = c / b1; /* (A/2) / (d/2) */
+ r = c % b1;
+ q = (~q) & 0xffffffffL; /* (A/2)/b1 */
+ r = (b1 - 1) - r; /* r < b1 => new r >= 0 */
+ }
+ r = 2 * r + (a0 & 1);
+ if ((D & 1) != 0)
+ {
+ if (r >= q) {
+ r = r - q;
+ } else if (q - r <= ((long) D & 0xffffffffL)) {
r = r - q + D;
- q -= 1;
- } else {
+ q -= 1;
+ } else {
r = r - q + D + D;
- q -= 2;
- }
- }
- }
- else /* Implies c1 = b1 */
- { /* Hence a1 = d - 1 = 2*b1 - 1 */
- if (a0 >= ((long)(-D) & 0xffffffffL))
- {
- q = -1;
- r = a0 + D;
- }
- else
- {
- q = -2;
- r = a0 + D + D;
- }
- }
+ q -= 2;
+ }
+ }
+ }
+ else /* Implies c1 = b1 */
+ { /* Hence a1 = d - 1 = 2*b1 - 1 */
+ if (a0 >= ((long)(-D) & 0xffffffffL))
+ {
+ q = -1;
+ r = a0 + D;
+ }
+ else
+ {
+ q = -2;
+ r = a0 + D + D;
+ }
+ }
}
return (r << 32) | (q & 0xFFFFFFFFl);
@@ -251,7 +251,7 @@ public class MPN
*/
public static int divmod_1 (int[] quotient, int[] dividend,
- int len, int divisor)
+ int len, int divisor)
{
int i = len - 1;
long r = dividend[i];
@@ -259,16 +259,16 @@ public class MPN
r = 0;
else
{
- quotient[i--] = 0;
- r <<= 32;
+ quotient[i--] = 0;
+ r <<= 32;
}
for (; i >= 0; i--)
{
- int n0 = dividend[i];
- r = (r & ~0xffffffffL) | (n0 & 0xffffffffL);
- r = udiv_qrnnd (r, divisor);
- quotient[i] = (int) r;
+ int n0 = dividend[i];
+ r = (r & ~0xffffffffL) | (n0 & 0xffffffffL);
+ r = udiv_qrnnd (r, divisor);
+ quotient[i] = (int) r;
}
return (int)(r >> 32);
}
@@ -285,19 +285,19 @@ public class MPN
int j = 0;
do
{
- long prod = ((long) x[j] & 0xffffffffL) * yl;
- int prod_low = (int) prod;
- int prod_high = (int) (prod >> 32);
- prod_low += carry;
- // Invert the high-order bit, because: (unsigned) X > (unsigned) Y
- // iff: (int) (X^0x80000000) > (int) (Y^0x80000000).
- carry = ((prod_low ^ 0x80000000) < (carry ^ 0x80000000) ? 1 : 0)
- + prod_high;
- int x_j = dest[offset+j];
- prod_low = x_j - prod_low;
- if ((prod_low ^ 0x80000000) > (x_j ^ 0x80000000))
- carry++;
- dest[offset+j] = prod_low;
+ long prod = ((long) x[j] & 0xffffffffL) * yl;
+ int prod_low = (int) prod;
+ int prod_high = (int) (prod >> 32);
+ prod_low += carry;
+ // Invert the high-order bit, because: (unsigned) X > (unsigned) Y
+ // iff: (int) (X^0x80000000) > (int) (Y^0x80000000).
+ carry = ((prod_low ^ 0x80000000) < (carry ^ 0x80000000) ? 1 : 0)
+ + prod_high;
+ int x_j = dest[offset+j];
+ prod_low = x_j - prod_low;
+ if ((prod_low ^ 0x80000000) > (x_j ^ 0x80000000))
+ carry++;
+ dest[offset+j] = prod_low;
}
while (++j < len);
return carry;
@@ -328,37 +328,37 @@ public class MPN
int j = nx;
do
{ // loop over digits of quotient
- // Knuth's j == our nx-j.
- // Knuth's u[j:j+n] == our zds[j:j-ny].
- int qhat; // treated as unsigned
- if (zds[j]==y[ny-1])
- qhat = -1; // 0xffffffff
- else
- {
- long w = (((long)(zds[j])) << 32) + ((long)zds[j-1] & 0xffffffffL);
- qhat = (int) udiv_qrnnd (w, y[ny-1]);
- }
- if (qhat != 0)
- {
- int borrow = submul_1 (zds, j - ny, y, ny, qhat);
- int save = zds[j];
- long num = ((long)save&0xffffffffL) - ((long)borrow&0xffffffffL);
+ // Knuth's j == our nx-j.
+ // Knuth's u[j:j+n] == our zds[j:j-ny].
+ int qhat; // treated as unsigned
+ if (zds[j]==y[ny-1])
+ qhat = -1; // 0xffffffff
+ else
+ {
+ long w = (((long)(zds[j])) << 32) + ((long)zds[j-1] & 0xffffffffL);
+ qhat = (int) udiv_qrnnd (w, y[ny-1]);
+ }
+ if (qhat != 0)
+ {
+ int borrow = submul_1 (zds, j - ny, y, ny, qhat);
+ int save = zds[j];
+ long num = ((long)save&0xffffffffL) - ((long)borrow&0xffffffffL);
while (num != 0)
- {
- qhat--;
- long carry = 0;
- for (int i = 0; i < ny; i++)
- {
- carry += ((long) zds[j-ny+i] & 0xffffffffL)
- + ((long) y[i] & 0xffffffffL);
- zds[j-ny+i] = (int) carry;
- carry >>>= 32;
- }
- zds[j] += carry;
- num = carry - 1;
- }
- }
- zds[j] = qhat;
+ {
+ qhat--;
+ long carry = 0;
+ for (int i = 0; i < ny; i++)
+ {
+ carry += ((long) zds[j-ny+i] & 0xffffffffL)
+ + ((long) y[i] & 0xffffffffL);
+ zds[j-ny+i] = (int) carry;
+ carry >>>= 32;
+ }
+ zds[j] += carry;
+ num = carry - 1;
+ }
+ }
+ zds[j] = qhat;
} while (--j >= ny);
}
@@ -372,19 +372,19 @@ public class MPN
{
if (radix < 10)
{
- if (radix < 8)
- {
- if (radix <= 2)
- return 32;
- else if (radix == 3)
- return 20;
- else if (radix == 4)
- return 16;
- else
- return 18 - radix;
- }
- else
- return 10;
+ if (radix < 8)
+ {
+ if (radix <= 2)
+ return 32;
+ else if (radix == 3)
+ return 20;
+ else if (radix == 4)
+ return 16;
+ else
+ return 18 - radix;
+ }
+ else
+ return 10;
}
else if (radix < 12)
return 9;
@@ -410,9 +410,9 @@ public class MPN
for (int k = 16; k > 0; k = k >> 1) {
int j = i >>> k;
if (j == 0)
- count += k;
+ count += k;
else
- i = j;
+ i = j;
}
return count;
}
@@ -422,61 +422,61 @@ public class MPN
int size = 0;
if ((base & (base - 1)) == 0)
{
- // The base is a power of 2. Read the input string from
- // least to most significant character/digit. */
-
- int next_bitpos = 0;
- int bits_per_indigit = 0;
- for (int i = base; (i >>= 1) != 0; ) bits_per_indigit++;
- int res_digit = 0;
-
- for (int i = str_len; --i >= 0; )
- {
- int inp_digit = str[i];
- res_digit |= inp_digit << next_bitpos;
- next_bitpos += bits_per_indigit;
- if (next_bitpos >= 32)
- {
- dest[size++] = res_digit;
- next_bitpos -= 32;
- res_digit = inp_digit >> (bits_per_indigit - next_bitpos);
- }
- }
-
- if (res_digit != 0)
- dest[size++] = res_digit;
+ // The base is a power of 2. Read the input string from
+ // least to most significant character/digit. */
+
+ int next_bitpos = 0;
+ int bits_per_indigit = 0;
+ for (int i = base; (i >>= 1) != 0; ) bits_per_indigit++;
+ int res_digit = 0;
+
+ for (int i = str_len; --i >= 0; )
+ {
+ int inp_digit = str[i];
+ res_digit |= inp_digit << next_bitpos;
+ next_bitpos += bits_per_indigit;
+ if (next_bitpos >= 32)
+ {
+ dest[size++] = res_digit;
+ next_bitpos -= 32;
+ res_digit = inp_digit >> (bits_per_indigit - next_bitpos);
+ }
+ }
+
+ if (res_digit != 0)
+ dest[size++] = res_digit;
}
else
{
- // General case. The base is not a power of 2.
- int indigits_per_limb = MPN.chars_per_word (base);
- int str_pos = 0;
-
- while (str_pos < str_len)
- {
- int chunk = str_len - str_pos;
- if (chunk > indigits_per_limb)
- chunk = indigits_per_limb;
- int res_digit = str[str_pos++];
- int big_base = base;
-
- while (--chunk > 0)
- {
- res_digit = res_digit * base + str[str_pos++];
- big_base *= base;
- }
-
- int cy_limb;
- if (size == 0)
- cy_limb = res_digit;
- else
- {
- cy_limb = MPN.mul_1 (dest, dest, size, big_base);
- cy_limb += MPN.add_1 (dest, dest, size, res_digit);
- }
- if (cy_limb != 0)
- dest[size++] = cy_limb;
- }
+ // General case. The base is not a power of 2.
+ int indigits_per_limb = MPN.chars_per_word (base);
+ int str_pos = 0;
+
+ while (str_pos < str_len)
+ {
+ int chunk = str_len - str_pos;
+ if (chunk > indigits_per_limb)
+ chunk = indigits_per_limb;
+ int res_digit = str[str_pos++];
+ int big_base = base;
+
+ while (--chunk > 0)
+ {
+ res_digit = res_digit * base + str[str_pos++];
+ big_base *= base;
+ }
+
+ int cy_limb;
+ if (size == 0)
+ cy_limb = res_digit;
+ else
+ {
+ cy_limb = MPN.mul_1 (dest, dest, size, big_base);
+ cy_limb += MPN.add_1 (dest, dest, size, res_digit);
+ }
+ if (cy_limb != 0)
+ dest[size++] = cy_limb;
+ }
}
return size;
}
@@ -489,22 +489,22 @@ public class MPN
{
while (--size >= 0)
{
- int x_word = x[size];
- int y_word = y[size];
- if (x_word != y_word)
- {
- // Invert the high-order bit, because:
- // (unsigned) X > (unsigned) Y iff
- // (int) (X^0x80000000) > (int) (Y^0x80000000).
- return (x_word ^ 0x80000000) > (y_word ^0x80000000) ? 1 : -1;
- }
+ int x_word = x[size];
+ int y_word = y[size];
+ if (x_word != y_word)
+ {
+ // Invert the high-order bit, because:
+ // (unsigned) X > (unsigned) Y iff
+ // (int) (X^0x80000000) > (int) (Y^0x80000000).
+ return (x_word ^ 0x80000000) > (y_word ^0x80000000) ? 1 : -1;
+ }
}
return 0;
}
/**
* Compare x[0:xlen-1] with y[0:ylen-1], treating them as unsigned integers.
- *
+ *
* @return -1, 0, or 1 depending on if x<y, x==y, or x>y.
*/
public static int cmp (int[] x, int xlen, int[] y, int ylen)
@@ -521,7 +521,7 @@ public class MPN
* Assumes: 0 < count < 32
*/
public static int rshift (int[] dest, int[] x, int x_start,
- int len, int count)
+ int len, int count)
{
int count_2 = 32 - count;
int low_word = x[x_start];
@@ -529,9 +529,9 @@ public class MPN
int i = 1;
for (; i < len; i++)
{
- int high_word = x[x_start+i];
- dest[i-1] = (low_word >>> count) | (high_word << count_2);
- low_word = high_word;
+ int high_word = x[x_start+i];
+ dest[i-1] = (low_word >>> count) | (high_word << count_2);
+ low_word = high_word;
}
dest[i-1] = low_word >>> count;
return retval;
@@ -546,13 +546,13 @@ public class MPN
* Same as rshift, but handles count==0 (and has no return value).
*/
public static void rshift0 (int[] dest, int[] x, int x_start,
- int len, int count)
+ int len, int count)
{
if (count > 0)
rshift(dest, x, x_start, len, count);
else
for (int i = 0; i < len; i++)
- dest[i] = x[i + x_start];
+ dest[i] = x[i + x_start];
}
/** Return the long-truncated value of right shifting.
@@ -571,10 +571,10 @@ public class MPN
int w1 = wordno >= len ? sign : x[wordno];
if (count != 0)
{
- wordno++;
- int w2 = wordno >= len ? sign : x[wordno];
- w0 = (w0 >>> count) | (w1 << (32-count));
- w1 = (w1 >>> count) | (w2 << (32-count));
+ wordno++;
+ int w2 = wordno >= len ? sign : x[wordno];
+ w0 = (w0 >>> count) | (w1 << (32-count));
+ w1 = (w1 >>> count) | (w2 << (32-count));
}
return ((long)w1 << 32) | ((long)w0 & 0xffffffffL);
}
@@ -587,7 +587,7 @@ public class MPN
*/
public static int lshift (int[] dest, int d_offset,
- int[] x, int len, int count)
+ int[] x, int len, int count)
{
int count_2 = 32 - count;
int i = len - 1;
@@ -596,9 +596,9 @@ public class MPN
d_offset++;
while (--i >= 0)
{
- int low_word = x[i];
- dest[d_offset+i] = (high_word << count) | (low_word >>> count_2);
- high_word = low_word;
+ int low_word = x[i];
+ dest[d_offset+i] = (high_word << count) | (low_word >>> count_2);
+ high_word = low_word;
}
dest[d_offset+i] = high_word << count;
return retval;
@@ -611,13 +611,13 @@ public class MPN
int i = 0;
while ((word & 0xF) == 0)
{
- word >>= 4;
- i += 4;
+ word >>= 4;
+ i += 4;
}
if ((word & 3) == 0)
{
- word >>= 2;
- i += 2;
+ word >>= 2;
+ i += 2;
}
if ((word & 1) == 0)
i += 1;
@@ -630,8 +630,8 @@ public class MPN
{
for (int i = 0; ; i++)
{
- if (words[i] != 0)
- return 32 * i + findLowestBit (words[i]);
+ if (words[i] != 0)
+ return 32 * i + findLowestBit (words[i]);
}
}
@@ -646,12 +646,12 @@ public class MPN
// Find sh such that both x and y are divisible by 2**sh.
for (i = 0; ; i++)
{
- word = x[i] | y[i];
- if (word != 0)
- {
- // Must terminate, since x and y are non-zero.
- break;
- }
+ word = x[i] | y[i];
+ if (word != 0)
+ {
+ // Must terminate, since x and y are non-zero.
+ break;
+ }
}
int initShiftWords = i;
int initShiftBits = findLowestBit (word);
@@ -666,69 +666,69 @@ public class MPN
int[] other_arg; /* The other one can be even or odd. */
if ((x[0] & 1) != 0)
{
- odd_arg = x;
- other_arg = y;
+ odd_arg = x;
+ other_arg = y;
}
else
{
- odd_arg = y;
- other_arg = x;
+ odd_arg = y;
+ other_arg = x;
}
for (;;)
{
- // Shift other_arg until it is odd; this doesn't
- // affect the gcd, since we divide by 2**k, which does not
- // divide odd_arg.
- for (i = 0; other_arg[i] == 0; ) i++;
- if (i > 0)
- {
- int j;
- for (j = 0; j < len-i; j++)
- other_arg[j] = other_arg[j+i];
- for ( ; j < len; j++)
- other_arg[j] = 0;
- }
- i = findLowestBit(other_arg[0]);
- if (i > 0)
- MPN.rshift (other_arg, other_arg, 0, len, i);
-
- // Now both odd_arg and other_arg are odd.
-
- // Subtract the smaller from the larger.
- // This does not change the result, since gcd(a-b,b)==gcd(a,b).
- i = MPN.cmp(odd_arg, other_arg, len);
- if (i == 0)
- break;
- if (i > 0)
- { // odd_arg > other_arg
- MPN.sub_n (odd_arg, odd_arg, other_arg, len);
- // Now odd_arg is even, so swap with other_arg;
- int[] tmp = odd_arg; odd_arg = other_arg; other_arg = tmp;
- }
- else
- { // other_arg > odd_arg
- MPN.sub_n (other_arg, other_arg, odd_arg, len);
- }
- while (odd_arg[len-1] == 0 && other_arg[len-1] == 0)
- len--;
+ // Shift other_arg until it is odd; this doesn't
+ // affect the gcd, since we divide by 2**k, which does not
+ // divide odd_arg.
+ for (i = 0; other_arg[i] == 0; ) i++;
+ if (i > 0)
+ {
+ int j;
+ for (j = 0; j < len-i; j++)
+ other_arg[j] = other_arg[j+i];
+ for ( ; j < len; j++)
+ other_arg[j] = 0;
+ }
+ i = findLowestBit(other_arg[0]);
+ if (i > 0)
+ MPN.rshift (other_arg, other_arg, 0, len, i);
+
+ // Now both odd_arg and other_arg are odd.
+
+ // Subtract the smaller from the larger.
+ // This does not change the result, since gcd(a-b,b)==gcd(a,b).
+ i = MPN.cmp(odd_arg, other_arg, len);
+ if (i == 0)
+ break;
+ if (i > 0)
+ { // odd_arg > other_arg
+ MPN.sub_n (odd_arg, odd_arg, other_arg, len);
+ // Now odd_arg is even, so swap with other_arg;
+ int[] tmp = odd_arg; odd_arg = other_arg; other_arg = tmp;
+ }
+ else
+ { // other_arg > odd_arg
+ MPN.sub_n (other_arg, other_arg, odd_arg, len);
+ }
+ while (odd_arg[len-1] == 0 && other_arg[len-1] == 0)
+ len--;
}
if (initShiftWords + initShiftBits > 0)
{
- if (initShiftBits > 0)
- {
- int sh_out = MPN.lshift (x, initShiftWords, x, len, initShiftBits);
- if (sh_out != 0)
- x[(len++)+initShiftWords] = sh_out;
- }
- else
- {
- for (i = len; --i >= 0;)
- x[i+initShiftWords] = x[i];
- }
- for (i = initShiftWords; --i >= 0; )
- x[i] = 0;
- len += initShiftWords;
+ if (initShiftBits > 0)
+ {
+ int sh_out = MPN.lshift (x, initShiftWords, x, len, initShiftBits);
+ if (sh_out != 0)
+ x[(len++)+initShiftWords] = sh_out;
+ }
+ else
+ {
+ for (i = len; --i >= 0;)
+ x[i+initShiftWords] = x[i];
+ }
+ for (i = initShiftWords; --i >= 0; )
+ x[i] = 0;
+ len += initShiftWords;
}
return len;
}
@@ -761,9 +761,9 @@ public class MPN
ps.print('(');
for (int i = 0; i < len; i++)
{
- if (i > 0)
- ps.print (' ');
- ps.print ("#x" + Long.toString ((long) x[i] & 0xffffffffL, 16));
+ if (i > 0)
+ ps.print (' ');
+ ps.print ("#x" + Long.toString ((long) x[i] & 0xffffffffL, 16));
}
ps.print(')');
}
diff --git a/libjava/classpath/gnu/java/net/CRLFInputStream.java b/libjava/classpath/gnu/java/net/CRLFInputStream.java
index ac34826..5e394ae 100644
--- a/libjava/classpath/gnu/java/net/CRLFInputStream.java
+++ b/libjava/classpath/gnu/java/net/CRLFInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -64,7 +64,7 @@ public class CRLFInputStream
* The underlying input stream.
*/
protected InputStream in;
-
+
private boolean doReset;
/**
@@ -100,7 +100,7 @@ public class CRLFInputStream
}
return c;
}
-
+
/**
* Reads up to b.length bytes of data from this input stream into
* an array of bytes.
@@ -176,4 +176,3 @@ public class CRLFInputStream
}
}
-
diff --git a/libjava/classpath/gnu/java/net/CRLFOutputStream.java b/libjava/classpath/gnu/java/net/CRLFOutputStream.java
index f27e0f2..0e94283 100644
--- a/libjava/classpath/gnu/java/net/CRLFOutputStream.java
+++ b/libjava/classpath/gnu/java/net/CRLFOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-/**
+/**
* An output stream that filters LFs into CR/LF pairs.
*
* @author Chris Burdess (dog@gnu.org)
@@ -105,7 +105,7 @@ public class CRLFOutputStream
}
last = ch;
}
-
+
/**
* Writes a byte array to the underlying stream.
* @exception IOException if an I/O error occurred
@@ -150,7 +150,7 @@ public class CRLFOutputStream
out.write (b, d, len - d);
}
}
-
+
/**
* Writes the specified ASCII string to the underlying stream.
* @exception IOException if an I/O error occurred
@@ -180,4 +180,3 @@ public class CRLFOutputStream
out.write(CRLF, 0, 2);
}
}
-
diff --git a/libjava/classpath/gnu/java/net/DefaultContentHandlerFactory.java b/libjava/classpath/gnu/java/net/DefaultContentHandlerFactory.java
index e3d1b8e..1d113b9 100644
--- a/libjava/classpath/gnu/java/net/DefaultContentHandlerFactory.java
+++ b/libjava/classpath/gnu/java/net/DefaultContentHandlerFactory.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -49,7 +49,7 @@ import java.util.HashSet;
class ImageHandler extends ContentHandler
{
static ImageHandler instance = new ImageHandler();
-
+
public Object getContent(URLConnection urlc) throws IOException
{
// FIXME: implement using ImageIO
@@ -80,7 +80,7 @@ public class DefaultContentHandlerFactory implements ContentHandlerFactory
"image/x-xbitmap",
"image/x-xpixmap"
};
-
+
private static HashSet imageTypes
= new HashSet(Arrays.asList(known_image_types));
diff --git a/libjava/classpath/gnu/java/net/DefaultProxySelector.java b/libjava/classpath/gnu/java/net/DefaultProxySelector.java
index 31f861e..f0215a0 100644
--- a/libjava/classpath/gnu/java/net/DefaultProxySelector.java
+++ b/libjava/classpath/gnu/java/net/DefaultProxySelector.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,13 +50,13 @@ public final class DefaultProxySelector
extends ProxySelector
{
private static final List proxies = new ArrayList();
-
+
static
{
// The default proxy selector supports only direct connections.
proxies.add(Proxy.NO_PROXY);
}
-
+
public DefaultProxySelector()
{
// Do nothing by default.
@@ -69,7 +69,7 @@ public final class DefaultProxySelector
// Do nothing by default.
}
-
+
public List select(URI uri)
{
if (uri == null)
diff --git a/libjava/classpath/gnu/java/net/EmptyX509TrustManager.java b/libjava/classpath/gnu/java/net/EmptyX509TrustManager.java
index b8faf41..466b49e 100644
--- a/libjava/classpath/gnu/java/net/EmptyX509TrustManager.java
+++ b/libjava/classpath/gnu/java/net/EmptyX509TrustManager.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -67,4 +67,3 @@ public class EmptyX509TrustManager
return new X509Certificate[0];
}
}
-
diff --git a/libjava/classpath/gnu/java/net/GetLocalHostAction.java b/libjava/classpath/gnu/java/net/GetLocalHostAction.java
index fa76015..1e18877 100644
--- a/libjava/classpath/gnu/java/net/GetLocalHostAction.java
+++ b/libjava/classpath/gnu/java/net/GetLocalHostAction.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -62,4 +62,3 @@ public class GetLocalHostAction
}
}
}
-
diff --git a/libjava/classpath/gnu/java/net/HeaderFieldHelper.java b/libjava/classpath/gnu/java/net/HeaderFieldHelper.java
index a8d13ce..ca3b9d2 100644
--- a/libjava/classpath/gnu/java/net/HeaderFieldHelper.java
+++ b/libjava/classpath/gnu/java/net/HeaderFieldHelper.java
@@ -1,4 +1,4 @@
-/* HeaderFieldHelper.java -- Helps manage headers fields
+/* HeaderFieldHelper.java -- Helps manage headers fields
Copyright (C) 1998, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -105,12 +105,12 @@ public class HeaderFieldHelper
try
{
- value = headerFieldValues.elementAt(headerFieldKeys.indexOf(key));
+ value = headerFieldValues.elementAt(headerFieldKeys.indexOf(key));
}
catch (ArrayIndexOutOfBoundsException e)
{
}
-
+
return value;
}
@@ -121,8 +121,8 @@ public class HeaderFieldHelper
for (int index = 0; index < max; index++)
{
- headers.put(headerFieldKeys.elementAt(index),
- headerFieldValues.elementAt(index));
+ headers.put(headerFieldKeys.elementAt(index),
+ headerFieldValues.elementAt(index));
}
return headers;
@@ -134,4 +134,3 @@ public class HeaderFieldHelper
}
} // class HeaderFieldHelper
-
diff --git a/libjava/classpath/gnu/java/net/IndexListParser.java b/libjava/classpath/gnu/java/net/IndexListParser.java
index 2d90ceb..bf274b1 100644
--- a/libjava/classpath/gnu/java/net/IndexListParser.java
+++ b/libjava/classpath/gnu/java/net/IndexListParser.java
@@ -1,4 +1,4 @@
-/* IndexListParser.java --
+/* IndexListParser.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,11 +47,11 @@ import java.util.Set;
import java.util.jar.JarFile;
/**
- * The INDEX.LIST file contains sections each separated by a blank line.
+ * The INDEX.LIST file contains sections each separated by a blank line.
* Each section defines the content of a jar, with a
* header defining the jar file path name, followed by a list of paths.
* The jar file paths are relative to the codebase of the root jar.
- *
+ *
Specification
index file : version-info blankline section*
version-info : JarIndex-Version: version-number
@@ -60,7 +60,7 @@ import java.util.jar.JarFile;
body : header name*
header : char+.jar newline
name : char+ newline
-
+
* @author langel at redhat dot com
*/
public class IndexListParser
@@ -73,10 +73,10 @@ public class IndexListParser
// This is intentionally kept in insertion order.
LinkedHashMap> prefixes
= new LinkedHashMap>();
-
+
/**
* Parses the given jarfile's INDEX.LIST file if it exists.
- *
+ *
* @param jarfile - the given jar file
* @param baseJarURL - the codebase of the jar file
* @param baseURL - the base url for the headers
@@ -90,13 +90,13 @@ public class IndexListParser
{
BufferedReader br = new BufferedReader(new InputStreamReader(new URL(baseJarURL,
JAR_INDEX_FILE).openStream()));
-
+
// Must start with version info
String line = br.readLine();
if (!line.startsWith(JAR_INDEX_VERSION_KEY))
return;
versionNumber = Double.parseDouble(line.substring(JAR_INDEX_VERSION_KEY.length()).trim());
-
+
// Blank line must be next
line = br.readLine();
if (! "".equals(line))
@@ -104,13 +104,13 @@ public class IndexListParser
clearAll();
return;
}
-
+
// May contain sections.
while ((line = br.readLine()) != null)
{
URL jarURL = new URL(baseURL, line);
HashSet values = new HashSet();
-
+
// Read the names in the section.
while ((line = br.readLine()) != null)
{
@@ -138,7 +138,7 @@ public class IndexListParser
clearAll();
}
}
-
+
/**
* Clears all the variables. This is called when parsing fails.
*/
@@ -147,33 +147,33 @@ public class IndexListParser
versionNumber = 0;
prefixes = null;
}
-
+
/**
* Gets the version info for the file.
- *
+ *
* @return the version info.
*/
public String getVersionInfo()
{
return JAR_INDEX_VERSION_KEY + getVersionNumber();
}
-
+
/**
* Gets the version number of the file.
- *
+ *
* @return the version number.
*/
public double getVersionNumber()
{
return versionNumber;
}
-
+
/**
* Gets the map of all the headers found in the file.
* The keys in the map are URLs of jars. The values in the map
* are Sets of package prefixes (and top-level file names), as
* specifed in INDEX.LIST.
- *
+ *
* @return an map of all the headers, or null if no INDEX.LIST was found
*/
public LinkedHashMap> getHeaders()
diff --git a/libjava/classpath/gnu/java/net/LineInputStream.java b/libjava/classpath/gnu/java/net/LineInputStream.java
index da307db..8bd4b69 100644
--- a/libjava/classpath/gnu/java/net/LineInputStream.java
+++ b/libjava/classpath/gnu/java/net/LineInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -56,7 +56,7 @@ public class LineInputStream
* The underlying input stream.
*/
protected InputStream in;
-
+
/*
* Line buffer.
*/
@@ -112,7 +112,7 @@ public class LineInputStream
{
return in.read(buf);
}
-
+
public int read(byte[] buf, int off, int len)
throws IOException
{
@@ -221,4 +221,3 @@ public class LineInputStream
return -1;
}
}
-
diff --git a/libjava/classpath/gnu/java/net/PlainDatagramSocketImpl.java b/libjava/classpath/gnu/java/net/PlainDatagramSocketImpl.java
index a84525e..639c9ff 100644
--- a/libjava/classpath/gnu/java/net/PlainDatagramSocketImpl.java
+++ b/libjava/classpath/gnu/java/net/PlainDatagramSocketImpl.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -69,19 +69,19 @@ import java.nio.ByteBuffer;
public final class PlainDatagramSocketImpl extends DatagramSocketImpl
{
private final VMChannel channel;
-
+
/**
* The platform-specific socket implementation.
*/
private final VMPlainSocketImpl impl;
-
+
/**
- * Lock object to serialize threads wanting to receive
+ * Lock object to serialize threads wanting to receive
*/
private final Object RECEIVE_LOCK = new Object();
-
+
/**
- * Lock object to serialize threads wanting to send
+ * Lock object to serialize threads wanting to send
*/
private final Object SEND_LOCK = new Object();
@@ -99,7 +99,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl
synchronized (this)
{
if (channel.getState().isValid())
- close();
+ close();
}
super.finalize();
}*/
diff --git a/libjava/classpath/gnu/java/net/PlainSocketImpl.java b/libjava/classpath/gnu/java/net/PlainSocketImpl.java
index 5bda0a5..72db531 100644
--- a/libjava/classpath/gnu/java/net/PlainSocketImpl.java
+++ b/libjava/classpath/gnu/java/net/PlainSocketImpl.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -93,13 +93,13 @@ public class PlainSocketImpl extends SocketImpl
* is being invoked on this socket.
*/
private boolean inChannelOperation;
-
+
/**
* The socket channel we use for IO operation. Package-private for
* use by inner classes.
*/
SocketChannelImpl channel;
-
+
/**
* Indicates whether we should ignore whether any associated
* channel is set to non-blocking mode. Certain operations
@@ -111,7 +111,7 @@ public class PlainSocketImpl extends SocketImpl
{
return inChannelOperation;
}
-
+
/**
* Sets our indicator of whether an I/O operation is being
* initiated by a channel.
@@ -120,7 +120,7 @@ public class PlainSocketImpl extends SocketImpl
{
inChannelOperation = b;
}
-
+
/**
* Default do nothing constructor.
*/
@@ -149,7 +149,7 @@ public class PlainSocketImpl extends SocketImpl
case SO_BROADCAST:
case SO_KEEPALIVE:
case SO_OOBINLINE:
- case TCP_NODELAY:
+ case TCP_NODELAY:
case IP_TOS:
case SO_RCVBUF:
case SO_SNDBUF:
@@ -188,7 +188,7 @@ public class PlainSocketImpl extends SocketImpl
throw se;
}
}
-
+
// This filters options which are invalid for TCP.
switch (optionId)
{
@@ -197,7 +197,7 @@ public class PlainSocketImpl extends SocketImpl
case SO_BROADCAST:
case SO_KEEPALIVE:
case SO_OOBINLINE:
- case TCP_NODELAY:
+ case TCP_NODELAY:
case IP_TOS:
case SO_RCVBUF:
case SO_SNDBUF:
@@ -207,7 +207,7 @@ public class PlainSocketImpl extends SocketImpl
default:
throw new SocketException("Unrecognized TCP option: " + optionId);
}
-
+
}
public void shutdownInput() throws IOException
@@ -281,10 +281,10 @@ public class PlainSocketImpl extends SocketImpl
boolean connected = channel.connect(address, timeout);
if (!connected)
throw new SocketTimeoutException("connect timed out");
-
+
// Using the given SocketAddress is important to preserve
// hostnames given by the caller.
- InetSocketAddress addr = (InetSocketAddress) address;
+ InetSocketAddress addr = (InetSocketAddress) address;
this.address = addr.getAddress();
this.port = addr.getPort();
}
@@ -314,7 +314,7 @@ public class PlainSocketImpl extends SocketImpl
* number, additional connections will be refused.
*
* @param queuelen The length of the pending connection queue
- *
+ *
* @throws IOException If an error occurs
*/
protected synchronized void listen(int queuelen)
@@ -324,7 +324,7 @@ public class PlainSocketImpl extends SocketImpl
}
/**
- * Accepts a new connection on this socket and returns in in the
+ * Accepts a new connection on this socket and returns in in the
* passed in SocketImpl.
*
* @param impl The SocketImpl object to accept this connection.
@@ -349,7 +349,7 @@ public class PlainSocketImpl extends SocketImpl
/**
* Returns the number of bytes that the caller can read from this socket
- * without blocking.
+ * without blocking.
*
* @return the number of readable bytes before blocking
*
@@ -377,7 +377,7 @@ public class PlainSocketImpl extends SocketImpl
{
if (impl.getState().isValid())
impl.close();
-
+
address = null;
port = -1;
}
@@ -418,7 +418,7 @@ public class PlainSocketImpl extends SocketImpl
return out;
}
-
+
public VMChannel getVMChannel()
{
if (channel == null)
@@ -433,7 +433,7 @@ public class PlainSocketImpl extends SocketImpl
{
if (channel == null)
return null;
-
+
try
{
InetSocketAddress remote = channel.getVMChannel().getPeerAddress();
@@ -444,7 +444,7 @@ public class PlainSocketImpl extends SocketImpl
// was created by the native layer (this preserves exact hostnames).
if (address != null)
return address;
-
+
return remote.getAddress();
}
catch (IOException ioe)
@@ -472,7 +472,7 @@ public class PlainSocketImpl extends SocketImpl
return -1;
}
}
-
+
public InetSocketAddress getLocalAddress()
{
if (channel == null)
@@ -494,7 +494,7 @@ public class PlainSocketImpl extends SocketImpl
{
if (channel == null)
return -1;
-
+
try
{
InetSocketAddress remote = channel.getVMChannel().getPeerAddress();
@@ -509,7 +509,7 @@ public class PlainSocketImpl extends SocketImpl
}
/**
- * This class contains an implementation of InputStream for
+ * This class contains an implementation of InputStream for
* sockets. It in an internal only class used by PlainSocketImpl.
*
* @author Nic Ferrier
@@ -536,7 +536,7 @@ public class PlainSocketImpl extends SocketImpl
}
/**
- * Reads the next byte of data and returns it as an int.
+ * Reads the next byte of data and returns it as an int.
*
* @return The byte read (as an int) or -1 if end of stream);
*
@@ -599,8 +599,8 @@ public class PlainSocketImpl extends SocketImpl
}
/**
- * This class is used internally by PlainSocketImpl to be the
- * OutputStream subclass returned by its
+ * This class is used internally by PlainSocketImpl to be the
+ * OutputStream subclass returned by its
* getOutputStream method. It expects only to be used in that
* context.
*
@@ -623,7 +623,7 @@ public class PlainSocketImpl extends SocketImpl
/**
* Writes a byte (passed in as an int) to the given output stream
- *
+ *
* @param b The byte to write
*
* @exception IOException If an error occurs
diff --git a/libjava/classpath/gnu/java/net/loader/FileResource.java b/libjava/classpath/gnu/java/net/loader/FileResource.java
index 8071bbf..4715840 100644
--- a/libjava/classpath/gnu/java/net/loader/FileResource.java
+++ b/libjava/classpath/gnu/java/net/loader/FileResource.java
@@ -79,4 +79,4 @@ public final class FileResource extends Resource
throw ie;
}
}
-}
\ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/java/net/loader/FileURLLoader.java b/libjava/classpath/gnu/java/net/loader/FileURLLoader.java
index 39d33a4..58b6dcf 100644
--- a/libjava/classpath/gnu/java/net/loader/FileURLLoader.java
+++ b/libjava/classpath/gnu/java/net/loader/FileURLLoader.java
@@ -66,7 +66,7 @@ public final class FileURLLoader extends URLLoader
/** get resource with the name "name" in the file url */
public Resource getResource(String name)
{
- try
+ try
{
// Make sure that all components in name are valid by walking through
// them
@@ -91,7 +91,7 @@ public final class FileURLLoader extends URLLoader
* directory or a non directory component (plain file, symbolic link, ...).
* An empty or null path is valid. Pathnames components are separated by
* File.separatorChar
- *
+ *
* @param resourceFileName the name to be checked for validity.
* @return the canonical file pointed by the resourceFileName or null if the
* walking failed
@@ -108,30 +108,30 @@ public final class FileURLLoader extends URLLoader
for (int i = 0; i < tokenCount - 1; i++)
{
String currentToken = stringTokenizer.nextToken();
-
+
// If we are at the root directory and trying to go up, the walking is
// finished with an error
if ("..".equals(currentToken) && currentFile.equals(dir))
return null;
-
+
currentFile = new File(currentFile, currentToken);
// If the current file doesn't exist or is not a directory, the walking is
// finished with an error
if (! (currentFile.exists() && currentFile.isDirectory()))
return null;
-
+
}
-
+
// Treat the last token differently, if it exists, because it does not need
// to be a directory
if (tokenCount > 0)
{
String currentToken = stringTokenizer.nextToken();
-
+
if ("..".equals(currentToken) && currentFile.equals(dir))
return null;
-
+
currentFile = new File(currentFile, currentToken);
// If the current file doesn't exist, the walking is
@@ -139,7 +139,7 @@ public final class FileURLLoader extends URLLoader
if (! currentFile.exists())
return null;
}
-
+
return currentFile.getCanonicalFile();
}
-}
\ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/java/net/loader/JarURLLoader.java b/libjava/classpath/gnu/java/net/loader/JarURLLoader.java
index 40194be..6f06ad3 100644
--- a/libjava/classpath/gnu/java/net/loader/JarURLLoader.java
+++ b/libjava/classpath/gnu/java/net/loader/JarURLLoader.java
@@ -83,7 +83,7 @@ public final class JarURLLoader extends URLLoader
{
jarfile =
((JarURLConnection) baseJarURL.openConnection()).getJarFile();
-
+
Manifest manifest;
Attributes attributes;
String classPathString;
@@ -124,12 +124,12 @@ public final class JarURLLoader extends URLLoader
else if ((manifest = jarfile.getManifest()) != null
&& (attributes = manifest.getMainAttributes()) != null
&& ((classPathString
- = attributes.getValue(Attributes.Name.CLASS_PATH))
+ = attributes.getValue(Attributes.Name.CLASS_PATH))
!= null))
{
this.classPath = new ArrayList();
StringTokenizer st = new StringTokenizer(classPathString, " ");
- while (st.hasMoreElements ())
+ while (st.hasMoreElements ())
{
String e = st.nextToken ();
try
diff --git a/libjava/classpath/gnu/java/net/loader/JarURLResource.java b/libjava/classpath/gnu/java/net/loader/JarURLResource.java
index a9db5ce..1dec92f 100644
--- a/libjava/classpath/gnu/java/net/loader/JarURLResource.java
+++ b/libjava/classpath/gnu/java/net/loader/JarURLResource.java
@@ -91,4 +91,4 @@ public final class JarURLResource extends Resource
throw ie;
}
}
-}
\ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/java/net/loader/RemoteResource.java b/libjava/classpath/gnu/java/net/loader/RemoteResource.java
index f180315..dc33b66 100644
--- a/libjava/classpath/gnu/java/net/loader/RemoteResource.java
+++ b/libjava/classpath/gnu/java/net/loader/RemoteResource.java
@@ -75,4 +75,4 @@ public final class RemoteResource extends Resource
{
return url;
}
-}
\ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/java/net/loader/RemoteURLLoader.java b/libjava/classpath/gnu/java/net/loader/RemoteURLLoader.java
index f044740..81ef34f 100644
--- a/libjava/classpath/gnu/java/net/loader/RemoteURLLoader.java
+++ b/libjava/classpath/gnu/java/net/loader/RemoteURLLoader.java
@@ -98,4 +98,4 @@ public final class RemoteURLLoader extends URLLoader
return null;
}
}
-}
\ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/java/net/loader/Resource.java b/libjava/classpath/gnu/java/net/loader/Resource.java
index e367a33..53720b0 100644
--- a/libjava/classpath/gnu/java/net/loader/Resource.java
+++ b/libjava/classpath/gnu/java/net/loader/Resource.java
@@ -107,4 +107,4 @@ public abstract class Resource
* this resource can be loaded.
*/
public abstract InputStream getInputStream() throws IOException;
-}
\ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/java/net/loader/URLLoader.java b/libjava/classpath/gnu/java/net/loader/URLLoader.java
index 5b9b674..337564f 100644
--- a/libjava/classpath/gnu/java/net/loader/URLLoader.java
+++ b/libjava/classpath/gnu/java/net/loader/URLLoader.java
@@ -145,4 +145,4 @@ public abstract class URLLoader
{
return null;
}
-}
\ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/file/Connection.java b/libjava/classpath/gnu/java/net/protocol/file/Connection.java
index 04278d4..80155af 100644
--- a/libjava/classpath/gnu/java/net/protocol/file/Connection.java
+++ b/libjava/classpath/gnu/java/net/protocol/file/Connection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -89,7 +89,7 @@ public class Connection extends URLConnection
SystemProperties.getProperty("line.separator");
}
-
+
/**
* This is a File object for this connection
*/
@@ -109,7 +109,7 @@ public class Connection extends URLConnection
* OutputStream if we are writing to the file
*/
private OutputStream outputStream;
-
+
/**
* FilePermission to read the file
*/
@@ -124,7 +124,7 @@ public class Connection extends URLConnection
permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION);
}
-
+
/**
* Unquote "%" + hex quotes characters
*
@@ -146,38 +146,38 @@ public class Connection extends URLConnection
int pos = 0;
for (int i = 0; i < str.length(); i++)
{
- char c = str.charAt(i);
- if (c == '%')
- {
- if (i + 2 >= str.length())
- throw new MalformedURLException(str + " : Invalid quoted character");
- int hi = Character.digit(str.charAt(++i), 16);
- int lo = Character.digit(str.charAt(++i), 16);
- if (lo < 0 || hi < 0)
- throw new MalformedURLException(str + " : Invalid quoted character");
- buf[pos++] = (byte) (hi * 16 + lo);
- }
- else if (c > 127) {
- try {
- byte [] c_as_bytes = Character.toString(c).getBytes("utf-8");
- final int c_length = c_as_bytes.length;
- System.arraycopy(c_as_bytes, 0, buf, pos, c_length);
- pos += c_length;
- }
- catch (java.io.UnsupportedEncodingException x2) {
- throw (Error) new InternalError().initCause(x2);
- }
- }
- else
- buf[pos++] = (byte) c;
+ char c = str.charAt(i);
+ if (c == '%')
+ {
+ if (i + 2 >= str.length())
+ throw new MalformedURLException(str + " : Invalid quoted character");
+ int hi = Character.digit(str.charAt(++i), 16);
+ int lo = Character.digit(str.charAt(++i), 16);
+ if (lo < 0 || hi < 0)
+ throw new MalformedURLException(str + " : Invalid quoted character");
+ buf[pos++] = (byte) (hi * 16 + lo);
+ }
+ else if (c > 127) {
+ try {
+ byte [] c_as_bytes = Character.toString(c).getBytes("utf-8");
+ final int c_length = c_as_bytes.length;
+ System.arraycopy(c_as_bytes, 0, buf, pos, c_length);
+ pos += c_length;
+ }
+ catch (java.io.UnsupportedEncodingException x2) {
+ throw (Error) new InternalError().initCause(x2);
+ }
+ }
+ else
+ buf[pos++] = (byte) c;
}
try
{
- return new String(buf, 0, pos, "utf-8");
+ return new String(buf, 0, pos, "utf-8");
}
catch (java.io.UnsupportedEncodingException x2)
{
- throw (Error) new InternalError().initCause(x2);
+ throw (Error) new InternalError().initCause(x2);
}
}
@@ -189,30 +189,30 @@ public class Connection extends URLConnection
// Call is ignored if already connected.
if (connected)
return;
-
+
// If not connected, then file needs to be openned.
file = new File (unquote(getURL().getFile()));
if (! file.isDirectory())
{
- if (doInput)
- inputStream = new BufferedInputStream(new FileInputStream(file));
-
- if (doOutput)
- outputStream = new BufferedOutputStream(new FileOutputStream(file));
+ if (doInput)
+ inputStream = new BufferedInputStream(new FileInputStream(file));
+
+ if (doOutput)
+ outputStream = new BufferedOutputStream(new FileOutputStream(file));
}
else
{
- if (doInput)
- {
+ if (doInput)
+ {
inputStream = new ByteArrayInputStream(getDirectoryListing());
- }
+ }
- if (doOutput)
- throw new ProtocolException
- ("file: protocol does not support output on directories");
+ if (doOutput)
+ throw new ProtocolException
+ ("file: protocol does not support output on directories");
}
-
+
connected = true;
}
@@ -228,9 +228,9 @@ public class Connection extends URLConnection
ByteArrayOutputStream sink = new ByteArrayOutputStream();
// NB uses default character encoding for this system
Writer writer = new OutputStreamWriter(sink);
-
+
String[] files = file.list();
-
+
for (int i = 0; i < files.length; i++)
{
writer.write(files[i]);
@@ -239,9 +239,9 @@ public class Connection extends URLConnection
directoryListing = sink.toByteArray();
}
- return directoryListing;
+ return directoryListing;
}
-
+
/**
* Opens the file for reading and returns a stream for it.
*
@@ -254,10 +254,10 @@ public class Connection extends URLConnection
{
if (!doInput)
throw new ProtocolException("Can't open InputStream if doInput is false");
-
+
if (!connected)
connect();
-
+
return inputStream;
}
@@ -273,11 +273,11 @@ public class Connection extends URLConnection
{
if (!doOutput)
throw new
- ProtocolException("Can't open OutputStream if doOutput is false");
+ ProtocolException("Can't open OutputStream if doOutput is false");
if (!connected)
connect();
-
+
return outputStream;
}
@@ -290,30 +290,30 @@ public class Connection extends URLConnection
{
try
{
- if (!connected)
- connect();
+ if (!connected)
+ connect();
- return file.lastModified();
+ return file.lastModified();
}
catch (IOException e)
{
- return -1;
+ return -1;
}
}
-
+
/**
- * Get an http-style header field. Just handle a few common ones.
+ * Get an http-style header field. Just handle a few common ones.
*/
public String getHeaderField(String field)
{
try
{
- if (!connected)
- connect();
+ if (!connected)
+ connect();
- if (field.equals("content-type"))
+ if (field.equals("content-type"))
return guessContentTypeFromName(file.getName());
- else if (field.equals("content-length"))
+ else if (field.equals("content-length"))
{
if (file.isDirectory())
{
@@ -321,14 +321,14 @@ public class Connection extends URLConnection
}
return Long.toString(file.length());
}
- else if (field.equals("last-modified"))
- {
- synchronized (StaticData.dateFormat)
- {
- return StaticData.dateFormat.format(
+ else if (field.equals("last-modified"))
+ {
+ synchronized (StaticData.dateFormat)
+ {
+ return StaticData.dateFormat.format(
new Date(file.lastModified()));
- }
- }
+ }
+ }
}
catch (IOException e)
{
@@ -346,21 +346,21 @@ public class Connection extends URLConnection
{
try
{
- if (!connected)
- connect();
-
+ if (!connected)
+ connect();
+
if (file.isDirectory())
{
return getDirectoryListing().length;
}
- return (int) file.length();
+ return (int) file.length();
}
catch (IOException e)
{
- return -1;
+ return -1;
}
}
-
+
/**
* This method returns a Permission object representing the
* permissions required to access this URL. This method returns a
diff --git a/libjava/classpath/gnu/java/net/protocol/file/Handler.java b/libjava/classpath/gnu/java/net/protocol/file/Handler.java
index fc56049..58ebe4c 100644
--- a/libjava/classpath/gnu/java/net/protocol/file/Handler.java
+++ b/libjava/classpath/gnu/java/net/protocol/file/Handler.java
@@ -76,14 +76,14 @@ public class Handler extends URLStreamHandler
String host = url.getHost();
if ((host != null) && (! host.equals("")))
{
- // Reset the protocol (and implicitly the handler) for this URL.
- // Then have the URL attempt the connection again, as it will
- // get the changed handler the next time around.
- // If the ftp protocol handler is not installed, an
- // exception will be thrown from the new openConnection() call.
- setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
- url.getRef());
- return url.openConnection();
+ // Reset the protocol (and implicitly the handler) for this URL.
+ // Then have the URL attempt the connection again, as it will
+ // get the changed handler the next time around.
+ // If the ftp protocol handler is not installed, an
+ // exception will be thrown from the new openConnection() call.
+ setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
+ url.getRef());
+ return url.openConnection();
}
return new Connection(url);
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/ActiveModeDTP.java b/libjava/classpath/gnu/java/net/protocol/ftp/ActiveModeDTP.java
index aa3c412..1ed31b8 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/ActiveModeDTP.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/ActiveModeDTP.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -128,7 +128,7 @@ final class ActiveModeDTP
}
acceptThread = null;
}
-
+
/**
* Returns an input stream from which a remote file can be read.
*/
@@ -213,7 +213,7 @@ final class ActiveModeDTP
transferComplete();
return inProgress;
}
-
+
public void transferComplete()
{
if (socket == null)
@@ -247,6 +247,5 @@ final class ActiveModeDTP
}
}
}
-
-}
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/BlockInputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/BlockInputStream.java
index 63897f1..09915e7 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/BlockInputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/BlockInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -147,4 +147,3 @@ class BlockInputStream
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/BlockOutputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/BlockOutputStream.java
index 85481c9..d181f9d 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/BlockOutputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/BlockOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -108,4 +108,3 @@ class BlockOutputStream
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/CompressedInputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/CompressedInputStream.java
index f2e65b7..638d780 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/CompressedInputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/CompressedInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -133,13 +133,13 @@ class CompressedInputStream
n--;
return c;
}
-
+
public int read(byte[] buf)
throws IOException
{
return read(buf, 0, buf.length);
}
-
+
public int read(byte[] buf, int off, int len)
throws IOException
{
@@ -186,7 +186,7 @@ class CompressedInputStream
return l;
*/
}
-
+
/**
* Reads the block header.
*/
@@ -212,4 +212,3 @@ class CompressedInputStream
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/CompressedOutputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/CompressedOutputStream.java
index b960fb3..ec3aef9 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/CompressedOutputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/CompressedOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -57,7 +57,7 @@ class CompressedOutputStream
{
super(dtp, out);
}
-
+
/**
* Just one byte cannot be compressed.
* It takes 5 bytes to transmit - hardly very compressed!
@@ -190,7 +190,7 @@ class CompressedOutputStream
System.arraycopy(buf, 0, ret, 3, pos);
return ret;
}
-
+
int flush_compressed(byte[] buf, int pos, int count, byte c)
{
buf[pos++] = (byte) (0x80 | count);
@@ -225,4 +225,3 @@ class CompressedOutputStream
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/DTP.java b/libjava/classpath/gnu/java/net/protocol/ftp/DTP.java
index 25580af..9ba4b7c 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/DTP.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/DTP.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -89,4 +89,3 @@ interface DTP
void transferComplete();
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/DTPInputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/DTPInputStream.java
index 363a559..7280b01 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/DTPInputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/DTPInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -74,7 +74,7 @@ abstract class DTPInputStream
{
transferComplete = flag;
}
-
+
/**
* Notifies the controlling DTP that this stream has completed transfer.
*/
@@ -85,4 +85,3 @@ abstract class DTPInputStream
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/DTPOutputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/DTPOutputStream.java
index 83f0be1..105c6f0 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/DTPOutputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/DTPOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/FTPConnection.java b/libjava/classpath/gnu/java/net/protocol/ftp/FTPConnection.java
index 98e8a86..4e253fc 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/FTPConnection.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/FTPConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -125,7 +125,7 @@ public class FTPConnection
protected static final String STAT = "STAT";
protected static final String HELP = "HELP";
protected static final String NOOP = "NOOP";
-
+
protected static final String AUTH = "AUTH";
protected static final String PBSZ = "PBSZ";
protected static final String PROT = "PROT";
@@ -211,7 +211,7 @@ public class FTPConnection
{
this(hostname, -1, 0, 0, false);
}
-
+
/**
* Creates a new connection to the server.
* @param hostname the hostname of the server to connect to
@@ -242,7 +242,7 @@ public class FTPConnection
{
port = FTP_PORT;
}
-
+
// Set up socket
socket = new Socket();
InetSocketAddress address = new InetSocketAddress(hostname, port);
@@ -258,7 +258,7 @@ public class FTPConnection
{
socket.setSoTimeout(timeout);
}
-
+
InputStream in = socket.getInputStream();
in = new BufferedInputStream(in);
in = new CRLFInputStream(in);
@@ -266,7 +266,7 @@ public class FTPConnection
OutputStream out = socket.getOutputStream();
out = new BufferedOutputStream(out);
this.out = new CRLFOutputStream(out);
-
+
// Read greeting
FTPResponse response = getResponse();
switch (response.getCode())
@@ -277,7 +277,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Authenticate using the specified username and password.
* If the username suffices for the server, the password will not be used
@@ -331,7 +331,7 @@ public class FTPConnection
{
return starttls(confidential, new EmptyX509TrustManager());
}
-
+
/**
* Negotiates TLS over the current connection.
* See IETF draft-murray-auth-ftp-ssl-15.txt for details.
@@ -351,7 +351,7 @@ public class FTPConnection
TrustManager[] trust = new TrustManager[] { tm };
context.init(null, trust, null);
SSLSocketFactory factory = context.getSocketFactory();
-
+
send(AUTH + ' ' + TLS);
FTPResponse response = getResponse();
switch (response.getCode())
@@ -367,7 +367,7 @@ public class FTPConnection
default:
throw new FTPException(response);
}
-
+
String hostname = socket.getInetAddress().getHostName();
int port = socket.getPort();
SSLSocket ss =
@@ -403,7 +403,7 @@ public class FTPConnection
default:
throw new FTPException(response);
}
-
+
if (confidential)
{
// Set up streams
@@ -422,7 +422,7 @@ public class FTPConnection
return false;
}
}
-
+
/**
* Changes directory to the specified path.
* @param path an absolute or relative pathname
@@ -447,7 +447,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Changes directory to the parent of the current working directory.
* @return true on success, false otherwise
@@ -521,7 +521,7 @@ public class FTPConnection
{
}
}
-
+
/**
* Initialise the data transfer process.
*/
@@ -533,7 +533,7 @@ public class FTPConnection
dtp.complete();
dtp = null;
}
-
+
InetAddress localhost = socket.getLocalAddress();
if (passive)
{
@@ -568,7 +568,7 @@ public class FTPConnection
{
c = message.charAt((++end) + 1);
}
-
+
String address =
message.substring(start, mid1).replace(',', '.');
int port_hi =
@@ -576,7 +576,7 @@ public class FTPConnection
int port_lo =
Integer.parseInt(message.substring(mid2 + 1, end + 1));
int port = (port_hi << 8) | port_lo;
-
+
/*System.out.println("Entering passive mode: " + address +
":" + port);*/
dtp = new PassiveModeDTP(address, port, localhost,
@@ -621,7 +621,7 @@ public class FTPConnection
}
}
}
-
+
// Send PORT command
CPStringBuilder buf = new CPStringBuilder(PORT);
buf.append(' ');
@@ -657,7 +657,7 @@ public class FTPConnection
}
dtp.setTransferMode(transferMode);
}
-
+
/**
* Set passive mode.
* @param flag true if we should use passive mode, false otherwise
@@ -671,7 +671,7 @@ public class FTPConnection
initialiseDTP();
}
}
-
+
/**
* Returns the current representation type of the transfer data.
* @return TYPE_ASCII, TYPE_EBCDIC, or TYPE_BINARY
@@ -809,7 +809,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Retrieves the specified file.
* @param filename the filename of the file to retrieve
@@ -849,7 +849,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns a stream for uploading a file.
* If a file with the same filename already exists on the server, it will
@@ -903,7 +903,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* This command may be required by some servers to reserve sufficient
* storage to accommodate the new file to be transferred.
@@ -926,7 +926,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Renames a file.
* @param oldName the current name of the file
@@ -963,7 +963,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Aborts the transfer in progress.
* @return true if a transfer was in progress, false otherwise
@@ -993,7 +993,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Causes the file specified to be deleted at the server site.
* @param filename the file to delete
@@ -1015,7 +1015,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Causes the directory specified to be deleted.
* This may be an absolute or relative pathname.
@@ -1059,7 +1059,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns the current working directory.
*/
@@ -1097,7 +1097,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns a listing of information about the specified pathname.
* If the pathname specifies a directory or other group of files, the
@@ -1133,7 +1133,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns a directory listing. The pathname should specify a
* directory or other system-specific file group descriptor; a null
@@ -1179,7 +1179,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns the type of operating system at the server.
*/
@@ -1205,7 +1205,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Does nothing.
* This method can be used to ensure that the connection does not time
@@ -1316,7 +1316,7 @@ public class FTPConnection
throw new ProtocolException(line);
}
}
-
+
/*
* Parses the 3-digit numeric code at the beginning of the given line.
* Returns -1 on failure.
@@ -1350,4 +1350,3 @@ public class FTPConnection
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/FTPException.java b/libjava/classpath/gnu/java/net/protocol/ftp/FTPException.java
index 14ad381..1a7fcb8 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/FTPException.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/FTPException.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -63,7 +63,7 @@ public class FTPException
super(response.getMessage());
this.response = response;
}
-
+
/**
* Returns the response that provoked this exception.
*/
@@ -73,4 +73,3 @@ public class FTPException
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/FTPResponse.java b/libjava/classpath/gnu/java/net/protocol/ftp/FTPResponse.java
index ec72c73..2620f0d 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/FTPResponse.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/FTPResponse.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -109,4 +109,3 @@ public final class FTPResponse
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/FTPURLConnection.java b/libjava/classpath/gnu/java/net/protocol/ftp/FTPURLConnection.java
index cfad5a7..8cc1faf 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/FTPURLConnection.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/FTPURLConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -137,7 +137,7 @@ public class FTPURLConnection
connection.setTransferMode(transferMode);
}
}
-
+
/**
* This connection supports doInput.
*/
@@ -153,7 +153,7 @@ public class FTPURLConnection
{
doOutput = dooutput;
}
-
+
/**
* Returns an input stream that reads from this open connection.
*/
@@ -174,7 +174,7 @@ public class FTPURLConnection
return this.new ClosingInputStream(connection.retrieve(path));
}
}
-
+
/**
* Returns an output stream that writes to this connection.
*/
@@ -252,7 +252,7 @@ public class FTPURLConnection
l.add(value);
map.put(key, l);
}
-
+
public void setRequestProperty(String key, String value)
{
if (connected)
@@ -351,7 +351,7 @@ public class FTPURLConnection
super.close();
connection.logout();
}
-
+
}
class ClosingOutputStream
@@ -369,8 +369,7 @@ public class FTPURLConnection
super.close();
connection.logout();
}
-
+
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/Handler.java b/libjava/classpath/gnu/java/net/protocol/ftp/Handler.java
index 88491b3..7638b66 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/Handler.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/Handler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -67,4 +67,3 @@ public class Handler
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/PassiveModeDTP.java b/libjava/classpath/gnu/java/net/protocol/ftp/PassiveModeDTP.java
index 6f4fd63..a74346c 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/PassiveModeDTP.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/PassiveModeDTP.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -118,7 +118,7 @@ final class PassiveModeDTP
in.setTransferComplete(false);
return in;
}
-
+
/**
* Returns an output stream to which a local file can be written for
* upload.
@@ -147,12 +147,12 @@ final class PassiveModeDTP
out.setTransferComplete(false);
return out;
}
-
+
public void setTransferMode(int mode)
{
transferMode = mode;
}
-
+
public void complete()
{
completed = true;
@@ -198,4 +198,3 @@ final class PassiveModeDTP
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/StreamInputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/StreamInputStream.java
index 93eee4e..beee14b 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/StreamInputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/StreamInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,7 +54,7 @@ class StreamInputStream
{
super(dtp, in);
}
-
+
public int read()
throws IOException
{
@@ -92,4 +92,3 @@ class StreamInputStream
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/ftp/StreamOutputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/StreamOutputStream.java
index a6e28ec..2df1a87 100644
--- a/libjava/classpath/gnu/java/net/protocol/ftp/StreamOutputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/ftp/StreamOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,7 +54,7 @@ class StreamOutputStream
{
super(dtp, out);
}
-
+
public void write(int c)
throws IOException
{
@@ -70,7 +70,7 @@ class StreamOutputStream
{
write(b, 0, b.length);
}
-
+
public void write(byte[] b, int off, int len)
throws IOException
{
@@ -80,6 +80,5 @@ class StreamOutputStream
}
out.write(b, off, len);
}
-
-}
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Authenticator.java b/libjava/classpath/gnu/java/net/protocol/http/Authenticator.java
index 0d7c988..b4ee41e 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Authenticator.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Authenticator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,6 +54,5 @@ public interface Authenticator
* unsuccessful attempt
*/
Credentials getCredentials(String realm, int attempt);
-
-}
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java b/libjava/classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
index 35ad2bc..22a33cc 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -102,6 +102,5 @@ public class ByteArrayRequestBodyWriter
}
return len;
}
-
-}
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java b/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java
index 8a30e51..33df0df 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -158,15 +158,15 @@ public class ChunkedInputStream
}
else
{
- int canRead = Math.min(size - count, length);
- int len = in.read(buffer, offset, canRead);
- if (len == -1)
- {
- // This is an error condition but it isn't clear what we
- // should do with it.
- eof = true;
- return -1;
- }
+ int canRead = Math.min(size - count, length);
+ int len = in.read(buffer, offset, canRead);
+ if (len == -1)
+ {
+ // This is an error condition but it isn't clear what we
+ // should do with it.
+ eof = true;
+ return -1;
+ }
count += len;
if (count == size)
{
@@ -205,20 +205,19 @@ public class ChunkedInputStream
{
if (meta)
return 0;
-
+
return Math.min(in.available(), size - count);
}
/**
* This method closes the ChunkedInputStream by closing the underlying
* InputStream.
- *
+ *
* @exception IOException If an error occurs
*/
public void close() throws IOException
{
in.close();
}
-
-}
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Cookie.java b/libjava/classpath/gnu/java/net/protocol/http/Cookie.java
index 4482a12..122a23f 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Cookie.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Cookie.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -138,7 +138,7 @@ public class Cookie
{
return toString(true, true);
}
-
+
public String toString(boolean showPath, boolean showDomain)
{
CPStringBuilder buf = new CPStringBuilder();
@@ -159,4 +159,3 @@ public class Cookie
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/CookieManager.java b/libjava/classpath/gnu/java/net/protocol/http/CookieManager.java
index cc1225c..da36866 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/CookieManager.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/CookieManager.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -61,5 +61,5 @@ public interface CookieManager
* @param path the path to access
*/
Cookie[] getCookies(String host, boolean secure, String path);
-
+
}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Credentials.java b/libjava/classpath/gnu/java/net/protocol/http/Credentials.java
index 9e5fcd1..f95b4b5 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Credentials.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Credentials.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -83,6 +83,5 @@ public class Credentials
{
return password;
}
-
-}
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java
index 44b1a60..b96bf4c 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -201,7 +201,7 @@ public class HTTPConnection
this(hostname, secure ? HTTPS_PORT : HTTP_PORT, secure,
connectionTimeout, timeout);
}
-
+
/**
* Creates a new HTTP connection on the specified port.
* @param hostname the name of the host to connect to
@@ -222,7 +222,7 @@ public class HTTPConnection
{
this(hostname, port, secure, 0, 0);
}
-
+
/**
* Creates a new HTTP or HTTPS connection on the specified port.
* @param hostname the name of the host to connect to
@@ -239,7 +239,7 @@ public class HTTPConnection
{
if (connectionTimeout < 0 || timeout < 0)
throw new IllegalArgumentException();
-
+
this.hostname = hostname;
this.port = port;
this.secure = secure;
@@ -477,8 +477,8 @@ public class HTTPConnection
*/
synchronized HTTPConnection get(String host,
int port,
- boolean secure,
- int connectionTimeout, int timeout)
+ boolean secure,
+ int connectionTimeout, int timeout)
{
String ttl =
SystemProperties.getProperty("classpath.net.http.keepAliveTTL");
@@ -510,7 +510,7 @@ public class HTTPConnection
}
HTTPConnection c = null;
-
+
ListIterator it = connectionPool.listIterator(0);
while (it.hasNext())
{
@@ -584,7 +584,7 @@ public class HTTPConnection
}
}
}
-
+
/**
* The number of times this HTTPConnection has be used via keep-alive.
*/
@@ -618,7 +618,7 @@ public class HTTPConnection
{
useCount++;
pool.put(this);
-
+
}
else
{
@@ -878,7 +878,7 @@ public class HTTPConnection
}
// -- Events --
-
+
void addHandshakeCompletedListener(HandshakeCompletedListener l)
{
synchronized (handshakeCompletedListeners)
@@ -895,4 +895,3 @@ public class HTTPConnection
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/HTTPDateFormat.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPDateFormat.java
index 2f59e43..743f8e8e 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/HTTPDateFormat.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/HTTPDateFormat.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -145,7 +145,7 @@ public class HTTPDateFormat
// Get time offset in minutes
int zoneOffset =(calendar.get(Calendar.ZONE_OFFSET) +
calendar.get(Calendar.DST_OFFSET)) / 60000;
-
+
// Apply + or - appropriately
if (zoneOffset < 0)
{
@@ -156,7 +156,7 @@ public class HTTPDateFormat
{
buf.append('+');
}
-
+
// Set the 2 2-char fields as specified above
int tzhours = zoneOffset / 60;
buf.append(Character.forDigit(tzhours / 10, 10));
@@ -340,14 +340,14 @@ public class HTTPDateFormat
}
second = Integer.parseInt(text.substring(start, end));
}
-
+
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DAY_OF_MONTH, date);
calendar.set(Calendar.HOUR, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
-
+
if (end != len)
{
// Timezone
@@ -380,7 +380,7 @@ public class HTTPDateFormat
}
}
pos.setIndex(end);
-
+
return calendar.getTime();
}
catch (NumberFormatException e)
@@ -400,7 +400,7 @@ public class HTTPDateFormat
{
pos++;
}
- return pos;
+ return pos;
}
private int skipNonWhitespace(String text, int pos)
@@ -409,7 +409,7 @@ public class HTTPDateFormat
{
pos++;
}
- return pos;
+ return pos;
}
private int skipTo(String text, int pos, char c)
@@ -418,7 +418,7 @@ public class HTTPDateFormat
{
pos++;
}
- return pos;
+ return pos;
}
/**
@@ -438,4 +438,3 @@ public class HTTPDateFormat
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
index b31f426..9ba5c47 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -151,7 +151,7 @@ public class HTTPURLConnection
}
final Credentials creds = (username == null) ? null :
new Credentials (username, password);
-
+
if ("POST".equals(method))
{
String contentType = requestHeaders.getValue("Content-Type");
@@ -241,113 +241,113 @@ public class HTTPURLConnection
throw ioe;
}
}
-
+
if (response.isRedirect() && getInstanceFollowRedirects())
{
- // Read the response body, if there is one. If the
- // redirect points us back at the same server, we will use
- // the cached connection, so we must make sure there is no
- // pending data in it.
+ // Read the response body, if there is one. If the
+ // redirect points us back at the same server, we will use
+ // the cached connection, so we must make sure there is no
+ // pending data in it.
InputStream body = response.getBody();
- if (body != null)
- {
- byte[] ignore = new byte[1024];
- while (true)
- {
- int n = body.read(ignore, 0, ignore.length);
- if (n == -1)
- break;
- }
- }
+ if (body != null)
+ {
+ byte[] ignore = new byte[1024];
+ while (true)
+ {
+ int n = body.read(ignore, 0, ignore.length);
+ if (n == -1)
+ break;
+ }
+ }
// Follow redirect
String location = response.getHeader("Location");
- if (location != null)
- {
- String connectionUri = connection.getURI();
- int start = connectionUri.length();
- if (location.startsWith(connectionUri) &&
- location.charAt(start) == '/')
- {
- file = location.substring(start);
- retry = true;
- }
- else if (location.startsWith("http:"))
- {
- connection.close();
- connection = null;
- secure = false;
- start = 7;
- int end = location.indexOf('/', start);
+ if (location != null)
+ {
+ String connectionUri = connection.getURI();
+ int start = connectionUri.length();
+ if (location.startsWith(connectionUri) &&
+ location.charAt(start) == '/')
+ {
+ file = location.substring(start);
+ retry = true;
+ }
+ else if (location.startsWith("http:"))
+ {
+ connection.close();
+ connection = null;
+ secure = false;
+ start = 7;
+ int end = location.indexOf('/', start);
if (end == -1)
end = location.length();
- host = location.substring(start, end);
- int ci = host.lastIndexOf(':');
- if (ci != -1)
- {
- port = Integer.parseInt(host.substring (ci + 1));
- host = host.substring(0, ci);
- }
- else
- {
- port = HTTPConnection.HTTP_PORT;
- }
- file = location.substring(end);
- retry = true;
- }
- else if (location.startsWith("https:"))
- {
- connection.close();
- connection = null;
- secure = true;
- start = 8;
- int end = location.indexOf('/', start);
+ host = location.substring(start, end);
+ int ci = host.lastIndexOf(':');
+ if (ci != -1)
+ {
+ port = Integer.parseInt(host.substring (ci + 1));
+ host = host.substring(0, ci);
+ }
+ else
+ {
+ port = HTTPConnection.HTTP_PORT;
+ }
+ file = location.substring(end);
+ retry = true;
+ }
+ else if (location.startsWith("https:"))
+ {
+ connection.close();
+ connection = null;
+ secure = true;
+ start = 8;
+ int end = location.indexOf('/', start);
if (end == -1)
end = location.length();
- host = location.substring(start, end);
- int ci = host.lastIndexOf(':');
- if (ci != -1)
- {
- port = Integer.parseInt(host.substring (ci + 1));
- host = host.substring(0, ci);
- }
- else
- {
- port = HTTPConnection.HTTPS_PORT;
- }
- file = location.substring(end);
- retry = true;
- }
- else if (location.length() > 0)
- {
- // Malformed absolute URI, treat as file part of URI
- if (location.charAt(0) == '/')
- {
- // Absolute path
- file = location;
- }
- else
- {
- // Relative path
- int lsi = file.lastIndexOf('/');
- file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
- file += location;
- }
- retry = true;
- }
- }
+ host = location.substring(start, end);
+ int ci = host.lastIndexOf(':');
+ if (ci != -1)
+ {
+ port = Integer.parseInt(host.substring (ci + 1));
+ host = host.substring(0, ci);
+ }
+ else
+ {
+ port = HTTPConnection.HTTPS_PORT;
+ }
+ file = location.substring(end);
+ retry = true;
+ }
+ else if (location.length() > 0)
+ {
+ // Malformed absolute URI, treat as file part of URI
+ if (location.charAt(0) == '/')
+ {
+ // Absolute path
+ file = location;
+ }
+ else
+ {
+ // Relative path
+ int lsi = file.lastIndexOf('/');
+ file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
+ file += location;
+ }
+ retry = true;
+ }
+ }
}
else
{
responseSink = response.getBody();
-
+
if (response.isError())
- errorSink = responseSink;
+ errorSink = responseSink;
}
}
while (retry);
connected = true;
- }
+ }
/**
* Returns a connection, from the pool if necessary.
@@ -425,7 +425,7 @@ public class HTTPURLConnection
}
public String getRequestProperty(String key)
- {
+ {
return requestHeaders.getValue(key);
}
@@ -433,7 +433,7 @@ public class HTTPURLConnection
{
if (connected)
throw new IllegalStateException("Already connected");
-
+
Map> m = requestHeaders.getAsMap();
return Collections.unmodifiableMap(m);
}
@@ -441,7 +441,7 @@ public class HTTPURLConnection
public void setRequestProperty(String key, String value)
{
super.setRequestProperty(key, value);
-
+
requestHeaders.put(key, value);
}
@@ -477,9 +477,9 @@ public class HTTPURLConnection
}
return requestSink;
}
-
+
// -- Response --
-
+
public InputStream getInputStream()
throws IOException
{
@@ -491,17 +491,17 @@ public class HTTPURLConnection
{
throw new ProtocolException("doInput is false");
}
-
+
if (response.isError())
{
int code = response.getCode();
if (code == 404 || code == 410)
throw new FileNotFoundException(url.toString());
-
+
throw new IOException("Server returned HTTP response code " + code
+ " for URL " + url.toString());
}
-
+
return responseSink;
}
@@ -535,7 +535,7 @@ public class HTTPURLConnection
" " + response.getCode() +
" " + response.getMessage();
}
-
+
public String getHeaderField(int index)
{
if (!connected)
@@ -641,7 +641,7 @@ public class HTTPURLConnection
}
return handshakeEvent.getCipherSuite();
}
-
+
public Certificate[] getLocalCertificates()
{
if (!connected)
@@ -681,14 +681,13 @@ public class HTTPURLConnection
super.setReadTimeout(timeout);
if (connection == null)
return;
- try
+ try
{
- connection.getSocket().setSoTimeout(timeout);
- }
+ connection.getSocket().setSoTimeout(timeout);
+ }
catch (IOException se)
{
- // Ignore socket exceptions.
+ // Ignore socket exceptions.
}
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Handler.java b/libjava/classpath/gnu/java/net/protocol/http/Handler.java
index 6405425..3081032 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Handler.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Handler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -70,4 +70,3 @@ public class Handler
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Headers.java b/libjava/classpath/gnu/java/net/protocol/http/Headers.java
index 690a0c6..faf5eb1 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Headers.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Headers.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -71,7 +71,7 @@ class Headers implements Iterable
*/
private final ArrayList headers
= new ArrayList();
-
+
/**
* The HTTP dateformat used to parse date header fields.
*/
@@ -111,11 +111,11 @@ class Headers implements Iterable
{
return headers.iterator();
}
-
+
/**
* Returns the value of the specified header as a string. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or null if not found.
*/
@@ -135,7 +135,7 @@ class Headers implements Iterable
/**
* Returns the value of the specified header as an integer. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or -1 if not present or
* not an integer value.
@@ -161,7 +161,7 @@ class Headers implements Iterable
/**
* Returns the value of the specified header as a long. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or -1 if not present or
* not a long value.
@@ -187,7 +187,7 @@ class Headers implements Iterable
/**
* Returns the value of the specified header as a date. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or null if not present or
* not a date value.
@@ -212,7 +212,7 @@ class Headers implements Iterable
/**
* Add a header to this set of headers. If there is an existing
* header with the same name it's value is replaced with the new value.
- * If multiple headers of the same name exist only the last one's value
+ * If multiple headers of the same name exist only the last one's value
* is replaced.
*
* @param name the header name
@@ -221,7 +221,7 @@ class Headers implements Iterable
* @see #addValue(String, String)
*/
public void put(String name, String value)
- {
+ {
for (int i = headers.size() - 1; i >= 0; i--)
{
HeaderElement e = headers.get(i);
@@ -231,14 +231,14 @@ class Headers implements Iterable
return;
}
}
-
+
// nothing was replaced so add it as new HeaderElement
addValue(name, value);
}
-
+
/**
- * Add all headers from a set of headers to this set. Any existing header
- * with the same (case insensitive) name as one of the new headers will
+ * Add all headers from a set of headers to this set. Any existing header
+ * with the same (case insensitive) name as one of the new headers will
* be overridden.
*
* @param o the headers to be added
@@ -280,7 +280,7 @@ class Headers implements Iterable
{
LineInputStream lin = (in instanceof LineInputStream) ?
(LineInputStream) in : new LineInputStream(in);
-
+
String name = null;
CPStringBuilder value = new CPStringBuilder();
while (true)
@@ -307,9 +307,9 @@ class Headers implements Iterable
if (c1 == ' ' || c1 == '\t')
{
// Continuation
- int last = len - 1;
- if (line.charAt(last) != '\r')
- ++last;
+ int last = len - 1;
+ if (line.charAt(last) != '\r')
+ ++last;
value.append(line.substring(0, last));
}
else
@@ -318,7 +318,7 @@ class Headers implements Iterable
{
addValue(name, value.toString());
}
-
+
int di = line.indexOf(':');
name = line.substring(0, di);
value.setLength(0);
@@ -327,14 +327,14 @@ class Headers implements Iterable
di++;
}
while (di < len && line.charAt(di) == ' ');
- int last = len - 1;
- if (line.charAt(last) != '\r')
- ++last;
+ int last = len - 1;
+ if (line.charAt(last) != '\r')
+ ++last;
value.append(line.substring(di, last));
}
}
}
-
+
/**
* Add a header to this set of headers. If there is an existing
@@ -352,12 +352,12 @@ class Headers implements Iterable
/**
* Get a new Map containing all the headers. The keys of the Map
- * are Strings (the header names). The headers will be included
+ * are Strings (the header names). The headers will be included
* case-sensitive in the map so that querying must be done with the
* correct case of the needed header name. The values of the Map are
* unmodifiable Lists containing Strings (the header values).
*
- *
+ *
* The returned map is modifiable. Changing it will not effect this
* collection of Headers in any way.
*
@@ -387,7 +387,7 @@ class Headers implements Iterable
}
return m;
}
-
+
/**
* Get the name of the Nth header.
*
@@ -401,7 +401,7 @@ class Headers implements Iterable
{
if (i >= headers.size() || i < 0)
return null;
-
+
return headers.get(i).name;
}
@@ -418,7 +418,7 @@ class Headers implements Iterable
{
if (i >= headers.size() || i < 0)
return null;
-
+
return headers.get(i).value;
}
}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Request.java b/libjava/classpath/gnu/java/net/protocol/http/Request.java
index 88e2fd0..534213e 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Request.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Request.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -280,14 +280,14 @@ public class Request
setHeader("Content-Length", Integer.toString(contentLength));
}
}
-
+
try
{
// Loop while authentication fails or continue
do
{
retry = false;
-
+
// Get socket output and input streams
OutputStream out = connection.getOutputStream();
@@ -314,7 +314,7 @@ public class Request
byte[] buffer = new byte[4096];
int len;
int count = 0;
-
+
requestBodyWriter.reset();
do
{
@@ -372,13 +372,13 @@ public class Request
}
return response;
}
-
+
Response readResponse(InputStream in)
throws IOException
{
String line;
int len;
-
+
// Read response status line
LineInputStream lis = new LineInputStream(in);
@@ -414,7 +414,7 @@ public class Request
responseHeaders.parse(lis);
notifyHeaderHandlers(responseHeaders);
InputStream body = null;
-
+
switch (code)
{
case 100:
@@ -459,7 +459,7 @@ public class Request
throws IOException
{
long contentLength = -1;
-
+
// Persistent connections are the default in HTTP/1.1
boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) ||
"close".equalsIgnoreCase(responseHeaders.getValue("Connection")) ||
@@ -475,9 +475,9 @@ public class Request
else if ("chunked".equalsIgnoreCase(transferCoding))
{
in = new LimitedLengthInputStream(in, -1, false, connection, doClose);
-
+
in = new ChunkedInputStream(in, responseHeaders);
- }
+ }
else
{
contentLength = responseHeaders.getLongValue("Content-Length");
@@ -505,9 +505,9 @@ public class Request
throw new ProtocolException("Unsupported Content-Encoding: " +
contentCoding);
}
- // Remove the Content-Encoding header because the content is
- // no longer compressed.
- responseHeaders.remove("Content-Encoding");
+ // Remove the Content-Encoding header because the content is
+ // no longer compressed.
+ responseHeaders.remove("Content-Encoding");
}
return in;
}
@@ -551,7 +551,7 @@ public class Request
{
MessageDigest md5 = MessageDigest.getInstance("MD5");
final byte[] COLON = { 0x3a };
-
+
// Calculate H(A1)
md5.reset();
md5.update(username.getBytes("US-ASCII"));
@@ -572,7 +572,7 @@ public class Request
ha1 = md5.digest();
}
String ha1Hex = toHexString(ha1);
-
+
// Calculate H(A2)
md5.reset();
md5.update(method.getBytes("US-ASCII"));
@@ -586,7 +586,7 @@ public class Request
}
byte[] ha2 = md5.digest();
String ha2Hex = toHexString(ha2);
-
+
// Calculate response
md5.reset();
md5.update(ha1Hex.getBytes("US-ASCII"));
@@ -606,8 +606,8 @@ public class Request
md5.update(COLON);
md5.update(ha2Hex.getBytes("US-ASCII"));
String digestResponse = toHexString(md5.digest());
-
- String authorization = scheme +
+
+ String authorization = scheme +
" username=\"" + username + "\"" +
" realm=\"" + realm + "\"" +
" nonce=\"" + nonce + "\"" +
@@ -652,7 +652,7 @@ public class Request
buf.setLength(0);
}
else if (c != ',' || (i <(len - 1) && text.charAt(i + 1) != ' '))
- {
+ {
buf.append(c);
}
}
@@ -855,4 +855,3 @@ public class Request
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/RequestBodyWriter.java b/libjava/classpath/gnu/java/net/protocol/http/RequestBodyWriter.java
index 05d98eb..aa5b78a 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/RequestBodyWriter.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/RequestBodyWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -64,6 +64,5 @@ public interface RequestBodyWriter
* @return the number of bytes written
*/
int write(byte[] buffer);
-
-}
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Response.java b/libjava/classpath/gnu/java/net/protocol/http/Response.java
index 76fac93..084cf75 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Response.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Response.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -61,7 +61,7 @@ public class Response
/**
* The HTTP status code of the response.
- */
+ */
protected final int code;
/**
@@ -114,7 +114,7 @@ public class Response
/**
* Returns the HTTP status code of the response.
* @see #code
- */
+ */
public int getCode()
{
return code;
@@ -188,22 +188,22 @@ public class Response
{
return headers.getDateValue(name);
}
-
+
/**
* Tests whether this response indicates a redirection.
- *
+ *
* @return true if, false otherwise.
*/
public boolean isRedirect()
{
return (code != 304 && getCodeClass() == 3);
}
-
+
/**
* Tests whether this response indicates an error.
* Errors are the response codes 4xx - Client error and
* 5xx - Server error.
- *
+ *
* @return true if, false otherwise.
*/
public boolean isError()
@@ -221,4 +221,3 @@ public class Response
return body;
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java b/libjava/classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java
index 4c5261d..ca86344 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -52,6 +52,5 @@ public interface ResponseHeaderHandler
* Sets the value for the header associated with this handler.
*/
void setValue(String value);
-
-}
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/SimpleCookieManager.java b/libjava/classpath/gnu/java/net/protocol/http/SimpleCookieManager.java
index fe05ba0..f082047 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/SimpleCookieManager.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/SimpleCookieManager.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -133,6 +133,5 @@ public class SimpleCookieManager
}
}
}
-
-}
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/https/Handler.java b/libjava/classpath/gnu/java/net/protocol/https/Handler.java
index 2b13751..dbb6199 100644
--- a/libjava/classpath/gnu/java/net/protocol/https/Handler.java
+++ b/libjava/classpath/gnu/java/net/protocol/https/Handler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -73,4 +73,3 @@ public class Handler
}
}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/jar/Connection.java b/libjava/classpath/gnu/java/net/protocol/jar/Connection.java
index 386aace..85d27bf 100644
--- a/libjava/classpath/gnu/java/net/protocol/jar/Connection.java
+++ b/libjava/classpath/gnu/java/net/protocol/jar/Connection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -73,13 +73,13 @@ public final class Connection extends JarURLConnection
private JarFile jar_file;
private JarEntry jar_entry;
private URL jar_url;
-
+
public static class JarFileCache
{
private static Hashtable cache
= new Hashtable();
private static final int READBUFSIZE = 4*1024;
-
+
public static synchronized JarFile get (URL url, boolean useCaches)
throws IOException
{
@@ -92,31 +92,31 @@ public final class Connection extends JarURLConnection
}
if ("file".equals (url.getProtocol()))
- {
- String fn = url.getFile();
- fn = gnu.java.net.protocol.file.Connection.unquote(fn);
- File f = new File (fn);
- jf = new JarFile (f, true, ZipFile.OPEN_READ);
- }
+ {
+ String fn = url.getFile();
+ fn = gnu.java.net.protocol.file.Connection.unquote(fn);
+ File f = new File (fn);
+ jf = new JarFile (f, true, ZipFile.OPEN_READ);
+ }
else
- {
- URLConnection urlconn = url.openConnection();
- InputStream is = urlconn.getInputStream();
- byte[] buf = new byte [READBUFSIZE];
- File f = File.createTempFile ("cache", "jar");
- FileOutputStream fos = new FileOutputStream (f);
- int len = 0;
-
- while ((len = is.read (buf)) != -1)
- {
- fos.write (buf, 0, len);
- }
-
- fos.close();
- // Always verify the Manifest, open read only and delete when done.
- jf = new JarFile (f, true,
- ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
- }
+ {
+ URLConnection urlconn = url.openConnection();
+ InputStream is = urlconn.getInputStream();
+ byte[] buf = new byte [READBUFSIZE];
+ File f = File.createTempFile ("cache", "jar");
+ FileOutputStream fos = new FileOutputStream (f);
+ int len = 0;
+
+ while ((len = is.read (buf)) != -1)
+ {
+ fos.write (buf, 0, len);
+ }
+
+ fos.close();
+ // Always verify the Manifest, open read only and delete when done.
+ jf = new JarFile (f, true,
+ ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
+ }
if (useCaches)
cache.put (url, jf);
@@ -140,7 +140,7 @@ public final class Connection extends JarURLConnection
jar_url = getJarFileURL();
jar_file = JarFileCache.get (jar_url, useCaches);
String entry_name = getEntryName();
-
+
if (entry_name != null
&& !entry_name.equals (""))
{
@@ -160,7 +160,7 @@ public final class Connection extends JarURLConnection
if (! doInput)
throw new ProtocolException("Can't open InputStream if doInput is false");
-
+
return jar_file.getInputStream (jar_entry);
}
@@ -179,26 +179,26 @@ public final class Connection extends JarURLConnection
{
try
{
- if (!connected)
- connect();
+ if (!connected)
+ connect();
- if (field.equals("content-type"))
+ if (field.equals("content-type"))
return guessContentTypeFromName(getJarEntry().getName());
- else if (field.equals("content-length"))
+ else if (field.equals("content-length"))
return Long.toString(getJarEntry().getSize());
- else if (field.equals("last-modified"))
- {
- // Both creating and manipulating dateFormat need synchronization.
- synchronized (Connection.class)
- {
- if (dateFormat == null)
- dateFormat = new SimpleDateFormat
- ("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
- new Locale ("En", "Us", "Unix"));
-
- return dateFormat.format(new Date(getJarEntry().getTime()));
- }
- }
+ else if (field.equals("last-modified"))
+ {
+ // Both creating and manipulating dateFormat need synchronization.
+ synchronized (Connection.class)
+ {
+ if (dateFormat == null)
+ dateFormat = new SimpleDateFormat
+ ("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
+ new Locale ("En", "Us", "Unix"));
+
+ return dateFormat.format(new Date(getJarEntry().getTime()));
+ }
+ }
}
catch (IOException e)
{
@@ -222,11 +222,11 @@ public final class Connection extends JarURLConnection
try
{
- return getJarEntry().getTime();
+ return getJarEntry().getTime();
}
catch (IOException e)
{
- return -1;
+ return -1;
}
}
}
diff --git a/libjava/classpath/gnu/java/net/protocol/jar/Handler.java b/libjava/classpath/gnu/java/net/protocol/jar/Handler.java
index 66f0fb6..7d6103e 100644
--- a/libjava/classpath/gnu/java/net/protocol/jar/Handler.java
+++ b/libjava/classpath/gnu/java/net/protocol/jar/Handler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -91,34 +91,34 @@ public class Handler extends URLStreamHandler
// strategy when we encounter an error in parsing is to return without
// doing anything.
String file = url.getFile();
-
+
if (!file.equals(""))
{ //has context url
- url_string = url_string.substring (start, end);
+ url_string = url_string.substring (start, end);
if (url_string.startsWith("/"))
{ //url string is an absolute path
int idx = file.lastIndexOf ("!/");
-
- if (idx < 0)
- throw new URLParseError("no !/ in spec");
-
- file = file.substring (0, idx + 1) + url_string;
+
+ if (idx < 0)
+ throw new URLParseError("no !/ in spec");
+
+ file = file.substring (0, idx + 1) + url_string;
}
else if (url_string.length() > 0)
{
int idx = file.lastIndexOf ("/");
if (idx == -1) //context path is weird
- file = "/" + url_string;
+ file = "/" + url_string;
else if (idx == (file.length() - 1))
//just concatenate two parts
file = file + url_string;
else
- // according to Java API Documentation, here is a little different
+ // according to Java API Documentation, here is a little different
// with URLStreamHandler.parseURL
// but JDK seems doesn't handle it well
file = file.substring(0, idx + 1) + url_string;
}
-
+
setURL (url, "jar", url.getHost(), url.getPort(), flat(file), null);
return;
}
@@ -130,7 +130,7 @@ public class Handler extends URLStreamHandler
return;
if (start > url_string.length())
return;
-
+
// Skip remains of protocol
url_string = url_string.substring (start, end);
@@ -140,16 +140,16 @@ public class Handler extends URLStreamHandler
try
{
- new URL(url_string.substring (0, jar_stop));
+ new URL(url_string.substring (0, jar_stop));
}
catch (MalformedURLException e)
{
- throw new URLParseError("invalid inner URL: " + e.getMessage());
+ throw new URLParseError("invalid inner URL: " + e.getMessage());
}
-
+
if (!url.getProtocol().equals ("jar") )
throw new URLParseError("unexpected protocol " + url.getProtocol());
-
+
setURL (url, "jar", url.getHost(), url.getPort(), url_string, null);
}
@@ -170,16 +170,16 @@ public class Handler extends URLStreamHandler
StringTokenizer st = new StringTokenizer(jar_path, "/");
while (st.hasMoreTokens())
{
- String token = st.nextToken();
+ String token = st.nextToken();
if (token.equals("."))
continue;
else if (token.equals(".."))
- {
- if (! tokens.isEmpty())
- tokens.remove(tokens.size() - 1);
- }
- else
- tokens.add(token);
+ {
+ if (! tokens.isEmpty())
+ tokens.remove(tokens.size() - 1);
+ }
+ else
+ tokens.add(token);
}
CPStringBuilder path = new CPStringBuilder(url_string.length());
@@ -203,8 +203,8 @@ public class Handler extends URLStreamHandler
String ref = url.getRef();
// return "jar:" + file;
- // Performance!!:
- // Do the concatenation manually to avoid resize StringBuffer's
+ // Performance!!:
+ // Do the concatenation manually to avoid resize StringBuffer's
// internal buffer. The length of ref is not taken into consideration
// as it's a rare path.
CPStringBuilder sb = new CPStringBuilder (file.length() + 5);
diff --git a/libjava/classpath/gnu/java/nio/ChannelInputStream.java b/libjava/classpath/gnu/java/nio/ChannelInputStream.java
index f56536d..5cad678 100644
--- a/libjava/classpath/gnu/java/nio/ChannelInputStream.java
+++ b/libjava/classpath/gnu/java/nio/ChannelInputStream.java
@@ -1,4 +1,4 @@
-/* ChannelInputStream.java --
+/* ChannelInputStream.java --
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,11 +51,11 @@ import java.nio.channels.SelectableChannel;
public final class ChannelInputStream extends InputStream
{
private ReadableByteChannel ch;
-
+
public ChannelInputStream (ReadableByteChannel ch)
{
super();
-
+
this.ch = ch;
}
@@ -72,9 +72,9 @@ public final class ChannelInputStream extends InputStream
public int read() throws IOException
{
if (ch instanceof SelectableChannel
- && (! ((SelectableChannel) ch).isBlocking()))
+ && (! ((SelectableChannel) ch).isBlocking()))
throw new IllegalBlockingModeException();
-
+
ByteBuffer buffer = ByteBuffer.allocate(1);
int result = ch.read(buffer);
diff --git a/libjava/classpath/gnu/java/nio/ChannelOutputStream.java b/libjava/classpath/gnu/java/nio/ChannelOutputStream.java
index 08323ea..606f377 100644
--- a/libjava/classpath/gnu/java/nio/ChannelOutputStream.java
+++ b/libjava/classpath/gnu/java/nio/ChannelOutputStream.java
@@ -1,4 +1,4 @@
-/* ChannelOutputStream.java --
+/* ChannelOutputStream.java --
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,11 +49,11 @@ import java.nio.channels.WritableByteChannel;
public final class ChannelOutputStream extends OutputStream
{
private WritableByteChannel ch;
-
+
public ChannelOutputStream (WritableByteChannel ch)
{
super();
-
+
this.ch = ch;
}
diff --git a/libjava/classpath/gnu/java/nio/ChannelReader.java b/libjava/classpath/gnu/java/nio/ChannelReader.java
index 1e7372d..3c1456a 100644
--- a/libjava/classpath/gnu/java/nio/ChannelReader.java
+++ b/libjava/classpath/gnu/java/nio/ChannelReader.java
@@ -1,4 +1,4 @@
-/* ChannelReader.java --
+/* ChannelReader.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,11 +50,11 @@ import java.nio.charset.CodingErrorAction;
/**
* A Reader implementation that works using a ReadableByteChannel and a
* CharsetDecoder.
- *
+ *
*
* This is a bridge between NIO <-> IO character decoding.
*
- *
+ *
* @return an RSA keypair.
*/
public KeyPair generate()
@@ -225,7 +225,7 @@ public class RSAKeyPairGenerator
/**
* Fills the designated byte array with random data.
- *
+ *
* @param buffer the byte array to fill with random data.
*/
private void nextRandomBytes(byte[] buffer)
diff --git a/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java b/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java
index 7a51d0a..2785f02 100644
--- a/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java
+++ b/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java
@@ -116,7 +116,7 @@ public class RSAKeyPairPKCS8Codec
* coefficient INTEGER, -- (inverse of q) mod p
* }
*
- *
+ *
* @return the DER encoded form of the ASN.1 representation of the
* PrivateKeyInfo field for an RSA {@link PrivateKey}..
* @throw InvalidParameterException if an error occurs during the marshalling
@@ -251,7 +251,7 @@ public class RSAKeyPairPKCS8Codec
der = new DERReader(pkBytes);
DERValue derRSAPrivateKey = der.read();
DerUtil.checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field");
-
+
val = der.read();
DerUtil.checkIsBigInteger(val, "Wrong RSAPrivateKey Version field");
version = (BigInteger) val.getValue();
diff --git a/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java b/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java
index 9522023..f088e79 100644
--- a/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java
+++ b/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java
@@ -1,4 +1,4 @@
-/* RSAKeyPairRawCodec.java --
+/* RSAKeyPairRawCodec.java --
Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -190,7 +190,7 @@ public class RSAKeyPairRawCodec
* the toByteArray() method on the RSA parameter d,
*
*
- *
+ *
* @param key the key to encode.
* @return the Raw format encoding of the designated key.
*/
diff --git a/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java b/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java
index b11e1c0..9ad6ae0 100644
--- a/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java
+++ b/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java
@@ -97,14 +97,14 @@ public class RSAKeyPairX509Codec
*
* The subjectPublicKey field, which is a BIT STRING, contains the
* DER-encoded form of the RSA public key defined as:
- *
+ *
*
* RSAPublicKey ::= SEQUENCE {
* modulus INTEGER, -- n
* publicExponent INTEGER -- e
* }
*
- *
+ *
* @param key the {@link PublicKey} instance to encode. MUST be an instance of
* {@link GnuRSAPublicKey}.
* @return the ASN.1 representation of the SubjectPublicKeyInfo in an
diff --git a/libjava/classpath/gnu/java/security/pkcs/PKCS7Data.java b/libjava/classpath/gnu/java/security/pkcs/PKCS7Data.java
index 3d3052b..c6474f0 100644
--- a/libjava/classpath/gnu/java/security/pkcs/PKCS7Data.java
+++ b/libjava/classpath/gnu/java/security/pkcs/PKCS7Data.java
@@ -52,7 +52,7 @@ public class PKCS7Data
/**
* Constructs a new instance of PKCS7Data with the possibly
* null (implicetly referenced) content data.
- *
+ *
* @param data the raw bytes of the data to use in a PKCS#7 framework.
*/
public PKCS7Data(byte[] data)
diff --git a/libjava/classpath/gnu/java/security/pkcs/PKCS7SignedData.java b/libjava/classpath/gnu/java/security/pkcs/PKCS7SignedData.java
index d59dba3..adb00a3 100644
--- a/libjava/classpath/gnu/java/security/pkcs/PKCS7SignedData.java
+++ b/libjava/classpath/gnu/java/security/pkcs/PKCS7SignedData.java
@@ -333,7 +333,7 @@ public class PKCS7SignedData
/**
* Constructs a new instance of PKCS7SignedData given a
* designated set of fields.
- *
+ *
* @param digestAlgorithms the collection of DigestAlgorithm elements. Each
* DigestAlgorithm is a {@link List} of two elements, the first is an
* OID while the second is dependent on the value of the OID element.
@@ -401,7 +401,7 @@ public class PKCS7SignedData
/**
* Writes to the designated output stream the DER encoding of the current
* contents of this instance.
- *
+ *
* @param out the destination output stream.
* @throws IOException if an I/O related exception occurs during the process.
* @throws CRLException if an exception occurs while encoding the certificate
diff --git a/libjava/classpath/gnu/java/security/pkcs/SignerInfo.java b/libjava/classpath/gnu/java/security/pkcs/SignerInfo.java
index 3066401..645ed67 100644
--- a/libjava/classpath/gnu/java/security/pkcs/SignerInfo.java
+++ b/libjava/classpath/gnu/java/security/pkcs/SignerInfo.java
@@ -90,9 +90,9 @@ public class SignerInfo
* issuer Name,
* serialNumber CertificateSerialNumber
* }
- *
+ *
* DigestAlgorithmIdentifier ::= AlgorithmIdentifier
- *
+ *
* DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
*
* EncryptedDigest ::= OCTET STRING
@@ -269,7 +269,7 @@ public class SignerInfo
/**
* Constructs a new instance of SignerInfo given a designated
* set of fields.
- *
+ *
* @param issuer the X.500 Principal name of the signer referenced by this
* instance.
* @param serialNumber the serial number of the certificate being used. Both
@@ -369,7 +369,7 @@ public class SignerInfo
/**
* Writes to the designated output stream the DER encoding of the current
* contents of this instance.
- *
+ *
* @param out the destination output stream.
* @throws IOException if an I/O related exception occurs during the process.
*/
diff --git a/libjava/classpath/gnu/java/security/prng/BasePRNG.java b/libjava/classpath/gnu/java/security/prng/BasePRNG.java
index 3b7c8cf..eb5ada7 100644
--- a/libjava/classpath/gnu/java/security/prng/BasePRNG.java
+++ b/libjava/classpath/gnu/java/security/prng/BasePRNG.java
@@ -1,4 +1,4 @@
-/* BasePRNG.java --
+/* BasePRNG.java --
Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -60,7 +60,7 @@ public abstract class BasePRNG
/**
* Trivial constructor for use by concrete subclasses.
- *
+ *
* @param name the canonical name of this instance.
*/
protected BasePRNG(String name)
diff --git a/libjava/classpath/gnu/java/security/prng/EntropySource.java b/libjava/classpath/gnu/java/security/prng/EntropySource.java
index 95f68f0..a7173d3 100644
--- a/libjava/classpath/gnu/java/security/prng/EntropySource.java
+++ b/libjava/classpath/gnu/java/security/prng/EntropySource.java
@@ -1,4 +1,4 @@
-/* EntropySource.java --
+/* EntropySource.java --
Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -58,4 +58,4 @@ public interface EntropySource
* @return The next random bytes.
*/
byte[] nextBytes();
-}
\ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/java/security/prng/IRandom.java b/libjava/classpath/gnu/java/security/prng/IRandom.java
index 66ad6d2..eb1495d 100644
--- a/libjava/classpath/gnu/java/security/prng/IRandom.java
+++ b/libjava/classpath/gnu/java/security/prng/IRandom.java
@@ -1,4 +1,4 @@
-/* IRandom.java --
+/* IRandom.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -79,7 +79,7 @@ public interface IRandom
{
/**
* Returns the canonical name of this instance.
- *
+ *
* @return the canonical name of this instance.
*/
String name();
@@ -87,7 +87,7 @@ public interface IRandom
/**
* Initialises the pseudo-random number generator scheme with the appropriate
* attributes.
- *
+ *
* @param attributes a set of name-value pairs that describe the desired
* future instance behaviour.
* @exception IllegalArgumentException if at least one of the defined name/
@@ -97,7 +97,7 @@ public interface IRandom
/**
* Returns the next 8 bits of random data generated from this instance.
- *
+ *
* @return the next 8 bits of random data generated from this instance.
* @exception IllegalStateException if the instance is not yet initialised.
* @exception LimitReachedException if this instance has reached its
@@ -110,7 +110,7 @@ public interface IRandom
* Fills the designated byte array, starting from byte at index
* offset, for a maximum of length bytes with
* the output of this generator instance.
- *
+ *
* @param out the placeholder to contain the generated random bytes.
* @param offset the starting index in out to consider. This method
* does nothing if this parameter is not within 0 and
@@ -132,7 +132,7 @@ public interface IRandom
* Implementations are not required to implement this method in any meaningful
* way; this may be a no-operation, and implementations may throw an
* {@link UnsupportedOperationException}.
- *
+ *
* @param b The byte to add.
*/
void addRandomByte(byte b);
@@ -144,7 +144,7 @@ public interface IRandom
* Implementations are not required to implement this method in any meaningful
* way; this may be a no-operation, and implementations may throw an
* {@link UnsupportedOperationException}.
- *
+ *
* @param in The buffer of new random bytes to add.
*/
void addRandomBytes(byte[] in);
@@ -156,7 +156,7 @@ public interface IRandom
* Implementations are not required to implement this method in any meaningful
* way; this may be a no-operation, and implementations may throw an
* {@link UnsupportedOperationException}.
- *
+ *
* @param in The buffer of new random bytes to add.
* @param offset The offset from whence to begin reading random bytes.
* @param length The number of random bytes to add.
@@ -167,7 +167,7 @@ public interface IRandom
/**
* Returns a clone copy of this instance.
- *
+ *
* @return a clone copy of this instance.
*/
Object clone() throws CloneNotSupportedException;
diff --git a/libjava/classpath/gnu/java/security/prng/LimitReachedException.java b/libjava/classpath/gnu/java/security/prng/LimitReachedException.java
index 8d5b30b..028c745 100644
--- a/libjava/classpath/gnu/java/security/prng/LimitReachedException.java
+++ b/libjava/classpath/gnu/java/security/prng/LimitReachedException.java
@@ -1,4 +1,4 @@
-/* LimitReachedException.java --
+/* LimitReachedException.java --
Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
diff --git a/libjava/classpath/gnu/java/security/prng/MDGenerator.java b/libjava/classpath/gnu/java/security/prng/MDGenerator.java
index 574a2f9..b110486 100644
--- a/libjava/classpath/gnu/java/security/prng/MDGenerator.java
+++ b/libjava/classpath/gnu/java/security/prng/MDGenerator.java
@@ -1,4 +1,4 @@
-/* MDGenerator.java --
+/* MDGenerator.java --
Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
diff --git a/libjava/classpath/gnu/java/security/prng/PRNGFactory.java b/libjava/classpath/gnu/java/security/prng/PRNGFactory.java
index ae15d05..b57d7c7 100644
--- a/libjava/classpath/gnu/java/security/prng/PRNGFactory.java
+++ b/libjava/classpath/gnu/java/security/prng/PRNGFactory.java
@@ -1,4 +1,4 @@
-/* PRNGFactory.java --
+/* PRNGFactory.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -57,7 +57,7 @@ public class PRNGFactory
/**
* Returns an instance of a padding algorithm given its name.
- *
+ *
* @param prng the case-insensitive name of the PRNG.
* @return an instance of the pseudo-random number generator.
* @exception InternalError if the implementation does not pass its self-
@@ -79,7 +79,7 @@ public class PRNGFactory
/**
* Returns a {@link Set} of names of padding algorithms supported by this
* Factory.
- *
+ *
* @return a {@link Set} of pseudo-random number generator algorithm names
* (Strings).
*/
diff --git a/libjava/classpath/gnu/java/security/prng/RandomEventListener.java b/libjava/classpath/gnu/java/security/prng/RandomEventListener.java
index beb9087..720f2af 100644
--- a/libjava/classpath/gnu/java/security/prng/RandomEventListener.java
+++ b/libjava/classpath/gnu/java/security/prng/RandomEventListener.java
@@ -1,4 +1,4 @@
-/* RandomEventListener.java --
+/* RandomEventListener.java --
Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
diff --git a/libjava/classpath/gnu/java/security/provider/DefaultPolicy.java b/libjava/classpath/gnu/java/security/provider/DefaultPolicy.java
index d42be6c..566c949 100644
--- a/libjava/classpath/gnu/java/security/provider/DefaultPolicy.java
+++ b/libjava/classpath/gnu/java/security/provider/DefaultPolicy.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,7 +44,7 @@ import java.security.PermissionCollection;
import java.security.Permissions;
import java.security.Policy;
-/**
+/**
* This is just a stub policy implementation which grants all permissions
* to any code source. FIXME: This should be replaced with a real
* implementation that reads the policy configuration from a file, like
@@ -60,7 +60,7 @@ public class DefaultPolicy extends Policy
perms.add(allPermission);
return perms;
}
-
+
public void refresh()
{
// Nothing.
diff --git a/libjava/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java b/libjava/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java
index cdfad3f..d4ce4ae 100644
--- a/libjava/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java
+++ b/libjava/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java
@@ -91,7 +91,7 @@ import java.util.logging.Logger;
* See RFC 3280: Internet X.509
* Public Key Infrastructure Certificate and Certificate Revocation List (CRL)
* Profile.
- *
+ *
* @author Casey Marshall (rsdio@metastatic.org)
*/
public class PKIXCertPathValidatorImpl
@@ -403,7 +403,7 @@ public class PKIXCertPathValidatorImpl
*
The CRL is signed by a certificate in the given cert stores, and that
* cert is signed by one of the certificates in the path.
*
- *
+ *
* @param crl The CRL being checked.
* @param path The path this CRL is being checked against.
* @param now The value to use as 'now'.
diff --git a/libjava/classpath/gnu/java/security/sig/BaseSignature.java b/libjava/classpath/gnu/java/security/sig/BaseSignature.java
index 9c76cac..ef4d87f 100644
--- a/libjava/classpath/gnu/java/security/sig/BaseSignature.java
+++ b/libjava/classpath/gnu/java/security/sig/BaseSignature.java
@@ -1,4 +1,4 @@
-/* BaseSignature.java --
+/* BaseSignature.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -77,7 +77,7 @@ public abstract class BaseSignature
/**
* Trivial constructor.
- *
+ *
* @param schemeName the name of this signature scheme.
* @param md the underlying instance of the message digest algorithm.
* @throws IllegalArgumentException if the designated hash instance is
@@ -174,7 +174,7 @@ public abstract class BaseSignature
/**
* Fills the designated byte array with random data.
- *
+ *
* @param buffer the byte array to fill with random data.
*/
protected void nextRandomBytes(byte[] buffer)
diff --git a/libjava/classpath/gnu/java/security/sig/ISignature.java b/libjava/classpath/gnu/java/security/sig/ISignature.java
index ff25f29..be98f9a 100644
--- a/libjava/classpath/gnu/java/security/sig/ISignature.java
+++ b/libjava/classpath/gnu/java/security/sig/ISignature.java
@@ -1,4 +1,4 @@
-/* ISignature.java --
+/* ISignature.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -75,14 +75,14 @@ public interface ISignature
/**
* Returns the canonical name of this signature scheme.
- *
+ *
* @return the canonical name of this instance.
*/
String name();
/**
* Initialises this instance for signature verification.
- *
+ *
* @param attributes the attributes to use for setting up this instance.
* @throws IllegalArgumentException if the designated public key is not
* appropriate for this signature scheme.
@@ -93,7 +93,7 @@ public interface ISignature
/**
* Initialises this instance for signature generation.
- *
+ *
* @param attributes the attributes to use for setting up this instance.
* @throws IllegalArgumentException if the designated private key is not
* appropriate for this signature scheme.
@@ -104,7 +104,7 @@ public interface ISignature
/**
* Digests one byte of a message for signing or verification purposes.
- *
+ *
* @param b the message byte to digest.
* @throws IllegalStateException if this instance was not setup for signature
* generation/verification.
@@ -114,7 +114,7 @@ public interface ISignature
/**
* Digests a sequence of bytes from a message for signing or verification
* purposes.
- *
+ *
* @param buffer the byte sequence to consider.
* @param offset the byte poisition in buffer of the first byte
* to consider.
@@ -129,7 +129,7 @@ public interface ISignature
/**
* Terminates a signature generation phase by digesting and processing the
* context of the underlying message digest algorithm instance.
- *
+ *
* @return a {@link Object} representing the native output of the signature
* scheme implementation.
* @throws IllegalStateException if this instance was not setup for signature
@@ -140,7 +140,7 @@ public interface ISignature
/**
* Terminates a signature verification phase by digesting and processing the
* context of the underlying message digest algorithm instance.
- *
+ *
* @param signature a native signature object previously generated by an
* invocation of the sign() method.
* @return true iff the outpout of the verification phase
@@ -153,7 +153,7 @@ public interface ISignature
/**
* Returns a clone copy of this instance.
- *
+ *
* @return a clone copy of this instance.
*/
Object clone();
diff --git a/libjava/classpath/gnu/java/security/sig/ISignatureCodec.java b/libjava/classpath/gnu/java/security/sig/ISignatureCodec.java
index aaae6cc..f8b1473 100644
--- a/libjava/classpath/gnu/java/security/sig/ISignatureCodec.java
+++ b/libjava/classpath/gnu/java/security/sig/ISignatureCodec.java
@@ -1,4 +1,4 @@
-/* ISignatureCodec.java --
+/* ISignatureCodec.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
diff --git a/libjava/classpath/gnu/java/security/sig/SignatureCodecFactory.java b/libjava/classpath/gnu/java/security/sig/SignatureCodecFactory.java
index c5b2ccd..0026ad1 100644
--- a/libjava/classpath/gnu/java/security/sig/SignatureCodecFactory.java
+++ b/libjava/classpath/gnu/java/security/sig/SignatureCodecFactory.java
@@ -74,7 +74,7 @@ public class SignatureCodecFactory
* When the encoding format name is missing, the Raw encoding format is
* assumed. When this is the case the trailing forward slash is discarded from
* the name.
- *
+ *
* @param name the case-insensitive, possibly composed, signature codec name.
* @return an instance of the signaturecodec, or null if none
* found.
@@ -107,7 +107,7 @@ public class SignatureCodecFactory
/**
* Returns an instance of a signature codec given the canonical name of the
* signature algorithm, and that of the encoding format.
- *
+ *
* @param name the case-insensitive signature algorithm name.
* @param format the name of the format to use when encodigng/decoding
* signatures generated by the named algorithm.
@@ -127,7 +127,7 @@ public class SignatureCodecFactory
* Returns an instance of a signature codec given the canonical name of the
* signature algorithm, and the identifier of the format to use when
* encoding/decoding signatures generated by that algorithm.
- *
+ *
* @param name the case-insensitive signature algorithm name.
* @param formatID the identifier of the format to use when encoding /
* decoding signatures generated by the designated algorithm.
diff --git a/libjava/classpath/gnu/java/security/sig/SignatureFactory.java b/libjava/classpath/gnu/java/security/sig/SignatureFactory.java
index 28b6892..6cdaf65 100644
--- a/libjava/classpath/gnu/java/security/sig/SignatureFactory.java
+++ b/libjava/classpath/gnu/java/security/sig/SignatureFactory.java
@@ -1,4 +1,4 @@
-/* SignatureFactory.java --
+/* SignatureFactory.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -61,7 +61,7 @@ public class SignatureFactory
/**
* Returns an instance of a signature-with-appendix scheme given its name.
- *
+ *
* @param ssa the case-insensitive signature-with-appendix scheme name.
* @return an instance of the scheme, or null if none found.
*/
@@ -84,7 +84,7 @@ public class SignatureFactory
/**
* Returns a {@link Set} of signature-with-appendix scheme names supported by
* this Factory.
- *
+ *
* @return a {@link Set} of signature-with-appendix scheme names (Strings).
*/
public static synchronized final Set getNames()
diff --git a/libjava/classpath/gnu/java/security/sig/dss/DSSSignature.java b/libjava/classpath/gnu/java/security/sig/dss/DSSSignature.java
index 1ef1bea..024521b 100644
--- a/libjava/classpath/gnu/java/security/sig/dss/DSSSignature.java
+++ b/libjava/classpath/gnu/java/security/sig/dss/DSSSignature.java
@@ -1,4 +1,4 @@
-/* DSSSignature.java --
+/* DSSSignature.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -211,7 +211,7 @@ public class DSSSignature
/**
* Returns the output of a signature generation phase.
- *
+ *
* @return an object encapsulating the DSS signature pair r and
* s.
*/
@@ -223,7 +223,7 @@ public class DSSSignature
/**
* Returns the output of a previously generated signature object as a pair of
* {@link java.math.BigInteger}.
- *
+ *
* @return the DSS signature pair r and s.
*/
private BigInteger[] decodeSignature(Object signature)
diff --git a/libjava/classpath/gnu/java/security/sig/dss/DSSSignatureRawCodec.java b/libjava/classpath/gnu/java/security/sig/dss/DSSSignatureRawCodec.java
index 903d7aa..169f84b 100644
--- a/libjava/classpath/gnu/java/security/sig/dss/DSSSignatureRawCodec.java
+++ b/libjava/classpath/gnu/java/security/sig/dss/DSSSignatureRawCodec.java
@@ -1,4 +1,4 @@
-/* DSSSignatureRawCodec.java --
+/* DSSSignatureRawCodec.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -78,7 +78,7 @@ public class DSSSignatureRawCodec
* the toByteArray() method on the DSS parameter s.
*
*
- *
+ *
* @param signature the signature to encode, consisting of the two DSS
* parameters r and s as a
* {@link BigInteger} array.
diff --git a/libjava/classpath/gnu/java/security/sig/dss/DSSSignatureX509Codec.java b/libjava/classpath/gnu/java/security/sig/dss/DSSSignatureX509Codec.java
index 0fdb754..d0a0188 100644
--- a/libjava/classpath/gnu/java/security/sig/dss/DSSSignatureX509Codec.java
+++ b/libjava/classpath/gnu/java/security/sig/dss/DSSSignatureX509Codec.java
@@ -60,7 +60,7 @@ import java.util.ArrayList;
*
* Digital signatures when transmitted in an X.509 certificates are encoded
* in DER (Distinguished Encoding Rules) as a BIT STRING; i.e.
- *
+ *
*
* Certificate ::= SEQUENCE {
* tbsCertificate TBSCertificate,
@@ -77,7 +77,7 @@ import java.util.ArrayList;
* generates two MPIs, commonly called r and s, as the
* result of digitally signing a message, these two numbers will be transferred
* as the following ASN.1 structure:
- *
+ *
*
* Dss-Sig-Value ::= SEQUENCE {
* r INTEGER,
@@ -112,7 +112,7 @@ public class DSSSignatureX509Codec
* Encodes a DSS Signature output as the signature raw bytes which can
* be used to construct an ASN.1 DER-encoded BIT STRING as defined in the
* documentation of this class.
- *
+ *
* @param signature the output of the DSS signature algorithm; i.e. the value
* returned by the invocation of
* {@link gnu.java.security.sig.ISignature#sign()} method. In the
@@ -154,7 +154,7 @@ public class DSSSignatureX509Codec
/**
* Decodes a signature as defined in the documentation of this class.
- *
+ *
* @param input the byte array to unmarshall into a valid DSS signature
* instance; i.e. an array of two MPIs. MUST NOT be null.
* @return an array of two MPIs, r and s in this
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/EME_PKCS1_V1_5.java b/libjava/classpath/gnu/java/security/sig/rsa/EME_PKCS1_V1_5.java
index 39de01f..329ca8e 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/EME_PKCS1_V1_5.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/EME_PKCS1_V1_5.java
@@ -1,4 +1,4 @@
-/* EME_PKCS1_V1_5.java --
+/* EME_PKCS1_V1_5.java --
Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -104,7 +104,7 @@ public class EME_PKCS1_V1_5
*
*
* This method uses a default PRNG to obtain the padding bytes.
- *
+ *
* @param M the message to encode.
* @return the encoded message EM.
*/
@@ -133,7 +133,7 @@ public class EME_PKCS1_V1_5
* Similar to {@link #encode(byte[])} method, except that the source of
* randomness to use for obtaining the padding bytes (an instance of
* {@link IRandom}) is given as a parameter.
- *
+ *
* @param M the message to encode.
* @param irnd the {@link IRandom} instance to use as a source of randomness.
* @return the encoded message EM.
@@ -173,7 +173,7 @@ public class EME_PKCS1_V1_5
/**
* Similar to the {@link #encode(byte[], IRandom)} method, except that the
* source of randmoness is an instance of {@link Random}.
- *
+ *
* @param M the message to encode.
* @param rnd the {@link Random} instance to use as a source of randomness.
* @return the encoded message EM.
@@ -213,7 +213,7 @@ public class EME_PKCS1_V1_5
* hexadecimal value 0x00 to separate PS from
* M, or if the length of PS is less than
* 8 octets, output "decryption error" and stop.
- *
+ *
* @param EM the designated encoded message.
* @return the decoded message M framed in the designated
* EM value.
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java b/libjava/classpath/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java
index a0c4de1..3cddab4 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java
@@ -1,4 +1,4 @@
-/* EMSA_PKCS1_V1_5.java --
+/* EMSA_PKCS1_V1_5.java --
Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/EMSA_PSS.java b/libjava/classpath/gnu/java/security/sig/rsa/EMSA_PSS.java
index 97b3afc..917d963 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/EMSA_PSS.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/EMSA_PSS.java
@@ -1,4 +1,4 @@
-/* EMSA_PSS.java --
+/* EMSA_PSS.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -83,7 +83,7 @@ public class EMSA_PSS
/**
* Trivial private constructor to enforce use through Factory method.
- *
+ *
* @param hash the message digest instance to use with this scheme instance.
*/
private EMSA_PSS(IMessageDigest hash)
@@ -97,7 +97,7 @@ public class EMSA_PSS
/**
* Returns an instance of this object given a designated name of a hash
* function.
- *
+ *
* @param mdName the canonical name of a hash function.
* @return an instance of this object configured for use with the designated
* options.
@@ -118,7 +118,7 @@ public class EMSA_PSS
* M using a hash function and maps the result to an encoded
* message EM of a specified length using a mask generation
* function.
- *
+ *
* @param mHash the byte sequence resulting from applying the message digest
* algorithm Hash to the message M.
* @param emBits the maximal bit length of the integer OS2IP(EM), at least
@@ -192,7 +192,7 @@ public class EMSA_PSS
* The decoding operation EMSA-PSS-Decode recovers the message hash from an
* encoded message EM and compares it to the hash of
* M.
- *
+ *
* @param mHash the byte sequence resulting from applying the message digest
* algorithm Hash to the message M.
* @param EM the encoded message, an octet string of length
@@ -324,7 +324,7 @@ public class EMSA_PSS
* the output. The provable security of RSA-PSS relies on the random nature of
* the output of the mask generation function, which in turn relies on the
* random nature of the underlying hash function.
- *
+ *
* @param Z a seed.
* @param l the desired output length in octets.
* @return the mask.
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/RSA.java b/libjava/classpath/gnu/java/security/sig/rsa/RSA.java
index cdd9eaa..343b2cf 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/RSA.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/RSA.java
@@ -1,4 +1,4 @@
-/* RSA.java --
+/* RSA.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -87,7 +87,7 @@ public class RSA
* RSA private key is a valid one, this method computes a signature
* representative for a designated message representative signed
* by the holder of the designated RSA private key.
- *
+ *
* @param K the RSA private key.
* @param m the message representative: an integer between
* 0 and n - 1, where n
@@ -117,7 +117,7 @@ public class RSA
* representative for the designated signature representative
* generated by an RSA private key, for a message intended for the holder of
* the designated RSA public key.
- *
+ *
* @param K the RSA public key.
* @param s the signature representative, an integer between
* 0 and n - 1, where n
@@ -143,7 +143,7 @@ public class RSA
/**
* An implementation of the RSAEP algorithm.
- *
+ *
* @param K the recipient's RSA public key.
* @param m the message representative as an MPI.
* @return the resulting MPI --an MPI between 0 and
@@ -170,7 +170,7 @@ public class RSA
/**
* An implementation of the RSADP algorithm.
- *
+ *
* @param K the recipient's RSA private key.
* @param c the ciphertext representative as an MPI.
* @return the message representative, an MPI between 0 and
@@ -197,7 +197,7 @@ public class RSA
/**
* Converts a multi-precision integer (MPI) s into an
* octet sequence of length k.
- *
+ *
* @param s the multi-precision integer to convert.
* @param k the length of the output.
* @return the result of the transform.
@@ -302,7 +302,7 @@ public class RSA
/**
* Returns a random MPI with a random bit-length of the form 8b,
* where b is in the range [32..64].
- *
+ *
* @return a random MPI whose length in bytes is between 32 and 64 inclusive.
*/
private static final BigInteger newR(final BigInteger N)
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java b/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java
index 76460c0..1420331 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java
@@ -1,4 +1,4 @@
-/* RSAPKCS1V1_5Signature.java --
+/* RSAPKCS1V1_5Signature.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -85,7 +85,7 @@ public class RSAPKCS1V1_5Signature
/**
* Constructs an instance of this object using the designated message digest
* algorithm as its underlying hash function.
- *
+ *
* @param mdName the canonical name of the underlying hash function.
*/
public RSAPKCS1V1_5Signature(final String mdName)
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java b/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java
index 68c1eda..548dc3d 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java
@@ -71,7 +71,7 @@ public class RSAPKCS1V1_5SignatureRawCodec
* signature bytes in internet order,
*
the RSA-PKCS#1 (v1.5) signature bytes in internet order.
*
- *
+ *
* @param signature the signature to encode, consisting of the output of the
* sign() method of a {@link RSAPKCS1V1_5Signature}
* instance --a byte array.
@@ -116,7 +116,7 @@ public class RSAPKCS1V1_5SignatureRawCodec
/**
* Returns the decoded object from a designated input assumed to have been
* generated by the {@link #encodeSignature(Object)} method.
- *
+ *
* @param input the input bytes of a previously Raw-encoded RSA PKCS1 (v1.5)
* signature.
* @return the signature object.
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java b/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java
index 3cb3756..ee8586f 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java
@@ -51,7 +51,7 @@ import java.security.InvalidParameterException;
*
* Digital signatures when transmitted in an X.509 certificates are encoded
* in DER (Distinguished Encoding Rules) as a BIT STRING; i.e.
- *
+ *
*
* Certificate ::= SEQUENCE {
* tbsCertificate TBSCertificate,
@@ -95,7 +95,7 @@ public class RSAPKCS1V1_5SignatureX509Codec
/**
* Encodes an RSA Signature output as a signature BIT STRING as
* defined in the documentation of this class.
- *
+ *
* @param signature the output of the RSA PKCS1 (v1.5) signature algorithm;
* i.e. the value returned by the invocation of
* {@link gnu.java.security.sig.ISignature#sign()} method. In the
@@ -111,7 +111,7 @@ public class RSAPKCS1V1_5SignatureX509Codec
/**
* Decodes a signature as defined in the documentation of this class.
- *
+ *
* @param input the byte array to unmarshall into a valid RSA PKCS1 (v1.5)
* signature instance; i.e. a byte array. MUST NOT be null.
* @return an array of raw bytes decoded from the designated input. In the
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/RSAPSSSignature.java b/libjava/classpath/gnu/java/security/sig/rsa/RSAPSSSignature.java
index 27c7fe62..d8f8327 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/RSAPSSSignature.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/RSAPSSSignature.java
@@ -1,4 +1,4 @@
-/* RSAPSSSignature.java --
+/* RSAPSSSignature.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -95,7 +95,7 @@ public class RSAPSSSignature
/**
* Constructs an instance of this object using the designated message digest
* algorithm as its underlying hash function, and having 0-octet salt.
- *
+ *
* @param mdName the canonical name of the underlying hash function.
*/
public RSAPSSSignature(String mdName)
@@ -106,7 +106,7 @@ public class RSAPSSSignature
/**
* Constructs an instance of this object using the designated message digest
* algorithm as its underlying hash function.
- *
+ *
* @param mdName the canonical name of the underlying hash function.
* @param sLen the desired length in octets of the salt to use for encoding /
* decoding signatures.
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java b/libjava/classpath/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java
index b5e059c..b147ea3 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java
@@ -1,4 +1,4 @@
-/* RSAPSSSignatureRawCodec.java --
+/* RSAPSSSignatureRawCodec.java --
Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -72,7 +72,7 @@ public class RSAPSSSignatureRawCodec
* bytes in internet order,
*
the RSA-PSS signature bytes in internet order.
*
- *
+ *
* @param signature the signature to encode, consisting of the output of the
* sign() method of a {@link RSAPSSSignature} instance
* --a byte array.
diff --git a/libjava/classpath/gnu/java/security/sig/rsa/RSASignatureFactory.java b/libjava/classpath/gnu/java/security/sig/rsa/RSASignatureFactory.java
index b8e12ca..ba5121b 100644
--- a/libjava/classpath/gnu/java/security/sig/rsa/RSASignatureFactory.java
+++ b/libjava/classpath/gnu/java/security/sig/rsa/RSASignatureFactory.java
@@ -71,7 +71,7 @@ public class RSASignatureFactory
* hyphen chanaracter - followed by the canonical message digest
* algorithm name. When no message digest algorithm name is given, SHA-160 is
* used.
- *
+ *
* @param name the composite RSA signature name.
* @return a new instance of an RSA Signature algorithm implementation.
* Returns null if the given name does not correspond to any
@@ -102,7 +102,7 @@ public class RSASignatureFactory
/**
* Returns a {@link Set} of names of RSA signatures supported by this
* Factory.
- *
+ *
* @return a {@link Set} of RSA Signature algorithm names (Strings).
*/
public static synchronized final Set getNames()
diff --git a/libjava/classpath/gnu/java/security/util/ByteArray.java b/libjava/classpath/gnu/java/security/util/ByteArray.java
index 5144920..a9b9e5d 100644
--- a/libjava/classpath/gnu/java/security/util/ByteArray.java
+++ b/libjava/classpath/gnu/java/security/util/ByteArray.java
@@ -65,23 +65,23 @@ public final class ByteArray
int len = value.length;
while (i < len)
{
- out.print (formatInt (i, 16, 8));
- out.print (" ");
- int l = Math.min (16, len - i);
- String s = toHexString (value, i, l, ' ');
- out.print (s);
- for (int j = 56 - (56 - s.length ()); j < 56; j++)
- out.print (" ");
- for (int j = 0; j < l; j++)
- {
- byte b = value[i+j];
- if ((b & 0xFF) < 0x20 || (b & 0xFF) > 0x7E)
- out.print (".");
- else
- out.print ((char) (b & 0xFF));
- }
- out.println ();
- i += 16;
+ out.print (formatInt (i, 16, 8));
+ out.print (" ");
+ int l = Math.min (16, len - i);
+ String s = toHexString (value, i, l, ' ');
+ out.print (s);
+ for (int j = 56 - (56 - s.length ()); j < 56; j++)
+ out.print (" ");
+ for (int j = 0; j < l; j++)
+ {
+ byte b = value[i+j];
+ if ((b & 0xFF) < 0x20 || (b & 0xFF) > 0x7E)
+ out.print (".");
+ else
+ out.print ((char) (b & 0xFF));
+ }
+ out.println ();
+ i += 16;
}
return str.toString ();
}
@@ -91,8 +91,8 @@ public final class ByteArray
CPStringBuilder str = new CPStringBuilder();
for (int i = 0; i < len; i++)
{
- str.append (Character.forDigit (buf[i+off] >>> 4 & 0x0F, 16));
- str.append (Character.forDigit (buf[i+off] & 0x0F, 16));
+ str.append (Character.forDigit (buf[i+off] >>> 4 & 0x0F, 16));
+ str.append (Character.forDigit (buf[i+off] & 0x0F, 16));
if (i < len - 1)
str.append(sep);
}
diff --git a/libjava/classpath/gnu/java/security/util/ByteBufferOutputStream.java b/libjava/classpath/gnu/java/security/util/ByteBufferOutputStream.java
index be4d0a9..642ccdf 100644
--- a/libjava/classpath/gnu/java/security/util/ByteBufferOutputStream.java
+++ b/libjava/classpath/gnu/java/security/util/ByteBufferOutputStream.java
@@ -47,18 +47,18 @@ import java.nio.ByteBuffer;
/**
* An output stream that writes bytes to a ByteBuffer, which will be resized
* if more space is needed.
- *
+ *
* @author Casey Marshall (csm@gnu.org)
*/
public class ByteBufferOutputStream extends OutputStream
{
private ByteBuffer buffer;
-
+
public ByteBufferOutputStream()
{
this(256);
}
-
+
public ByteBufferOutputStream(int initialCapacity)
{
buffer = ByteBuffer.allocate(initialCapacity);
@@ -71,16 +71,16 @@ public class ByteBufferOutputStream extends OutputStream
{
if (!buffer.hasRemaining())
growBuffer();
- buffer.put((byte) b);
+ buffer.put((byte) b);
}
-
+
public @Override synchronized void write(byte[] b, int offset, int length)
{
if (buffer.remaining() < length)
growBuffer();
buffer.put(b, offset, length);
}
-
+
public @Override void write(byte[] b)
{
write(b, 0, b.length);
@@ -90,19 +90,19 @@ public class ByteBufferOutputStream extends OutputStream
* Get the current state of the buffer. The returned buffer will have
* its position set to zero, its capacity set to the current limit,
* and its limit set to its capacity.
- *
+ *
* @return The buffer.
*/
public ByteBuffer buffer()
{
return ((ByteBuffer) buffer.duplicate().flip()).slice();
}
-
+
public String toString()
{
return super.toString() + " [ buffer: " + buffer + " ]";
}
-
+
private void growBuffer()
{
int newCapacity = buffer.capacity();
diff --git a/libjava/classpath/gnu/java/security/util/ExpirableObject.java b/libjava/classpath/gnu/java/security/util/ExpirableObject.java
index e0c4e6b..e24af24 100644
--- a/libjava/classpath/gnu/java/security/util/ExpirableObject.java
+++ b/libjava/classpath/gnu/java/security/util/ExpirableObject.java
@@ -57,7 +57,7 @@ import javax.security.auth.Destroyable;
*
* Note that if a {@link DestroyFailedException} occurs when the timeout
* expires, it will not be reported.
- *
+ *
* @see Destroyable
*/
public abstract class ExpirableObject
@@ -89,7 +89,7 @@ public abstract class ExpirableObject
/**
* Create a new expirable object that will expire after the specified timeout.
- *
+ *
* @param delay The delay before expiration.
* @throws IllegalArgumentException If delay is negative, or if
* delay + System.currentTimeMillis() is negative.
@@ -104,7 +104,7 @@ public abstract class ExpirableObject
* Destroys this object. This method calls {@link #doDestroy}, then, if no
* exception is thrown, cancels the task that would destroy this object when
* the timeout is reached.
- *
+ *
* @throws DestroyFailedException If this operation fails.
*/
public final void destroy() throws DestroyFailedException
@@ -116,7 +116,7 @@ public abstract class ExpirableObject
/**
* Subclasses must implement this method instead of the {@link
* Destroyable#destroy()} method.
- *
+ *
* @throws DestroyFailedException If this operation fails.
*/
protected abstract void doDestroy() throws DestroyFailedException;
diff --git a/libjava/classpath/gnu/java/security/util/FormatUtil.java b/libjava/classpath/gnu/java/security/util/FormatUtil.java
index eed669c..35da322 100644
--- a/libjava/classpath/gnu/java/security/util/FormatUtil.java
+++ b/libjava/classpath/gnu/java/security/util/FormatUtil.java
@@ -53,7 +53,7 @@ public class FormatUtil
/**
* Returns the fully qualified name of the designated encoding ID.
- *
+ *
* @param formatID the unique identifier of the encoding format.
* @return the fully qualified name of the designated format. Returns
* null if no such encoding format is known.
@@ -83,7 +83,7 @@ public class FormatUtil
/**
* Returns the short name of the designated encoding ID. This is used by the
* JCE Adapters.
- *
+ *
* @param formatID the unique identifier of the encoding format.
* @return the short name of the designated format. Returns null
* if no such encoding format is known.
@@ -112,7 +112,7 @@ public class FormatUtil
/**
* Returns the identifier of the encoding format given its short name.
- *
+ *
* @param name the case-insensitive canonical short name of an encoding
* format.
* @return the identifier of the designated encoding format, or 0
@@ -134,7 +134,7 @@ public class FormatUtil
result = Registry.X509_ENCODING_ID;
else if (name.equalsIgnoreCase(Registry.PKCS8_ENCODING_SHORT_NAME))
result = Registry.PKCS8_ENCODING_ID;
-
+
return result;
}
}
diff --git a/libjava/classpath/gnu/java/security/util/IntegerUtil.java b/libjava/classpath/gnu/java/security/util/IntegerUtil.java
index f071308..106dc4d 100644
--- a/libjava/classpath/gnu/java/security/util/IntegerUtil.java
+++ b/libjava/classpath/gnu/java/security/util/IntegerUtil.java
@@ -71,7 +71,7 @@ public abstract class IntegerUtil
* This method MUST be used in the gnu.java.security and gnu.javax.crypto
* packages to ensure they would work with a version 1.4 only of the Java
* class library API.
- *
+ *
* @param aString a string representation of an integer.
* @return the {@link Integer} object representing the designated string.
*/
@@ -98,7 +98,7 @@ public abstract class IntegerUtil
* This method MUST be used in the gnu.java.security and gnu.javax.crypto
* packages to ensure they would work with a version 1.4 only of the Java
* class library API.
- *
+ *
* @param anInt a decimal integer.
* @return the {@link Integer} object representing the designated primitive.
*/
diff --git a/libjava/classpath/gnu/java/security/util/PRNG.java b/libjava/classpath/gnu/java/security/util/PRNG.java
index 7bb27cb..1bed04d 100644
--- a/libjava/classpath/gnu/java/security/util/PRNG.java
+++ b/libjava/classpath/gnu/java/security/util/PRNG.java
@@ -47,7 +47,7 @@ import gnu.java.security.prng.MDGenerator;
/**
* A useful hash-based (SHA) pseudo-random number generator used throughout this
* library.
- *
+ *
* @see MDGenerator
*/
public class PRNG
@@ -57,7 +57,7 @@ public class PRNG
/**
* Private constructor to enforce using the Factory method.
- *
+ *
* @param delegate the undelying {@link IRandom} object used.
*/
private PRNG(IRandom delegate)
@@ -93,7 +93,7 @@ public class PRNG
/**
* Completely fills the designated buffer with random data
* generated by the underlying delegate.
- *
+ *
* @param buffer the place holder of random bytes generated by the underlying
* delegate. On output, the contents of buffer are
* replaced with pseudo-random data, iff the buffer
@@ -108,7 +108,7 @@ public class PRNG
* Fills the designated buffer, starting from byte at position
* offset with, at most, length bytes of random
* data generated by the underlying delegate.
- *
+ *
* @see IRandom#nextBytes
*/
public void nextBytes(byte[] buffer, int offset, int length)
diff --git a/libjava/classpath/gnu/java/security/util/Prime.java b/libjava/classpath/gnu/java/security/util/Prime.java
index e493ce6..82c584f 100644
--- a/libjava/classpath/gnu/java/security/util/Prime.java
+++ b/libjava/classpath/gnu/java/security/util/Prime.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -55,49 +55,49 @@ public final class Prime
BigInteger p = new BigInteger( (pmax + pmin)/2, new Random() );
if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmin ) ) <= 0 )
{
- p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin ).subtract( p ) );
+ p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin ).subtract( p ) );
}
-
+
//Step 2 - test for even
if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0)
p = p.add( BigInteger.valueOf( 1 ) );
for(;;)
{
- //Step 3
- if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0)
- {
- //Step 3.1
- p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) );
- p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) );
- p = p.subtract( BigInteger.valueOf( 1 ) );
-
- //Step 3.2
- // put step 2 code here so looping code is cleaner
- //Step 2 - test for even
- if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0)
- p = p.add( BigInteger.valueOf( 1 ) );
- continue;
- }
-
- //Step 4 - compute GCD
- d = p.subtract( BigInteger.valueOf(1) );
- d = d.gcd( f );
-
- //Step 5 - test d
- if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0)
- {
- //Step 5.1 - test primality
- if( p.isProbablePrime( 1 ) == true )
- {
- //Step 5.2;
- return p;
- }
- }
- //Step 6
- p = p.add( BigInteger.valueOf( 2 ) );
-
- //Step 7
+ //Step 3
+ if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0)
+ {
+ //Step 3.1
+ p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) );
+ p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) );
+ p = p.subtract( BigInteger.valueOf( 1 ) );
+
+ //Step 3.2
+ // put step 2 code here so looping code is cleaner
+ //Step 2 - test for even
+ if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0)
+ p = p.add( BigInteger.valueOf( 1 ) );
+ continue;
+ }
+
+ //Step 4 - compute GCD
+ d = p.subtract( BigInteger.valueOf(1) );
+ d = d.gcd( f );
+
+ //Step 5 - test d
+ if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0)
+ {
+ //Step 5.1 - test primality
+ if( p.isProbablePrime( 1 ) == true )
+ {
+ //Step 5.2;
+ return p;
+ }
+ }
+ //Step 6
+ p = p.add( BigInteger.valueOf( 2 ) );
+
+ //Step 7
}
}
@@ -122,43 +122,43 @@ public final class Prime
//Step 4 - test for even
if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0)
- p = p.add( r );
+ p = p.add( r );
for(;;)
- {
- //Step 5
- if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0)
- {
- //Step 5.1
- p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) );
- p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) );
- p = p.subtract( BigInteger.valueOf( 1 ) );
-
- //Step 5.2 - goto to Step 2
- break steptwo;
- }
-
- //Step 6
- d = p.subtract( BigInteger.valueOf(1) );
- d = d.gcd( f );
-
- //Step 7 - test d
- if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0)
- {
- //Step 7.1 - test primality
- if( p.isProbablePrime( 1 ) == true )
- {
- //Step 7.2;
- return p;
- }
- }
- //Step 8
- p = p.add( r.multiply( BigInteger.valueOf(2) ) );
-
- //Step 9
- }
+ {
+ //Step 5
+ if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0)
+ {
+ //Step 5.1
+ p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) );
+ p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) );
+ p = p.subtract( BigInteger.valueOf( 1 ) );
+
+ //Step 5.2 - goto to Step 2
+ break steptwo;
+ }
+
+ //Step 6
+ d = p.subtract( BigInteger.valueOf(1) );
+ d = d.gcd( f );
+
+ //Step 7 - test d
+ if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0)
+ {
+ //Step 7.1 - test primality
+ if( p.isProbablePrime( 1 ) == true )
+ {
+ //Step 7.2;
+ return p;
+ }
+ }
+ //Step 8
+ p = p.add( r.multiply( BigInteger.valueOf(2) ) );
+
+ //Step 9
+ }
}
//Should never reach here but makes the compiler happy
- return BigInteger.valueOf(0);
+ return BigInteger.valueOf(0);
}
}
diff --git a/libjava/classpath/gnu/java/security/util/Sequence.java b/libjava/classpath/gnu/java/security/util/Sequence.java
index 5e3a64e..63086d2 100644
--- a/libjava/classpath/gnu/java/security/util/Sequence.java
+++ b/libjava/classpath/gnu/java/security/util/Sequence.java
@@ -55,7 +55,7 @@ public final class Sequence
* through all positive integers then negative integers until the end value is
* reached. Naturally, this will result in an enormous object, so don't do
* this.
- *
+ *
* @param end The ending value.
*/
public Sequence(int end)
@@ -68,7 +68,7 @@ public final class Sequence
* increment of 1. If end is less than start, then the
* sequence will wrap around until the end value is reached. Naturally, this
* will result in an enormous object, so don't do this.
- *
+ *
* @param start The starting value.
* @param end The ending value.
*/
@@ -88,7 +88,7 @@ public final class Sequence
* If span is 0, then the sequence will contain {start,
* end} if start != end, or just the singleton
* start if start == end.
- *
+ *
* @param start The starting value.
* @param end The ending value.
* @param span The increment value.
diff --git a/libjava/classpath/gnu/java/security/util/SimpleList.java b/libjava/classpath/gnu/java/security/util/SimpleList.java
index 74f3baf..15d54c9 100644
--- a/libjava/classpath/gnu/java/security/util/SimpleList.java
+++ b/libjava/classpath/gnu/java/security/util/SimpleList.java
@@ -54,7 +54,7 @@ public final class SimpleList
/**
* Create a singleton list.
- *
+ *
* @param element The first element.
*/
public SimpleList(final Object element)
@@ -65,7 +65,7 @@ public final class SimpleList
/**
* Create an ordered pair (2-tuple).
- *
+ *
* @param e1 The first element.
* @param e2 The second element.
*/
@@ -78,7 +78,7 @@ public final class SimpleList
/**
* Create a 3-tuple.
- *
+ *
* @param e1 The first element.
* @param e2 The second element.
* @param e3 The third element.
@@ -93,7 +93,7 @@ public final class SimpleList
/**
* Create a 4-tuple.
- *
+ *
* @param e1 The first element.
* @param e2 The second element.
* @param e3 The third element.
@@ -121,7 +121,7 @@ public final class SimpleList
* Create an n-tuple of arbitrary size. Even if the supplied collection has no
* natural order, the created n-tuple will have the order that the elements
* are returned by the collection's iterator.
- *
+ *
* @param c The collection.
*/
public SimpleList(Collection c)
diff --git a/libjava/classpath/gnu/java/security/util/Util.java b/libjava/classpath/gnu/java/security/util/Util.java
index 50d4466..ef3d480 100644
--- a/libjava/classpath/gnu/java/security/util/Util.java
+++ b/libjava/classpath/gnu/java/security/util/Util.java
@@ -70,7 +70,7 @@ public class Util
*
* toString(ba, 0, ba.length);
*
- *
+ *
* @param ba the byte array to convert.
* @return a string of hexadecimal characters (two for each byte) representing
* the designated input byte array.
@@ -84,7 +84,7 @@ public class Util
* Returns a string of hexadecimal digits from a byte array, starting at
* offset and consisting of length bytes. Each
* byte is converted to 2 hex symbols; zero(es) included.
- *
+ *
* @param ba the byte array to convert.
* @param offset the index from which to start considering the bytes to
* convert.
@@ -114,7 +114,7 @@ public class Util
*
* toReversedString(ba, 0, ba.length);
*
- *
+ *
* @param ba the byte array to convert.
* @return a string of hexadecimal characters (two for each byte) representing
* the designated input byte array.
@@ -131,7 +131,7 @@ public class Util
*
* The byte array is treated as a large little-endian integer, and is returned
* as a large big-endian integer.
- *
+ *
* @param ba the byte array to convert.
* @param offset the index from which to start considering the bytes to
* convert.
@@ -156,7 +156,7 @@ public class Util
*
* Returns a byte array from a string of hexadecimal digits.
*
- *
+ *
* @param s a string of hexadecimal ASCII characters
* @return the decoded byte array from the input hexadecimal string.
*/
@@ -179,7 +179,7 @@ public class Util
* Returns a byte array from a string of hexadecimal digits, interpreting them
* as a large big-endian integer and returning it as a large little-endian
* integer.
- *
+ *
* @param s a string of hexadecimal ASCII characters
* @return the decoded byte array from the input hexadecimal string.
*/
@@ -201,7 +201,7 @@ public class Util
/**
* Returns a number from 0 to 15 corresponding
* to the designated hexadecimal digit.
- *
+ *
* @param c a hexadecimal ASCII symbol.
*/
public static int fromDigit(char c)
@@ -219,7 +219,7 @@ public class Util
/**
* Returns a string of 8 hexadecimal digits (most significant digit first)
* corresponding to the unsigned integer n.
- *
+ *
* @param n the unsigned integer to convert.
* @return a hexadecimal string 8-character long.
*/
@@ -260,7 +260,7 @@ public class Util
/**
* Returns a string of 16 hexadecimal digits (most significant digit first)
* corresponding to the unsigned long n.
- *
+ *
* @param n the unsigned long to convert.
* @return a hexadecimal string 16-character long.
*/
@@ -280,7 +280,7 @@ public class Util
* escape character is inserted before every pair of bytes. Useful to
* externalise byte arrays that will be constructed later from such strings;
* eg. s-box values.
- *
+ *
* @throws ArrayIndexOutOfBoundsException if the length is odd.
*/
public static String toUnicodeString(byte[] ba)
@@ -293,7 +293,7 @@ public class Util
* escape character is inserted before every pair of bytes. Useful to
* externalise byte arrays that will be constructed later from such strings;
* eg. s-box values.
- *
+ *
* @throws ArrayIndexOutOfBoundsException if the length is odd.
*/
public static final String toUnicodeString(byte[] ba, int offset, int length)
@@ -324,7 +324,7 @@ public class Util
* escape character is inserted before every pair of bytes. Useful to
* externalise integer arrays that will be constructed later from such
* strings; eg. s-box values.
- *
+ *
* @throws ArrayIndexOutOfBoundsException if the length is not a multiple of
* 4.
*/
@@ -376,7 +376,7 @@ public class Util
* If offset and length are omitted, the whole
* array is used. If m is omitted, nothing is prepended to each
* line.
- *
+ *
* @param data the byte array to be dumped.
* @param offset the offset within data to start from.
* @param length the number of bytes to dump.
@@ -433,7 +433,7 @@ public class Util
/**
* Returns a string of 2 hexadecimal digits (most significant digit first)
* corresponding to the lowest 8 bits of n.
- *
+ *
* @param n the byte value to convert.
* @return a string of 2 hex characters representing the input.
*/
@@ -449,7 +449,7 @@ public class Util
* '.' (dot) shall be used instead of "+' (plus).
*
* Used by SASL password file manipulation primitives.
- *
+ *
* @param buffer an arbitrary sequence of bytes to represent in Base-64.
* @return unpadded (without the '=' character(s)) Base-64 representation of
* the input.
@@ -525,7 +525,7 @@ public class Util
*
* Converts a string representing the encoding of some bytes in Base-64 to
* their original form.
- *
+ *
* @param str the Base-64 encoded representation of some byte(s).
* @return the bytes represented by the str.
* @throws NumberFormatException if str is null,
@@ -597,7 +597,7 @@ public class Util
* Treats the input as the MSB representation of a number, and discards
* leading zero elements. For efficiency, the input is simply returned if no
* leading zeroes are found.
- *
+ *
* @param n the {@link BigInteger} to trim.
* @return the byte array representation of the designated {@link BigInteger}
* with no leading 0-bytes.
@@ -618,7 +618,7 @@ public class Util
/**
* Returns a hexadecimal dump of the trimmed bytes of a {@link BigInteger}.
- *
+ *
* @param x the {@link BigInteger} to display.
* @return the string representation of the designated {@link BigInteger}.
*/
diff --git a/libjava/classpath/gnu/java/security/x509/X509CRLSelectorImpl.java b/libjava/classpath/gnu/java/security/x509/X509CRLSelectorImpl.java
index 0ada550..582d185 100644
--- a/libjava/classpath/gnu/java/security/x509/X509CRLSelectorImpl.java
+++ b/libjava/classpath/gnu/java/security/x509/X509CRLSelectorImpl.java
@@ -135,4 +135,3 @@ public class X509CRLSelectorImpl implements CRLSelector
return false;
}
}
-
diff --git a/libjava/classpath/gnu/java/security/x509/X509CertSelectorImpl.java b/libjava/classpath/gnu/java/security/x509/X509CertSelectorImpl.java
index 36187ad..5201a76 100644
--- a/libjava/classpath/gnu/java/security/x509/X509CertSelectorImpl.java
+++ b/libjava/classpath/gnu/java/security/x509/X509CertSelectorImpl.java
@@ -194,4 +194,3 @@ public class X509CertSelectorImpl implements CertSelector
return matchIssuer && matchSubject;
}
}
-
diff --git a/libjava/classpath/gnu/java/security/x509/ext/CertificatePolicies.java b/libjava/classpath/gnu/java/security/x509/ext/CertificatePolicies.java
index c451762..874b8ee 100644
--- a/libjava/classpath/gnu/java/security/x509/ext/CertificatePolicies.java
+++ b/libjava/classpath/gnu/java/security/x509/ext/CertificatePolicies.java
@@ -142,7 +142,7 @@ public class CertificatePolicies extends Extension.Value
{
return policies;
}
-
+
/**
* Returns the list of policy OIDs, formatted as dotted-decimal strings.
*
diff --git a/libjava/classpath/gnu/java/security/x509/ext/GeneralName.java b/libjava/classpath/gnu/java/security/x509/ext/GeneralName.java
index fbc0533..f399de1 100644
--- a/libjava/classpath/gnu/java/security/x509/ext/GeneralName.java
+++ b/libjava/classpath/gnu/java/security/x509/ext/GeneralName.java
@@ -48,7 +48,7 @@ import java.util.Arrays;
/**
* The GeneralName structure from X.509.
- *
+ *
*
GeneralName ::= CHOICE {
otherName [0] OtherName,
@@ -87,12 +87,12 @@ public class GeneralName
registeredId (8);
private int tag;
-
+
private Kind(int tag)
{
this.tag = tag;
}
-
+
public static Kind forTag(final int tag)
{
switch (tag)
@@ -107,10 +107,10 @@ public class GeneralName
case 7: return iPAddress;
case 8: return registeredId;
}
-
+
throw new IllegalArgumentException("invalid tag: " + tag);
}
-
+
public int tag()
{
return tag;
@@ -120,17 +120,17 @@ public class GeneralName
private final Kind kind;
private final byte[] name;
private final byte[] encoded;
-
+
public GeneralName(byte[] encoded) throws IOException
{
DERReader reader = new DERReader(encoded);
DERValue value = reader.read();
-
+
if (value.getTagClass() != DER.CONTEXT)
throw new IOException("malformed GeneralName");
-
+
this.encoded = value.getEncoded();
-
+
kind = Kind.forTag(value.getTag());
switch (kind)
{
@@ -176,29 +176,29 @@ public class GeneralName
name = value.getEncoded();
name[0] = DER.OBJECT_IDENTIFIER;
break;
-
+
default:
name = null; // Not reached.
}
}
-
+
public GeneralName(Kind kind, byte[] name)
{
this.kind = kind;
this.name = (byte[]) name.clone();
this.encoded = null;
}
-
+
public Kind kind()
{
return kind;
}
-
+
public byte[] name()
{
return (byte[]) name.clone();
}
-
+
public byte[] encoded()
{
try
@@ -210,7 +210,7 @@ public class GeneralName
return null;
}
}
-
+
public boolean equals(Object o)
{
try
@@ -223,7 +223,7 @@ public class GeneralName
return false;
}
}
-
+
public String toString()
{
return (super.toString() + " [ kind=" + kind + "; name=" +
diff --git a/libjava/classpath/gnu/java/security/x509/ext/GeneralSubtree.java b/libjava/classpath/gnu/java/security/x509/ext/GeneralSubtree.java
index 5f6ffd9..5d688de 100644
--- a/libjava/classpath/gnu/java/security/x509/ext/GeneralSubtree.java
+++ b/libjava/classpath/gnu/java/security/x509/ext/GeneralSubtree.java
@@ -1,4 +1,4 @@
-/* GeneralSubtree.java --
+/* GeneralSubtree.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -63,20 +63,20 @@ public class GeneralSubtree
private final GeneralName base;
private final int minimum;
private final int maximum;
-
+
public GeneralSubtree(byte[] encoded) throws IOException
{
DERReader reader = new DERReader(encoded);
DERValue generalSubtree = reader.read();
-
+
if (!generalSubtree.isConstructed())
throw new IOException("malformed GeneralSubtree");
-
+
DERValue generalName = reader.read();
base = new GeneralName(generalName.getEncoded());
if (generalName.isConstructed())
reader.skip(generalName.getLength());
-
+
int len = generalName.getEncodedLength();
if (len < generalSubtree.getLength())
{
@@ -116,7 +116,7 @@ public class GeneralSubtree
maximum = -1;
}
}
-
+
/**
* Returns the base name.
*
@@ -126,7 +126,7 @@ public class GeneralSubtree
{
return base;
}
-
+
/**
* Returns the minimum base distance, possibly zero.
*
@@ -136,7 +136,7 @@ public class GeneralSubtree
{
return minimum;
}
-
+
/**
* Returns the maximum base distance, or -1 if this value was not specified.
*
@@ -146,7 +146,7 @@ public class GeneralSubtree
{
return maximum;
}
-
+
public String toString()
{
return (GeneralSubtree.class.getName() + " [ base=" + base
diff --git a/libjava/classpath/gnu/java/security/x509/ext/NameConstraints.java b/libjava/classpath/gnu/java/security/x509/ext/NameConstraints.java
index 607c429..8f374d5 100644
--- a/libjava/classpath/gnu/java/security/x509/ext/NameConstraints.java
+++ b/libjava/classpath/gnu/java/security/x509/ext/NameConstraints.java
@@ -51,7 +51,7 @@ import java.util.List;
/**
* The NameConstraints extension. From RFC 3280, section 4.2.1.11, this
* extension is defined as:
- *
+ *
*
- *
+ *
* See also the classes {@link GeneralNames} and {@link GeneralSubtree}.
- *
+ *
* @author csm
*/
public class NameConstraints extends Value
{
public static final OID ID = new OID("2.5.29.30");
-
+
private List permittedSubtrees;
private List excludedSubtrees;
-
+
public NameConstraints(byte[] encoded) throws IOException
{
super(encoded);
-
+
DERReader der = new DERReader(encoded);
DERValue value = der.read();
if (!value.isConstructed())
{
throw new IOException("malformed NameConstraints");
}
-
+
permittedSubtrees = new LinkedList();
excludedSubtrees = new LinkedList();
int len = 0;
@@ -108,7 +108,7 @@ public class NameConstraints extends Value
len2 += subtree.getEncodedLength();
}
len += subtrees.getEncodedLength();
-
+
if (len < value.getLength())
{
subtrees = der.read();
@@ -134,24 +134,24 @@ public class NameConstraints extends Value
excludedSubtrees.add(new GeneralSubtree(subtree.getEncoded()));
der.skip(subtree.getLength());
len2 += subtree.getEncodedLength();
- }
+ }
}
else
throw new IOException("unexpected tag " + subtrees.getTag()
+ " (expecting 0 or 1)");
}
}
-
+
public List permittedSubtrees()
{
return Collections.unmodifiableList(permittedSubtrees);
}
-
+
public List excludedSubtrees()
{
return Collections.unmodifiableList(excludedSubtrees);
}
-
+
public String toString()
{
return NameConstraints.class.getName() + " [ permittedSubtrees="
diff --git a/libjava/classpath/gnu/java/text/AttributedFormatBuffer.java b/libjava/classpath/gnu/java/text/AttributedFormatBuffer.java
index c2aae96..2a89ae0 100644
--- a/libjava/classpath/gnu/java/text/AttributedFormatBuffer.java
+++ b/libjava/classpath/gnu/java/text/AttributedFormatBuffer.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -56,13 +56,13 @@ public class AttributedFormatBuffer implements FormatBuffer
private final ArrayList ranges;
private final ArrayList attributes;
private int[] a_ranges;
- private HashMap[] a_attributes;
+ private HashMap[] a_attributes;
private int startingRange;
AttributedCharacterIterator.Attribute defaultAttr;
/**
* This constructor accepts a StringBuffer. If the buffer contains
- * already some characters they will not be attributed.
+ * already some characters they will not be attributed.
*/
public AttributedFormatBuffer(CPStringBuilder buffer)
{
@@ -72,8 +72,8 @@ public class AttributedFormatBuffer implements FormatBuffer
this.defaultAttr = null;
if (buffer.length() != 0)
{
- this.startingRange = buffer.length();
- addAttribute(buffer.length(), null);
+ this.startingRange = buffer.length();
+ addAttribute(buffer.length(), null);
}
else
this.startingRange = -1;
@@ -96,16 +96,16 @@ public class AttributedFormatBuffer implements FormatBuffer
*
* @param new_range A new range to insert in the list.
* @param attr A new attribute to insert in the list.
- */
+ */
private final void addAttribute(int new_range, AttributedCharacterIterator.Attribute attr)
{
HashMap map;
if (attr != null)
{
- map = new HashMap();
- map.put(attr, attr);
- attributes.add(map);
+ map = new HashMap();
+ map.put(attr, attr);
+ attributes.add(map);
}
else
attributes.add(null);
@@ -119,7 +119,7 @@ public class AttributedFormatBuffer implements FormatBuffer
startingRange = 0;
buffer.append(s);
}
-
+
public void append(String s, AttributedCharacterIterator.Attribute attr)
{
setDefaultAttribute(attr);
@@ -135,11 +135,11 @@ public class AttributedFormatBuffer implements FormatBuffer
setDefaultAttribute(null);
if (ranges != null)
{
- for (int i = 0; i < ranges.length; i++)
- {
- this.ranges.add(new Integer(ranges[i] + curPos));
- this.attributes.add(attrs[i]);
- }
+ for (int i = 0; i < ranges.length; i++)
+ {
+ this.ranges.add(new Integer(ranges[i] + curPos));
+ this.attributes.add(attrs[i]);
+ }
}
startingRange = buffer.length();
buffer.append(s);
@@ -168,7 +168,7 @@ public class AttributedFormatBuffer implements FormatBuffer
if (startingRange != currentPos && startingRange >= 0)
{
- addAttribute(currentPos, defaultAttr);
+ addAttribute(currentPos, defaultAttr);
}
defaultAttr = attr;
startingRange = currentPos;
@@ -212,7 +212,7 @@ public class AttributedFormatBuffer implements FormatBuffer
a_ranges = new int[ranges.size()];
for (int i = 0; i < a_ranges.length; i++)
a_ranges[i] = ((Integer)(ranges.get (i))).intValue();
-
+
a_attributes = new HashMap[attributes.size()];
System.arraycopy(attributes.toArray(), 0, a_attributes, 0, a_attributes.length);
}
@@ -239,7 +239,7 @@ public class AttributedFormatBuffer implements FormatBuffer
}
/**
- * This method returns the array containing the map on the
+ * This method returns the array containing the map on the
* attributes.
*
* @return An array of {@link java.util.Map} containing the attributes.
diff --git a/libjava/classpath/gnu/java/text/BaseBreakIterator.java b/libjava/classpath/gnu/java/text/BaseBreakIterator.java
index 4afd8ae..b69f698 100644
--- a/libjava/classpath/gnu/java/text/BaseBreakIterator.java
+++ b/libjava/classpath/gnu/java/text/BaseBreakIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -70,7 +70,7 @@ public abstract class BaseBreakIterator extends BreakIterator
/**
* Return the first boundary after pos.
- * This has the side effect of setting the index of the
+ * This has the side effect of setting the index of the
* CharacterIterator.
*/
public int following (int pos)
@@ -98,19 +98,19 @@ public abstract class BaseBreakIterator extends BreakIterator
int r = iter.getIndex ();
if (n > 0)
{
- while (n > 0 && r != DONE)
- {
- r = next ();
- --n;
- }
+ while (n > 0 && r != DONE)
+ {
+ r = next ();
+ --n;
+ }
}
else if (n < 0)
{
- while (n < 0 && r != DONE)
- {
- r = previous ();
- ++n;
- }
+ while (n < 0 && r != DONE)
+ {
+ r = previous ();
+ ++n;
+ }
}
return r;
}
diff --git a/libjava/classpath/gnu/java/text/CharacterBreakIterator.java b/libjava/classpath/gnu/java/text/CharacterBreakIterator.java
index 5274543..565eb9b 100644
--- a/libjava/classpath/gnu/java/text/CharacterBreakIterator.java
+++ b/libjava/classpath/gnu/java/text/CharacterBreakIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -111,44 +111,44 @@ public class CharacterBreakIterator extends BaseBreakIterator
char c;
for (char prev = CharacterIterator.DONE; iter.getIndex() < end; prev = c)
{
- c = iter.next();
- if (c == CharacterIterator.DONE)
- break;
- int type = Character.getType(c);
-
- // Break after paragraph separators.
- if (type == Character.PARAGRAPH_SEPARATOR)
- break;
-
- // Now we need some lookahead.
- char ahead = iter.next();
- iter.previous();
- if (ahead == CharacterIterator.DONE)
- break;
- int aheadType = Character.getType(ahead);
-
- if (aheadType != Character.NON_SPACING_MARK
- && ! isLowSurrogate (ahead)
- && ! isLVT (ahead))
- break;
- if (! isLVT (c) && isLVT (ahead))
- break;
- if (isL (c) && ! isLVT (ahead)
- && aheadType != Character.NON_SPACING_MARK)
- break;
- if (isV (c) && ! isV (ahead) && !isT (ahead)
- && aheadType != Character.NON_SPACING_MARK)
- break;
- if (isT (c) && ! isT (ahead)
- && aheadType != Character.NON_SPACING_MARK)
- break;
-
- if (! isHighSurrogate (c) && isLowSurrogate (ahead))
- break;
- if (isHighSurrogate (c) && ! isLowSurrogate (ahead))
- break;
- if (! isHighSurrogate (prev) && isLowSurrogate (c))
- break;
+ c = iter.next();
+ if (c == CharacterIterator.DONE)
+ break;
+ int type = Character.getType(c);
+
+ // Break after paragraph separators.
+ if (type == Character.PARAGRAPH_SEPARATOR)
+ break;
+
+ // Now we need some lookahead.
+ char ahead = iter.next();
+ iter.previous();
+ if (ahead == CharacterIterator.DONE)
+ break;
+ int aheadType = Character.getType(ahead);
+
+ if (aheadType != Character.NON_SPACING_MARK
+ && ! isLowSurrogate (ahead)
+ && ! isLVT (ahead))
+ break;
+ if (! isLVT (c) && isLVT (ahead))
+ break;
+ if (isL (c) && ! isLVT (ahead)
+ && aheadType != Character.NON_SPACING_MARK)
+ break;
+ if (isV (c) && ! isV (ahead) && !isT (ahead)
+ && aheadType != Character.NON_SPACING_MARK)
+ break;
+ if (isT (c) && ! isT (ahead)
+ && aheadType != Character.NON_SPACING_MARK)
+ break;
+
+ if (! isHighSurrogate (c) && isLowSurrogate (ahead))
+ break;
+ if (isHighSurrogate (c) && ! isLowSurrogate (ahead))
+ break;
+ if (! isHighSurrogate (prev) && isLowSurrogate (c))
+ break;
}
return iter.getIndex();
@@ -161,51 +161,51 @@ public class CharacterBreakIterator extends BaseBreakIterator
while (iter.getIndex() >= iter.getBeginIndex())
{
- char c = iter.previous();
- if (c == CharacterIterator.DONE)
- break;
- int type = Character.getType(c);
-
- if (type != Character.NON_SPACING_MARK
- && ! isLowSurrogate (c)
- && ! isLVT (c))
- break;
-
- // Now we need some lookahead.
- char ahead = iter.previous();
- if (ahead == CharacterIterator.DONE)
- {
- iter.next();
- break;
- }
- char ahead2 = iter.previous();
- iter.next();
- iter.next();
- if (ahead2 == CharacterIterator.DONE)
- break;
- int aheadType = Character.getType(ahead);
-
- if (aheadType == Character.PARAGRAPH_SEPARATOR)
- break;
-
- if (isLVT (c) && ! isLVT (ahead))
- break;
- if (! isLVT (c) && type != Character.NON_SPACING_MARK
- && isL (ahead))
- break;
- if (! isV (c) && ! isT (c) && type != Character.NON_SPACING_MARK
- && isV (ahead))
- break;
- if (! isT (c) && type != Character.NON_SPACING_MARK
- && isT (ahead))
- break;
-
- if (isLowSurrogate (c) && ! isHighSurrogate (ahead))
- break;
- if (! isLowSurrogate (c) && isHighSurrogate (ahead))
- break;
- if (isLowSurrogate (ahead) && ! isHighSurrogate (ahead2))
- break;
+ char c = iter.previous();
+ if (c == CharacterIterator.DONE)
+ break;
+ int type = Character.getType(c);
+
+ if (type != Character.NON_SPACING_MARK
+ && ! isLowSurrogate (c)
+ && ! isLVT (c))
+ break;
+
+ // Now we need some lookahead.
+ char ahead = iter.previous();
+ if (ahead == CharacterIterator.DONE)
+ {
+ iter.next();
+ break;
+ }
+ char ahead2 = iter.previous();
+ iter.next();
+ iter.next();
+ if (ahead2 == CharacterIterator.DONE)
+ break;
+ int aheadType = Character.getType(ahead);
+
+ if (aheadType == Character.PARAGRAPH_SEPARATOR)
+ break;
+
+ if (isLVT (c) && ! isLVT (ahead))
+ break;
+ if (! isLVT (c) && type != Character.NON_SPACING_MARK
+ && isL (ahead))
+ break;
+ if (! isV (c) && ! isT (c) && type != Character.NON_SPACING_MARK
+ && isV (ahead))
+ break;
+ if (! isT (c) && type != Character.NON_SPACING_MARK
+ && isT (ahead))
+ break;
+
+ if (isLowSurrogate (c) && ! isHighSurrogate (ahead))
+ break;
+ if (! isLowSurrogate (c) && isHighSurrogate (ahead))
+ break;
+ if (isLowSurrogate (ahead) && ! isHighSurrogate (ahead2))
+ break;
}
return iter.getIndex();
diff --git a/libjava/classpath/gnu/java/text/FormatBuffer.java b/libjava/classpath/gnu/java/text/FormatBuffer.java
index e6b6820..590b16c 100644
--- a/libjava/classpath/gnu/java/text/FormatBuffer.java
+++ b/libjava/classpath/gnu/java/text/FormatBuffer.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -42,14 +42,14 @@ import java.util.HashMap;
/**
* This interface describes a modifiable buffer which contains attributed
* characters. The implementation may or may not implements attributes. It
- * aims to greatly simplify and clarify the implementation of java.text
+ * aims to greatly simplify and clarify the implementation of java.text
* formatters. The buffer may be appended or have its tail cut. It may also
* be completely cleant up.
*
* @author Guilhem Lavaux
* @date April 10, 2004
*/
-public interface FormatBuffer
+public interface FormatBuffer
{
/**
* This method appends a simple string to the buffer. This part of
@@ -72,8 +72,8 @@ public interface FormatBuffer
/**
* This method appends a simple string to the buffer. This part of
* the buffer will be attributed using the specified ranges and attributes.
- * To have an example on how to specify ranges see {@link gnu.java.text.FormatCharacterIterator}.
- *
+ * To have an example on how to specify ranges see {@link gnu.java.text.FormatCharacterIterator}.
+ *
* @param s The string to append to the buffer.
* @param ranges The ranges describing how the attributes should be applied
* to the string.
@@ -121,7 +121,7 @@ public interface FormatBuffer
* @param length Number of characters to cut at the end of the buffer.
*/
public void cutTail(int length);
-
+
/**
* This method resets completely the buffer.
*/
diff --git a/libjava/classpath/gnu/java/text/FormatCharacterIterator.java b/libjava/classpath/gnu/java/text/FormatCharacterIterator.java
index 60773aa..889394c 100644
--- a/libjava/classpath/gnu/java/text/FormatCharacterIterator.java
+++ b/libjava/classpath/gnu/java/text/FormatCharacterIterator.java
@@ -1,4 +1,4 @@
-/* FormatCharacter.java -- Implementation of AttributedCharacterIterator for
+/* FormatCharacter.java -- Implementation of AttributedCharacterIterator for
formatters.
Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -78,7 +78,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
}
/**
- * This constructor take a string s, a set of ranges
+ * This constructor take a string s, a set of ranges
* and the corresponding attributes. This is used to build an iterator.
* The array ranges should be formatted as follow:
* each element of ranges specifies the index in the string
@@ -98,10 +98,10 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
this.ranges = ranges;
this.attributes = attributes;
}
-
- /*
+
+ /*
* The following methods are inherited from AttributedCharacterIterator,
- * and thus are already documented.
+ * and thus are already documented.
*/
public Set getAllAttributeKeys()
@@ -111,7 +111,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
else
return new HashSet();
}
-
+
public Map getAttributes()
{
if (attributes != null && attributes[attributeIndex] != null)
@@ -119,7 +119,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
else
return new HashMap();
}
-
+
public Object getAttribute (AttributedCharacterIterator.Attribute attrib)
{
if (attributes != null && attributes[attributeIndex] != null)
@@ -127,7 +127,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
else
return null;
}
-
+
public int getRunLimit(Set reqAttrs)
{
if (attributes == null)
@@ -138,19 +138,19 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
do
{
- currentAttrIndex++;
- if (currentAttrIndex == attributes.length)
- return formattedString.length();
- if (attributes[currentAttrIndex] == null)
- break;
- newKeys = attributes[currentAttrIndex].keySet();
+ currentAttrIndex++;
+ if (currentAttrIndex == attributes.length)
+ return formattedString.length();
+ if (attributes[currentAttrIndex] == null)
+ break;
+ newKeys = attributes[currentAttrIndex].keySet();
}
while (newKeys.containsAll (reqAttrs));
return ranges[currentAttrIndex-1];
}
-
- public int getRunLimit (AttributedCharacterIterator.Attribute attribute)
+
+ public int getRunLimit (AttributedCharacterIterator.Attribute attribute)
{
Set s = new HashSet();
@@ -164,38 +164,38 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
return formattedString.length();
if (attributes[attributeIndex] == null)
{
- for (int i=attributeIndex+1;i 0) ? ranges[currentAttrIndex-1] : 0;
- }
-
+ }
+
public int getRunStart()
{
if (attributes == null)
@@ -203,19 +203,19 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
if (attributes[attributeIndex] == null)
{
- for (int i=attributeIndex;i>0;i--)
- if (attributes[i] != null)
- return ranges[attributeIndex-1];
- return 0;
+ for (int i=attributeIndex;i>0;i--)
+ if (attributes[i] != null)
+ return ranges[attributeIndex-1];
+ return 0;
}
return getRunStart (attributes[attributeIndex].keySet());
}
-
- public int getRunStart (AttributedCharacterIterator.Attribute attribute)
+
+ public int getRunStart (AttributedCharacterIterator.Attribute attribute)
{
Set s = new HashSet();
-
+
s.add (attribute);
return getRunStart (s);
}
@@ -224,7 +224,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
{
return new FormatCharacterIterator (formattedString, ranges, attributes);
}
-
+
/*
* The following methods are inherited from CharacterIterator and thus
* are already documented.
@@ -234,29 +234,29 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
{
return formattedString.charAt (charIndex);
}
-
+
public char first()
{
charIndex = 0;
attributeIndex = 0;
return formattedString.charAt (0);
}
-
+
public int getBeginIndex()
{
return 0;
}
-
+
public int getEndIndex()
{
return formattedString.length();
}
-
+
public int getIndex()
{
return charIndex;
}
-
+
public char last()
{
charIndex = formattedString.length()-1;
@@ -264,53 +264,53 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
attributeIndex = attributes.length-1;
return formattedString.charAt (charIndex);
}
-
+
public char next()
{
charIndex++;
if (charIndex >= formattedString.length())
{
- charIndex = getEndIndex();
- return DONE;
+ charIndex = getEndIndex();
+ return DONE;
}
if (attributes != null)
{
- if (charIndex >= ranges[attributeIndex])
- attributeIndex++;
+ if (charIndex >= ranges[attributeIndex])
+ attributeIndex++;
}
return formattedString.charAt (charIndex);
}
-
+
public char previous()
{
charIndex--;
if (charIndex < 0)
{
- charIndex = 0;
- return DONE;
+ charIndex = 0;
+ return DONE;
}
-
+
if (attributes != null)
{
- if (charIndex < ranges[attributeIndex])
- attributeIndex--;
+ if (charIndex < ranges[attributeIndex])
+ attributeIndex--;
}
return formattedString.charAt (charIndex);
}
-
+
public char setIndex (int position)
{
if (position < 0 || position > formattedString.length())
throw new IllegalArgumentException ("position is out of range");
-
+
charIndex = position;
if (attributes != null)
{
- for (attributeIndex=0;attributeIndex charIndex)
- break;
- attributeIndex--;
+ for (attributeIndex=0;attributeIndex charIndex)
+ break;
+ attributeIndex--;
}
if (charIndex == formattedString.length())
return DONE;
@@ -334,64 +334,64 @@ public class FormatCharacterIterator implements AttributedCharacterIterator
int i = 0, j = 0;
debug("merging " + attributes.length + " attrs");
-
+
while (i < this.ranges.length && j < ranges.length)
{
- if (this.attributes[i] != null)
- {
- new_attributes.add (this.attributes[i]);
- if (attributes[j] != null)
- this.attributes[i].putAll (attributes[j]);
- }
- else
- {
- new_attributes.add (attributes[j]);
- }
- if (this.ranges[i] == ranges[j])
- {
- new_ranges.add (new Integer (ranges[j]));
- i++;
- j++;
- }
- else if (this.ranges[i] < ranges[j])
- {
- new_ranges.add (new Integer (this.ranges[i]));
- i++;
- }
- else
- {
- new_ranges.add (new Integer (ranges[j]));
- j++;
- }
+ if (this.attributes[i] != null)
+ {
+ new_attributes.add (this.attributes[i]);
+ if (attributes[j] != null)
+ this.attributes[i].putAll (attributes[j]);
+ }
+ else
+ {
+ new_attributes.add (attributes[j]);
+ }
+ if (this.ranges[i] == ranges[j])
+ {
+ new_ranges.add (new Integer (ranges[j]));
+ i++;
+ j++;
+ }
+ else if (this.ranges[i] < ranges[j])
+ {
+ new_ranges.add (new Integer (this.ranges[i]));
+ i++;
+ }
+ else
+ {
+ new_ranges.add (new Integer (ranges[j]));
+ j++;
+ }
}
-
+
if (i != this.ranges.length)
{
- for (;i " + ranges[i] + ":");
- if (attributes[i] == null)
- System.out.println("null");
- else
- {
- Set keyset = attributes[i].keySet();
- if (keyset != null)
- {
- Iterator keys = keyset.iterator();
-
- while (keys.hasNext())
- System.out.print(" " + keys.next());
- }
- else
- System.out.println("keySet null");
- System.out.println();
- }
+ System.out.print("\t" + start_range + " => " + ranges[i] + ":");
+ if (attributes[i] == null)
+ System.out.println("null");
+ else
+ {
+ Set keyset = attributes[i].keySet();
+ if (keyset != null)
+ {
+ Iterator keys = keyset.iterator();
+
+ while (keys.hasNext())
+ System.out.print(" " + keys.next());
+ }
+ else
+ System.out.println("keySet null");
+ System.out.println();
+ }
}
System.out.println();
System.out.flush();
diff --git a/libjava/classpath/gnu/java/text/LineBreakIterator.java b/libjava/classpath/gnu/java/text/LineBreakIterator.java
index ad07479..7e44121 100644
--- a/libjava/classpath/gnu/java/text/LineBreakIterator.java
+++ b/libjava/classpath/gnu/java/text/LineBreakIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -65,23 +65,23 @@ public class LineBreakIterator extends BaseBreakIterator
// Some methods to tell us different properties of characters.
private final boolean isNb (char c)
{
- return (c == 0x00a0 // NO-BREAK SPACE
- || c == 0x2011 // NON-BREAKING HYPHEN
- || c == 0xfeff); // ZERO WITH NO-BREAK SPACE
+ return (c == 0x00a0 // NO-BREAK SPACE
+ || c == 0x2011 // NON-BREAKING HYPHEN
+ || c == 0xfeff); // ZERO WITH NO-BREAK SPACE
}
private final boolean isClose (int type)
{
return (type == Character.END_PUNCTUATION
- // Unicode book says "comma, period, ...", which I take to
- // mean "Po" class.
- || type == Character.OTHER_PUNCTUATION);
+ // Unicode book says "comma, period, ...", which I take to
+ // mean "Po" class.
+ || type == Character.OTHER_PUNCTUATION);
}
private final boolean isIdeo (char c)
{
- return (c >= 0x3040 && c <= 0x309f // Hiragana
- || c >= 0x30a0 && c <= 0x30ff // Katakana
- || c >= 0x4e00 && c <= 0x9fff // Han
- || c >= 0x3100 && c <= 0x312f); // Bopomofo
+ return (c >= 0x3040 && c <= 0x309f // Hiragana
+ || c >= 0x30a0 && c <= 0x30ff // Katakana
+ || c >= 0x4e00 && c <= 0x9fff // Han
+ || c >= 0x3100 && c <= 0x312f); // Bopomofo
}
public int next ()
@@ -92,54 +92,54 @@ public class LineBreakIterator extends BaseBreakIterator
while (iter.getIndex() < end)
{
- char c = iter.current();
- int type = Character.getType(c);
-
- char n = iter.next();
-
- if (n == CharacterIterator.DONE
- || type == Character.PARAGRAPH_SEPARATOR
- || type == Character.LINE_SEPARATOR)
- break;
-
- // Handle two cases where we must scan for non-spacing marks.
- int start = iter.getIndex();
- if (type == Character.SPACE_SEPARATOR
- || type == Character.START_PUNCTUATION
- || isIdeo (c))
- {
- while (n != CharacterIterator.DONE
- && Character.getType(n) == Character.NON_SPACING_MARK)
- n = iter.next();
- if (n == CharacterIterator.DONE)
- break;
-
- if (type == Character.SPACE_SEPARATOR)
- {
- int nt = Character.getType(n);
- if (nt != Character.NON_SPACING_MARK
- && nt != Character.SPACE_SEPARATOR
- && ! isNb (n))
- break;
- }
- else if (type == Character.START_PUNCTUATION)
- {
- if (isIdeo (n))
- {
- // Open punctuation followed by non spacing marks
- // and then ideograph does not have a break in
- // it. So skip all this.
- start = iter.getIndex();
- }
- }
- else
- {
- // Ideograph preceded this character.
- if (isClose (Character.getType(n)))
- break;
- }
- }
- iter.setIndex(start);
+ char c = iter.current();
+ int type = Character.getType(c);
+
+ char n = iter.next();
+
+ if (n == CharacterIterator.DONE
+ || type == Character.PARAGRAPH_SEPARATOR
+ || type == Character.LINE_SEPARATOR)
+ break;
+
+ // Handle two cases where we must scan for non-spacing marks.
+ int start = iter.getIndex();
+ if (type == Character.SPACE_SEPARATOR
+ || type == Character.START_PUNCTUATION
+ || isIdeo (c))
+ {
+ while (n != CharacterIterator.DONE
+ && Character.getType(n) == Character.NON_SPACING_MARK)
+ n = iter.next();
+ if (n == CharacterIterator.DONE)
+ break;
+
+ if (type == Character.SPACE_SEPARATOR)
+ {
+ int nt = Character.getType(n);
+ if (nt != Character.NON_SPACING_MARK
+ && nt != Character.SPACE_SEPARATOR
+ && ! isNb (n))
+ break;
+ }
+ else if (type == Character.START_PUNCTUATION)
+ {
+ if (isIdeo (n))
+ {
+ // Open punctuation followed by non spacing marks
+ // and then ideograph does not have a break in
+ // it. So skip all this.
+ start = iter.getIndex();
+ }
+ }
+ else
+ {
+ // Ideograph preceded this character.
+ if (isClose (Character.getType(n)))
+ break;
+ }
+ }
+ iter.setIndex(start);
}
return iter.getIndex();
@@ -153,40 +153,40 @@ public class LineBreakIterator extends BaseBreakIterator
while (iter.getIndex() >= start)
{
- char c = iter.previous();
- if (c == CharacterIterator.DONE)
- break;
- int type = Character.getType(c);
-
- char n = iter.previous();
- if (n == CharacterIterator.DONE)
- break;
- iter.next();
-
- int nt = Character.getType(n);
- // Break after paragraph separators.
- if (nt == Character.PARAGRAPH_SEPARATOR
- || nt == Character.LINE_SEPARATOR)
- break;
-
- // Skip non-spacing marks.
- int init = iter.getIndex();
- while (n != CharacterIterator.DONE && nt == Character.NON_SPACING_MARK)
- {
- n = iter.previous();
- nt = Character.getType(n);
- }
-
- if (nt == Character.SPACE_SEPARATOR
- && type != Character.SPACE_SEPARATOR
- && type != Character.NON_SPACING_MARK
- && ! isNb (c))
- break;
- if (! isClose (type) && isIdeo (n))
- break;
- if (isIdeo (c) && nt != Character.START_PUNCTUATION)
- break;
- iter.setIndex(init);
+ char c = iter.previous();
+ if (c == CharacterIterator.DONE)
+ break;
+ int type = Character.getType(c);
+
+ char n = iter.previous();
+ if (n == CharacterIterator.DONE)
+ break;
+ iter.next();
+
+ int nt = Character.getType(n);
+ // Break after paragraph separators.
+ if (nt == Character.PARAGRAPH_SEPARATOR
+ || nt == Character.LINE_SEPARATOR)
+ break;
+
+ // Skip non-spacing marks.
+ int init = iter.getIndex();
+ while (n != CharacterIterator.DONE && nt == Character.NON_SPACING_MARK)
+ {
+ n = iter.previous();
+ nt = Character.getType(n);
+ }
+
+ if (nt == Character.SPACE_SEPARATOR
+ && type != Character.SPACE_SEPARATOR
+ && type != Character.NON_SPACING_MARK
+ && ! isNb (c))
+ break;
+ if (! isClose (type) && isIdeo (n))
+ break;
+ if (isIdeo (c) && nt != Character.START_PUNCTUATION)
+ break;
+ iter.setIndex(init);
}
return iter.getIndex();
diff --git a/libjava/classpath/gnu/java/text/SentenceBreakIterator.java b/libjava/classpath/gnu/java/text/SentenceBreakIterator.java
index f91d269..4da9df2 100644
--- a/libjava/classpath/gnu/java/text/SentenceBreakIterator.java
+++ b/libjava/classpath/gnu/java/text/SentenceBreakIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -70,66 +70,66 @@ public class SentenceBreakIterator extends BaseBreakIterator
while (iter.getIndex() < end)
{
- char c = iter.current();
- if (c == CharacterIterator.DONE)
- break;
- int type = Character.getType(c);
-
- char n = iter.next();
- if (n == CharacterIterator.DONE)
- break;
-
- // Always break after paragraph separator.
- if (type == Character.PARAGRAPH_SEPARATOR)
- break;
-
- if (c == '!' || c == '?')
- {
- // Skip close punctuation.
- while (n != CharacterIterator.DONE
- && Character.getType(n) == Character.END_PUNCTUATION)
- n = iter.next();
- // Skip (java) space, line and paragraph separators.
- while (n != CharacterIterator.DONE && Character.isWhitespace(n))
- n = iter.next();
-
- // There's always a break somewhere after `!' or `?'.
- break;
- }
-
- if (c == '.')
- {
- int save = iter.getIndex();
- // Skip close punctuation.
- while (n != CharacterIterator.DONE
- && Character.getType(n) == Character.END_PUNCTUATION)
- n = iter.next();
- // Skip (java) space, line and paragraph separators.
- // We keep count because we need at least one for this period to
- // represent a terminator.
- int spcount = 0;
- while (n != CharacterIterator.DONE && Character.isWhitespace(n))
- {
- n = iter.next();
- ++spcount;
- }
- if (spcount > 0)
- {
- int save2 = iter.getIndex();
- // Skip over open puncutation.
- while (n != CharacterIterator.DONE
- && Character.getType(n) == Character.START_PUNCTUATION)
- n = iter.next();
- // Next character must not be lower case.
- if (n == CharacterIterator.DONE
- || ! Character.isLowerCase(n))
- {
- iter.setIndex(save2);
- break;
- }
- }
- iter.setIndex(save);
- }
+ char c = iter.current();
+ if (c == CharacterIterator.DONE)
+ break;
+ int type = Character.getType(c);
+
+ char n = iter.next();
+ if (n == CharacterIterator.DONE)
+ break;
+
+ // Always break after paragraph separator.
+ if (type == Character.PARAGRAPH_SEPARATOR)
+ break;
+
+ if (c == '!' || c == '?')
+ {
+ // Skip close punctuation.
+ while (n != CharacterIterator.DONE
+ && Character.getType(n) == Character.END_PUNCTUATION)
+ n = iter.next();
+ // Skip (java) space, line and paragraph separators.
+ while (n != CharacterIterator.DONE && Character.isWhitespace(n))
+ n = iter.next();
+
+ // There's always a break somewhere after `!' or `?'.
+ break;
+ }
+
+ if (c == '.')
+ {
+ int save = iter.getIndex();
+ // Skip close punctuation.
+ while (n != CharacterIterator.DONE
+ && Character.getType(n) == Character.END_PUNCTUATION)
+ n = iter.next();
+ // Skip (java) space, line and paragraph separators.
+ // We keep count because we need at least one for this period to
+ // represent a terminator.
+ int spcount = 0;
+ while (n != CharacterIterator.DONE && Character.isWhitespace(n))
+ {
+ n = iter.next();
+ ++spcount;
+ }
+ if (spcount > 0)
+ {
+ int save2 = iter.getIndex();
+ // Skip over open puncutation.
+ while (n != CharacterIterator.DONE
+ && Character.getType(n) == Character.START_PUNCTUATION)
+ n = iter.next();
+ // Next character must not be lower case.
+ if (n == CharacterIterator.DONE
+ || ! Character.isLowerCase(n))
+ {
+ iter.setIndex(save2);
+ break;
+ }
+ }
+ iter.setIndex(save);
+ }
}
return iter.getIndex();
@@ -143,86 +143,86 @@ public class SentenceBreakIterator extends BaseBreakIterator
while (iter.getIndex() >= start)
{
- char c = iter.previous();
- if (c == CharacterIterator.DONE)
- break;
-
- char n = iter.previous();
- if (n == CharacterIterator.DONE)
- break;
- iter.next();
- int nt = Character.getType(n);
-
- if (! Character.isLowerCase(c)
- && (nt == Character.START_PUNCTUATION
- || Character.isWhitespace(n)))
- {
- int save = iter.getIndex();
- int save_nt = nt;
- char save_n = n;
- // Skip open punctuation.
- while (n != CharacterIterator.DONE
- && Character.getType(n) == Character.START_PUNCTUATION)
- n = iter.previous();
- if (n == CharacterIterator.DONE)
- break;
- if (Character.isWhitespace(n))
- {
- // Must have at least one (java) space after the `.'.
- int save2 = iter.getIndex();
- while (n != CharacterIterator.DONE
- && Character.isWhitespace(n))
- n = iter.previous();
- // Skip close punctuation.
- while (n != CharacterIterator.DONE
- && Character.getType(n) == Character.END_PUNCTUATION)
- n = iter.previous();
- if (n == CharacterIterator.DONE || n == '.')
- {
- // Communicate location of actual end.
- period = iter.getIndex();
- iter.setIndex(save2);
- break;
- }
- }
- iter.setIndex(save);
- nt = save_nt;
- n = save_n;
- }
-
- if (nt == Character.PARAGRAPH_SEPARATOR)
- {
- // Communicate location of actual end.
- period = iter.getIndex();
- break;
- }
- else if (Character.isWhitespace(n)
- || nt == Character.END_PUNCTUATION)
- {
- int save = iter.getIndex();
- // Skip (java) space, line and paragraph separators.
- while (n != CharacterIterator.DONE
- && Character.isWhitespace(n))
- n = iter.previous();
- // Skip close punctuation.
- while (n != CharacterIterator.DONE
- && Character.getType(n) == Character.END_PUNCTUATION)
- n = iter.previous();
- int here = iter.getIndex();
- iter.setIndex(save);
- if (n == CharacterIterator.DONE || n == '!' || n == '?')
- {
- // Communicate location of actual end.
- period = here;
- break;
- }
- }
- else if (n == '!' || n == '?')
- {
- // Communicate location of actual end.
- period = iter.getIndex();
- break;
- }
+ char c = iter.previous();
+ if (c == CharacterIterator.DONE)
+ break;
+
+ char n = iter.previous();
+ if (n == CharacterIterator.DONE)
+ break;
+ iter.next();
+ int nt = Character.getType(n);
+
+ if (! Character.isLowerCase(c)
+ && (nt == Character.START_PUNCTUATION
+ || Character.isWhitespace(n)))
+ {
+ int save = iter.getIndex();
+ int save_nt = nt;
+ char save_n = n;
+ // Skip open punctuation.
+ while (n != CharacterIterator.DONE
+ && Character.getType(n) == Character.START_PUNCTUATION)
+ n = iter.previous();
+ if (n == CharacterIterator.DONE)
+ break;
+ if (Character.isWhitespace(n))
+ {
+ // Must have at least one (java) space after the `.'.
+ int save2 = iter.getIndex();
+ while (n != CharacterIterator.DONE
+ && Character.isWhitespace(n))
+ n = iter.previous();
+ // Skip close punctuation.
+ while (n != CharacterIterator.DONE
+ && Character.getType(n) == Character.END_PUNCTUATION)
+ n = iter.previous();
+ if (n == CharacterIterator.DONE || n == '.')
+ {
+ // Communicate location of actual end.
+ period = iter.getIndex();
+ iter.setIndex(save2);
+ break;
+ }
+ }
+ iter.setIndex(save);
+ nt = save_nt;
+ n = save_n;
+ }
+
+ if (nt == Character.PARAGRAPH_SEPARATOR)
+ {
+ // Communicate location of actual end.
+ period = iter.getIndex();
+ break;
+ }
+ else if (Character.isWhitespace(n)
+ || nt == Character.END_PUNCTUATION)
+ {
+ int save = iter.getIndex();
+ // Skip (java) space, line and paragraph separators.
+ while (n != CharacterIterator.DONE
+ && Character.isWhitespace(n))
+ n = iter.previous();
+ // Skip close punctuation.
+ while (n != CharacterIterator.DONE
+ && Character.getType(n) == Character.END_PUNCTUATION)
+ n = iter.previous();
+ int here = iter.getIndex();
+ iter.setIndex(save);
+ if (n == CharacterIterator.DONE || n == '!' || n == '?')
+ {
+ // Communicate location of actual end.
+ period = here;
+ break;
+ }
+ }
+ else if (n == '!' || n == '?')
+ {
+ // Communicate location of actual end.
+ period = iter.getIndex();
+ break;
+ }
}
return iter.getIndex();
diff --git a/libjava/classpath/gnu/java/text/StringFormatBuffer.java b/libjava/classpath/gnu/java/text/StringFormatBuffer.java
index fc8d08e..2367fcc 100644
--- a/libjava/classpath/gnu/java/text/StringFormatBuffer.java
+++ b/libjava/classpath/gnu/java/text/StringFormatBuffer.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -41,7 +41,7 @@ import java.util.HashMap;
/**
* This class is an implementation of a FormatBuffer without attributes.
- *
+ *
* @author Guilhem Lavaux
* @date April 10, 2004
*/
@@ -64,7 +64,7 @@ public class StringFormatBuffer implements FormatBuffer
{
buffer.append(s);
}
-
+
public void append(String s, AttributedCharacterIterator.Attribute attr)
{
buffer.append(s);
@@ -111,7 +111,7 @@ public class StringFormatBuffer implements FormatBuffer
}
/**
- * This method returns the internal {@link java.lang.StringBuffer} which
+ * This method returns the internal {@link java.lang.StringBuffer} which
* contains the string of character.
*/
public StringBuffer getBuffer()
diff --git a/libjava/classpath/gnu/java/text/WordBreakIterator.java b/libjava/classpath/gnu/java/text/WordBreakIterator.java
index f140369..fded4bf 100644
--- a/libjava/classpath/gnu/java/text/WordBreakIterator.java
+++ b/libjava/classpath/gnu/java/text/WordBreakIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -84,78 +84,78 @@ public class WordBreakIterator extends BaseBreakIterator
while (iter.getIndex() < end)
{
- char c = iter.current();
- if (c == CharacterIterator.DONE)
- break;
- int type = Character.getType(c);
-
- char n = iter.next();
- if (n == CharacterIterator.DONE)
- break;
-
- // Break after paragraph separators.
- if (type == Character.PARAGRAPH_SEPARATOR
- || type == Character.LINE_SEPARATOR)
- break;
-
- // Break between letters and non-letters.
- // FIXME: we treat apostrophe as part of a word. This
- // is an English-ism.
- boolean is_letter = Character.isLetter(c);
- if (c != '\'' && ! is_letter && type != Character.NON_SPACING_MARK
- && Character.isLetter(n))
- break;
-
- // Always break after certain symbols, such as punctuation.
- // This heuristic is derived from hints in the JCL book and is
- // not part of Unicode. It seems to be right, however.
- // FIXME: we treat apostrophe as part of a word. This
- // is an English-ism.
- if (c != '\''
- && (type == Character.DASH_PUNCTUATION
- || type == Character.START_PUNCTUATION
- || type == Character.END_PUNCTUATION
- || type == Character.CONNECTOR_PUNCTUATION
- || type == Character.OTHER_PUNCTUATION
- || type == Character.MATH_SYMBOL
- || type == Character.CURRENCY_SYMBOL
- || type == Character.MODIFIER_SYMBOL
- || type == Character.OTHER_SYMBOL
- || type == Character.FORMAT
- || type == Character.CONTROL))
- break;
-
- boolean is_hira = isHira (c);
- boolean is_kata = isKata (c);
- boolean is_han = isHan (c);
-
- // Special case Japanese.
- if (! is_hira && ! is_kata && ! is_han
- && type != Character.NON_SPACING_MARK
- && (isHira (n) || isKata (n) || isHan (n)))
- break;
-
- if (is_hira || is_kata || is_han || is_letter)
- {
- // Now we need to do some lookahead. We might need to do
- // quite a bit of lookahead, so we save our position and
- // restore it later.
- int save = iter.getIndex();
- // Skip string of non spacing marks.
- while (n != CharacterIterator.DONE
- && Character.getType(n) == Character.NON_SPACING_MARK)
- n = iter.next();
- if (n == CharacterIterator.DONE)
- break;
- if ((is_hira && ! isHira (n))
- || (is_kata && ! isHira (n) && ! isKata (n))
- || (is_han && ! isHira (n) && ! isHan (n))
- // FIXME: we treat apostrophe as part of a word. This
- // is an English-ism.
- || (is_letter && ! Character.isLetter(n) && n != '\''))
- break;
- iter.setIndex(save);
- }
+ char c = iter.current();
+ if (c == CharacterIterator.DONE)
+ break;
+ int type = Character.getType(c);
+
+ char n = iter.next();
+ if (n == CharacterIterator.DONE)
+ break;
+
+ // Break after paragraph separators.
+ if (type == Character.PARAGRAPH_SEPARATOR
+ || type == Character.LINE_SEPARATOR)
+ break;
+
+ // Break between letters and non-letters.
+ // FIXME: we treat apostrophe as part of a word. This
+ // is an English-ism.
+ boolean is_letter = Character.isLetter(c);
+ if (c != '\'' && ! is_letter && type != Character.NON_SPACING_MARK
+ && Character.isLetter(n))
+ break;
+
+ // Always break after certain symbols, such as punctuation.
+ // This heuristic is derived from hints in the JCL book and is
+ // not part of Unicode. It seems to be right, however.
+ // FIXME: we treat apostrophe as part of a word. This
+ // is an English-ism.
+ if (c != '\''
+ && (type == Character.DASH_PUNCTUATION
+ || type == Character.START_PUNCTUATION
+ || type == Character.END_PUNCTUATION
+ || type == Character.CONNECTOR_PUNCTUATION
+ || type == Character.OTHER_PUNCTUATION
+ || type == Character.MATH_SYMBOL
+ || type == Character.CURRENCY_SYMBOL
+ || type == Character.MODIFIER_SYMBOL
+ || type == Character.OTHER_SYMBOL
+ || type == Character.FORMAT
+ || type == Character.CONTROL))
+ break;
+
+ boolean is_hira = isHira (c);
+ boolean is_kata = isKata (c);
+ boolean is_han = isHan (c);
+
+ // Special case Japanese.
+ if (! is_hira && ! is_kata && ! is_han
+ && type != Character.NON_SPACING_MARK
+ && (isHira (n) || isKata (n) || isHan (n)))
+ break;
+
+ if (is_hira || is_kata || is_han || is_letter)
+ {
+ // Now we need to do some lookahead. We might need to do
+ // quite a bit of lookahead, so we save our position and
+ // restore it later.
+ int save = iter.getIndex();
+ // Skip string of non spacing marks.
+ while (n != CharacterIterator.DONE
+ && Character.getType(n) == Character.NON_SPACING_MARK)
+ n = iter.next();
+ if (n == CharacterIterator.DONE)
+ break;
+ if ((is_hira && ! isHira (n))
+ || (is_kata && ! isHira (n) && ! isKata (n))
+ || (is_han && ! isHira (n) && ! isHan (n))
+ // FIXME: we treat apostrophe as part of a word. This
+ // is an English-ism.
+ || (is_letter && ! Character.isLetter(n) && n != '\''))
+ break;
+ iter.setIndex(save);
+ }
}
return iter.getIndex();
@@ -169,80 +169,80 @@ public class WordBreakIterator extends BaseBreakIterator
while (iter.getIndex() >= start)
{
- char c = iter.previous();
- if (c == CharacterIterator.DONE)
- break;
-
- boolean is_hira = isHira (c);
- boolean is_kata = isKata (c);
- boolean is_han = isHan (c);
- boolean is_letter = Character.isLetter(c);
-
- char n = iter.previous();
- if (n == CharacterIterator.DONE)
- break;
- iter.next();
- int type = Character.getType(n);
- // Break after paragraph separators.
- if (type == Character.PARAGRAPH_SEPARATOR
- || type == Character.LINE_SEPARATOR)
- break;
-
- // Break between letters and non-letters.
- // FIXME: we treat apostrophe as part of a word. This
- // is an English-ism.
- if (n != '\'' && ! Character.isLetter(n)
- && type != Character.NON_SPACING_MARK
- && is_letter)
- break;
-
- // Always break after certain symbols, such as punctuation.
- // This heuristic is derived from hints in the JCL book and is
- // not part of Unicode. It seems to be right, however.
- // FIXME: we treat apostrophe as part of a word. This
- // is an English-ism.
- if (n != '\''
- && (type == Character.DASH_PUNCTUATION
- || type == Character.START_PUNCTUATION
- || type == Character.END_PUNCTUATION
- || type == Character.CONNECTOR_PUNCTUATION
- || type == Character.OTHER_PUNCTUATION
- || type == Character.MATH_SYMBOL
- || type == Character.CURRENCY_SYMBOL
- || type == Character.MODIFIER_SYMBOL
- || type == Character.OTHER_SYMBOL
- || type == Character.FORMAT
- || type == Character.CONTROL))
- break;
-
- // Special case Japanese.
- if ((is_hira || is_kata || is_han)
- && ! isHira (n) && ! isKata (n) && ! isHan (n)
- && type != Character.NON_SPACING_MARK)
- break;
-
- // We might have to skip over non spacing marks to see what's
- // on the other side.
- if (! is_hira || (! is_letter && c != '\''))
- {
- int save = iter.getIndex();
- while (n != CharacterIterator.DONE
- && Character.getType(n) == Character.NON_SPACING_MARK)
- n = iter.previous();
- iter.setIndex(save);
- // This is a strange case: a bunch of non-spacing marks at
- // the beginning. We treat the current location as a word
- // break.
- if (n == CharacterIterator.DONE)
- break;
- if ((isHira (n) && ! is_hira)
- || (isKata (n) && ! is_hira && ! is_kata)
- || (isHan (n) && ! is_hira && ! is_han)
- // FIXME: we treat apostrophe as part of a word. This
- // is an English-ism.
- || (! is_letter && c != '\'' && Character.isLetter(n)))
- break;
- }
+ char c = iter.previous();
+ if (c == CharacterIterator.DONE)
+ break;
+
+ boolean is_hira = isHira (c);
+ boolean is_kata = isKata (c);
+ boolean is_han = isHan (c);
+ boolean is_letter = Character.isLetter(c);
+
+ char n = iter.previous();
+ if (n == CharacterIterator.DONE)
+ break;
+ iter.next();
+ int type = Character.getType(n);
+ // Break after paragraph separators.
+ if (type == Character.PARAGRAPH_SEPARATOR
+ || type == Character.LINE_SEPARATOR)
+ break;
+
+ // Break between letters and non-letters.
+ // FIXME: we treat apostrophe as part of a word. This
+ // is an English-ism.
+ if (n != '\'' && ! Character.isLetter(n)
+ && type != Character.NON_SPACING_MARK
+ && is_letter)
+ break;
+
+ // Always break after certain symbols, such as punctuation.
+ // This heuristic is derived from hints in the JCL book and is
+ // not part of Unicode. It seems to be right, however.
+ // FIXME: we treat apostrophe as part of a word. This
+ // is an English-ism.
+ if (n != '\''
+ && (type == Character.DASH_PUNCTUATION
+ || type == Character.START_PUNCTUATION
+ || type == Character.END_PUNCTUATION
+ || type == Character.CONNECTOR_PUNCTUATION
+ || type == Character.OTHER_PUNCTUATION
+ || type == Character.MATH_SYMBOL
+ || type == Character.CURRENCY_SYMBOL
+ || type == Character.MODIFIER_SYMBOL
+ || type == Character.OTHER_SYMBOL
+ || type == Character.FORMAT
+ || type == Character.CONTROL))
+ break;
+
+ // Special case Japanese.
+ if ((is_hira || is_kata || is_han)
+ && ! isHira (n) && ! isKata (n) && ! isHan (n)
+ && type != Character.NON_SPACING_MARK)
+ break;
+
+ // We might have to skip over non spacing marks to see what's
+ // on the other side.
+ if (! is_hira || (! is_letter && c != '\''))
+ {
+ int save = iter.getIndex();
+ while (n != CharacterIterator.DONE
+ && Character.getType(n) == Character.NON_SPACING_MARK)
+ n = iter.previous();
+ iter.setIndex(save);
+ // This is a strange case: a bunch of non-spacing marks at
+ // the beginning. We treat the current location as a word
+ // break.
+ if (n == CharacterIterator.DONE)
+ break;
+ if ((isHira (n) && ! is_hira)
+ || (isKata (n) && ! is_hira && ! is_kata)
+ || (isHan (n) && ! is_hira && ! is_han)
+ // FIXME: we treat apostrophe as part of a word. This
+ // is an English-ism.
+ || (! is_letter && c != '\'' && Character.isLetter(n)))
+ break;
+ }
}
return iter.getIndex();
diff --git a/libjava/classpath/gnu/java/util/Base64.java b/libjava/classpath/gnu/java/util/Base64.java
index 4401a15..80b1fcc 100644
--- a/libjava/classpath/gnu/java/util/Base64.java
+++ b/libjava/classpath/gnu/java/util/Base64.java
@@ -114,7 +114,7 @@ public final class Base64
{
return encode(buf, 0);
}
-
+
/**
* Base64 encode a byte array, returning the returning string.
*
@@ -129,7 +129,7 @@ public final class Base64
/**
* Base64 encode a byte array, returning the returning string.
- *
+ *
* @param buf The byte array to encode.
* @param offset The offset in the byte array to start.
* @param length The number of bytes to encode.
diff --git a/libjava/classpath/gnu/java/util/DoubleEnumeration.java b/libjava/classpath/gnu/java/util/DoubleEnumeration.java
index 94efb92..852644b 100644
--- a/libjava/classpath/gnu/java/util/DoubleEnumeration.java
+++ b/libjava/classpath/gnu/java/util/DoubleEnumeration.java
@@ -46,7 +46,7 @@ import java.util.NoSuchElementException;
* It returns the elements of the first Enumeration until it has
* no more elements and then returns the elements of the second
* Enumeration.
- *
+ *
* In the default case:
*
* doubleEnum = new DoubleEnumeration(enum1, enum2);
@@ -67,7 +67,7 @@ public class DoubleEnumeration implements Enumeration
{
/**
* This is true as long as one of the enumerations has more
- * elements.
+ * elements.
* Only valid when hasChecked is true.
* Set in hasMoreElements()
*/
diff --git a/libjava/classpath/gnu/java/util/EmptyEnumeration.java b/libjava/classpath/gnu/java/util/EmptyEnumeration.java
index ca2c56d73..30c50d8 100644
--- a/libjava/classpath/gnu/java/util/EmptyEnumeration.java
+++ b/libjava/classpath/gnu/java/util/EmptyEnumeration.java
@@ -54,7 +54,7 @@ import java.util.NoSuchElementException;
public final class EmptyEnumeration implements Enumeration, Serializable
{
/** The only instance of this class */
- private static final EmptyEnumeration instance =
+ private static final EmptyEnumeration instance =
new EmptyEnumeration();
/**
diff --git a/libjava/classpath/gnu/java/util/WeakIdentityHashMap.java b/libjava/classpath/gnu/java/util/WeakIdentityHashMap.java
index 210a3d8..4d90149 100644
--- a/libjava/classpath/gnu/java/util/WeakIdentityHashMap.java
+++ b/libjava/classpath/gnu/java/util/WeakIdentityHashMap.java
@@ -686,12 +686,12 @@ public class WeakIdentityHashMap extends AbstractMap implements Map
{
if (next == null)
throw new InternalError("WeakIdentityHashMap in inconsistent state");
- prev = next;
+ prev = next;
next = prev.next;
}
if (prev == null)
buckets[slot] = bucket.next;
- else
+ else
prev.next = bucket.next;
size--;
diff --git a/libjava/classpath/gnu/java/util/ZoneInfo.java b/libjava/classpath/gnu/java/util/ZoneInfo.java
index 2146a32..117ef3c 100644
--- a/libjava/classpath/gnu/java/util/ZoneInfo.java
+++ b/libjava/classpath/gnu/java/util/ZoneInfo.java
@@ -134,7 +134,7 @@ public class ZoneInfo extends TimeZone
* rules after the last transition.
*/
public ZoneInfo(int rawOffset, String id, long[] transitions,
- SimpleTimeZone lastRule)
+ SimpleTimeZone lastRule)
{
if (transitions == null || transitions.length < 1)
throw new IllegalArgumentException("transitions must not be null");
@@ -166,7 +166,7 @@ public class ZoneInfo extends TimeZone
* @throws IllegalArgumentException if arguments are incorrect.
*/
public int getOffset(int era, int year, int month, int day, int dayOfWeek,
- int millis)
+ int millis)
{
if (gmtZone == null)
gmtZone = new SimpleTimeZone(0, "GMT");
@@ -201,15 +201,15 @@ public class ZoneInfo extends TimeZone
int mid = 1;
while (lo < hi)
{
- mid = (lo + hi) / 2;
- // secs < (transitions[mid-1] >> SECS_SHIFT)
- if (val <= transitions[mid-1])
- hi = mid;
- // secs >= (transitions[mid] >> SECS_SHIFT)
- else if (val > transitions[mid])
- lo = mid + 1;
- else
- break;
+ mid = (lo + hi) / 2;
+ // secs < (transitions[mid-1] >> SECS_SHIFT)
+ if (val <= transitions[mid-1])
+ hi = mid;
+ // secs >= (transitions[mid] >> SECS_SHIFT)
+ else if (val > transitions[mid])
+ lo = mid + 1;
+ else
+ break;
}
return transitions[mid];
}
@@ -257,30 +257,30 @@ public class ZoneInfo extends TimeZone
{
if (lastRule.useDaylightTime())
{
- dstSavings = lastRule.getDSTSavings();
- useDaylight = true;
+ dstSavings = lastRule.getDSTSavings();
+ useDaylight = true;
}
else
{
- dstSavings = 0;
- useDaylight = false;
- // lastRule might say no DST is in effect simply because
- // the DST rules are too complex for SimpleTimeZone, say
- // for Asia/Jerusalem.
- // Look at the last DST offset if it is newer than current time.
- long currentSecs = System.currentTimeMillis() / 1000;
- int i;
- for (i = transitions.length - 1;
- i >= 0 && currentSecs < (transitions[i] >> SECS_SHIFT);
- i--)
- if ((transitions[i] & IS_DST) != 0)
- {
- dstSavings = (int) (((transitions[i] << OFFSET_SHIFT)
- >> OFFSET_SHIFT) * 1000)
- - rawOffset;
- useDaylight = true;
- break;
- }
+ dstSavings = 0;
+ useDaylight = false;
+ // lastRule might say no DST is in effect simply because
+ // the DST rules are too complex for SimpleTimeZone, say
+ // for Asia/Jerusalem.
+ // Look at the last DST offset if it is newer than current time.
+ long currentSecs = System.currentTimeMillis() / 1000;
+ int i;
+ for (i = transitions.length - 1;
+ i >= 0 && currentSecs < (transitions[i] >> SECS_SHIFT);
+ i--)
+ if ((transitions[i] & IS_DST) != 0)
+ {
+ dstSavings = (int) (((transitions[i] << OFFSET_SHIFT)
+ >> OFFSET_SHIFT) * 1000)
+ - rawOffset;
+ useDaylight = true;
+ break;
+ }
}
}
@@ -372,10 +372,10 @@ public class ZoneInfo extends TimeZone
public String toString()
{
return getClass().getName() + "[" + "id=" + getID() + ",offset="
- + rawOffset + ",transitions=" + transitions.length
- + ",useDaylight=" + useDaylight
- + (useDaylight ? (",dstSavings=" + dstSavings) : "")
- + ",lastRule=" + lastRule.toString() + "]";
+ + rawOffset + ",transitions=" + transitions.length
+ + ",useDaylight=" + useDaylight
+ + (useDaylight ? (",dstSavings=" + dstSavings) : "")
+ + ",lastRule=" + lastRule.toString() + "]";
}
/**
@@ -389,470 +389,470 @@ public class ZoneInfo extends TimeZone
DataInputStream dis = null;
try
{
- FileInputStream fis = new FileInputStream(file);
- BufferedInputStream bis = new BufferedInputStream(fis);
- dis = new DataInputStream(bis);
-
- // Make sure we are reading a tzfile.
- byte[] tzif = new byte[5];
- dis.readFully(tzif);
- int tzif2 = 4;
- if (tzif[0] == 'T' && tzif[1] == 'Z'
- && tzif[2] == 'i' && tzif[3] == 'f')
- {
- if (tzif[4] >= '2')
- tzif2 = 8;
- // Reserved bytes
- skipFully(dis, 16 - 1);
- }
- else
- // Darwin has tzdata files that don't start with the TZif marker
- skipFully(dis, 16 - 5);
-
- int ttisgmtcnt = dis.readInt();
- int ttisstdcnt = dis.readInt();
- int leapcnt = dis.readInt();
- int timecnt = dis.readInt();
- int typecnt = dis.readInt();
- int charcnt = dis.readInt();
- if (tzif2 == 8)
- {
- skipFully(dis, timecnt * (4 + 1) + typecnt * (4 + 1 + 1) + charcnt
- + leapcnt * (4 + 4) + ttisgmtcnt + ttisstdcnt);
-
- dis.readFully(tzif);
- if (tzif[0] != 'T' || tzif[1] != 'Z' || tzif[2] != 'i'
- || tzif[3] != 'f' || tzif[4] < '2')
- return null;
-
- // Reserved bytes
- skipFully(dis, 16 - 1);
- ttisgmtcnt = dis.readInt();
- ttisstdcnt = dis.readInt();
- leapcnt = dis.readInt();
- timecnt = dis.readInt();
- typecnt = dis.readInt();
- charcnt = dis.readInt();
- }
-
- // Sanity checks
- if (typecnt <= 0 || timecnt < 0 || charcnt < 0
- || leapcnt < 0 || ttisgmtcnt < 0 || ttisstdcnt < 0
- || ttisgmtcnt > typecnt || ttisstdcnt > typecnt)
- return null;
-
- // Transition times
- long[] times = new long[timecnt];
- for (int i = 0; i < timecnt; i++)
- if (tzif2 == 8)
- times[i] = dis.readLong();
- else
- times[i] = (long) dis.readInt();
-
- // Transition types
- int[] types = new int[timecnt];
- for (int i = 0; i < timecnt; i++)
- {
- types[i] = dis.readByte();
- if (types[i] < 0)
- types[i] += 256;
- if (types[i] >= typecnt)
- return null;
- }
-
- // Types
- int[] offsets = new int[typecnt];
- int[] typeflags = new int[typecnt];
- for (int i = 0; i < typecnt; i++)
- {
- offsets[i] = dis.readInt();
- if (offsets[i] >= IS_DST / 2 || offsets[i] <= -IS_DST / 2)
- return null;
- int dst = dis.readByte();
- int abbrind = dis.readByte();
- if (abbrind < 0)
- abbrind += 256;
- if (abbrind >= charcnt)
- return null;
- typeflags[i] = (dst != 0 ? (1 << 8) : 0) + abbrind;
- }
-
- // Abbrev names
- byte[] names = new byte[charcnt];
- dis.readFully(names);
-
- // Leap transitions, for now ignore
- skipFully(dis, leapcnt * (tzif2 + 4) + ttisstdcnt + ttisgmtcnt);
-
- // tzIf2 format has optional POSIX TZ env string
- String tzstr = null;
- if (tzif2 == 8 && dis.readByte() == '\n')
- {
- tzstr = dis.readLine();
- if (tzstr.length() <= 0)
- tzstr = null;
- }
-
- // Get std/dst_offset and dst/non-dst time zone names.
- int std_ind = -1;
- int dst_ind = -1;
- if (timecnt == 0)
- std_ind = 0;
- else
- for (int i = timecnt - 1; i >= 0; i--)
- {
- if (std_ind == -1 && (typeflags[types[i]] & (1 << 8)) == 0)
- std_ind = types[i];
- else if (dst_ind == -1 && (typeflags[types[i]] & (1 << 8)) != 0)
- dst_ind = types[i];
- if (dst_ind != -1 && std_ind != -1)
- break;
- }
-
- if (std_ind == -1)
- return null;
-
- int j = typeflags[std_ind] & 255;
- while (j < charcnt && names[j] != 0)
- j++;
- String std_zonename = new String(names, typeflags[std_ind] & 255,
- j - (typeflags[std_ind] & 255),
- "ASCII");
-
- String dst_zonename = "";
- if (dst_ind != -1)
- {
- j = typeflags[dst_ind] & 255;
- while (j < charcnt && names[j] != 0)
- j++;
- dst_zonename = new String(names, typeflags[dst_ind] & 255,
- j - (typeflags[dst_ind] & 255), "ASCII");
- }
-
- // Only use gmt offset when necessary.
- // Also special case GMT+/- timezones.
- String std_offset_string = "";
- String dst_offset_string = "";
- if (tzstr == null
- && (dst_ind != -1
- || (offsets[std_ind] != 0
- && !std_zonename.startsWith("GMT+")
- && !std_zonename.startsWith("GMT-"))))
- {
- std_offset_string = Integer.toString(-offsets[std_ind] / 3600);
- int seconds = -offsets[std_ind] % 3600;
- if (seconds != 0)
- {
- if (seconds < 0)
- seconds *= -1;
- if (seconds < 600)
- std_offset_string += ":0" + Integer.toString(seconds / 60);
- else
- std_offset_string += ":" + Integer.toString(seconds / 60);
- seconds = seconds % 60;
- if (seconds >= 10)
- std_offset_string += ":" + Integer.toString(seconds);
- else if (seconds > 0)
- std_offset_string += ":0" + Integer.toString(seconds);
- }
-
- if (dst_ind != -1 && offsets[dst_ind] != offsets[std_ind] + 3600)
- {
- dst_offset_string = Integer.toString(-offsets[dst_ind] / 3600);
- seconds = -offsets[dst_ind] % 3600;
- if (seconds != 0)
- {
- if (seconds < 0)
- seconds *= -1;
- if (seconds < 600)
- dst_offset_string
- += ":0" + Integer.toString(seconds / 60);
- else
- dst_offset_string
- += ":" + Integer.toString(seconds / 60);
- seconds = seconds % 60;
- if (seconds >= 10)
- dst_offset_string += ":" + Integer.toString(seconds);
- else if (seconds > 0)
- dst_offset_string += ":0" + Integer.toString(seconds);
- }
- }
- }
-
- /*
- * If no tzIf2 POSIX TZ string is available and the timezone
- * uses DST, try to guess the last rule by trying to make
- * sense from transitions at 5 years in the future and onwards.
- * tzdata actually uses only 3 forms of rules:
- * fixed date within a month, e.g. change on April, 5th
- * 1st weekday on or after Nth: change on Sun>=15 in April
- * last weekday in a month: change on lastSun in April
- */
- String[] change_spec = { null, null };
- if (tzstr == null && dst_ind != -1 && timecnt > 10)
- {
- long nowPlus5y = System.currentTimeMillis() / 1000
- + 5 * 365 * 86400;
- int first;
-
- for (first = timecnt - 1; first >= 0; first--)
- if (times[first] < nowPlus5y
- || (types[first] != std_ind && types[first] != dst_ind)
- || types[first] != types[timecnt - 2 + ((first ^ timecnt) & 1)])
- break;
- first++;
-
- if (timecnt - first >= 10 && types[timecnt - 1] != types[timecnt - 2])
- {
- GregorianCalendar cal
- = new GregorianCalendar(new SimpleTimeZone(0, "GMT"));
-
- int[] values = new int[2 * 11];
- int i;
- for (i = timecnt - 1; i >= first; i--)
- {
- int base = (i % 2) * 11;
- int offset = offsets[types[i > first ? i - 1 : i + 1]];
- cal.setTimeInMillis((times[i] + offset) * 1000);
- if (i >= timecnt - 2)
- {
- values[base + 0] = cal.get(Calendar.YEAR);
- values[base + 1] = cal.get(Calendar.MONTH);
- values[base + 2] = cal.get(Calendar.DAY_OF_MONTH);
- values[base + 3]
- = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
- values[base + 4] = cal.get(Calendar.DAY_OF_WEEK);
- values[base + 5] = cal.get(Calendar.HOUR_OF_DAY);
- values[base + 6] = cal.get(Calendar.MINUTE);
- values[base + 7] = cal.get(Calendar.SECOND);
- values[base + 8] = values[base + 2]; // Range start
- values[base + 9] = values[base + 2]; // Range end
- values[base + 10] = 0; // Determined type
- }
- else
- {
- int year = cal.get(Calendar.YEAR);
- int month = cal.get(Calendar.MONTH);
- int day_of_month = cal.get(Calendar.DAY_OF_MONTH);
- int month_days
- = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
- int day_of_week = cal.get(Calendar.DAY_OF_WEEK);
- int hour = cal.get(Calendar.HOUR_OF_DAY);
- int minute = cal.get(Calendar.MINUTE);
- int second = cal.get(Calendar.SECOND);
- if (year != values[base + 0] - 1
- || month != values[base + 1]
- || hour != values[base + 5]
- || minute != values[base + 6]
- || second != values[base + 7])
- break;
- if (day_of_week == values[base + 4])
- {
- // Either a Sun>=8 or lastSun rule.
- if (day_of_month < values[base + 8])
- values[base + 8] = day_of_month;
- if (day_of_month > values[base + 9])
- values[base + 9] = day_of_month;
- if (values[base + 10] < 0)
- break;
- if (values[base + 10] == 0)
- {
- values[base + 10] = 1;
- // If day of month > 28, this is
- // certainly lastSun rule.
- if (values[base + 2] > 28)
- values[base + 2] = 3;
- // If day of month isn't in the last
- // week, it can't be lastSun rule.
- else if (values[base + 2]
- <= values[base + 3] - 7)
- values[base + 3] = 2;
- }
- if (values[base + 10] == 1)
- {
- // If day of month is > 28, this is
- // certainly lastSun rule.
- if (day_of_month > 28)
- values[base + 10] = 3;
- // If day of month isn't in the last
- // week, it can't be lastSun rule.
- else if (day_of_month <= month_days - 7)
- values[base + 10] = 2;
- }
- else if ((values[base + 10] == 2
- && day_of_month > 28)
- || (values[base + 10] == 3
- && day_of_month <= month_days - 7))
- break;
- }
- else
- {
- // Must be fixed day in month rule.
- if (day_of_month != values[base + 2]
- || values[base + 10] > 0)
- break;
- values[base + 4] = day_of_week;
- values[base + 10] = -1;
- }
- values[base + 0] -= 1;
- }
- }
-
- if (i < first)
- {
- for (i = 0; i < 2; i++)
- {
- int base = 11 * i;
- if (values[base + 10] == 0)
- continue;
- if (values[base + 10] == -1)
- {
- int[] dayCount
- = { 0, 31, 59, 90, 120, 151,
- 181, 212, 243, 273, 304, 334 };
- int d = dayCount[values[base + 1]
- - Calendar.JANUARY];
- d += values[base + 2];
- change_spec[i] = ",J" + Integer.toString(d);
- }
- else if (values[base + 10] == 2)
- {
- // If we haven't seen all days of the week,
- // we can't be sure what the rule really is.
- if (values[base + 8] + 6 != values[base + 9])
- continue;
-
- int d;
- d = values[base + 1] - Calendar.JANUARY + 1;
- // E.g. Sun >= 5 is not representable in POSIX
- // TZ env string, use ",Am.n.d" extension
- // where m is month 1 .. 12, n is the date on
- // or after which it happens and d is day
- // of the week, 0 .. 6. So Sun >= 5 in April
- // is ",A4.5.0".
- if ((values[base + 8] % 7) == 1)
- {
- change_spec[i] = ",M" + Integer.toString(d);
- d = (values[base + 8] + 6) / 7;
- }
- else
- {
- change_spec[i] = ",A" + Integer.toString(d);
- d = values[base + 8];
- }
- change_spec[i] += "." + Integer.toString(d);
- d = values[base + 4] - Calendar.SUNDAY;
- change_spec[i] += "." + Integer.toString(d);
- }
- else
- {
- // If we don't know whether this is lastSun or
- // Sun >= 22 rule. That can be either because
- // there was insufficient number of
- // transitions, or February, where it is quite
- // probable we haven't seen any 29th dates.
- // For February, assume lastSun rule, otherwise
- // punt.
- if (values[base + 10] == 1
- && values[base + 1] != Calendar.FEBRUARY)
- continue;
-
- int d;
- d = values[base + 1] - Calendar.JANUARY + 1;
- change_spec[i] = ",M" + Integer.toString(d);
- d = values[base + 4] - Calendar.SUNDAY;
- change_spec[i] += ".5." + Integer.toString(d);
- }
-
- // Don't add time specification if time is
- // 02:00:00.
- if (values[base + 5] != 2
- || values[base + 6] != 0
- || values[base + 7] != 0)
- {
- int d = values[base + 5];
- change_spec[i] += "/" + Integer.toString(d);
- if (values[base + 6] != 0 || values[base + 7] != 0)
- {
- d = values[base + 6];
- if (d < 10)
- change_spec[i]
- += ":0" + Integer.toString(d);
- else
- change_spec[i] += ":" + Integer.toString(d);
- d = values[base + 7];
- if (d >= 10)
- change_spec[i]
- += ":" + Integer.toString(d);
- else if (d > 0)
- change_spec[i]
- += ":0" + Integer.toString(d);
- }
- }
- }
- if (types[(timecnt - 1) & -2] == std_ind)
- {
- String tmp = change_spec[0];
- change_spec[0] = change_spec[1];
- change_spec[1] = tmp;
- }
- }
- }
- }
-
- if (tzstr == null)
- {
- tzstr = std_zonename + std_offset_string;
- if (change_spec[0] != null && change_spec[1] != null)
- tzstr += dst_zonename + dst_offset_string
- + change_spec[0] + change_spec[1];
- }
-
- if (timecnt == 0)
- return new SimpleTimeZone(offsets[std_ind] * 1000,
- id != null ? id : tzstr);
-
- SimpleTimeZone endRule = createLastRule(tzstr);
- if (endRule == null)
- return null;
-
- /* Finally adjust the times array into the form the constructor
- * expects. times[0] is special, the offset and DST flag there
- * are for all times before that transition. Use the first non-DST
- * type. For all other transitions, the data file has the type
- * () for the time interval starting
- */
- for (int i = 0; i < typecnt; i++)
- if ((typeflags[i] & (1 << 8)) == 0)
- {
- times[0] = (times[0] << SECS_SHIFT) | (offsets[i] & OFFSET_MASK);
- break;
- }
-
- for (int i = 1; i < timecnt; i++)
- times[i] = (times[i] << SECS_SHIFT)
- | (offsets[types[i - 1]] & OFFSET_MASK)
- | ((typeflags[types[i - 1]] & (1 << 8)) != 0 ? IS_DST : 0);
-
- return new ZoneInfo(offsets[std_ind] * 1000, id != null ? id : tzstr,
- times, endRule);
+ FileInputStream fis = new FileInputStream(file);
+ BufferedInputStream bis = new BufferedInputStream(fis);
+ dis = new DataInputStream(bis);
+
+ // Make sure we are reading a tzfile.
+ byte[] tzif = new byte[5];
+ dis.readFully(tzif);
+ int tzif2 = 4;
+ if (tzif[0] == 'T' && tzif[1] == 'Z'
+ && tzif[2] == 'i' && tzif[3] == 'f')
+ {
+ if (tzif[4] >= '2')
+ tzif2 = 8;
+ // Reserved bytes
+ skipFully(dis, 16 - 1);
+ }
+ else
+ // Darwin has tzdata files that don't start with the TZif marker
+ skipFully(dis, 16 - 5);
+
+ int ttisgmtcnt = dis.readInt();
+ int ttisstdcnt = dis.readInt();
+ int leapcnt = dis.readInt();
+ int timecnt = dis.readInt();
+ int typecnt = dis.readInt();
+ int charcnt = dis.readInt();
+ if (tzif2 == 8)
+ {
+ skipFully(dis, timecnt * (4 + 1) + typecnt * (4 + 1 + 1) + charcnt
+ + leapcnt * (4 + 4) + ttisgmtcnt + ttisstdcnt);
+
+ dis.readFully(tzif);
+ if (tzif[0] != 'T' || tzif[1] != 'Z' || tzif[2] != 'i'
+ || tzif[3] != 'f' || tzif[4] < '2')
+ return null;
+
+ // Reserved bytes
+ skipFully(dis, 16 - 1);
+ ttisgmtcnt = dis.readInt();
+ ttisstdcnt = dis.readInt();
+ leapcnt = dis.readInt();
+ timecnt = dis.readInt();
+ typecnt = dis.readInt();
+ charcnt = dis.readInt();
+ }
+
+ // Sanity checks
+ if (typecnt <= 0 || timecnt < 0 || charcnt < 0
+ || leapcnt < 0 || ttisgmtcnt < 0 || ttisstdcnt < 0
+ || ttisgmtcnt > typecnt || ttisstdcnt > typecnt)
+ return null;
+
+ // Transition times
+ long[] times = new long[timecnt];
+ for (int i = 0; i < timecnt; i++)
+ if (tzif2 == 8)
+ times[i] = dis.readLong();
+ else
+ times[i] = (long) dis.readInt();
+
+ // Transition types
+ int[] types = new int[timecnt];
+ for (int i = 0; i < timecnt; i++)
+ {
+ types[i] = dis.readByte();
+ if (types[i] < 0)
+ types[i] += 256;
+ if (types[i] >= typecnt)
+ return null;
+ }
+
+ // Types
+ int[] offsets = new int[typecnt];
+ int[] typeflags = new int[typecnt];
+ for (int i = 0; i < typecnt; i++)
+ {
+ offsets[i] = dis.readInt();
+ if (offsets[i] >= IS_DST / 2 || offsets[i] <= -IS_DST / 2)
+ return null;
+ int dst = dis.readByte();
+ int abbrind = dis.readByte();
+ if (abbrind < 0)
+ abbrind += 256;
+ if (abbrind >= charcnt)
+ return null;
+ typeflags[i] = (dst != 0 ? (1 << 8) : 0) + abbrind;
+ }
+
+ // Abbrev names
+ byte[] names = new byte[charcnt];
+ dis.readFully(names);
+
+ // Leap transitions, for now ignore
+ skipFully(dis, leapcnt * (tzif2 + 4) + ttisstdcnt + ttisgmtcnt);
+
+ // tzIf2 format has optional POSIX TZ env string
+ String tzstr = null;
+ if (tzif2 == 8 && dis.readByte() == '\n')
+ {
+ tzstr = dis.readLine();
+ if (tzstr.length() <= 0)
+ tzstr = null;
+ }
+
+ // Get std/dst_offset and dst/non-dst time zone names.
+ int std_ind = -1;
+ int dst_ind = -1;
+ if (timecnt == 0)
+ std_ind = 0;
+ else
+ for (int i = timecnt - 1; i >= 0; i--)
+ {
+ if (std_ind == -1 && (typeflags[types[i]] & (1 << 8)) == 0)
+ std_ind = types[i];
+ else if (dst_ind == -1 && (typeflags[types[i]] & (1 << 8)) != 0)
+ dst_ind = types[i];
+ if (dst_ind != -1 && std_ind != -1)
+ break;
+ }
+
+ if (std_ind == -1)
+ return null;
+
+ int j = typeflags[std_ind] & 255;
+ while (j < charcnt && names[j] != 0)
+ j++;
+ String std_zonename = new String(names, typeflags[std_ind] & 255,
+ j - (typeflags[std_ind] & 255),
+ "ASCII");
+
+ String dst_zonename = "";
+ if (dst_ind != -1)
+ {
+ j = typeflags[dst_ind] & 255;
+ while (j < charcnt && names[j] != 0)
+ j++;
+ dst_zonename = new String(names, typeflags[dst_ind] & 255,
+ j - (typeflags[dst_ind] & 255), "ASCII");
+ }
+
+ // Only use gmt offset when necessary.
+ // Also special case GMT+/- timezones.
+ String std_offset_string = "";
+ String dst_offset_string = "";
+ if (tzstr == null
+ && (dst_ind != -1
+ || (offsets[std_ind] != 0
+ && !std_zonename.startsWith("GMT+")
+ && !std_zonename.startsWith("GMT-"))))
+ {
+ std_offset_string = Integer.toString(-offsets[std_ind] / 3600);
+ int seconds = -offsets[std_ind] % 3600;
+ if (seconds != 0)
+ {
+ if (seconds < 0)
+ seconds *= -1;
+ if (seconds < 600)
+ std_offset_string += ":0" + Integer.toString(seconds / 60);
+ else
+ std_offset_string += ":" + Integer.toString(seconds / 60);
+ seconds = seconds % 60;
+ if (seconds >= 10)
+ std_offset_string += ":" + Integer.toString(seconds);
+ else if (seconds > 0)
+ std_offset_string += ":0" + Integer.toString(seconds);
+ }
+
+ if (dst_ind != -1 && offsets[dst_ind] != offsets[std_ind] + 3600)
+ {
+ dst_offset_string = Integer.toString(-offsets[dst_ind] / 3600);
+ seconds = -offsets[dst_ind] % 3600;
+ if (seconds != 0)
+ {
+ if (seconds < 0)
+ seconds *= -1;
+ if (seconds < 600)
+ dst_offset_string
+ += ":0" + Integer.toString(seconds / 60);
+ else
+ dst_offset_string
+ += ":" + Integer.toString(seconds / 60);
+ seconds = seconds % 60;
+ if (seconds >= 10)
+ dst_offset_string += ":" + Integer.toString(seconds);
+ else if (seconds > 0)
+ dst_offset_string += ":0" + Integer.toString(seconds);
+ }
+ }
+ }
+
+ /*
+ * If no tzIf2 POSIX TZ string is available and the timezone
+ * uses DST, try to guess the last rule by trying to make
+ * sense from transitions at 5 years in the future and onwards.
+ * tzdata actually uses only 3 forms of rules:
+ * fixed date within a month, e.g. change on April, 5th
+ * 1st weekday on or after Nth: change on Sun>=15 in April
+ * last weekday in a month: change on lastSun in April
+ */
+ String[] change_spec = { null, null };
+ if (tzstr == null && dst_ind != -1 && timecnt > 10)
+ {
+ long nowPlus5y = System.currentTimeMillis() / 1000
+ + 5 * 365 * 86400;
+ int first;
+
+ for (first = timecnt - 1; first >= 0; first--)
+ if (times[first] < nowPlus5y
+ || (types[first] != std_ind && types[first] != dst_ind)
+ || types[first] != types[timecnt - 2 + ((first ^ timecnt) & 1)])
+ break;
+ first++;
+
+ if (timecnt - first >= 10 && types[timecnt - 1] != types[timecnt - 2])
+ {
+ GregorianCalendar cal
+ = new GregorianCalendar(new SimpleTimeZone(0, "GMT"));
+
+ int[] values = new int[2 * 11];
+ int i;
+ for (i = timecnt - 1; i >= first; i--)
+ {
+ int base = (i % 2) * 11;
+ int offset = offsets[types[i > first ? i - 1 : i + 1]];
+ cal.setTimeInMillis((times[i] + offset) * 1000);
+ if (i >= timecnt - 2)
+ {
+ values[base + 0] = cal.get(Calendar.YEAR);
+ values[base + 1] = cal.get(Calendar.MONTH);
+ values[base + 2] = cal.get(Calendar.DAY_OF_MONTH);
+ values[base + 3]
+ = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ values[base + 4] = cal.get(Calendar.DAY_OF_WEEK);
+ values[base + 5] = cal.get(Calendar.HOUR_OF_DAY);
+ values[base + 6] = cal.get(Calendar.MINUTE);
+ values[base + 7] = cal.get(Calendar.SECOND);
+ values[base + 8] = values[base + 2]; // Range start
+ values[base + 9] = values[base + 2]; // Range end
+ values[base + 10] = 0; // Determined type
+ }
+ else
+ {
+ int year = cal.get(Calendar.YEAR);
+ int month = cal.get(Calendar.MONTH);
+ int day_of_month = cal.get(Calendar.DAY_OF_MONTH);
+ int month_days
+ = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ int day_of_week = cal.get(Calendar.DAY_OF_WEEK);
+ int hour = cal.get(Calendar.HOUR_OF_DAY);
+ int minute = cal.get(Calendar.MINUTE);
+ int second = cal.get(Calendar.SECOND);
+ if (year != values[base + 0] - 1
+ || month != values[base + 1]
+ || hour != values[base + 5]
+ || minute != values[base + 6]
+ || second != values[base + 7])
+ break;
+ if (day_of_week == values[base + 4])
+ {
+ // Either a Sun>=8 or lastSun rule.
+ if (day_of_month < values[base + 8])
+ values[base + 8] = day_of_month;
+ if (day_of_month > values[base + 9])
+ values[base + 9] = day_of_month;
+ if (values[base + 10] < 0)
+ break;
+ if (values[base + 10] == 0)
+ {
+ values[base + 10] = 1;
+ // If day of month > 28, this is
+ // certainly lastSun rule.
+ if (values[base + 2] > 28)
+ values[base + 2] = 3;
+ // If day of month isn't in the last
+ // week, it can't be lastSun rule.
+ else if (values[base + 2]
+ <= values[base + 3] - 7)
+ values[base + 3] = 2;
+ }
+ if (values[base + 10] == 1)
+ {
+ // If day of month is > 28, this is
+ // certainly lastSun rule.
+ if (day_of_month > 28)
+ values[base + 10] = 3;
+ // If day of month isn't in the last
+ // week, it can't be lastSun rule.
+ else if (day_of_month <= month_days - 7)
+ values[base + 10] = 2;
+ }
+ else if ((values[base + 10] == 2
+ && day_of_month > 28)
+ || (values[base + 10] == 3
+ && day_of_month <= month_days - 7))
+ break;
+ }
+ else
+ {
+ // Must be fixed day in month rule.
+ if (day_of_month != values[base + 2]
+ || values[base + 10] > 0)
+ break;
+ values[base + 4] = day_of_week;
+ values[base + 10] = -1;
+ }
+ values[base + 0] -= 1;
+ }
+ }
+
+ if (i < first)
+ {
+ for (i = 0; i < 2; i++)
+ {
+ int base = 11 * i;
+ if (values[base + 10] == 0)
+ continue;
+ if (values[base + 10] == -1)
+ {
+ int[] dayCount
+ = { 0, 31, 59, 90, 120, 151,
+ 181, 212, 243, 273, 304, 334 };
+ int d = dayCount[values[base + 1]
+ - Calendar.JANUARY];
+ d += values[base + 2];
+ change_spec[i] = ",J" + Integer.toString(d);
+ }
+ else if (values[base + 10] == 2)
+ {
+ // If we haven't seen all days of the week,
+ // we can't be sure what the rule really is.
+ if (values[base + 8] + 6 != values[base + 9])
+ continue;
+
+ int d;
+ d = values[base + 1] - Calendar.JANUARY + 1;
+ // E.g. Sun >= 5 is not representable in POSIX
+ // TZ env string, use ",Am.n.d" extension
+ // where m is month 1 .. 12, n is the date on
+ // or after which it happens and d is day
+ // of the week, 0 .. 6. So Sun >= 5 in April
+ // is ",A4.5.0".
+ if ((values[base + 8] % 7) == 1)
+ {
+ change_spec[i] = ",M" + Integer.toString(d);
+ d = (values[base + 8] + 6) / 7;
+ }
+ else
+ {
+ change_spec[i] = ",A" + Integer.toString(d);
+ d = values[base + 8];
+ }
+ change_spec[i] += "." + Integer.toString(d);
+ d = values[base + 4] - Calendar.SUNDAY;
+ change_spec[i] += "." + Integer.toString(d);
+ }
+ else
+ {
+ // If we don't know whether this is lastSun or
+ // Sun >= 22 rule. That can be either because
+ // there was insufficient number of
+ // transitions, or February, where it is quite
+ // probable we haven't seen any 29th dates.
+ // For February, assume lastSun rule, otherwise
+ // punt.
+ if (values[base + 10] == 1
+ && values[base + 1] != Calendar.FEBRUARY)
+ continue;
+
+ int d;
+ d = values[base + 1] - Calendar.JANUARY + 1;
+ change_spec[i] = ",M" + Integer.toString(d);
+ d = values[base + 4] - Calendar.SUNDAY;
+ change_spec[i] += ".5." + Integer.toString(d);
+ }
+
+ // Don't add time specification if time is
+ // 02:00:00.
+ if (values[base + 5] != 2
+ || values[base + 6] != 0
+ || values[base + 7] != 0)
+ {
+ int d = values[base + 5];
+ change_spec[i] += "/" + Integer.toString(d);
+ if (values[base + 6] != 0 || values[base + 7] != 0)
+ {
+ d = values[base + 6];
+ if (d < 10)
+ change_spec[i]
+ += ":0" + Integer.toString(d);
+ else
+ change_spec[i] += ":" + Integer.toString(d);
+ d = values[base + 7];
+ if (d >= 10)
+ change_spec[i]
+ += ":" + Integer.toString(d);
+ else if (d > 0)
+ change_spec[i]
+ += ":0" + Integer.toString(d);
+ }
+ }
+ }
+ if (types[(timecnt - 1) & -2] == std_ind)
+ {
+ String tmp = change_spec[0];
+ change_spec[0] = change_spec[1];
+ change_spec[1] = tmp;
+ }
+ }
+ }
+ }
+
+ if (tzstr == null)
+ {
+ tzstr = std_zonename + std_offset_string;
+ if (change_spec[0] != null && change_spec[1] != null)
+ tzstr += dst_zonename + dst_offset_string
+ + change_spec[0] + change_spec[1];
+ }
+
+ if (timecnt == 0)
+ return new SimpleTimeZone(offsets[std_ind] * 1000,
+ id != null ? id : tzstr);
+
+ SimpleTimeZone endRule = createLastRule(tzstr);
+ if (endRule == null)
+ return null;
+
+ /* Finally adjust the times array into the form the constructor
+ * expects. times[0] is special, the offset and DST flag there
+ * are for all times before that transition. Use the first non-DST
+ * type. For all other transitions, the data file has the type
+ * () for the time interval starting
+ */
+ for (int i = 0; i < typecnt; i++)
+ if ((typeflags[i] & (1 << 8)) == 0)
+ {
+ times[0] = (times[0] << SECS_SHIFT) | (offsets[i] & OFFSET_MASK);
+ break;
+ }
+
+ for (int i = 1; i < timecnt; i++)
+ times[i] = (times[i] << SECS_SHIFT)
+ | (offsets[types[i - 1]] & OFFSET_MASK)
+ | ((typeflags[types[i - 1]] & (1 << 8)) != 0 ? IS_DST : 0);
+
+ return new ZoneInfo(offsets[std_ind] * 1000, id != null ? id : tzstr,
+ times, endRule);
}
catch (IOException ioe)
{
- // Parse error, not a proper tzfile.
- return null;
+ // Parse error, not a proper tzfile.
+ return null;
}
finally
{
- try
- {
- if (dis != null)
- dis.close();
- }
- catch(IOException ioe)
- {
- // Error while close, nothing we can do.
- }
+ try
+ {
+ if (dis != null)
+ dis.close();
+ }
+ catch(IOException ioe)
+ {
+ // Error while close, nothing we can do.
+ }
}
}
@@ -865,10 +865,10 @@ public class ZoneInfo extends TimeZone
{
while (l > 0)
{
- long k = is.skip(l);
- if (k <= 0)
- throw new EOFException();
- l -= k;
+ long k = is.skip(l);
+ if (k <= 0)
+ throw new EOFException();
+ l -= k;
}
}
@@ -887,146 +887,146 @@ public class ZoneInfo extends TimeZone
int dstOffs;
try
{
- int idLength = tzstr.length();
-
- int index = 0;
- int prevIndex;
- char c;
-
- // get std
- do
- c = tzstr.charAt(index);
- while (c != '+' && c != '-' && c != ',' && c != ':'
- && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
-
- if (index >= idLength)
- return new SimpleTimeZone(0, tzstr);
-
- stdName = tzstr.substring(0, index);
- prevIndex = index;
-
- // get the std offset
- do
- c = tzstr.charAt(index++);
- while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
- && index < idLength);
- if (index < idLength)
- index--;
-
- { // convert the dst string to a millis number
- String offset = tzstr.substring(prevIndex, index);
- prevIndex = index;
-
- if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
- stdOffs = parseTime(offset.substring(1));
- else
- stdOffs = parseTime(offset);
-
- if (offset.charAt(0) == '-')
- stdOffs = -stdOffs;
-
- // TZ timezone offsets are positive when WEST of the meridian.
- stdOffs = -stdOffs;
- }
-
- // Done yet? (Format: std offset)
- if (index >= idLength)
- return new SimpleTimeZone(stdOffs, stdName);
-
- // get dst
- do
- c = tzstr.charAt(index);
- while (c != '+' && c != '-' && c != ',' && c != ':'
- && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
-
- // Done yet? (Format: std offset dst)
- if (index >= idLength)
- return new SimpleTimeZone(stdOffs, stdName);
-
- // get the dst offset
- prevIndex = index;
- do
- c = tzstr.charAt(index++);
- while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
- && index < idLength);
- if (index < idLength)
- index--;
-
- if (index == prevIndex && (c == ',' || c == ';'))
- {
- // Missing dst offset defaults to one hour ahead of standard
- // time.
- dstOffs = stdOffs + 60 * 60 * 1000;
- }
- else
- { // convert the dst string to a millis number
- String offset = tzstr.substring(prevIndex, index);
- prevIndex = index;
-
- if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
- dstOffs = parseTime(offset.substring(1));
- else
- dstOffs = parseTime(offset);
-
- if (offset.charAt(0) == '-')
- dstOffs = -dstOffs;
-
- // TZ timezone offsets are positive when WEST of the meridian.
- dstOffs = -dstOffs;
- }
-
- // Done yet? (Format: std offset dst offset)
- if (index >= idLength)
- return new SimpleTimeZone(stdOffs, stdName);
-
- // get the DST rule
- if (tzstr.charAt(index) == ','
- || tzstr.charAt(index) == ';')
- {
- index++;
- int offs = index;
- while (tzstr.charAt(index) != ','
- && tzstr.charAt(index) != ';')
- index++;
- String startTime = tzstr.substring(offs, index);
- index++;
- String endTime = tzstr.substring(index);
-
- index = startTime.indexOf('/');
- int startMillis;
- int endMillis;
- String startDate;
- String endDate;
- if (index != -1)
- {
- startDate = startTime.substring(0, index);
- startMillis = parseTime(startTime.substring(index + 1));
- }
- else
- {
- startDate = startTime;
- // if time isn't given, default to 2:00:00 AM.
- startMillis = 2 * 60 * 60 * 1000;
- }
- index = endTime.indexOf('/');
- if (index != -1)
- {
- endDate = endTime.substring(0, index);
- endMillis = parseTime(endTime.substring(index + 1));
- }
- else
- {
- endDate = endTime;
- // if time isn't given, default to 2:00:00 AM.
- endMillis = 2 * 60 * 60 * 1000;
- }
-
- int[] start = getDateParams(startDate);
- int[] end = getDateParams(endDate);
- return new SimpleTimeZone(stdOffs, tzstr, start[0], start[1],
- start[2], startMillis, end[0], end[1],
- end[2], endMillis, (dstOffs - stdOffs));
- }
+ int idLength = tzstr.length();
+
+ int index = 0;
+ int prevIndex;
+ char c;
+
+ // get std
+ do
+ c = tzstr.charAt(index);
+ while (c != '+' && c != '-' && c != ',' && c != ':'
+ && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
+
+ if (index >= idLength)
+ return new SimpleTimeZone(0, tzstr);
+
+ stdName = tzstr.substring(0, index);
+ prevIndex = index;
+
+ // get the std offset
+ do
+ c = tzstr.charAt(index++);
+ while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
+ && index < idLength);
+ if (index < idLength)
+ index--;
+
+ { // convert the dst string to a millis number
+ String offset = tzstr.substring(prevIndex, index);
+ prevIndex = index;
+
+ if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
+ stdOffs = parseTime(offset.substring(1));
+ else
+ stdOffs = parseTime(offset);
+
+ if (offset.charAt(0) == '-')
+ stdOffs = -stdOffs;
+
+ // TZ timezone offsets are positive when WEST of the meridian.
+ stdOffs = -stdOffs;
+ }
+
+ // Done yet? (Format: std offset)
+ if (index >= idLength)
+ return new SimpleTimeZone(stdOffs, stdName);
+
+ // get dst
+ do
+ c = tzstr.charAt(index);
+ while (c != '+' && c != '-' && c != ',' && c != ':'
+ && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
+
+ // Done yet? (Format: std offset dst)
+ if (index >= idLength)
+ return new SimpleTimeZone(stdOffs, stdName);
+
+ // get the dst offset
+ prevIndex = index;
+ do
+ c = tzstr.charAt(index++);
+ while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
+ && index < idLength);
+ if (index < idLength)
+ index--;
+
+ if (index == prevIndex && (c == ',' || c == ';'))
+ {
+ // Missing dst offset defaults to one hour ahead of standard
+ // time.
+ dstOffs = stdOffs + 60 * 60 * 1000;
+ }
+ else
+ { // convert the dst string to a millis number
+ String offset = tzstr.substring(prevIndex, index);
+ prevIndex = index;
+
+ if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
+ dstOffs = parseTime(offset.substring(1));
+ else
+ dstOffs = parseTime(offset);
+
+ if (offset.charAt(0) == '-')
+ dstOffs = -dstOffs;
+
+ // TZ timezone offsets are positive when WEST of the meridian.
+ dstOffs = -dstOffs;
+ }
+
+ // Done yet? (Format: std offset dst offset)
+ if (index >= idLength)
+ return new SimpleTimeZone(stdOffs, stdName);
+
+ // get the DST rule
+ if (tzstr.charAt(index) == ','
+ || tzstr.charAt(index) == ';')
+ {
+ index++;
+ int offs = index;
+ while (tzstr.charAt(index) != ','
+ && tzstr.charAt(index) != ';')
+ index++;
+ String startTime = tzstr.substring(offs, index);
+ index++;
+ String endTime = tzstr.substring(index);
+
+ index = startTime.indexOf('/');
+ int startMillis;
+ int endMillis;
+ String startDate;
+ String endDate;
+ if (index != -1)
+ {
+ startDate = startTime.substring(0, index);
+ startMillis = parseTime(startTime.substring(index + 1));
+ }
+ else
+ {
+ startDate = startTime;
+ // if time isn't given, default to 2:00:00 AM.
+ startMillis = 2 * 60 * 60 * 1000;
+ }
+ index = endTime.indexOf('/');
+ if (index != -1)
+ {
+ endDate = endTime.substring(0, index);
+ endMillis = parseTime(endTime.substring(index + 1));
+ }
+ else
+ {
+ endDate = endTime;
+ // if time isn't given, default to 2:00:00 AM.
+ endMillis = 2 * 60 * 60 * 1000;
+ }
+
+ int[] start = getDateParams(startDate);
+ int[] end = getDateParams(endDate);
+ return new SimpleTimeZone(stdOffs, tzstr, start[0], start[1],
+ start[2], startMillis, end[0], end[1],
+ end[2], endMillis, (dstOffs - stdOffs));
+ }
}
catch (IndexOutOfBoundsException _)
@@ -1057,44 +1057,44 @@ public class ZoneInfo extends TimeZone
if (type > 0)
{
- int day;
-
- // Month, week of month, day of week
- // "Mm.w.d". d is between 0 (Sunday) and 6. Week w is
- // between 1 and 5; Week 1 is the first week in which day d
- // occurs and Week 5 specifies the last d day in the month.
- // Month m is between 1 and 12.
-
- // Month, day of month, day of week
- // ZoneInfo extension, not in POSIX
- // "Am.n.d". d is between 0 (Sunday) and 6. Day of month n is
- // between 1 and 25. Month m is between 1 and 12.
-
- month = Integer.parseInt(date.substring(1, date.indexOf('.')));
- int week = Integer.parseInt(date.substring(date.indexOf('.') + 1,
- date.lastIndexOf('.')));
- int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.')
- + 1));
- dayOfWeek++; // Java day of week is one-based, Sunday is first day.
-
- if (type == 2)
- {
- day = week;
- dayOfWeek = -dayOfWeek;
- }
- else if (week == 5)
- day = -1; // last day of month is -1 in java, 5 in TZ
- else
- {
- // First day of week starting on or after. For example,
- // to specify the second Sunday of April, set month to
- // APRIL, day-of-month to 8, and day-of-week to -SUNDAY.
- day = (week - 1) * 7 + 1;
- dayOfWeek = -dayOfWeek;
- }
-
- month--; // Java month is zero-based.
- return new int[] { month, day, dayOfWeek };
+ int day;
+
+ // Month, week of month, day of week
+ // "Mm.w.d". d is between 0 (Sunday) and 6. Week w is
+ // between 1 and 5; Week 1 is the first week in which day d
+ // occurs and Week 5 specifies the last d day in the month.
+ // Month m is between 1 and 12.
+
+ // Month, day of month, day of week
+ // ZoneInfo extension, not in POSIX
+ // "Am.n.d". d is between 0 (Sunday) and 6. Day of month n is
+ // between 1 and 25. Month m is between 1 and 12.
+
+ month = Integer.parseInt(date.substring(1, date.indexOf('.')));
+ int week = Integer.parseInt(date.substring(date.indexOf('.') + 1,
+ date.lastIndexOf('.')));
+ int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.')
+ + 1));
+ dayOfWeek++; // Java day of week is one-based, Sunday is first day.
+
+ if (type == 2)
+ {
+ day = week;
+ dayOfWeek = -dayOfWeek;
+ }
+ else if (week == 5)
+ day = -1; // last day of month is -1 in java, 5 in TZ
+ else
+ {
+ // First day of week starting on or after. For example,
+ // to specify the second Sunday of April, set month to
+ // APRIL, day-of-month to 8, and day-of-week to -SUNDAY.
+ day = (week - 1) * 7 + 1;
+ dayOfWeek = -dayOfWeek;
+ }
+
+ month--; // Java month is zero-based.
+ return new int[] { month, day, dayOfWeek };
}
// julian day, either zero-based 0<=n<=365 (incl feb 29)
@@ -1103,13 +1103,13 @@ public class ZoneInfo extends TimeZone
if (date.charAt(0) != 'J' || date.charAt(0) != 'j')
{
- julianDay = Integer.parseInt(date.substring(1));
- julianDay++; // make 1-based
- // Adjust day count to include feb 29.
- dayCount = new int[]
- {
- 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
- };
+ julianDay = Integer.parseInt(date.substring(1));
+ julianDay++; // make 1-based
+ // Adjust day count to include feb 29.
+ dayCount = new int[]
+ {
+ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
+ };
}
else
// 1-based julian day
@@ -1118,9 +1118,9 @@ public class ZoneInfo extends TimeZone
int i = 11;
while (i > 0)
if (dayCount[i] < julianDay)
- break;
+ break;
else
- i--;
+ i--;
julianDay -= dayCount[i];
month = i;
return new int[] { month, julianDay, 0 };
@@ -1137,9 +1137,9 @@ public class ZoneInfo extends TimeZone
while (i < time.length())
if (time.charAt(i) == ':')
- break;
+ break;
else
- i++;
+ i++;
millis = 60 * 60 * 1000 * Integer.parseInt(time.substring(0, i));
if (i >= time.length())
return millis;
@@ -1147,9 +1147,9 @@ public class ZoneInfo extends TimeZone
int iprev = ++i;
while (i < time.length())
if (time.charAt(i) == ':')
- break;
+ break;
else
- i++;
+ i++;
millis += 60 * 1000 * Integer.parseInt(time.substring(iprev, i));
if (i >= time.length())
return millis;
diff --git a/libjava/classpath/gnu/java/util/jar/JarUtils.java b/libjava/classpath/gnu/java/util/jar/JarUtils.java
index 9debf64..aa2bc2e 100644
--- a/libjava/classpath/gnu/java/util/jar/JarUtils.java
+++ b/libjava/classpath/gnu/java/util/jar/JarUtils.java
@@ -73,7 +73,7 @@ public abstract class JarUtils
/**
* The original string representation of the manifest version attribute name.
- */
+ */
public static final String MANIFEST_VERSION = "Manifest-Version";
/**
@@ -115,7 +115,7 @@ public abstract class JarUtils
{
String version = expectHeader(version_header, br);
attr.putValue(SIGNATURE_VERSION, version);
- // This may cause problems during VM bootstrap.
+ // This may cause problems during VM bootstrap.
// if (! DEFAULT_SF_VERSION.equals(version))
// log.warning("Unexpected version number: " + version
// + ". Continue (but may fail later)");
@@ -382,20 +382,20 @@ public abstract class JarUtils
* The basic method for writing Mainfest attributes. This
* implementation respects the rule stated in the Jar Specification concerning
* the maximum allowed line length; i.e.
- *
+ *
*
* No line may be longer than 72 bytes (not characters), in its UTF8-encoded
* form. If a value would make the initial line longer than this, it should
* be continued on extra lines (each starting with a single SPACE).
*
- *
+ *
* and
- *
+ *
*
* Because header names cannot be continued, the maximum length of a header
* name is 70 bytes (there must be a colon and a SPACE after the name).
*
- *
+ *
* @param name the name of the attribute.
* @param value the value of the attribute.
* @param out the output stream to write the attribute's name/value pair to.
diff --git a/libjava/classpath/gnu/java/util/prefs/FileBasedFactory.java b/libjava/classpath/gnu/java/util/prefs/FileBasedFactory.java
index e5f24ef..91ea861 100644
--- a/libjava/classpath/gnu/java/util/prefs/FileBasedFactory.java
+++ b/libjava/classpath/gnu/java/util/prefs/FileBasedFactory.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/libjava/classpath/gnu/java/util/prefs/FileBasedPreferences.java b/libjava/classpath/gnu/java/util/prefs/FileBasedPreferences.java
index f7566dd..f89ed6b 100644
--- a/libjava/classpath/gnu/java/util/prefs/FileBasedPreferences.java
+++ b/libjava/classpath/gnu/java/util/prefs/FileBasedPreferences.java
@@ -57,7 +57,7 @@ import java.util.prefs.BackingStoreException;
* beneath the user's home directory. The preferences for the node are
* stored in a single properties file in that directory. Sub-nodes are
* stored in subdirectories. This implementation uses file locking to
- * mediate access to the properties files.
+ * mediate access to the properties files.
*/
public class FileBasedPreferences
extends AbstractPreferences
@@ -217,7 +217,7 @@ public class FileBasedPreferences
{
// Write the underlying file.
directory.mkdirs();
-
+
FileOutputStream fos = null;
FileLock lock = null;
try
diff --git a/libjava/classpath/gnu/java/util/prefs/GConfBasedFactory.java b/libjava/classpath/gnu/java/util/prefs/GConfBasedFactory.java
index ae734b60..f5a1894 100644
--- a/libjava/classpath/gnu/java/util/prefs/GConfBasedFactory.java
+++ b/libjava/classpath/gnu/java/util/prefs/GConfBasedFactory.java
@@ -43,7 +43,7 @@ import java.util.prefs.PreferencesFactory;
/**
* Factory object that generates a Preferences nodes that are read from a GConf
* daemon.
- *
+ *
* @author Mario Torre
*/
public class GConfBasedFactory implements PreferencesFactory
@@ -58,7 +58,7 @@ public class GConfBasedFactory implements PreferencesFactory
/**
* Returns the system root preference node.
- *
+ *
* @see java.util.prefs.PreferencesFactory#systemRoot()
*/
public Preferences systemRoot()
@@ -68,7 +68,7 @@ public class GConfBasedFactory implements PreferencesFactory
/**
* Returns the user root preference node corresponding to the calling user.
- *
+ *
* @see java.util.prefs.PreferencesFactory#userRoot()
*/
public Preferences userRoot()
diff --git a/libjava/classpath/gnu/java/util/prefs/GConfBasedPreferences.java b/libjava/classpath/gnu/java/util/prefs/GConfBasedPreferences.java
index c26fe63..e3374ee 100644
--- a/libjava/classpath/gnu/java/util/prefs/GConfBasedPreferences.java
+++ b/libjava/classpath/gnu/java/util/prefs/GConfBasedPreferences.java
@@ -54,22 +54,22 @@ import java.util.prefs.BackingStoreException;
*
* User Root:
*
- *
+ *
*
* gnu.java.util.prefs.gconf.user_root
*
- *
+ *
*
*
* and System Root:
*
- *
+ *
*
* gnu.java.util.prefs.gconf.system_root
*
- *
+ *
*
- *
+ *
* @author Mario Torre
*/
public class GConfBasedPreferences
@@ -115,7 +115,7 @@ public class GConfBasedPreferences
* Creates a new preference node given a parent node and a name, which has to
* be relative to its parent. When isUser is true it will be user
* node otherwise it will be a system node.
- *
+ *
* @param parent The parent node of this newly created node.
* @param name A name relative to the parent node.
* @param isUser Set to true initializes this node to be
@@ -142,7 +142,7 @@ public class GConfBasedPreferences
absolutePath = absolutePath.substring(0, index + 1);
absolutePath = absolutePath + GConfNativePeer.escapeString(name);
}
-
+
this.node = this.getRealRoot(isUser) + absolutePath;
boolean nodeExist = backend.nodeExist(this.node);
@@ -153,7 +153,7 @@ public class GConfBasedPreferences
/**
* Returns a child node with the given name.
* If the child node does not exists, it will be created.
- *
+ *
* @param name The name of the requested node.
* @return A new reference to the node, creating the node if it is necessary.
*/
@@ -162,10 +162,10 @@ public class GConfBasedPreferences
// we don't check anything here, if the node is a new node this will be
// detected in the constructor, so we simply return a new reference to
// the requested node.
-
+
GConfBasedPreferences preferenceNode
= new GConfBasedPreferences(this, name, this.isUser);
-
+
return preferenceNode;
}
@@ -173,7 +173,7 @@ public class GConfBasedPreferences
* Returns an array of names of the children of this preference node.
* If the current node does not have children, the returned array will be
* of size 0 (that is, not null).
- *
+ *
* @return A String array of names of children of the current
* node.
* @throws BackingStoreException if this operation cannot be completed.
@@ -192,7 +192,7 @@ public class GConfBasedPreferences
* GConf handles this for us asynchronously. More over, both sync and flush
* have the same meaning in this class, so calling sync has exactly the same
* effect.
- *
+ *
* @see #sync
* @throws BackingStoreException if this operation cannot be completed.
*/
@@ -203,7 +203,7 @@ public class GConfBasedPreferences
/**
* Request a flush.
- *
+ *
* @see #flush
* @throws BackingStoreException if this operation cannot be completed.
*/
@@ -216,7 +216,7 @@ public class GConfBasedPreferences
* Returns all of the key in this preference node.
* If the current node does not have preferences, the returned array will be
* of size zero.
- *
+ *
* @return A String array of keys stored under the current
* node.
* @throws BackingStoreException if this operation cannot be completed.
@@ -233,7 +233,7 @@ public class GConfBasedPreferences
/**
* Does a recursive postorder traversal of the preference tree, starting from
* the given directory invalidating every preference found in the node.
- *
+ *
* @param directory The name of the starting directory (node)
*/
private void postorderRemove(String directory)
@@ -271,7 +271,7 @@ public class GConfBasedPreferences
/**
* Stores the given key-value pair into this preference node.
- *
+ *
* @param key The key of this preference.
* @param value The value of this preference.
*/
@@ -293,7 +293,7 @@ public class GConfBasedPreferences
/**
* Removes the given key from this preference node.
* If the key does not exist, no operation is performed.
- *
+ *
* @param key The key to remove.
*/
protected void removeSpi(String key)
@@ -305,7 +305,7 @@ public class GConfBasedPreferences
* Suggest a sync to the backend. Actually, this is only a suggestion as GConf
* handles this for us asynchronously. More over, both sync and flush have the
* same meaning in this class, so calling flush has exactly the same effect.
- *
+ *
* @see #flush
* @throws BackingStoreException if this operation cannot be completed due to
* a failure in the backing store, or inability to communicate with
@@ -318,7 +318,7 @@ public class GConfBasedPreferences
/**
* Request a sync.
- *
+ *
* @see #sync
* @throws BackingStoreException if this operation cannot be completed due to
* a failure in the backing store, or inability to communicate with
@@ -333,7 +333,7 @@ public class GConfBasedPreferences
* Returns the value of the given key.
* If the keys does not have a value, or there is an error in the backing
* store, null is returned instead.
- *
+ *
* @param key The key to retrieve.
* @return The value associated with the given key.
*/
@@ -345,7 +345,7 @@ public class GConfBasedPreferences
/**
* Returns true if this preference node is a user node,
* false if is a system preference node.
- *
+ *
* @return true if this preference node is a user node,
* false if is a system preference node.
*/
@@ -360,18 +360,18 @@ public class GConfBasedPreferences
/**
* Builds a GConf key string suitable for operations on the backend.
- *
+ *
* @param key The key to convert into a valid GConf key.
* @return A valid Gconf key.
*/
private String getGConfKey(String key)
{
String nodeName = "";
-
+
// strip key
// please, note that all names are unescaped into the native peer
key = GConfNativePeer.escapeString(key);
-
+
if (this.node.endsWith("/"))
{
nodeName = this.node + key;
@@ -380,13 +380,13 @@ public class GConfBasedPreferences
{
nodeName = this.node + "/" + key;
}
-
+
return nodeName;
}
/**
* Builds the root node to use for this preference.
- *
+ *
* @param isUser Defines if this node is a user (true) or system
* (false) node.
* @return The real root of this preference tree.
diff --git a/libjava/classpath/gnu/java/util/prefs/MemoryBasedFactory.java b/libjava/classpath/gnu/java/util/prefs/MemoryBasedFactory.java
index 275b879..32ed12f 100644
--- a/libjava/classpath/gnu/java/util/prefs/MemoryBasedFactory.java
+++ b/libjava/classpath/gnu/java/util/prefs/MemoryBasedFactory.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/libjava/classpath/gnu/java/util/prefs/MemoryBasedPreferences.java b/libjava/classpath/gnu/java/util/prefs/MemoryBasedPreferences.java
index dc82379..ee184d1 100644
--- a/libjava/classpath/gnu/java/util/prefs/MemoryBasedPreferences.java
+++ b/libjava/classpath/gnu/java/util/prefs/MemoryBasedPreferences.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/libjava/classpath/gnu/java/util/prefs/NodeReader.java b/libjava/classpath/gnu/java/util/prefs/NodeReader.java
index ae5510e1..0a49fc7 100644
--- a/libjava/classpath/gnu/java/util/prefs/NodeReader.java
+++ b/libjava/classpath/gnu/java/util/prefs/NodeReader.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -128,7 +128,7 @@ public class NodeReader {
readNodes(subnode);
skipTill("");
}
-
+
}
private void readMap(Preferences node)
@@ -169,7 +169,7 @@ public class NodeReader {
while(true) {
if (line == null)
throw new InvalidPreferencesFormatException(s + " not found");
-
+
int index = line.indexOf(s);
if (index == -1) {
line = br.readLine();
@@ -199,7 +199,7 @@ public class NodeReader {
while(true) {
if (line == null)
throw new InvalidPreferencesFormatException("unexpected EOF");
-
+
int start = line.indexOf("<");
if (start == -1) {
line = br.readLine();
diff --git a/libjava/classpath/gnu/java/util/prefs/NodeWriter.java b/libjava/classpath/gnu/java/util/prefs/NodeWriter.java
index d3c0953..3e4f972 100644
--- a/libjava/classpath/gnu/java/util/prefs/NodeWriter.java
+++ b/libjava/classpath/gnu/java/util/prefs/NodeWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -271,7 +271,7 @@ public class NodeWriter {
}
}
- private void writeMap(Preferences node, int indent)
+ private void writeMap(Preferences node, int indent)
throws BackingStoreException, IOException
{
// construct String used for indentation
diff --git a/libjava/classpath/gnu/java/util/prefs/gconf/GConfNativePeer.java b/libjava/classpath/gnu/java/util/prefs/gconf/GConfNativePeer.java
index 3c02919..64fc049 100644
--- a/libjava/classpath/gnu/java/util/prefs/gconf/GConfNativePeer.java
+++ b/libjava/classpath/gnu/java/util/prefs/gconf/GConfNativePeer.java
@@ -43,7 +43,7 @@ import java.util.prefs.BackingStoreException;
/**
* Native peer for GConf based preference backend.
- *
+ *
* @author Mario Torre
*/
public final class GConfNativePeer
@@ -59,7 +59,7 @@ public final class GConfNativePeer
/**
* Queries whether the node node exists in theGConf database.
* Returns true or false.
- *
+ *
* @param node the node to check.
*/
public boolean nodeExist(String node)
@@ -72,7 +72,7 @@ public final class GConfNativePeer
* exist before (ie it was unset or it only had a default value).
* Key names must be valid GConf key names, that is, there can be more
* restrictions than for normal Preference Backend.
- *
+ *
* @param key the key to alter (or add).
* @param value the new value for this key.
* @return true if the key was updated, false otherwise.
@@ -86,7 +86,7 @@ public final class GConfNativePeer
* Unsets the value of key; if key is already unset, has no effect. Depending
* on the GConf daemon, unsetting a key may have the side effect to remove it
* completely form the database.
- *
+ *
* @param key the key to unset.
* @return true on success, false if the key was not updated.
*/
@@ -97,7 +97,7 @@ public final class GConfNativePeer
/**
* Gets the value of a configuration key.
- *
+ *
* @param key the configuration key.
* @return the values of this key, null if the key is not valid.
*/
@@ -110,7 +110,7 @@ public final class GConfNativePeer
* Lists the key in the given node. Does not list subnodes. Keys names are the
* stripped names (name relative to the current node) of the keys stored in
* this node.
- *
+ *
* @param node the node where keys are stored.
* @return a java.util.List of keys. If there are no keys in the given node, a
* list of size 0 is returned.
@@ -123,7 +123,7 @@ public final class GConfNativePeer
/**
* Lists the subnodes in node. The returned list contains
* allocated strings. Each string is the name relative tho the given node.
- *
+ *
* @param node the node to get subnodes from. If there are no subnodes in the
* given node, a list of size 0 is returned.
*/
@@ -139,7 +139,7 @@ public final class GConfNativePeer
{
return gconf_escape_key(plain);
}
-
+
/**
* Unescape a string escaped with {@link #escapeString}.
*/
@@ -147,7 +147,7 @@ public final class GConfNativePeer
{
return gconf_unescape_key(escaped);
}
-
+
/**
* Suggest to the backend GConf daemon to synch with the database.
*/
@@ -155,7 +155,7 @@ public final class GConfNativePeer
{
gconf_suggest_sync();
}
-
+
protected void finalize() throws Throwable
{
try
@@ -181,7 +181,7 @@ public final class GConfNativePeer
* It is meant to be used by the static initializer.
*/
native synchronized static final private void init_id_cache();
-
+
/**
* Initialize the GConf native peer. This is meant to be used by the
* class constructor.
@@ -196,7 +196,7 @@ public final class GConfNativePeer
/**
* Queries the GConf database to see if the given node exists, returning
* true if the node exist, false otherwise.
- *
+ *
* @param node the node to query for existence.
* @return true if the node exist, false otherwise.
*/
@@ -206,7 +206,7 @@ public final class GConfNativePeer
/**
* Sets the given key/value pair into the GConf database.
* The key must be a valid GConf key.
- *
+ *
* @param key the key to store in the GConf database
* @param value the value to associate to the given key.
* @return true if the change has effect, false otherwise.
@@ -217,7 +217,7 @@ public final class GConfNativePeer
/**
* Returns the key associated to the given key. Null is returned if the
* key is not valid.
- *
+ *
* @param key the key to return the value of.
* @return The value associated to the given key, or null.
*/
@@ -226,7 +226,7 @@ public final class GConfNativePeer
/**
* Usets the given key, removing the key from the database.
- *
+ *
* @param key the key to remove.
* @return true if the operation success, false otherwise.
*/
@@ -238,46 +238,46 @@ public final class GConfNativePeer
*/
native synchronized static final protected void gconf_suggest_sync()
throws BackingStoreException;
-
+
/**
* Returns a list of all nodes under the given node.
- *
+ *
* @param node the source node.
* @return A list of nodes under the given source node.
*/
native
static synchronized final protected List gconf_all_nodes(String node)
throws BackingStoreException;
-
+
/**
* Returns a list of all keys stored in the given node.
- *
+ *
* @param node the source node.
* @return A list of all keys stored in the given node.
*/
- native synchronized
+ native synchronized
static final protected List gconf_all_keys(String node)
throws BackingStoreException;
/**
* Escape the input String so that it's a valid element for GConf.
- *
+ *
* @param plain the String to escape.
* @return An escaped String for use with GConf.
*/
- native synchronized
+ native synchronized
static final protected String gconf_escape_key(String plain);
-
+
/**
* Converts a string escaped with gconf_escape_key back into its
* original form.
- *
- * @param escaped key as returned by gconf_escape_key
+ *
+ * @param escaped key as returned by gconf_escape_key
* @return An unescaped key.
*/
- native synchronized
+ native synchronized
static final protected String gconf_unescape_key(String escaped);
-
+
static
{
System.loadLibrary("gconfpeer");
diff --git a/libjava/classpath/gnu/java/util/regex/BacktrackStack.java b/libjava/classpath/gnu/java/util/regex/BacktrackStack.java
index 6847261..b03fb87 100644
--- a/libjava/classpath/gnu/java/util/regex/BacktrackStack.java
+++ b/libjava/classpath/gnu/java/util/regex/BacktrackStack.java
@@ -50,16 +50,16 @@ final class BacktrackStack
/** A set of data to be used for backtracking. */
static class Backtrack
{
- /** REToken to which to go back */
+ /** REToken to which to go back */
REToken token;
- /** CharIndexed on which matches are being searched for. */
+ /** CharIndexed on which matches are being searched for. */
CharIndexed input;
- /** REMatch to be used by the REToken token. */
+ /** REMatch to be used by the REToken token. */
REMatch match;
- /** Some parameter used by the token's backtrack method. */
+ /** Some parameter used by the token's backtrack method. */
Object param;
Backtrack (REToken token, CharIndexed input, REMatch match,
- Object param)
+ Object param)
{
this.token = token;
this.input = input;
@@ -104,7 +104,7 @@ final class BacktrackStack
{
for (int i = 0; i < size; i++)
{
- stack[i] = null;
+ stack[i] = null;
}
size = 0;
}
@@ -113,10 +113,10 @@ final class BacktrackStack
{
if (size >= capacity)
{
- capacity += CAPACITY_INCREMENT;
- Backtrack[]newStack = new Backtrack[capacity];
- System.arraycopy (stack, 0, newStack, 0, size);
- stack = newStack;
+ capacity += CAPACITY_INCREMENT;
+ Backtrack[]newStack = new Backtrack[capacity];
+ System.arraycopy (stack, 0, newStack, 0, size);
+ stack = newStack;
}
stack[size++] = bt;
}
diff --git a/libjava/classpath/gnu/java/util/regex/CharIndexed.java b/libjava/classpath/gnu/java/util/regex/CharIndexed.java
index 070547d..de4b166 100644
--- a/libjava/classpath/gnu/java/util/regex/CharIndexed.java
+++ b/libjava/classpath/gnu/java/util/regex/CharIndexed.java
@@ -82,7 +82,7 @@ public interface CharIndexed
* true if the new cursor position is valid or cursor position is at
* the end of input.
*/
- boolean move1 (int index); // I cannot think of a better name for this.
+ boolean move1 (int index); // I cannot think of a better name for this.
/**
* Returns true if the most recent move() operation placed the cursor
diff --git a/libjava/classpath/gnu/java/util/regex/CharIndexedInputStream.java b/libjava/classpath/gnu/java/util/regex/CharIndexedInputStream.java
index e42710b..d634029 100644
--- a/libjava/classpath/gnu/java/util/regex/CharIndexedInputStream.java
+++ b/libjava/classpath/gnu/java/util/regex/CharIndexedInputStream.java
@@ -45,7 +45,7 @@ import java.io.InputStream;
class CharIndexedInputStream implements CharIndexed
{
private static final int BUFFER_INCREMENT = 1024;
- private static final int UNKNOWN = Integer.MAX_VALUE; // value for end
+ private static final int UNKNOWN = Integer.MAX_VALUE; // value for end
private BufferedInputStream br;
@@ -78,22 +78,22 @@ class CharIndexedInputStream implements CharIndexed
{
if (end == 1)
return false;
- end--; // closer to end
+ end--; // closer to end
try
{
if (index != -1)
- {
- br.reset ();
- }
+ {
+ br.reset ();
+ }
int i = br.read ();
br.mark (bufsize);
if (i == -1)
- {
- end = 1;
- cached = OUT_OF_BOUNDS;
- return false;
- }
+ {
+ end = 1;
+ cached = OUT_OF_BOUNDS;
+ return false;
+ }
cached = (char) i;
index = 1;
} catch (IOException e)
@@ -109,62 +109,62 @@ class CharIndexedInputStream implements CharIndexed
{
if (index == 0)
{
- return cached;
+ return cached;
}
else if (index >= end)
{
- return OUT_OF_BOUNDS;
+ return OUT_OF_BOUNDS;
}
else if (index == -1)
{
- return lookBehind[0];
+ return lookBehind[0];
}
else if (index == -2)
{
- return lookBehind[1];
+ return lookBehind[1];
}
else if (index < -2)
{
- return OUT_OF_BOUNDS;
+ return OUT_OF_BOUNDS;
}
else if (index >= bufsize)
{
- // Allocate more space in the buffer.
- try
- {
- while (bufsize <= index)
- bufsize += BUFFER_INCREMENT;
- br.reset ();
- br.mark (bufsize);
- br.skip (index - 1);
- }
- catch (IOException e)
- {
- }
+ // Allocate more space in the buffer.
+ try
+ {
+ while (bufsize <= index)
+ bufsize += BUFFER_INCREMENT;
+ br.reset ();
+ br.mark (bufsize);
+ br.skip (index - 1);
+ }
+ catch (IOException e)
+ {
+ }
}
else if (this.index != index)
{
- try
- {
- br.reset ();
- br.skip (index - 1);
- }
- catch (IOException e)
- {
- }
+ try
+ {
+ br.reset ();
+ br.skip (index - 1);
+ }
+ catch (IOException e)
+ {
+ }
}
char ch = OUT_OF_BOUNDS;
try
{
int i = br.read ();
- this.index = index + 1; // this.index is index of next pos relative to charAt(0)
+ this.index = index + 1; // this.index is index of next pos relative to charAt(0)
if (i == -1)
- {
- // set flag that next should fail next time?
- end = index;
- return ch;
- }
+ {
+ // set flag that next should fail next time?
+ end = index;
+ return ch;
+ }
ch = (char) i;
} catch (IOException ie)
{
diff --git a/libjava/classpath/gnu/java/util/regex/RE.java b/libjava/classpath/gnu/java/util/regex/RE.java
index d064f7a..5e9974a 100644
--- a/libjava/classpath/gnu/java/util/regex/RE.java
+++ b/libjava/classpath/gnu/java/util/regex/RE.java
@@ -53,7 +53,7 @@ import java.util.ResourceBundle;
* expressions.
*
* A regular expression object (class RE) is compiled by constructing it
- * from a String, StringBuffer or character array, with optional
+ * from a String, StringBuffer or character array, with optional
* compilation flags (below)
* and an optional syntax specification (see RESyntax; if not specified,
* RESyntax.RE_SYNTAX_PERL5 is used).
@@ -110,7 +110,7 @@ import java.util.ResourceBundle;
*
* You can optionally affect the execution environment by using a
* combination of execution flags (constants listed below).
- *
+ *
*
* All operations on a regular expression are performed in a
* thread-safe manner.
@@ -281,7 +281,7 @@ public class RE extends REToken
{
if (messages == null)
messages =
- PropertyResourceBundle.getBundle (bundle, Locale.getDefault ());
+ PropertyResourceBundle.getBundle (bundle, Locale.getDefault ());
return messages.getString (key);
}
@@ -335,7 +335,7 @@ public class RE extends REToken
// internal constructor used for alternation
private RE (REToken first, REToken last, int subs, int subIndex,
- int minLength, int maxLength)
+ int minLength, int maxLength)
{
super (subIndex);
firstToken = first;
@@ -347,9 +347,9 @@ public class RE extends REToken
}
private RE (Object patternObj, int cflags, RESyntax syntax, int myIndex,
- int nextSub) throws REException
+ int nextSub) throws REException
{
- super (myIndex); // Subexpression index of this token.
+ super (myIndex); // Subexpression index of this token.
initialize (patternObj, cflags, syntax, myIndex, nextSub);
}
@@ -361,41 +361,41 @@ public class RE extends REToken
// The meat of construction
protected void initialize (Object patternObj, int cflags, RESyntax syntax,
- int myIndex, int nextSub) throws REException
+ int myIndex, int nextSub) throws REException
{
char[] pattern;
if (patternObj instanceof String)
{
- pattern = ((String) patternObj).toCharArray ();
+ pattern = ((String) patternObj).toCharArray ();
}
else if (patternObj instanceof char[])
{
- pattern = (char[]) patternObj;
+ pattern = (char[]) patternObj;
}
else if (patternObj instanceof StringBuffer)
{
- pattern = new char[((StringBuffer) patternObj).length ()];
- ((StringBuffer) patternObj).getChars (0, pattern.length, pattern, 0);
+ pattern = new char[((StringBuffer) patternObj).length ()];
+ ((StringBuffer) patternObj).getChars (0, pattern.length, pattern, 0);
}
else if (patternObj instanceof StringBuilder)
{
- pattern = new char[((StringBuilder) patternObj).length ()];
- ((StringBuilder) patternObj).getChars (0, pattern.length, pattern, 0);
+ pattern = new char[((StringBuilder) patternObj).length ()];
+ ((StringBuilder) patternObj).getChars (0, pattern.length, pattern, 0);
}
else if (patternObj instanceof CPStringBuilder)
{
- pattern = new char[((CPStringBuilder) patternObj).length ()];
- ((CPStringBuilder) patternObj).getChars (0, pattern.length, pattern,
- 0);
+ pattern = new char[((CPStringBuilder) patternObj).length ()];
+ ((CPStringBuilder) patternObj).getChars (0, pattern.length, pattern,
+ 0);
}
else
{
- pattern = patternObj.toString ().toCharArray ();
+ pattern = patternObj.toString ().toCharArray ();
}
int pLength = pattern.length;
- numSubs = 0; // Number of subexpressions in this token.
+ numSubs = 0; // Number of subexpressions in this token.
ArrayList < REToken > branches = null;
// linked list of tokens (sort of -- some closed loops can exist)
@@ -429,956 +429,956 @@ public class RE extends REToken
while (index < pLength)
{
- // read the next character unit (including backslash escapes)
- index = getCharUnit (pattern, index, unit, quot);
-
- if (unit.bk)
- if (unit.ch == 'Q')
- {
- quot = true;
- continue;
- }
- else if (unit.ch == 'E')
- {
- quot = false;
- continue;
- }
- if (quot)
- unit.bk = false;
-
- if (((cflags & REG_X_COMMENTS) > 0) && (!unit.bk) && (!quot))
- {
- if (Character.isWhitespace (unit.ch))
- {
- continue;
- }
- if (unit.ch == '#')
- {
- for (int i = index; i < pLength; i++)
- {
- if (pattern[i] == '\n')
- {
- index = i + 1;
- continue;
- }
- else if (pattern[i] == '\r')
- {
- if (i + 1 < pLength && pattern[i + 1] == '\n')
- {
- index = i + 2;
- }
- else
- {
- index = i + 1;
- }
- continue;
- }
- }
- index = pLength;
- continue;
- }
- }
-
- // ALTERNATION OPERATOR
- // \| or | (if RE_NO_BK_VBAR) or newline (if RE_NEWLINE_ALT)
- // not available if RE_LIMITED_OPS is set
-
- // TODO: the '\n' literal here should be a test against REToken.newline,
- // which unfortunately may be more than a single character.
- if (((unit.ch == '|'
- && (syntax.get (RESyntax.RE_NO_BK_VBAR) ^ (unit.bk || quot)))
- || (syntax.get (RESyntax.RE_NEWLINE_ALT) && (unit.ch == '\n')
- && !(unit.bk || quot)))
- && !syntax.get (RESyntax.RE_LIMITED_OPS))
- {
- // make everything up to here be a branch. create vector if nec.
- addToken (currentToken);
- RE theBranch =
- new RE (firstToken, lastToken, numSubs, subIndex, minimumLength,
- maximumLength);
- minimumLength = 0;
- maximumLength = 0;
- if (branches == null)
- {
- branches = new ArrayList < REToken > ();
- }
- branches.add (theBranch);
- firstToken = lastToken = currentToken = null;
- }
-
- // INTERVAL OPERATOR:
- // {x} | {x,} | {x,y} (RE_INTERVALS && RE_NO_BK_BRACES)
- // \{x\} | \{x,\} | \{x,y\} (RE_INTERVALS && !RE_NO_BK_BRACES)
- //
- // OPEN QUESTION:
- // what is proper interpretation of '{' at start of string?
- //
- // This method used to check "repeat.empty.token" to avoid such regexp
- // as "(a*){2,}", but now "repeat.empty.token" is allowed.
-
- else if ((unit.ch == '{') && syntax.get (RESyntax.RE_INTERVALS)
- && (syntax.
- get (RESyntax.RE_NO_BK_BRACES) ^ (unit.bk || quot)))
- {
- int newIndex = getMinMax (pattern, index, minMax, syntax);
- if (newIndex > index)
- {
- if (minMax.first > minMax.second)
- throw new
- REException (getLocalizedMessage ("interval.order"),
- REException.REG_BADRPT, newIndex);
- if (currentToken == null)
- throw new
- REException (getLocalizedMessage ("repeat.no.token"),
- REException.REG_BADRPT, newIndex);
- if (currentToken instanceof RETokenRepeated)
- throw new
- REException (getLocalizedMessage ("repeat.chained"),
- REException.REG_BADRPT, newIndex);
- if (currentToken instanceof RETokenWordBoundary
- || currentToken instanceof RETokenWordBoundary)
- throw new
- REException (getLocalizedMessage ("repeat.assertion"),
- REException.REG_BADRPT, newIndex);
- index = newIndex;
- currentToken =
- setRepeated (currentToken, minMax.first, minMax.second,
- index);
- }
- else
- {
- addToken (currentToken);
- currentToken = new RETokenChar (subIndex, unit.ch, insens);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
- }
-
- // LIST OPERATOR:
- // [...] | [^...]
-
- else if ((unit.ch == '[') && !(unit.bk || quot))
- {
- // Create a new RETokenOneOf
- ParseCharClassResult result =
- parseCharClass (subIndex, pattern, index, pLength, cflags,
- syntax, 0);
- addToken (currentToken);
- currentToken = result.token;
- index = result.index;
- }
-
- // SUBEXPRESSIONS
- // (...) | \(...\) depending on RE_NO_BK_PARENS
-
- else if ((unit.ch == '(')
- && (syntax.
- get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot)))
- {
- boolean pure = false;
- boolean comment = false;
- boolean lookAhead = false;
- boolean lookBehind = false;
- boolean independent = false;
- boolean negativelh = false;
- boolean negativelb = false;
- if ((index + 1 < pLength) && (pattern[index] == '?'))
- {
- switch (pattern[index + 1])
- {
- case '!':
- if (syntax.get (RESyntax.RE_LOOKAHEAD))
- {
- pure = true;
- negativelh = true;
- lookAhead = true;
- index += 2;
- }
- break;
- case '=':
- if (syntax.get (RESyntax.RE_LOOKAHEAD))
- {
- pure = true;
- lookAhead = true;
- index += 2;
- }
- break;
- case '<':
- // We assume that if the syntax supports look-ahead,
- // it also supports look-behind.
- if (syntax.get (RESyntax.RE_LOOKAHEAD))
- {
- index++;
- switch (pattern[index + 1])
- {
- case '!':
- pure = true;
- negativelb = true;
- lookBehind = true;
- index += 2;
- break;
- case '=':
- pure = true;
- lookBehind = true;
- index += 2;
- }
- }
- break;
- case '>':
- // We assume that if the syntax supports look-ahead,
- // it also supports independent group.
- if (syntax.get (RESyntax.RE_LOOKAHEAD))
- {
- pure = true;
- independent = true;
- index += 2;
- }
- break;
- case 'i':
- case 'd':
- case 'm':
- case 's':
- case 'u':
- case 'x':
- case '-':
- if (!syntax.get (RESyntax.RE_EMBEDDED_FLAGS))
- break;
- // Set or reset syntax flags.
- int flagIndex = index + 1;
- int endFlag = -1;
- RESyntax newSyntax = new RESyntax (syntax);
- int newCflags = cflags;
- boolean negate = false;
- while (flagIndex < pLength && endFlag < 0)
- {
- switch (pattern[flagIndex])
- {
- case 'i':
- if (negate)
- newCflags &= ~REG_ICASE;
- else
- newCflags |= REG_ICASE;
- flagIndex++;
- break;
- case 'd':
- if (negate)
- newSyntax.setLineSeparator (RESyntax.
- DEFAULT_LINE_SEPARATOR);
- else
- newSyntax.setLineSeparator ("\n");
- flagIndex++;
- break;
- case 'm':
- if (negate)
- newCflags &= ~REG_MULTILINE;
- else
- newCflags |= REG_MULTILINE;
- flagIndex++;
- break;
- case 's':
- if (negate)
- newCflags &= ~REG_DOT_NEWLINE;
- else
- newCflags |= REG_DOT_NEWLINE;
- flagIndex++;
- break;
- case 'u':
- if (negate)
- newCflags |= REG_ICASE_USASCII;
- else
- newCflags &= ~REG_ICASE_USASCII;
- flagIndex++;
- break;
- case 'x':
- if (negate)
- newCflags &= ~REG_X_COMMENTS;
- else
- newCflags |= REG_X_COMMENTS;
- flagIndex++;
- break;
- case '-':
- negate = true;
- flagIndex++;
- break;
- case ':':
- case ')':
- endFlag = pattern[flagIndex];
- break;
- default:
- throw new
- REException (getLocalizedMessage
- ("repeat.no.token"),
- REException.REG_BADRPT, index);
- }
- }
- if (endFlag == ')')
- {
- syntax = newSyntax;
- cflags = newCflags;
- insens = ((cflags & REG_ICASE) > 0);
- insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
- // This can be treated as though it were a comment.
- comment = true;
- index = flagIndex - 1;
- break;
- }
- if (endFlag == ':')
- {
- savedSyntax = syntax;
- savedCflags = cflags;
- flagsSaved = true;
- syntax = newSyntax;
- cflags = newCflags;
- insens = ((cflags & REG_ICASE) > 0);
- insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
- index = flagIndex - 1;
- // Fall through to the next case.
- }
- else
- {
- throw new
- REException (getLocalizedMessage
- ("unmatched.paren"),
- REException.REG_ESUBREG, index);
- }
- case ':':
- if (syntax.get (RESyntax.RE_PURE_GROUPING))
- {
- pure = true;
- index += 2;
- }
- break;
- case '#':
- if (syntax.get (RESyntax.RE_COMMENTS))
- {
- comment = true;
- }
- break;
- default:
- throw new
- REException (getLocalizedMessage ("repeat.no.token"),
- REException.REG_BADRPT, index);
- }
- }
-
- if (index >= pLength)
- {
- throw new
- REException (getLocalizedMessage ("unmatched.paren"),
- REException.REG_ESUBREG, index);
- }
-
- // find end of subexpression
- int endIndex = index;
- int nextIndex = index;
- int nested = 0;
-
- while (((nextIndex =
- getCharUnit (pattern, endIndex, unit, false)) > 0)
- && !(nested == 0 && (unit.ch == ')')
- && (syntax.
- get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk
- || quot))))
- {
- if ((endIndex = nextIndex) >= pLength)
- throw new
- REException (getLocalizedMessage ("subexpr.no.end"),
- REException.REG_ESUBREG, nextIndex);
- else
- if ((unit.ch == '[') && !(unit.bk || quot))
- {
- // I hate to do something similar to the LIST OPERATOR matters
- // above, but ...
- int listIndex = nextIndex;
- if (listIndex < pLength && pattern[listIndex] == '^')
- listIndex++;
- if (listIndex < pLength && pattern[listIndex] == ']')
- listIndex++;
- int listEndIndex = -1;
- int listNest = 0;
- while (listIndex < pLength && listEndIndex < 0)
- {
- switch (pattern[listIndex++])
- {
- case '\\':
- listIndex++;
- break;
- case '[':
- // Sun's API document says that regexp like "[a-d[m-p]]"
- // is legal. Even something like "[[[^]]]]" is accepted.
- listNest++;
- if (listIndex < pLength
- && pattern[listIndex] == '^')
- listIndex++;
- if (listIndex < pLength
- && pattern[listIndex] == ']')
- listIndex++;
- break;
- case ']':
- if (listNest == 0)
- listEndIndex = listIndex;
- listNest--;
- break;
- }
- }
- if (listEndIndex >= 0)
- {
- nextIndex = listEndIndex;
- if ((endIndex = nextIndex) >= pLength)
- throw new
- REException (getLocalizedMessage ("subexpr.no.end"),
- REException.REG_ESUBREG, nextIndex);
- else
- continue;
- }
- throw new
- REException (getLocalizedMessage ("subexpr.no.end"),
- REException.REG_ESUBREG, nextIndex);
- }
- else if (unit.ch == '('
- && (syntax.
- get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk
- || quot)))
- nested++;
- else if (unit.ch == ')'
- && (syntax.
- get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk
- || quot)))
- nested--;
- }
-
- // endIndex is now position at a ')','\)'
- // nextIndex is end of string or position after ')' or '\)'
-
- if (comment)
- index = nextIndex;
- else
- { // not a comment
- // create RE subexpression as token.
- addToken (currentToken);
- if (!pure)
- {
- numSubs++;
- }
-
- int useIndex = (pure || lookAhead || lookBehind
- || independent) ? 0 : nextSub + numSubs;
- currentToken =
- new RE (String.valueOf (pattern, index, endIndex - index).
- toCharArray (), cflags, syntax, useIndex,
- nextSub + numSubs);
- numSubs += ((RE) currentToken).getNumSubs ();
-
- if (lookAhead)
- {
- currentToken =
- new RETokenLookAhead (currentToken, negativelh);
- }
- else if (lookBehind)
- {
- currentToken =
- new RETokenLookBehind (currentToken, negativelb);
- }
- else if (independent)
- {
- currentToken = new RETokenIndependent (currentToken);
- }
-
- index = nextIndex;
- if (flagsSaved)
- {
- syntax = savedSyntax;
- cflags = savedCflags;
- insens = ((cflags & REG_ICASE) > 0);
- insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
- flagsSaved = false;
- }
- } // not a comment
- } // subexpression
-
- // UNMATCHED RIGHT PAREN
- // ) or \) throw exception if
- // !syntax.get(RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD)
- else if (!syntax.get (RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD)
- && ((unit.ch == ')')
- && (syntax.
- get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot))))
- {
- throw new REException (getLocalizedMessage ("unmatched.paren"),
- REException.REG_EPAREN, index);
- }
-
- // START OF LINE OPERATOR
- // ^
-
- else if ((unit.ch == '^') && !(unit.bk || quot))
- {
- addToken (currentToken);
- currentToken = null;
- RETokenStart token = null;
- if ((cflags & REG_MULTILINE) > 0)
- {
- String sep = syntax.getLineSeparator ();
- if (sep == null)
- {
- token = new RETokenStart (subIndex, null, true);
- }
- else
- {
- token = new RETokenStart (subIndex, sep);
- }
- }
- else
- {
- token = new RETokenStart (subIndex, null);
- }
- addToken (token);
- }
-
- // END OF LINE OPERATOR
- // $
-
- else if ((unit.ch == '$') && !(unit.bk || quot))
- {
- addToken (currentToken);
- currentToken = null;
- RETokenEnd token = null;
- if ((cflags & REG_MULTILINE) > 0)
- {
- String sep = syntax.getLineSeparator ();
- if (sep == null)
- {
- token = new RETokenEnd (subIndex, null, true);
- }
- else
- {
- token = new RETokenEnd (subIndex, sep);
- }
- }
- else
- {
- token = new RETokenEnd (subIndex, null);
- }
- addToken (token);
- }
-
- // MATCH-ANY-CHARACTER OPERATOR (except possibly newline and null)
- // .
-
- else if ((unit.ch == '.') && !(unit.bk || quot))
- {
- addToken (currentToken);
- currentToken =
- new RETokenAny (subIndex, syntax.get (RESyntax.RE_DOT_NEWLINE)
- || ((cflags & REG_DOT_NEWLINE) > 0),
- syntax.get (RESyntax.RE_DOT_NOT_NULL));
- }
-
- // ZERO-OR-MORE REPEAT OPERATOR
- // *
- //
- // This method used to check "repeat.empty.token" to avoid such regexp
- // as "(a*)*", but now "repeat.empty.token" is allowed.
-
- else if ((unit.ch == '*') && !(unit.bk || quot))
- {
- if (currentToken == null)
- throw new REException (getLocalizedMessage ("repeat.no.token"),
- REException.REG_BADRPT, index);
- if (currentToken instanceof RETokenRepeated)
- throw new REException (getLocalizedMessage ("repeat.chained"),
- REException.REG_BADRPT, index);
- if (currentToken instanceof RETokenWordBoundary
- || currentToken instanceof RETokenWordBoundary)
- throw new REException (getLocalizedMessage ("repeat.assertion"),
- REException.REG_BADRPT, index);
- currentToken =
- setRepeated (currentToken, 0, Integer.MAX_VALUE, index);
- }
-
- // ONE-OR-MORE REPEAT OPERATOR / POSSESSIVE MATCHING OPERATOR
- // + | \+ depending on RE_BK_PLUS_QM
- // not available if RE_LIMITED_OPS is set
- //
- // This method used to check "repeat.empty.token" to avoid such regexp
- // as "(a*)+", but now "repeat.empty.token" is allowed.
-
- else if ((unit.ch == '+') && !syntax.get (RESyntax.RE_LIMITED_OPS)
- && (!syntax.
- get (RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot)))
- {
- if (currentToken == null)
- throw new REException (getLocalizedMessage ("repeat.no.token"),
- REException.REG_BADRPT, index);
-
- // Check for possessive matching on RETokenRepeated
- if (currentToken instanceof RETokenRepeated)
- {
- RETokenRepeated tokenRep = (RETokenRepeated) currentToken;
- if (syntax.get (RESyntax.RE_POSSESSIVE_OPS)
- && !tokenRep.isPossessive () && !tokenRep.isStingy ())
- tokenRep.makePossessive ();
- else
- throw new
- REException (getLocalizedMessage ("repeat.chained"),
- REException.REG_BADRPT, index);
-
- }
- else if (currentToken instanceof RETokenWordBoundary
- || currentToken instanceof RETokenWordBoundary)
- throw new REException (getLocalizedMessage ("repeat.assertion"),
- REException.REG_BADRPT, index);
- else
- currentToken =
- setRepeated (currentToken, 1, Integer.MAX_VALUE, index);
- }
-
- // ZERO-OR-ONE REPEAT OPERATOR / STINGY MATCHING OPERATOR
- // ? | \? depending on RE_BK_PLUS_QM
- // not available if RE_LIMITED_OPS is set
- // stingy matching if RE_STINGY_OPS is set and it follows a quantifier
-
- else if ((unit.ch == '?') && !syntax.get (RESyntax.RE_LIMITED_OPS)
- && (!syntax.
- get (RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot)))
- {
- if (currentToken == null)
- throw new REException (getLocalizedMessage ("repeat.no.token"),
- REException.REG_BADRPT, index);
-
- // Check for stingy matching on RETokenRepeated
- if (currentToken instanceof RETokenRepeated)
- {
- RETokenRepeated tokenRep = (RETokenRepeated) currentToken;
- if (syntax.get (RESyntax.RE_STINGY_OPS)
- && !tokenRep.isStingy () && !tokenRep.isPossessive ())
- tokenRep.makeStingy ();
- else
- throw new
- REException (getLocalizedMessage ("repeat.chained"),
- REException.REG_BADRPT, index);
- }
- else if (currentToken instanceof RETokenWordBoundary
- || currentToken instanceof RETokenWordBoundary)
- throw new REException (getLocalizedMessage ("repeat.assertion"),
- REException.REG_BADRPT, index);
- else
- currentToken = setRepeated (currentToken, 0, 1, index);
- }
-
- // OCTAL CHARACTER
- // \0377
-
- else if (unit.bk && (unit.ch == '0')
- && syntax.get (RESyntax.RE_OCTAL_CHAR))
- {
- CharExpression ce =
- getCharExpression (pattern, index - 2, pLength, syntax);
- if (ce == null)
- throw new REException ("invalid octal character",
- REException.REG_ESCAPE, index);
- index = index - 2 + ce.len;
- addToken (currentToken);
- currentToken = new RETokenChar (subIndex, ce.ch, insens);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
-
- // BACKREFERENCE OPERATOR
- // \1 \2 ... \9 and \10 \11 \12 ...
- // not available if RE_NO_BK_REFS is set
- // Perl recognizes \10, \11, and so on only if enough number of
- // parentheses have opened before it, otherwise they are treated
- // as aliases of \010, \011, ... (octal characters). In case of
- // Sun's JDK, octal character expression must always begin with \0.
- // We will do as JDK does. But FIXME, take a look at "(a)(b)\29".
- // JDK treats \2 as a back reference to the 2nd group because
- // there are only two groups. But in our poor implementation,
- // we cannot help but treat \29 as a back reference to the 29th group.
-
- else if (unit.bk && Character.isDigit (unit.ch)
- && !syntax.get (RESyntax.RE_NO_BK_REFS))
- {
- addToken (currentToken);
- int numBegin = index - 1;
- int numEnd = pLength;
- for (int i = index; i < pLength; i++)
- {
- if (!Character.isDigit (pattern[i]))
- {
- numEnd = i;
- break;
- }
- }
- int num = parseInt (pattern, numBegin, numEnd - numBegin, 10);
-
- currentToken = new RETokenBackRef (subIndex, num, insens);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- index = numEnd;
- }
-
- // START OF STRING OPERATOR
- // \A if RE_STRING_ANCHORS is set
-
- else if (unit.bk && (unit.ch == 'A')
- && syntax.get (RESyntax.RE_STRING_ANCHORS))
- {
- addToken (currentToken);
- currentToken = new RETokenStart (subIndex, null);
- }
-
- // WORD BREAK OPERATOR
- // \b if ????
-
- else if (unit.bk && (unit.ch == 'b')
- && syntax.get (RESyntax.RE_STRING_ANCHORS))
- {
- addToken (currentToken);
- currentToken =
- new RETokenWordBoundary (subIndex,
- RETokenWordBoundary.
- BEGIN | RETokenWordBoundary.END,
- false);
- }
-
- // WORD BEGIN OPERATOR
- // \< if ????
- else if (unit.bk && (unit.ch == '<'))
- {
- addToken (currentToken);
- currentToken =
- new RETokenWordBoundary (subIndex, RETokenWordBoundary.BEGIN,
- false);
- }
-
- // WORD END OPERATOR
- // \> if ????
- else if (unit.bk && (unit.ch == '>'))
- {
- addToken (currentToken);
- currentToken =
- new RETokenWordBoundary (subIndex, RETokenWordBoundary.END,
- false);
- }
-
- // NON-WORD BREAK OPERATOR
- // \B if ????
-
- else if (unit.bk && (unit.ch == 'B')
- && syntax.get (RESyntax.RE_STRING_ANCHORS))
- {
- addToken (currentToken);
- currentToken =
- new RETokenWordBoundary (subIndex,
- RETokenWordBoundary.
- BEGIN | RETokenWordBoundary.END, true);
- }
-
-
- // DIGIT OPERATOR
- // \d if RE_CHAR_CLASS_ESCAPES is set
-
- else if (unit.bk && (unit.ch == 'd')
- && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
- {
- addToken (currentToken);
- currentToken =
- new RETokenPOSIX (subIndex, RETokenPOSIX.DIGIT, insens, false);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
-
- // NON-DIGIT OPERATOR
- // \D
-
- else if (unit.bk && (unit.ch == 'D')
- && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
- {
- addToken (currentToken);
- currentToken =
- new RETokenPOSIX (subIndex, RETokenPOSIX.DIGIT, insens, true);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
-
- // NEWLINE ESCAPE
- // \n
-
- else if (unit.bk && (unit.ch == 'n'))
- {
- addToken (currentToken);
- currentToken = new RETokenChar (subIndex, '\n', false);
- }
-
- // RETURN ESCAPE
- // \r
-
- else if (unit.bk && (unit.ch == 'r'))
- {
- addToken (currentToken);
- currentToken = new RETokenChar (subIndex, '\r', false);
- }
-
- // WHITESPACE OPERATOR
- // \s if RE_CHAR_CLASS_ESCAPES is set
-
- else if (unit.bk && (unit.ch == 's')
- && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
- {
- addToken (currentToken);
- currentToken =
- new RETokenPOSIX (subIndex, RETokenPOSIX.SPACE, insens, false);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
-
- // NON-WHITESPACE OPERATOR
- // \S
-
- else if (unit.bk && (unit.ch == 'S')
- && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
- {
- addToken (currentToken);
- currentToken =
- new RETokenPOSIX (subIndex, RETokenPOSIX.SPACE, insens, true);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
-
- // TAB ESCAPE
- // \t
-
- else if (unit.bk && (unit.ch == 't'))
- {
- addToken (currentToken);
- currentToken = new RETokenChar (subIndex, '\t', false);
- }
-
- // ALPHANUMERIC OPERATOR
- // \w
-
- else if (unit.bk && (unit.ch == 'w')
- && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
- {
- addToken (currentToken);
- currentToken =
- new RETokenPOSIX (subIndex, RETokenPOSIX.ALNUM, insens, false);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
-
- // NON-ALPHANUMERIC OPERATOR
- // \W
-
- else if (unit.bk && (unit.ch == 'W')
- && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
- {
- addToken (currentToken);
- currentToken =
- new RETokenPOSIX (subIndex, RETokenPOSIX.ALNUM, insens, true);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
-
- // END OF STRING OPERATOR
- // \Z, \z
-
- // FIXME: \Z and \z are different in that if the input string
- // ends with a line terminator, \Z matches the position before
- // the final terminator. This special behavior of \Z is yet
- // to be implemented.
-
- else if (unit.bk && (unit.ch == 'Z' || unit.ch == 'z') &&
- syntax.get (RESyntax.RE_STRING_ANCHORS))
- {
- addToken (currentToken);
- currentToken = new RETokenEnd (subIndex, null);
- }
-
- // HEX CHARACTER, UNICODE CHARACTER
- // \x1B, \u1234
-
- else
- if ((unit.bk && (unit.ch == 'x')
- && syntax.get (RESyntax.RE_HEX_CHAR)) || (unit.bk
- && (unit.ch == 'u')
- && syntax.
- get (RESyntax.
- RE_UNICODE_CHAR)))
- {
- CharExpression ce =
- getCharExpression (pattern, index - 2, pLength, syntax);
- if (ce == null)
- throw new REException ("invalid hex character",
- REException.REG_ESCAPE, index);
- index = index - 2 + ce.len;
- addToken (currentToken);
- currentToken = new RETokenChar (subIndex, ce.ch, insens);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
-
- // NAMED PROPERTY
- // \p{prop}, \P{prop}
-
- else
- if ((unit.bk && (unit.ch == 'p')
- && syntax.get (RESyntax.RE_NAMED_PROPERTY)) || (unit.bk
- && (unit.ch ==
- 'P')
- && syntax.
- get (RESyntax.
- RE_NAMED_PROPERTY)))
- {
- NamedProperty np = getNamedProperty (pattern, index - 2, pLength);
- if (np == null)
- throw new REException ("invalid escape sequence",
- REException.REG_ESCAPE, index);
- index = index - 2 + np.len;
- addToken (currentToken);
- currentToken =
- getRETokenNamedProperty (subIndex, np, insens, index);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
-
- // END OF PREVIOUS MATCH
- // \G
-
- else if (unit.bk && (unit.ch == 'G') &&
- syntax.get (RESyntax.RE_STRING_ANCHORS))
- {
- addToken (currentToken);
- currentToken = new RETokenEndOfPreviousMatch (subIndex);
- }
-
- // NON-SPECIAL CHARACTER (or escape to make literal)
- // c | \* for example
-
- else
- { // not a special character
- addToken (currentToken);
- currentToken = new RETokenChar (subIndex, unit.ch, insens);
- if (insensUSASCII)
- currentToken.unicodeAware = false;
- }
- } // end while
+ // read the next character unit (including backslash escapes)
+ index = getCharUnit (pattern, index, unit, quot);
+
+ if (unit.bk)
+ if (unit.ch == 'Q')
+ {
+ quot = true;
+ continue;
+ }
+ else if (unit.ch == 'E')
+ {
+ quot = false;
+ continue;
+ }
+ if (quot)
+ unit.bk = false;
+
+ if (((cflags & REG_X_COMMENTS) > 0) && (!unit.bk) && (!quot))
+ {
+ if (Character.isWhitespace (unit.ch))
+ {
+ continue;
+ }
+ if (unit.ch == '#')
+ {
+ for (int i = index; i < pLength; i++)
+ {
+ if (pattern[i] == '\n')
+ {
+ index = i + 1;
+ continue;
+ }
+ else if (pattern[i] == '\r')
+ {
+ if (i + 1 < pLength && pattern[i + 1] == '\n')
+ {
+ index = i + 2;
+ }
+ else
+ {
+ index = i + 1;
+ }
+ continue;
+ }
+ }
+ index = pLength;
+ continue;
+ }
+ }
+
+ // ALTERNATION OPERATOR
+ // \| or | (if RE_NO_BK_VBAR) or newline (if RE_NEWLINE_ALT)
+ // not available if RE_LIMITED_OPS is set
+
+ // TODO: the '\n' literal here should be a test against REToken.newline,
+ // which unfortunately may be more than a single character.
+ if (((unit.ch == '|'
+ && (syntax.get (RESyntax.RE_NO_BK_VBAR) ^ (unit.bk || quot)))
+ || (syntax.get (RESyntax.RE_NEWLINE_ALT) && (unit.ch == '\n')
+ && !(unit.bk || quot)))
+ && !syntax.get (RESyntax.RE_LIMITED_OPS))
+ {
+ // make everything up to here be a branch. create vector if nec.
+ addToken (currentToken);
+ RE theBranch =
+ new RE (firstToken, lastToken, numSubs, subIndex, minimumLength,
+ maximumLength);
+ minimumLength = 0;
+ maximumLength = 0;
+ if (branches == null)
+ {
+ branches = new ArrayList < REToken > ();
+ }
+ branches.add (theBranch);
+ firstToken = lastToken = currentToken = null;
+ }
+
+ // INTERVAL OPERATOR:
+ // {x} | {x,} | {x,y} (RE_INTERVALS && RE_NO_BK_BRACES)
+ // \{x\} | \{x,\} | \{x,y\} (RE_INTERVALS && !RE_NO_BK_BRACES)
+ //
+ // OPEN QUESTION:
+ // what is proper interpretation of '{' at start of string?
+ //
+ // This method used to check "repeat.empty.token" to avoid such regexp
+ // as "(a*){2,}", but now "repeat.empty.token" is allowed.
+
+ else if ((unit.ch == '{') && syntax.get (RESyntax.RE_INTERVALS)
+ && (syntax.
+ get (RESyntax.RE_NO_BK_BRACES) ^ (unit.bk || quot)))
+ {
+ int newIndex = getMinMax (pattern, index, minMax, syntax);
+ if (newIndex > index)
+ {
+ if (minMax.first > minMax.second)
+ throw new
+ REException (getLocalizedMessage ("interval.order"),
+ REException.REG_BADRPT, newIndex);
+ if (currentToken == null)
+ throw new
+ REException (getLocalizedMessage ("repeat.no.token"),
+ REException.REG_BADRPT, newIndex);
+ if (currentToken instanceof RETokenRepeated)
+ throw new
+ REException (getLocalizedMessage ("repeat.chained"),
+ REException.REG_BADRPT, newIndex);
+ if (currentToken instanceof RETokenWordBoundary
+ || currentToken instanceof RETokenWordBoundary)
+ throw new
+ REException (getLocalizedMessage ("repeat.assertion"),
+ REException.REG_BADRPT, newIndex);
+ index = newIndex;
+ currentToken =
+ setRepeated (currentToken, minMax.first, minMax.second,
+ index);
+ }
+ else
+ {
+ addToken (currentToken);
+ currentToken = new RETokenChar (subIndex, unit.ch, insens);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+ }
+
+ // LIST OPERATOR:
+ // [...] | [^...]
+
+ else if ((unit.ch == '[') && !(unit.bk || quot))
+ {
+ // Create a new RETokenOneOf
+ ParseCharClassResult result =
+ parseCharClass (subIndex, pattern, index, pLength, cflags,
+ syntax, 0);
+ addToken (currentToken);
+ currentToken = result.token;
+ index = result.index;
+ }
+
+ // SUBEXPRESSIONS
+ // (...) | \(...\) depending on RE_NO_BK_PARENS
+
+ else if ((unit.ch == '(')
+ && (syntax.
+ get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot)))
+ {
+ boolean pure = false;
+ boolean comment = false;
+ boolean lookAhead = false;
+ boolean lookBehind = false;
+ boolean independent = false;
+ boolean negativelh = false;
+ boolean negativelb = false;
+ if ((index + 1 < pLength) && (pattern[index] == '?'))
+ {
+ switch (pattern[index + 1])
+ {
+ case '!':
+ if (syntax.get (RESyntax.RE_LOOKAHEAD))
+ {
+ pure = true;
+ negativelh = true;
+ lookAhead = true;
+ index += 2;
+ }
+ break;
+ case '=':
+ if (syntax.get (RESyntax.RE_LOOKAHEAD))
+ {
+ pure = true;
+ lookAhead = true;
+ index += 2;
+ }
+ break;
+ case '<':
+ // We assume that if the syntax supports look-ahead,
+ // it also supports look-behind.
+ if (syntax.get (RESyntax.RE_LOOKAHEAD))
+ {
+ index++;
+ switch (pattern[index + 1])
+ {
+ case '!':
+ pure = true;
+ negativelb = true;
+ lookBehind = true;
+ index += 2;
+ break;
+ case '=':
+ pure = true;
+ lookBehind = true;
+ index += 2;
+ }
+ }
+ break;
+ case '>':
+ // We assume that if the syntax supports look-ahead,
+ // it also supports independent group.
+ if (syntax.get (RESyntax.RE_LOOKAHEAD))
+ {
+ pure = true;
+ independent = true;
+ index += 2;
+ }
+ break;
+ case 'i':
+ case 'd':
+ case 'm':
+ case 's':
+ case 'u':
+ case 'x':
+ case '-':
+ if (!syntax.get (RESyntax.RE_EMBEDDED_FLAGS))
+ break;
+ // Set or reset syntax flags.
+ int flagIndex = index + 1;
+ int endFlag = -1;
+ RESyntax newSyntax = new RESyntax (syntax);
+ int newCflags = cflags;
+ boolean negate = false;
+ while (flagIndex < pLength && endFlag < 0)
+ {
+ switch (pattern[flagIndex])
+ {
+ case 'i':
+ if (negate)
+ newCflags &= ~REG_ICASE;
+ else
+ newCflags |= REG_ICASE;
+ flagIndex++;
+ break;
+ case 'd':
+ if (negate)
+ newSyntax.setLineSeparator (RESyntax.
+ DEFAULT_LINE_SEPARATOR);
+ else
+ newSyntax.setLineSeparator ("\n");
+ flagIndex++;
+ break;
+ case 'm':
+ if (negate)
+ newCflags &= ~REG_MULTILINE;
+ else
+ newCflags |= REG_MULTILINE;
+ flagIndex++;
+ break;
+ case 's':
+ if (negate)
+ newCflags &= ~REG_DOT_NEWLINE;
+ else
+ newCflags |= REG_DOT_NEWLINE;
+ flagIndex++;
+ break;
+ case 'u':
+ if (negate)
+ newCflags |= REG_ICASE_USASCII;
+ else
+ newCflags &= ~REG_ICASE_USASCII;
+ flagIndex++;
+ break;
+ case 'x':
+ if (negate)
+ newCflags &= ~REG_X_COMMENTS;
+ else
+ newCflags |= REG_X_COMMENTS;
+ flagIndex++;
+ break;
+ case '-':
+ negate = true;
+ flagIndex++;
+ break;
+ case ':':
+ case ')':
+ endFlag = pattern[flagIndex];
+ break;
+ default:
+ throw new
+ REException (getLocalizedMessage
+ ("repeat.no.token"),
+ REException.REG_BADRPT, index);
+ }
+ }
+ if (endFlag == ')')
+ {
+ syntax = newSyntax;
+ cflags = newCflags;
+ insens = ((cflags & REG_ICASE) > 0);
+ insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
+ // This can be treated as though it were a comment.
+ comment = true;
+ index = flagIndex - 1;
+ break;
+ }
+ if (endFlag == ':')
+ {
+ savedSyntax = syntax;
+ savedCflags = cflags;
+ flagsSaved = true;
+ syntax = newSyntax;
+ cflags = newCflags;
+ insens = ((cflags & REG_ICASE) > 0);
+ insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
+ index = flagIndex - 1;
+ // Fall through to the next case.
+ }
+ else
+ {
+ throw new
+ REException (getLocalizedMessage
+ ("unmatched.paren"),
+ REException.REG_ESUBREG, index);
+ }
+ case ':':
+ if (syntax.get (RESyntax.RE_PURE_GROUPING))
+ {
+ pure = true;
+ index += 2;
+ }
+ break;
+ case '#':
+ if (syntax.get (RESyntax.RE_COMMENTS))
+ {
+ comment = true;
+ }
+ break;
+ default:
+ throw new
+ REException (getLocalizedMessage ("repeat.no.token"),
+ REException.REG_BADRPT, index);
+ }
+ }
+
+ if (index >= pLength)
+ {
+ throw new
+ REException (getLocalizedMessage ("unmatched.paren"),
+ REException.REG_ESUBREG, index);
+ }
+
+ // find end of subexpression
+ int endIndex = index;
+ int nextIndex = index;
+ int nested = 0;
+
+ while (((nextIndex =
+ getCharUnit (pattern, endIndex, unit, false)) > 0)
+ && !(nested == 0 && (unit.ch == ')')
+ && (syntax.
+ get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk
+ || quot))))
+ {
+ if ((endIndex = nextIndex) >= pLength)
+ throw new
+ REException (getLocalizedMessage ("subexpr.no.end"),
+ REException.REG_ESUBREG, nextIndex);
+ else
+ if ((unit.ch == '[') && !(unit.bk || quot))
+ {
+ // I hate to do something similar to the LIST OPERATOR matters
+ // above, but ...
+ int listIndex = nextIndex;
+ if (listIndex < pLength && pattern[listIndex] == '^')
+ listIndex++;
+ if (listIndex < pLength && pattern[listIndex] == ']')
+ listIndex++;
+ int listEndIndex = -1;
+ int listNest = 0;
+ while (listIndex < pLength && listEndIndex < 0)
+ {
+ switch (pattern[listIndex++])
+ {
+ case '\\':
+ listIndex++;
+ break;
+ case '[':
+ // Sun's API document says that regexp like "[a-d[m-p]]"
+ // is legal. Even something like "[[[^]]]]" is accepted.
+ listNest++;
+ if (listIndex < pLength
+ && pattern[listIndex] == '^')
+ listIndex++;
+ if (listIndex < pLength
+ && pattern[listIndex] == ']')
+ listIndex++;
+ break;
+ case ']':
+ if (listNest == 0)
+ listEndIndex = listIndex;
+ listNest--;
+ break;
+ }
+ }
+ if (listEndIndex >= 0)
+ {
+ nextIndex = listEndIndex;
+ if ((endIndex = nextIndex) >= pLength)
+ throw new
+ REException (getLocalizedMessage ("subexpr.no.end"),
+ REException.REG_ESUBREG, nextIndex);
+ else
+ continue;
+ }
+ throw new
+ REException (getLocalizedMessage ("subexpr.no.end"),
+ REException.REG_ESUBREG, nextIndex);
+ }
+ else if (unit.ch == '('
+ && (syntax.
+ get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk
+ || quot)))
+ nested++;
+ else if (unit.ch == ')'
+ && (syntax.
+ get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk
+ || quot)))
+ nested--;
+ }
+
+ // endIndex is now position at a ')','\)'
+ // nextIndex is end of string or position after ')' or '\)'
+
+ if (comment)
+ index = nextIndex;
+ else
+ { // not a comment
+ // create RE subexpression as token.
+ addToken (currentToken);
+ if (!pure)
+ {
+ numSubs++;
+ }
+
+ int useIndex = (pure || lookAhead || lookBehind
+ || independent) ? 0 : nextSub + numSubs;
+ currentToken =
+ new RE (String.valueOf (pattern, index, endIndex - index).
+ toCharArray (), cflags, syntax, useIndex,
+ nextSub + numSubs);
+ numSubs += ((RE) currentToken).getNumSubs ();
+
+ if (lookAhead)
+ {
+ currentToken =
+ new RETokenLookAhead (currentToken, negativelh);
+ }
+ else if (lookBehind)
+ {
+ currentToken =
+ new RETokenLookBehind (currentToken, negativelb);
+ }
+ else if (independent)
+ {
+ currentToken = new RETokenIndependent (currentToken);
+ }
+
+ index = nextIndex;
+ if (flagsSaved)
+ {
+ syntax = savedSyntax;
+ cflags = savedCflags;
+ insens = ((cflags & REG_ICASE) > 0);
+ insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
+ flagsSaved = false;
+ }
+ } // not a comment
+ } // subexpression
+
+ // UNMATCHED RIGHT PAREN
+ // ) or \) throw exception if
+ // !syntax.get(RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD)
+ else if (!syntax.get (RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD)
+ && ((unit.ch == ')')
+ && (syntax.
+ get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot))))
+ {
+ throw new REException (getLocalizedMessage ("unmatched.paren"),
+ REException.REG_EPAREN, index);
+ }
+
+ // START OF LINE OPERATOR
+ // ^
+
+ else if ((unit.ch == '^') && !(unit.bk || quot))
+ {
+ addToken (currentToken);
+ currentToken = null;
+ RETokenStart token = null;
+ if ((cflags & REG_MULTILINE) > 0)
+ {
+ String sep = syntax.getLineSeparator ();
+ if (sep == null)
+ {
+ token = new RETokenStart (subIndex, null, true);
+ }
+ else
+ {
+ token = new RETokenStart (subIndex, sep);
+ }
+ }
+ else
+ {
+ token = new RETokenStart (subIndex, null);
+ }
+ addToken (token);
+ }
+
+ // END OF LINE OPERATOR
+ // $
+
+ else if ((unit.ch == '$') && !(unit.bk || quot))
+ {
+ addToken (currentToken);
+ currentToken = null;
+ RETokenEnd token = null;
+ if ((cflags & REG_MULTILINE) > 0)
+ {
+ String sep = syntax.getLineSeparator ();
+ if (sep == null)
+ {
+ token = new RETokenEnd (subIndex, null, true);
+ }
+ else
+ {
+ token = new RETokenEnd (subIndex, sep);
+ }
+ }
+ else
+ {
+ token = new RETokenEnd (subIndex, null);
+ }
+ addToken (token);
+ }
+
+ // MATCH-ANY-CHARACTER OPERATOR (except possibly newline and null)
+ // .
+
+ else if ((unit.ch == '.') && !(unit.bk || quot))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenAny (subIndex, syntax.get (RESyntax.RE_DOT_NEWLINE)
+ || ((cflags & REG_DOT_NEWLINE) > 0),
+ syntax.get (RESyntax.RE_DOT_NOT_NULL));
+ }
+
+ // ZERO-OR-MORE REPEAT OPERATOR
+ // *
+ //
+ // This method used to check "repeat.empty.token" to avoid such regexp
+ // as "(a*)*", but now "repeat.empty.token" is allowed.
+
+ else if ((unit.ch == '*') && !(unit.bk || quot))
+ {
+ if (currentToken == null)
+ throw new REException (getLocalizedMessage ("repeat.no.token"),
+ REException.REG_BADRPT, index);
+ if (currentToken instanceof RETokenRepeated)
+ throw new REException (getLocalizedMessage ("repeat.chained"),
+ REException.REG_BADRPT, index);
+ if (currentToken instanceof RETokenWordBoundary
+ || currentToken instanceof RETokenWordBoundary)
+ throw new REException (getLocalizedMessage ("repeat.assertion"),
+ REException.REG_BADRPT, index);
+ currentToken =
+ setRepeated (currentToken, 0, Integer.MAX_VALUE, index);
+ }
+
+ // ONE-OR-MORE REPEAT OPERATOR / POSSESSIVE MATCHING OPERATOR
+ // + | \+ depending on RE_BK_PLUS_QM
+ // not available if RE_LIMITED_OPS is set
+ //
+ // This method used to check "repeat.empty.token" to avoid such regexp
+ // as "(a*)+", but now "repeat.empty.token" is allowed.
+
+ else if ((unit.ch == '+') && !syntax.get (RESyntax.RE_LIMITED_OPS)
+ && (!syntax.
+ get (RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot)))
+ {
+ if (currentToken == null)
+ throw new REException (getLocalizedMessage ("repeat.no.token"),
+ REException.REG_BADRPT, index);
+
+ // Check for possessive matching on RETokenRepeated
+ if (currentToken instanceof RETokenRepeated)
+ {
+ RETokenRepeated tokenRep = (RETokenRepeated) currentToken;
+ if (syntax.get (RESyntax.RE_POSSESSIVE_OPS)
+ && !tokenRep.isPossessive () && !tokenRep.isStingy ())
+ tokenRep.makePossessive ();
+ else
+ throw new
+ REException (getLocalizedMessage ("repeat.chained"),
+ REException.REG_BADRPT, index);
+
+ }
+ else if (currentToken instanceof RETokenWordBoundary
+ || currentToken instanceof RETokenWordBoundary)
+ throw new REException (getLocalizedMessage ("repeat.assertion"),
+ REException.REG_BADRPT, index);
+ else
+ currentToken =
+ setRepeated (currentToken, 1, Integer.MAX_VALUE, index);
+ }
+
+ // ZERO-OR-ONE REPEAT OPERATOR / STINGY MATCHING OPERATOR
+ // ? | \? depending on RE_BK_PLUS_QM
+ // not available if RE_LIMITED_OPS is set
+ // stingy matching if RE_STINGY_OPS is set and it follows a quantifier
+
+ else if ((unit.ch == '?') && !syntax.get (RESyntax.RE_LIMITED_OPS)
+ && (!syntax.
+ get (RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot)))
+ {
+ if (currentToken == null)
+ throw new REException (getLocalizedMessage ("repeat.no.token"),
+ REException.REG_BADRPT, index);
+
+ // Check for stingy matching on RETokenRepeated
+ if (currentToken instanceof RETokenRepeated)
+ {
+ RETokenRepeated tokenRep = (RETokenRepeated) currentToken;
+ if (syntax.get (RESyntax.RE_STINGY_OPS)
+ && !tokenRep.isStingy () && !tokenRep.isPossessive ())
+ tokenRep.makeStingy ();
+ else
+ throw new
+ REException (getLocalizedMessage ("repeat.chained"),
+ REException.REG_BADRPT, index);
+ }
+ else if (currentToken instanceof RETokenWordBoundary
+ || currentToken instanceof RETokenWordBoundary)
+ throw new REException (getLocalizedMessage ("repeat.assertion"),
+ REException.REG_BADRPT, index);
+ else
+ currentToken = setRepeated (currentToken, 0, 1, index);
+ }
+
+ // OCTAL CHARACTER
+ // \0377
+
+ else if (unit.bk && (unit.ch == '0')
+ && syntax.get (RESyntax.RE_OCTAL_CHAR))
+ {
+ CharExpression ce =
+ getCharExpression (pattern, index - 2, pLength, syntax);
+ if (ce == null)
+ throw new REException ("invalid octal character",
+ REException.REG_ESCAPE, index);
+ index = index - 2 + ce.len;
+ addToken (currentToken);
+ currentToken = new RETokenChar (subIndex, ce.ch, insens);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+
+ // BACKREFERENCE OPERATOR
+ // \1 \2 ... \9 and \10 \11 \12 ...
+ // not available if RE_NO_BK_REFS is set
+ // Perl recognizes \10, \11, and so on only if enough number of
+ // parentheses have opened before it, otherwise they are treated
+ // as aliases of \010, \011, ... (octal characters). In case of
+ // Sun's JDK, octal character expression must always begin with \0.
+ // We will do as JDK does. But FIXME, take a look at "(a)(b)\29".
+ // JDK treats \2 as a back reference to the 2nd group because
+ // there are only two groups. But in our poor implementation,
+ // we cannot help but treat \29 as a back reference to the 29th group.
+
+ else if (unit.bk && Character.isDigit (unit.ch)
+ && !syntax.get (RESyntax.RE_NO_BK_REFS))
+ {
+ addToken (currentToken);
+ int numBegin = index - 1;
+ int numEnd = pLength;
+ for (int i = index; i < pLength; i++)
+ {
+ if (!Character.isDigit (pattern[i]))
+ {
+ numEnd = i;
+ break;
+ }
+ }
+ int num = parseInt (pattern, numBegin, numEnd - numBegin, 10);
+
+ currentToken = new RETokenBackRef (subIndex, num, insens);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ index = numEnd;
+ }
+
+ // START OF STRING OPERATOR
+ // \A if RE_STRING_ANCHORS is set
+
+ else if (unit.bk && (unit.ch == 'A')
+ && syntax.get (RESyntax.RE_STRING_ANCHORS))
+ {
+ addToken (currentToken);
+ currentToken = new RETokenStart (subIndex, null);
+ }
+
+ // WORD BREAK OPERATOR
+ // \b if ????
+
+ else if (unit.bk && (unit.ch == 'b')
+ && syntax.get (RESyntax.RE_STRING_ANCHORS))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenWordBoundary (subIndex,
+ RETokenWordBoundary.
+ BEGIN | RETokenWordBoundary.END,
+ false);
+ }
+
+ // WORD BEGIN OPERATOR
+ // \< if ????
+ else if (unit.bk && (unit.ch == '<'))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenWordBoundary (subIndex, RETokenWordBoundary.BEGIN,
+ false);
+ }
+
+ // WORD END OPERATOR
+ // \> if ????
+ else if (unit.bk && (unit.ch == '>'))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenWordBoundary (subIndex, RETokenWordBoundary.END,
+ false);
+ }
+
+ // NON-WORD BREAK OPERATOR
+ // \B if ????
+
+ else if (unit.bk && (unit.ch == 'B')
+ && syntax.get (RESyntax.RE_STRING_ANCHORS))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenWordBoundary (subIndex,
+ RETokenWordBoundary.
+ BEGIN | RETokenWordBoundary.END, true);
+ }
+
+
+ // DIGIT OPERATOR
+ // \d if RE_CHAR_CLASS_ESCAPES is set
+
+ else if (unit.bk && (unit.ch == 'd')
+ && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenPOSIX (subIndex, RETokenPOSIX.DIGIT, insens, false);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+
+ // NON-DIGIT OPERATOR
+ // \D
+
+ else if (unit.bk && (unit.ch == 'D')
+ && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenPOSIX (subIndex, RETokenPOSIX.DIGIT, insens, true);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+
+ // NEWLINE ESCAPE
+ // \n
+
+ else if (unit.bk && (unit.ch == 'n'))
+ {
+ addToken (currentToken);
+ currentToken = new RETokenChar (subIndex, '\n', false);
+ }
+
+ // RETURN ESCAPE
+ // \r
+
+ else if (unit.bk && (unit.ch == 'r'))
+ {
+ addToken (currentToken);
+ currentToken = new RETokenChar (subIndex, '\r', false);
+ }
+
+ // WHITESPACE OPERATOR
+ // \s if RE_CHAR_CLASS_ESCAPES is set
+
+ else if (unit.bk && (unit.ch == 's')
+ && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenPOSIX (subIndex, RETokenPOSIX.SPACE, insens, false);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+
+ // NON-WHITESPACE OPERATOR
+ // \S
+
+ else if (unit.bk && (unit.ch == 'S')
+ && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenPOSIX (subIndex, RETokenPOSIX.SPACE, insens, true);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+
+ // TAB ESCAPE
+ // \t
+
+ else if (unit.bk && (unit.ch == 't'))
+ {
+ addToken (currentToken);
+ currentToken = new RETokenChar (subIndex, '\t', false);
+ }
+
+ // ALPHANUMERIC OPERATOR
+ // \w
+
+ else if (unit.bk && (unit.ch == 'w')
+ && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenPOSIX (subIndex, RETokenPOSIX.ALNUM, insens, false);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+
+ // NON-ALPHANUMERIC OPERATOR
+ // \W
+
+ else if (unit.bk && (unit.ch == 'W')
+ && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES))
+ {
+ addToken (currentToken);
+ currentToken =
+ new RETokenPOSIX (subIndex, RETokenPOSIX.ALNUM, insens, true);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+
+ // END OF STRING OPERATOR
+ // \Z, \z
+
+ // FIXME: \Z and \z are different in that if the input string
+ // ends with a line terminator, \Z matches the position before
+ // the final terminator. This special behavior of \Z is yet
+ // to be implemented.
+
+ else if (unit.bk && (unit.ch == 'Z' || unit.ch == 'z') &&
+ syntax.get (RESyntax.RE_STRING_ANCHORS))
+ {
+ addToken (currentToken);
+ currentToken = new RETokenEnd (subIndex, null);
+ }
+
+ // HEX CHARACTER, UNICODE CHARACTER
+ // \x1B, \u1234
+
+ else
+ if ((unit.bk && (unit.ch == 'x')
+ && syntax.get (RESyntax.RE_HEX_CHAR)) || (unit.bk
+ && (unit.ch == 'u')
+ && syntax.
+ get (RESyntax.
+ RE_UNICODE_CHAR)))
+ {
+ CharExpression ce =
+ getCharExpression (pattern, index - 2, pLength, syntax);
+ if (ce == null)
+ throw new REException ("invalid hex character",
+ REException.REG_ESCAPE, index);
+ index = index - 2 + ce.len;
+ addToken (currentToken);
+ currentToken = new RETokenChar (subIndex, ce.ch, insens);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+
+ // NAMED PROPERTY
+ // \p{prop}, \P{prop}
+
+ else
+ if ((unit.bk && (unit.ch == 'p')
+ && syntax.get (RESyntax.RE_NAMED_PROPERTY)) || (unit.bk
+ && (unit.ch ==
+ 'P')
+ && syntax.
+ get (RESyntax.
+ RE_NAMED_PROPERTY)))
+ {
+ NamedProperty np = getNamedProperty (pattern, index - 2, pLength);
+ if (np == null)
+ throw new REException ("invalid escape sequence",
+ REException.REG_ESCAPE, index);
+ index = index - 2 + np.len;
+ addToken (currentToken);
+ currentToken =
+ getRETokenNamedProperty (subIndex, np, insens, index);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+
+ // END OF PREVIOUS MATCH
+ // \G
+
+ else if (unit.bk && (unit.ch == 'G') &&
+ syntax.get (RESyntax.RE_STRING_ANCHORS))
+ {
+ addToken (currentToken);
+ currentToken = new RETokenEndOfPreviousMatch (subIndex);
+ }
+
+ // NON-SPECIAL CHARACTER (or escape to make literal)
+ // c | \* for example
+
+ else
+ { // not a special character
+ addToken (currentToken);
+ currentToken = new RETokenChar (subIndex, unit.ch, insens);
+ if (insensUSASCII)
+ currentToken.unicodeAware = false;
+ }
+ } // end while
// Add final buffered token and an EndSub marker
addToken (currentToken);
if (branches != null)
{
- branches.
- add (new
- RE (firstToken, lastToken, numSubs, subIndex, minimumLength,
- maximumLength));
- branches.trimToSize (); // compact the Vector
- minimumLength = 0;
- maximumLength = 0;
- firstToken = lastToken = null;
- addToken (new RETokenOneOf (subIndex, branches, false));
+ branches.
+ add (new
+ RE (firstToken, lastToken, numSubs, subIndex, minimumLength,
+ maximumLength));
+ branches.trimToSize (); // compact the Vector
+ minimumLength = 0;
+ maximumLength = 0;
+ firstToken = lastToken = null;
+ addToken (new RETokenOneOf (subIndex, branches, false));
}
else
addToken (new RETokenEndSub (subIndex));
@@ -1403,11 +1403,11 @@ public class RE extends REToken
* @param syntax Syntax used to parse the pattern.
*/
private static ParseCharClassResult parseCharClass (int subIndex,
- char[]pattern,
- int index, int pLength,
- int cflags,
- RESyntax syntax,
- int pflags) throws
+ char[]pattern,
+ int index, int pLength,
+ int cflags,
+ RESyntax syntax,
+ int pflags) throws
REException
{
@@ -1425,256 +1425,256 @@ public class RE extends REToken
boolean lastCharIsSet = false;
if (index == pLength)
throw new REException (getLocalizedMessage ("unmatched.bracket"),
- REException.REG_EBRACK, index);
+ REException.REG_EBRACK, index);
// Check for initial caret, negation
if ((ch = pattern[index]) == '^')
{
- negative = true;
- if (++index == pLength)
- throw new REException (getLocalizedMessage ("class.no.end"),
- REException.REG_EBRACK, index);
- ch = pattern[index];
+ negative = true;
+ if (++index == pLength)
+ throw new REException (getLocalizedMessage ("class.no.end"),
+ REException.REG_EBRACK, index);
+ ch = pattern[index];
}
// Check for leading right bracket literal
if (ch == ']')
{
- lastChar = ch;
- lastCharIsSet = true;
- if (++index == pLength)
- throw new REException (getLocalizedMessage ("class.no.end"),
- REException.REG_EBRACK, index);
+ lastChar = ch;
+ lastCharIsSet = true;
+ if (++index == pLength)
+ throw new REException (getLocalizedMessage ("class.no.end"),
+ REException.REG_EBRACK, index);
}
while ((ch = pattern[index++]) != ']')
{
- if ((ch == '-') && (lastCharIsSet))
- {
- if (index == pLength)
- throw new REException (getLocalizedMessage ("class.no.end"),
- REException.REG_EBRACK, index);
- if ((ch = pattern[index]) == ']')
- {
- RETokenChar t = new RETokenChar (subIndex, lastChar, insens);
- if (insensUSASCII)
- t.unicodeAware = false;
- options.add (t);
- lastChar = '-';
- }
- else
- {
- if ((ch == '\\')
- && syntax.get (RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS))
- {
- CharExpression ce =
- getCharExpression (pattern, index, pLength, syntax);
- if (ce == null)
- throw new REException ("invalid escape sequence",
- REException.REG_ESCAPE, index);
- ch = ce.ch;
- index = index + ce.len - 1;
- }
- RETokenRange t =
- new RETokenRange (subIndex, lastChar, ch, insens);
- if (insensUSASCII)
- t.unicodeAware = false;
- options.add (t);
- lastChar = 0;
- lastCharIsSet = false;
- index++;
- }
- }
- else if ((ch == '\\')
- && syntax.get (RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS))
- {
- if (index == pLength)
- throw new REException (getLocalizedMessage ("class.no.end"),
- REException.REG_EBRACK, index);
- int posixID = -1;
- boolean negate = false;
- char asciiEsc = 0;
- boolean asciiEscIsSet = false;
- NamedProperty np = null;
- if (("dswDSW".indexOf (pattern[index]) != -1)
- && syntax.get (RESyntax.RE_CHAR_CLASS_ESC_IN_LISTS))
- {
- switch (pattern[index])
- {
- case 'D':
- negate = true;
- case 'd':
- posixID = RETokenPOSIX.DIGIT;
- break;
- case 'S':
- negate = true;
- case 's':
- posixID = RETokenPOSIX.SPACE;
- break;
- case 'W':
- negate = true;
- case 'w':
- posixID = RETokenPOSIX.ALNUM;
- break;
- }
- }
- if (("pP".indexOf (pattern[index]) != -1)
- && syntax.get (RESyntax.RE_NAMED_PROPERTY))
- {
- np = getNamedProperty (pattern, index - 1, pLength);
- if (np == null)
- throw new REException ("invalid escape sequence",
- REException.REG_ESCAPE, index);
- index = index - 1 + np.len - 1;
- }
- else
- {
- CharExpression ce =
- getCharExpression (pattern, index - 1, pLength, syntax);
- if (ce == null)
- throw new REException ("invalid escape sequence",
- REException.REG_ESCAPE, index);
- asciiEsc = ce.ch;
- asciiEscIsSet = true;
- index = index - 1 + ce.len - 1;
- }
- if (lastCharIsSet)
- {
- RETokenChar t = new RETokenChar (subIndex, lastChar, insens);
- if (insensUSASCII)
- t.unicodeAware = false;
- options.add (t);
- }
-
- if (posixID != -1)
- {
- RETokenPOSIX t =
- new RETokenPOSIX (subIndex, posixID, insens, negate);
- if (insensUSASCII)
- t.unicodeAware = false;
- options.add (t);
- }
- else if (np != null)
- {
- RETokenNamedProperty t =
- getRETokenNamedProperty (subIndex, np, insens, index);
- if (insensUSASCII)
- t.unicodeAware = false;
- options.add (t);
- }
- else if (asciiEscIsSet)
- {
- lastChar = asciiEsc;
- lastCharIsSet = true;
- }
- else
- {
- lastChar = pattern[index];
- lastCharIsSet = true;
- }
- ++index;
- }
- else if ((ch == '[') && (syntax.get (RESyntax.RE_CHAR_CLASSES))
- && (index < pLength) && (pattern[index] == ':'))
- {
- CPStringBuilder posixSet = new CPStringBuilder ();
- index = getPosixSet (pattern, index + 1, posixSet);
- int posixId = RETokenPOSIX.intValue (posixSet.toString ());
- if (posixId != -1)
- {
- RETokenPOSIX t =
- new RETokenPOSIX (subIndex, posixId, insens, false);
- if (insensUSASCII)
- t.unicodeAware = false;
- options.add (t);
- }
- }
- else if ((ch == '[') && (syntax.get (RESyntax.RE_NESTED_CHARCLASS)))
- {
- ParseCharClassResult result =
- parseCharClass (subIndex, pattern, index, pLength, cflags,
- syntax, 0);
- addition.add (result.token);
- addition.add ("|");
- index = result.index;
- }
- else if ((ch == '&') &&
- (syntax.get (RESyntax.RE_NESTED_CHARCLASS)) &&
- (index < pLength) && (pattern[index] == '&'))
- {
- if (returnAtAndOperator)
- {
- ParseCharClassResult result = new ParseCharClassResult ();
- options.trimToSize ();
- if (additionAndAppeared)
- addition.add ("&");
- if (addition.size () == 0)
- addition = null;
- result.token = new RETokenOneOf (subIndex,
- options, addition, negative);
- result.index = index - 1;
- result.returnAtAndOperator = true;
- return result;
- }
- // The precedence of the operator "&&" is the lowest.
- // So we postpone adding "&" until other elements
- // are added. And we insert Boolean.FALSE at the
- // beginning of the list of tokens following "&&".
- // So, "&&[a-b][k-m]" will be stored in the Vecter
- // addition in this order:
- // Boolean.FALSE, [a-b], "|", [k-m], "|", "&"
- if (additionAndAppeared)
- addition.add ("&");
- addition.add (Boolean.FALSE);
- additionAndAppeared = true;
-
- // The part on which "&&" operates may be either
- // (1) explicitly enclosed by []
- // or
- // (2) not enclosed by [] and terminated by the
- // next "&&" or the end of the character list.
- // Let the preceding else if block do the case (1).
- // We must do something in case of (2).
- if ((index + 1 < pLength) && (pattern[index + 1] != '['))
- {
- ParseCharClassResult result =
- parseCharClass (subIndex, pattern, index + 1, pLength,
- cflags, syntax,
- RETURN_AT_AND);
- addition.add (result.token);
- addition.add ("|");
- // If the method returned at the next "&&", it is OK.
- // Otherwise we have eaten the mark of the end of this
- // character list "]". In this case we must give back
- // the end mark.
- index = (result.returnAtAndOperator ?
- result.index : result.index - 1);
- }
- }
- else
- {
- if (lastCharIsSet)
- {
- RETokenChar t = new RETokenChar (subIndex, lastChar, insens);
- if (insensUSASCII)
- t.unicodeAware = false;
- options.add (t);
- }
- lastChar = ch;
- lastCharIsSet = true;
- }
- if (index == pLength)
- throw new REException (getLocalizedMessage ("class.no.end"),
- REException.REG_EBRACK, index);
- } // while in list
+ if ((ch == '-') && (lastCharIsSet))
+ {
+ if (index == pLength)
+ throw new REException (getLocalizedMessage ("class.no.end"),
+ REException.REG_EBRACK, index);
+ if ((ch = pattern[index]) == ']')
+ {
+ RETokenChar t = new RETokenChar (subIndex, lastChar, insens);
+ if (insensUSASCII)
+ t.unicodeAware = false;
+ options.add (t);
+ lastChar = '-';
+ }
+ else
+ {
+ if ((ch == '\\')
+ && syntax.get (RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS))
+ {
+ CharExpression ce =
+ getCharExpression (pattern, index, pLength, syntax);
+ if (ce == null)
+ throw new REException ("invalid escape sequence",
+ REException.REG_ESCAPE, index);
+ ch = ce.ch;
+ index = index + ce.len - 1;
+ }
+ RETokenRange t =
+ new RETokenRange (subIndex, lastChar, ch, insens);
+ if (insensUSASCII)
+ t.unicodeAware = false;
+ options.add (t);
+ lastChar = 0;
+ lastCharIsSet = false;
+ index++;
+ }
+ }
+ else if ((ch == '\\')
+ && syntax.get (RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS))
+ {
+ if (index == pLength)
+ throw new REException (getLocalizedMessage ("class.no.end"),
+ REException.REG_EBRACK, index);
+ int posixID = -1;
+ boolean negate = false;
+ char asciiEsc = 0;
+ boolean asciiEscIsSet = false;
+ NamedProperty np = null;
+ if (("dswDSW".indexOf (pattern[index]) != -1)
+ && syntax.get (RESyntax.RE_CHAR_CLASS_ESC_IN_LISTS))
+ {
+ switch (pattern[index])
+ {
+ case 'D':
+ negate = true;
+ case 'd':
+ posixID = RETokenPOSIX.DIGIT;
+ break;
+ case 'S':
+ negate = true;
+ case 's':
+ posixID = RETokenPOSIX.SPACE;
+ break;
+ case 'W':
+ negate = true;
+ case 'w':
+ posixID = RETokenPOSIX.ALNUM;
+ break;
+ }
+ }
+ if (("pP".indexOf (pattern[index]) != -1)
+ && syntax.get (RESyntax.RE_NAMED_PROPERTY))
+ {
+ np = getNamedProperty (pattern, index - 1, pLength);
+ if (np == null)
+ throw new REException ("invalid escape sequence",
+ REException.REG_ESCAPE, index);
+ index = index - 1 + np.len - 1;
+ }
+ else
+ {
+ CharExpression ce =
+ getCharExpression (pattern, index - 1, pLength, syntax);
+ if (ce == null)
+ throw new REException ("invalid escape sequence",
+ REException.REG_ESCAPE, index);
+ asciiEsc = ce.ch;
+ asciiEscIsSet = true;
+ index = index - 1 + ce.len - 1;
+ }
+ if (lastCharIsSet)
+ {
+ RETokenChar t = new RETokenChar (subIndex, lastChar, insens);
+ if (insensUSASCII)
+ t.unicodeAware = false;
+ options.add (t);
+ }
+
+ if (posixID != -1)
+ {
+ RETokenPOSIX t =
+ new RETokenPOSIX (subIndex, posixID, insens, negate);
+ if (insensUSASCII)
+ t.unicodeAware = false;
+ options.add (t);
+ }
+ else if (np != null)
+ {
+ RETokenNamedProperty t =
+ getRETokenNamedProperty (subIndex, np, insens, index);
+ if (insensUSASCII)
+ t.unicodeAware = false;
+ options.add (t);
+ }
+ else if (asciiEscIsSet)
+ {
+ lastChar = asciiEsc;
+ lastCharIsSet = true;
+ }
+ else
+ {
+ lastChar = pattern[index];
+ lastCharIsSet = true;
+ }
+ ++index;
+ }
+ else if ((ch == '[') && (syntax.get (RESyntax.RE_CHAR_CLASSES))
+ && (index < pLength) && (pattern[index] == ':'))
+ {
+ CPStringBuilder posixSet = new CPStringBuilder ();
+ index = getPosixSet (pattern, index + 1, posixSet);
+ int posixId = RETokenPOSIX.intValue (posixSet.toString ());
+ if (posixId != -1)
+ {
+ RETokenPOSIX t =
+ new RETokenPOSIX (subIndex, posixId, insens, false);
+ if (insensUSASCII)
+ t.unicodeAware = false;
+ options.add (t);
+ }
+ }
+ else if ((ch == '[') && (syntax.get (RESyntax.RE_NESTED_CHARCLASS)))
+ {
+ ParseCharClassResult result =
+ parseCharClass (subIndex, pattern, index, pLength, cflags,
+ syntax, 0);
+ addition.add (result.token);
+ addition.add ("|");
+ index = result.index;
+ }
+ else if ((ch == '&') &&
+ (syntax.get (RESyntax.RE_NESTED_CHARCLASS)) &&
+ (index < pLength) && (pattern[index] == '&'))
+ {
+ if (returnAtAndOperator)
+ {
+ ParseCharClassResult result = new ParseCharClassResult ();
+ options.trimToSize ();
+ if (additionAndAppeared)
+ addition.add ("&");
+ if (addition.size () == 0)
+ addition = null;
+ result.token = new RETokenOneOf (subIndex,
+ options, addition, negative);
+ result.index = index - 1;
+ result.returnAtAndOperator = true;
+ return result;
+ }
+ // The precedence of the operator "&&" is the lowest.
+ // So we postpone adding "&" until other elements
+ // are added. And we insert Boolean.FALSE at the
+ // beginning of the list of tokens following "&&".
+ // So, "&&[a-b][k-m]" will be stored in the Vecter
+ // addition in this order:
+ // Boolean.FALSE, [a-b], "|", [k-m], "|", "&"
+ if (additionAndAppeared)
+ addition.add ("&");
+ addition.add (Boolean.FALSE);
+ additionAndAppeared = true;
+
+ // The part on which "&&" operates may be either
+ // (1) explicitly enclosed by []
+ // or
+ // (2) not enclosed by [] and terminated by the
+ // next "&&" or the end of the character list.
+ // Let the preceding else if block do the case (1).
+ // We must do something in case of (2).
+ if ((index + 1 < pLength) && (pattern[index + 1] != '['))
+ {
+ ParseCharClassResult result =
+ parseCharClass (subIndex, pattern, index + 1, pLength,
+ cflags, syntax,
+ RETURN_AT_AND);
+ addition.add (result.token);
+ addition.add ("|");
+ // If the method returned at the next "&&", it is OK.
+ // Otherwise we have eaten the mark of the end of this
+ // character list "]". In this case we must give back
+ // the end mark.
+ index = (result.returnAtAndOperator ?
+ result.index : result.index - 1);
+ }
+ }
+ else
+ {
+ if (lastCharIsSet)
+ {
+ RETokenChar t = new RETokenChar (subIndex, lastChar, insens);
+ if (insensUSASCII)
+ t.unicodeAware = false;
+ options.add (t);
+ }
+ lastChar = ch;
+ lastCharIsSet = true;
+ }
+ if (index == pLength)
+ throw new REException (getLocalizedMessage ("class.no.end"),
+ REException.REG_EBRACK, index);
+ } // while in list
// Out of list, index is one past ']'
if (lastCharIsSet)
{
- RETokenChar t = new RETokenChar (subIndex, lastChar, insens);
- if (insensUSASCII)
- t.unicodeAware = false;
- options.add (t);
+ RETokenChar t = new RETokenChar (subIndex, lastChar, insens);
+ if (insensUSASCII)
+ t.unicodeAware = false;
+ options.add (t);
}
ParseCharClassResult result = new ParseCharClassResult ();
@@ -1690,17 +1690,17 @@ public class RE extends REToken
}
private static int getCharUnit (char[]input, int index, CharUnit unit,
- boolean quot) throws REException
+ boolean quot) throws REException
{
unit.ch = input[index++];
unit.bk = (unit.ch == '\\'
- && (!quot || index >= input.length || input[index] == 'E'));
+ && (!quot || index >= input.length || input[index] == 'E'));
if (unit.bk)
if (index < input.length)
- unit.ch = input[index++];
+ unit.ch = input[index++];
else
- throw new REException (getLocalizedMessage ("ends.with.backslash"),
- REException.REG_ESCAPE, index);
+ throw new REException (getLocalizedMessage ("ends.with.backslash"),
+ REException.REG_ESCAPE, index);
return index;
}
@@ -1709,7 +1709,7 @@ public class RE extends REToken
int ret = 0;
for (int i = pos; i < pos + len; i++)
{
- ret = ret * radix + Character.digit (input[i], radix);
+ ret = ret * radix + Character.digit (input[i], radix);
}
return ret;
}
@@ -1736,92 +1736,92 @@ public class RE extends REToken
}
private static CharExpression getCharExpression (char[]input, int pos,
- int lim, RESyntax syntax)
+ int lim, RESyntax syntax)
{
CharExpression ce = new CharExpression ();
char c = input[pos];
if (c == '\\')
{
- if (pos + 1 >= lim)
- return null;
- c = input[pos + 1];
- switch (c)
- {
- case 't':
- ce.ch = '\t';
- ce.len = 2;
- break;
- case 'n':
- ce.ch = '\n';
- ce.len = 2;
- break;
- case 'r':
- ce.ch = '\r';
- ce.len = 2;
- break;
- case 'x':
- case 'u':
- if ((c == 'x' && syntax.get (RESyntax.RE_HEX_CHAR)) ||
- (c == 'u' && syntax.get (RESyntax.RE_UNICODE_CHAR)))
- {
- int l = 0;
- int expectedLength = (c == 'x' ? 2 : 4);
- for (int i = pos + 2; i < pos + 2 + expectedLength; i++)
- {
- if (i >= lim)
- break;
- if (!((input[i] >= '0' && input[i] <= '9') ||
- (input[i] >= 'A' && input[i] <= 'F') ||
- (input[i] >= 'a' && input[i] <= 'f')))
- break;
- l++;
- }
- if (l != expectedLength)
- return null;
- ce.ch = (char) (parseInt (input, pos + 2, l, 16));
- ce.len = l + 2;
- }
- else
- {
- ce.ch = c;
- ce.len = 2;
- }
- break;
- case '0':
- if (syntax.get (RESyntax.RE_OCTAL_CHAR))
- {
- int l = 0;
- for (int i = pos + 2; i < pos + 2 + 3; i++)
- {
- if (i >= lim)
- break;
- if (input[i] < '0' || input[i] > '7')
- break;
- l++;
- }
- if (l == 3 && input[pos + 2] > '3')
- l--;
- if (l <= 0)
- return null;
- ce.ch = (char) (parseInt (input, pos + 2, l, 8));
- ce.len = l + 2;
- }
- else
- {
- ce.ch = c;
- ce.len = 2;
- }
- break;
- default:
- ce.ch = c;
- ce.len = 2;
- break;
- }
+ if (pos + 1 >= lim)
+ return null;
+ c = input[pos + 1];
+ switch (c)
+ {
+ case 't':
+ ce.ch = '\t';
+ ce.len = 2;
+ break;
+ case 'n':
+ ce.ch = '\n';
+ ce.len = 2;
+ break;
+ case 'r':
+ ce.ch = '\r';
+ ce.len = 2;
+ break;
+ case 'x':
+ case 'u':
+ if ((c == 'x' && syntax.get (RESyntax.RE_HEX_CHAR)) ||
+ (c == 'u' && syntax.get (RESyntax.RE_UNICODE_CHAR)))
+ {
+ int l = 0;
+ int expectedLength = (c == 'x' ? 2 : 4);
+ for (int i = pos + 2; i < pos + 2 + expectedLength; i++)
+ {
+ if (i >= lim)
+ break;
+ if (!((input[i] >= '0' && input[i] <= '9') ||
+ (input[i] >= 'A' && input[i] <= 'F') ||
+ (input[i] >= 'a' && input[i] <= 'f')))
+ break;
+ l++;
+ }
+ if (l != expectedLength)
+ return null;
+ ce.ch = (char) (parseInt (input, pos + 2, l, 16));
+ ce.len = l + 2;
+ }
+ else
+ {
+ ce.ch = c;
+ ce.len = 2;
+ }
+ break;
+ case '0':
+ if (syntax.get (RESyntax.RE_OCTAL_CHAR))
+ {
+ int l = 0;
+ for (int i = pos + 2; i < pos + 2 + 3; i++)
+ {
+ if (i >= lim)
+ break;
+ if (input[i] < '0' || input[i] > '7')
+ break;
+ l++;
+ }
+ if (l == 3 && input[pos + 2] > '3')
+ l--;
+ if (l <= 0)
+ return null;
+ ce.ch = (char) (parseInt (input, pos + 2, l, 8));
+ ce.len = l + 2;
+ }
+ else
+ {
+ ce.ch = c;
+ ce.len = 2;
+ }
+ break;
+ default:
+ ce.ch = c;
+ ce.len = 2;
+ break;
+ }
}
else
{
- ce.ch = input[pos];
- ce.len = 1;
+ ce.ch = input[pos];
+ ce.len = 1;
}
ce.expr = new String (input, pos, ce.len);
return ce;
@@ -1846,60 +1846,60 @@ public class RE extends REToken
}
private static NamedProperty getNamedProperty (char[]input, int pos,
- int lim)
+ int lim)
{
NamedProperty np = new NamedProperty ();
char c = input[pos];
if (c == '\\')
{
- if (++pos >= lim)
- return null;
- c = input[pos++];
- switch (c)
- {
- case 'p':
- np.negate = false;
- break;
- case 'P':
- np.negate = true;
- break;
- default:
- return null;
- }
- c = input[pos++];
- if (c == '{')
- {
- int p = -1;
- for (int i = pos; i < lim; i++)
- {
- if (input[i] == '}')
- {
- p = i;
- break;
- }
- }
- if (p < 0)
- return null;
- int len = p - pos;
- np.name = new String (input, pos, len);
- np.len = len + 4;
- }
- else
- {
- np.name = new String (input, pos - 1, 1);
- np.len = 3;
- }
- return np;
+ if (++pos >= lim)
+ return null;
+ c = input[pos++];
+ switch (c)
+ {
+ case 'p':
+ np.negate = false;
+ break;
+ case 'P':
+ np.negate = true;
+ break;
+ default:
+ return null;
+ }
+ c = input[pos++];
+ if (c == '{')
+ {
+ int p = -1;
+ for (int i = pos; i < lim; i++)
+ {
+ if (input[i] == '}')
+ {
+ p = i;
+ break;
+ }
+ }
+ if (p < 0)
+ return null;
+ int len = p - pos;
+ np.name = new String (input, pos, len);
+ np.len = len + 4;
+ }
+ else
+ {
+ np.name = new String (input, pos - 1, 1);
+ np.len = 3;
+ }
+ return np;
}
else
return null;
}
private static RETokenNamedProperty getRETokenNamedProperty (int subIndex,
- NamedProperty
- np,
- boolean insens,
- int index)
+ NamedProperty
+ np,
+ boolean insens,
+ int index)
throws REException
{
try
@@ -1953,18 +1953,18 @@ public class RE extends REToken
private boolean isMatchImpl (CharIndexed input, int index, int eflags)
{
- if (firstToken == null) // Trivial case
+ if (firstToken == null) // Trivial case
return (input.charAt (0) == CharIndexed.OUT_OF_BOUNDS);
REMatch m = new REMatch (numSubs, index, eflags);
if (firstToken.match (input, m))
{
- if (m != null)
- {
- if (input.charAt (m.index) == CharIndexed.OUT_OF_BOUNDS)
- {
- return true;
- }
- }
+ if (m != null)
+ {
+ if (input.charAt (m.index) == CharIndexed.OUT_OF_BOUNDS)
+ {
+ return true;
+ }
+ }
}
return false;
}
@@ -1984,10 +1984,10 @@ public class RE extends REToken
{
if (lastToken != null)
{
- lastToken.setUncle (uncle);
+ lastToken.setUncle (uncle);
}
else
- super.setUncle (uncle); // to deal with empty subexpressions
+ super.setUncle (uncle); // to deal with empty subexpressions
}
// Overrides REToken.chain
@@ -2063,25 +2063,25 @@ public class RE extends REToken
// this has been changed since 1.03 to be non-overlapping matches
private REMatch[] getAllMatchesImpl (CharIndexed input, int index,
- int eflags)
+ int eflags)
{
List < REMatch > all = new ArrayList < REMatch > ();
REMatch m = null;
while ((m = getMatchImpl (input, index, eflags, null)) != null)
{
- all.add (m);
- index = m.getEndIndex ();
- if (m.end[0] == 0)
- { // handle pathological case of zero-length match
- index++;
- input.move (1);
- }
- else
- {
- input.move (m.end[0]);
- }
- if (!input.isValid ())
- break;
+ all.add (m);
+ index = m.getEndIndex ();
+ if (m.end[0] == 0)
+ { // handle pathological case of zero-length match
+ index++;
+ input.move (1);
+ }
+ else
+ {
+ input.move (m.end[0]);
+ }
+ if (!input.isValid ())
+ break;
}
return all.toArray (new REMatch[all.size ()]);
}
@@ -2092,7 +2092,7 @@ public class RE extends REToken
input.setHitEnd (mymatch);
if (firstToken == null)
{
- return next (input, mymatch);
+ return next (input, mymatch);
}
// Note the start of this subexpression
@@ -2108,7 +2108,7 @@ public class RE extends REToken
boolean b = match (input, mymatch);
if (b)
{
- return mymatch;
+ return mymatch;
}
return null;
}
@@ -2168,78 +2168,78 @@ public class RE extends REToken
* @param buffer The StringBuffer to save pre-match text in.
* @return An REMatch instance referencing the match, or null if none. */
public REMatch getMatch (Object input, int index, int eflags,
- CPStringBuilder buffer)
+ CPStringBuilder buffer)
{
return getMatchImpl (makeCharIndexed (input, index), index, eflags,
- buffer);
+ buffer);
}
REMatch getMatchImpl (CharIndexed input, int anchor, int eflags,
- CPStringBuilder buffer)
+ CPStringBuilder buffer)
{
boolean tryEntireMatch = ((eflags & REG_TRY_ENTIRE_MATCH) != 0);
boolean doMove = ((eflags & REG_FIX_STARTING_POSITION) == 0);
RE re = (tryEntireMatch ? (RE) this.clone () : this);
if (tryEntireMatch)
{
- RETokenEnd reEnd = new RETokenEnd (0, null);
- reEnd.setFake (true);
- re.chain (reEnd);
+ RETokenEnd reEnd = new RETokenEnd (0, null);
+ reEnd.setFake (true);
+ re.chain (reEnd);
}
// Create a new REMatch to hold results
REMatch mymatch = new REMatch (numSubs, anchor, eflags);
do
{
- /* The following potimization is commented out because
- the matching should be tried even if the length of
- input is obviously too short in order that
- java.util.regex.Matcher#hitEnd() may work correctly.
- // Optimization: check if anchor + minimumLength > length
- if (minimumLength == 0 || input.charAt(minimumLength-1) != CharIndexed.OUT_OF_BOUNDS) {
- */
- if (re.match (input, mymatch))
- {
- REMatch best = mymatch;
- // We assume that the match that coms first is the best.
- // And the following "The longer, the better" rule has
- // been commented out. The longest is not neccesarily
- // the best. For example, "a" out of "aaa" is the best
- // match for /a+?/.
- /*
- // Find best match of them all to observe leftmost longest
- while ((mymatch = mymatch.next) != null) {
- if (mymatch.index > best.index) {
- best = mymatch;
- }
- }
- */
- best.end[0] = best.index;
- best.finish (input);
- input.setLastMatch (best);
- return best;
- }
- /* End of the optimization commented out
- }
- */
- mymatch.clear (++anchor);
- // Append character to buffer if needed
- if (buffer != null && input.charAt (0) != CharIndexed.OUT_OF_BOUNDS)
- {
- buffer.append (input.charAt (0));
- }
- // java.util.regex.Matcher#hitEnd() requires that the search should
- // be tried at the end of input, so we use move1(1) instead of move(1)
+ /* The following potimization is commented out because
+ the matching should be tried even if the length of
+ input is obviously too short in order that
+ java.util.regex.Matcher#hitEnd() may work correctly.
+ // Optimization: check if anchor + minimumLength > length
+ if (minimumLength == 0 || input.charAt(minimumLength-1) != CharIndexed.OUT_OF_BOUNDS) {
+ */
+ if (re.match (input, mymatch))
+ {
+ REMatch best = mymatch;
+ // We assume that the match that coms first is the best.
+ // And the following "The longer, the better" rule has
+ // been commented out. The longest is not neccesarily
+ // the best. For example, "a" out of "aaa" is the best
+ // match for /a+?/.
+ /*
+ // Find best match of them all to observe leftmost longest
+ while ((mymatch = mymatch.next) != null) {
+ if (mymatch.index > best.index) {
+ best = mymatch;
+ }
+ }
+ */
+ best.end[0] = best.index;
+ best.finish (input);
+ input.setLastMatch (best);
+ return best;
+ }
+ /* End of the optimization commented out
+ }
+ */
+ mymatch.clear (++anchor);
+ // Append character to buffer if needed
+ if (buffer != null && input.charAt (0) != CharIndexed.OUT_OF_BOUNDS)
+ {
+ buffer.append (input.charAt (0));
+ }
+ // java.util.regex.Matcher#hitEnd() requires that the search should
+ // be tried at the end of input, so we use move1(1) instead of move(1)
}
while (doMove && input.move1 (1));
// Special handling at end of input for e.g. "$"
if (minimumLength == 0)
{
- if (match (input, mymatch))
- {
- mymatch.finish (input);
- return mymatch;
- }
+ if (match (input, mymatch))
+ {
+ mymatch.finish (input);
+ return mymatch;
+ }
}
return null;
@@ -2283,10 +2283,10 @@ public class RE extends REToken
* set to the index position specified.
*/
public REMatchEnumeration getMatchEnumeration (Object input, int index,
- int eflags)
+ int eflags)
{
return new REMatchEnumeration (this, makeCharIndexed (input, index),
- index, eflags);
+ index, eflags);
}
@@ -2307,7 +2307,7 @@ public class RE extends REToken
* Substitutes the replacement text for the first match found in the input
* beginning at the specified index position. Specifying an index
* effectively causes the regular expression engine to throw away the
- * specified number of characters.
+ * specified number of characters.
*
* @param input The input text.
* @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
@@ -2335,14 +2335,14 @@ public class RE extends REToken
* @see REMatch#substituteInto
*/
public String substitute (Object input, String replace, int index,
- int eflags)
+ int eflags)
{
return substituteImpl (makeCharIndexed (input, index), replace, index,
- eflags);
+ eflags);
}
private String substituteImpl (CharIndexed input, String replace, int index,
- int eflags)
+ int eflags)
{
CPStringBuilder buffer = new CPStringBuilder ();
REMatch m = getMatchImpl (input, index, eflags, buffer);
@@ -2351,17 +2351,17 @@ public class RE extends REToken
buffer.append (getReplacement (replace, m, eflags));
if (input.move (m.end[0]))
{
- do
- {
- buffer.append (input.charAt (0));
- }
- while (input.move (1));
+ do
+ {
+ buffer.append (input.charAt (0));
+ }
+ while (input.move (1));
}
return buffer.toString ();
}
/**
- * Substitutes the replacement text for each non-overlapping match found
+ * Substitutes the replacement text for each non-overlapping match found
* in the input text.
*
* @param input The input text.
@@ -2375,7 +2375,7 @@ public class RE extends REToken
}
/**
- * Substitutes the replacement text for each non-overlapping match found
+ * Substitutes the replacement text for each non-overlapping match found
* in the input text, starting at the specified index.
*
* If the regular expression allows the empty string to match, it will
@@ -2394,7 +2394,7 @@ public class RE extends REToken
}
/**
- * Substitutes the replacement text for each non-overlapping match found
+ * Substitutes the replacement text for each non-overlapping match found
* in the input text, starting at the specified index and using the
* specified execution flags.
*
@@ -2407,35 +2407,35 @@ public class RE extends REToken
* @see REMatch#substituteInto
*/
public String substituteAll (Object input, String replace, int index,
- int eflags)
+ int eflags)
{
return substituteAllImpl (makeCharIndexed (input, index), replace, index,
- eflags);
+ eflags);
}
private String substituteAllImpl (CharIndexed input, String replace,
- int index, int eflags)
+ int index, int eflags)
{
CPStringBuilder buffer = new CPStringBuilder ();
REMatch m;
while ((m = getMatchImpl (input, index, eflags, buffer)) != null)
{
- buffer.append (getReplacement (replace, m, eflags));
- index = m.getEndIndex ();
- if (m.end[0] == 0)
- {
- char ch = input.charAt (0);
- if (ch != CharIndexed.OUT_OF_BOUNDS)
- buffer.append (ch);
- input.move (1);
- }
- else
- {
- input.move (m.end[0]);
- }
-
- if (!input.isValid ())
- break;
+ buffer.append (getReplacement (replace, m, eflags));
+ index = m.getEndIndex ();
+ if (m.end[0] == 0)
+ {
+ char ch = input.charAt (0);
+ if (ch != CharIndexed.OUT_OF_BOUNDS)
+ buffer.append (ch);
+ input.move (1);
+ }
+ else
+ {
+ input.move (m.end[0]);
+ }
+
+ if (!input.isValid ())
+ break;
}
return buffer.toString ();
}
@@ -2446,36 +2446,36 @@ public class RE extends REToken
return replace;
else
{
- if ((eflags & REG_REPLACE_USE_BACKSLASHESCAPE) > 0)
- {
- CPStringBuilder sb = new CPStringBuilder ();
- int l = replace.length ();
- for (int i = 0; i < l; i++)
- {
- char c = replace.charAt (i);
- switch (c)
- {
- case '\\':
- i++;
- // Let StringIndexOutOfBoundsException be thrown.
- sb.append (replace.charAt (i));
- break;
- case '$':
- int i1 = i + 1;
- while (i1 < replace.length () &&
- Character.isDigit (replace.charAt (i1)))
- i1++;
- sb.append (m.substituteInto (replace.substring (i, i1)));
- i = i1 - 1;
- break;
- default:
- sb.append (c);
- }
- }
- return sb.toString ();
- }
- else
- return m.substituteInto (replace);
+ if ((eflags & REG_REPLACE_USE_BACKSLASHESCAPE) > 0)
+ {
+ CPStringBuilder sb = new CPStringBuilder ();
+ int l = replace.length ();
+ for (int i = 0; i < l; i++)
+ {
+ char c = replace.charAt (i);
+ switch (c)
+ {
+ case '\\':
+ i++;
+ // Let StringIndexOutOfBoundsException be thrown.
+ sb.append (replace.charAt (i));
+ break;
+ case '$':
+ int i1 = i + 1;
+ while (i1 < replace.length () &&
+ Character.isDigit (replace.charAt (i1)))
+ i1++;
+ sb.append (m.substituteInto (replace.substring (i, i1)));
+ i = i1 - 1;
+ break;
+ default:
+ sb.append (c);
+ }
+ }
+ return sb.toString ();
+ }
+ else
+ return m.substituteInto (replace);
}
}
@@ -2493,45 +2493,45 @@ public class RE extends REToken
if (firstToken == null)
{
- lastToken = firstToken = next;
+ lastToken = firstToken = next;
}
else
{
- // if chain returns false, it "rejected" the token due to
- // an optimization, and next was combined with lastToken
- if (lastToken.chain (next))
- {
- lastToken = next;
- }
+ // if chain returns false, it "rejected" the token due to
+ // an optimization, and next was combined with lastToken
+ if (lastToken.chain (next))
+ {
+ lastToken = next;
+ }
}
}
private static REToken setRepeated (REToken current, int min, int max,
- int index) throws REException
+ int index) throws REException
{
if (current == null)
throw new REException (getLocalizedMessage ("repeat.no.token"),
- REException.REG_BADRPT, index);
+ REException.REG_BADRPT, index);
return new RETokenRepeated (current.subIndex, current, min, max);
}
private static int getPosixSet (char[]pattern, int index,
- CPStringBuilder buf)
+ CPStringBuilder buf)
{
// Precondition: pattern[index-1] == ':'
// we will return pos of closing ']'.
int i;
for (i = index; i < (pattern.length - 1); i++)
{
- if ((pattern[i] == ':') && (pattern[i + 1] == ']'))
- return i + 2;
- buf.append (pattern[i]);
+ if ((pattern[i] == ':') && (pattern[i + 1] == ']'))
+ return i + 2;
+ buf.append (pattern[i]);
}
- return index; // didn't match up
+ return index; // didn't match up
}
private int getMinMax (char[]input, int index, IntPair minMax,
- RESyntax syntax) throws REException
+ RESyntax syntax) throws REException
{
// Precondition: input[index-1] == '{', minMax != null
@@ -2539,11 +2539,11 @@ public class RE extends REToken
int startIndex = index;
if (index == input.length)
{
- if (mustMatch)
- throw new REException (getLocalizedMessage ("unmatched.brace"),
- REException.REG_EBRACE, index);
- else
- return startIndex;
+ if (mustMatch)
+ throw new REException (getLocalizedMessage ("unmatched.brace"),
+ REException.REG_EBRACE, index);
+ else
+ return startIndex;
}
int min, max = 0;
@@ -2553,20 +2553,20 @@ public class RE extends REToken
// Read string of digits
do
{
- index = getCharUnit (input, index, unit, false);
- if (Character.isDigit (unit.ch))
- buf.append (unit.ch);
+ index = getCharUnit (input, index, unit, false);
+ if (Character.isDigit (unit.ch))
+ buf.append (unit.ch);
}
while ((index != input.length) && Character.isDigit (unit.ch));
// Check for {} tomfoolery
if (buf.length () == 0)
{
- if (mustMatch)
- throw new REException (getLocalizedMessage ("interval.error"),
- REException.REG_EBRACE, index);
- else
- return startIndex;
+ if (mustMatch)
+ throw new REException (getLocalizedMessage ("interval.error"),
+ REException.REG_EBRACE, index);
+ else
+ return startIndex;
}
min = Integer.parseInt (buf.toString ());
@@ -2575,8 +2575,8 @@ public class RE extends REToken
max = min;
else if (index == input.length)
if (mustMatch)
- throw new REException (getLocalizedMessage ("interval.no.end"),
- REException.REG_EBRACE, index);
+ throw new REException (getLocalizedMessage ("interval.no.end"),
+ REException.REG_EBRACE, index);
else
return startIndex;
else
@@ -2585,28 +2585,28 @@ public class RE extends REToken
buf = new CPStringBuilder ();
// Read string of digits
while (((index =
- getCharUnit (input, index, unit, false)) != input.length)
- && Character.isDigit (unit.ch))
- buf.append (unit.ch);
+ getCharUnit (input, index, unit, false)) != input.length)
+ && Character.isDigit (unit.ch))
+ buf.append (unit.ch);
if (!
- ((unit.ch == '}')
- && (syntax.get (RESyntax.RE_NO_BK_BRACES) ^ unit.bk)))
- if (mustMatch)
- throw new REException (getLocalizedMessage ("interval.error"),
- REException.REG_EBRACE, index);
+ ((unit.ch == '}')
+ && (syntax.get (RESyntax.RE_NO_BK_BRACES) ^ unit.bk)))
+ if (mustMatch)
+ throw new REException (getLocalizedMessage ("interval.error"),
+ REException.REG_EBRACE, index);
else
return startIndex;
// This is the case of {x,}
if (buf.length () == 0)
- max = Integer.MAX_VALUE;
+ max = Integer.MAX_VALUE;
else
- max = Integer.parseInt (buf.toString ());
+ max = Integer.parseInt (buf.toString ());
}
else if (mustMatch)
throw new REException (getLocalizedMessage ("interval.error"),
- REException.REG_EBRACE, index);
+ REException.REG_EBRACE, index);
else
return startIndex;
@@ -2651,13 +2651,13 @@ public class RE extends REToken
// be the most likely because this is the case with
// java.util.regex.Matcher.
// We could let a String or a CharSequence fall through
- // to final input, but since it'a very likely input type,
+ // to final input, but since it'a very likely input type,
// we check it first.
if (input instanceof CharIndexed)
{
- CharIndexed ci = (CharIndexed) input;
- ci.setAnchor (index);
- return ci;
+ CharIndexed ci = (CharIndexed) input;
+ ci.setAnchor (index);
+ return ci;
}
else if (input instanceof CharSequence)
return new CharIndexedCharSequence ((CharSequence) input, index);
diff --git a/libjava/classpath/gnu/java/util/regex/REFilterInputStream.java b/libjava/classpath/gnu/java/util/regex/REFilterInputStream.java
index c7acb71..c9fb346 100644
--- a/libjava/classpath/gnu/java/util/regex/REFilterInputStream.java
+++ b/libjava/classpath/gnu/java/util/regex/REFilterInputStream.java
@@ -70,7 +70,7 @@ public class REFilterInputStream extends FilterInputStream
*
* @param stream The InputStream to be filtered.
* @param expr The regular expression to search for.
- * @param replace The text pattern to replace matches with.
+ * @param replace The text pattern to replace matches with.
*/
public REFilterInputStream (InputStream stream, RE expr, String replace)
{
@@ -89,7 +89,7 @@ public class REFilterInputStream extends FilterInputStream
// If we have buffered replace data, use it.
if ((buffer != null) && (bufpos < buffer.length ()))
{
- return (int) buffer.charAt (bufpos++);
+ return (int) buffer.charAt (bufpos++);
}
// check if input is at a valid position
@@ -99,18 +99,18 @@ public class REFilterInputStream extends FilterInputStream
REMatch mymatch = new REMatch (expr.getNumSubs (), offset, 0);
if (expr.match (stream, mymatch))
{
- mymatch.end[0] = mymatch.index;
- mymatch.finish (stream);
- stream.move (mymatch.toString ().length ());
- offset += mymatch.toString ().length ();
- buffer = mymatch.substituteInto (replace);
- bufpos = 1;
-
- // This is prone to infinite loops if replace string turns out empty.
- if (buffer.length () > 0)
- {
- return buffer.charAt (0);
- }
+ mymatch.end[0] = mymatch.index;
+ mymatch.finish (stream);
+ stream.move (mymatch.toString ().length ());
+ offset += mymatch.toString ().length ();
+ buffer = mymatch.substituteInto (replace);
+ bufpos = 1;
+
+ // This is prone to infinite loops if replace string turns out empty.
+ if (buffer.length () > 0)
+ {
+ return buffer.charAt (0);
+ }
}
char ch = stream.charAt (0);
if (ch == CharIndexed.OUT_OF_BOUNDS)
@@ -120,9 +120,9 @@ public class REFilterInputStream extends FilterInputStream
return ch;
}
- /**
+ /**
* Returns false. REFilterInputStream does not support mark() and
- * reset() methods.
+ * reset() methods.
*/
public boolean markSupported ()
{
@@ -136,11 +136,11 @@ public class REFilterInputStream extends FilterInputStream
int ok = 0;
while (len-- > 0)
{
- i = read ();
- if (i == -1)
- return (ok == 0) ? -1 : ok;
- b[off++] = (byte) i;
- ok++;
+ i = read ();
+ if (i == -1)
+ return (ok == 0) ? -1 : ok;
+ b[off++] = (byte) i;
+ ok++;
}
return ok;
}
diff --git a/libjava/classpath/gnu/java/util/regex/REMatch.java b/libjava/classpath/gnu/java/util/regex/REMatch.java
index d29972e..5940094 100644
--- a/libjava/classpath/gnu/java/util/regex/REMatch.java
+++ b/libjava/classpath/gnu/java/util/regex/REMatch.java
@@ -56,7 +56,7 @@ public final class REMatch implements Serializable, Cloneable
private CharIndexed matchedCharIndexed;
// These variables are package scope for fast access within the engine
- int eflags; // execution flags this match was made using
+ int eflags; // execution flags this match was made using
// Offset in source text where match was tried. This is zero-based;
// the actual position in the source text is given by (offset + anchor).
@@ -68,19 +68,19 @@ public final class REMatch implements Serializable, Cloneable
int anchor;
// Package scope; used by RE.
- int index; // used while matching to mark current match position in input
+ int index; // used while matching to mark current match position in input
// start1[i] is set when the i-th subexp starts. And start1[i] is copied
// to start[i] when the i-th subexp ends. So start[i] keeps the previously
// assigned value while the i-th subexp is being processed. This makes
// backreference to the i-th subexp within the i-th subexp possible.
- int[] start; // start positions (relative to offset) for each (sub)exp.
- int[] start1; // start positions (relative to offset) for each (sub)exp.
- int[] end; // end positions for the same
+ int[] start; // start positions (relative to offset) for each (sub)exp.
+ int[] start1; // start positions (relative to offset) for each (sub)exp.
+ int[] end; // end positions for the same
// start[i] == -1 or end[i] == -1 means that the start/end position is void.
// start[i] == p or end[i] == p where p < 0 and p != -1 means that
// the actual start/end position is (p+1). Start/end positions may
// become negative when the subexpression is in a RETokenLookBehind.
- boolean empty; // empty string matched. This flag is used only within
+ boolean empty; // empty string matched. This flag is used only within
// RETokenRepeated.
BacktrackStack backtrackStack;
@@ -99,7 +99,7 @@ public final class REMatch implements Serializable, Cloneable
}
catch (CloneNotSupportedException e)
{
- throw new Error (); // doesn't happen
+ throw new Error (); // doesn't happen
}
}
@@ -133,13 +133,13 @@ public final class REMatch implements Serializable, Cloneable
matchedCharIndexed = text;
for (i = 0; i < start.length; i++)
{
- // If any subexpressions didn't terminate, they don't count
- // TODO check if this code ever gets hit
- if ((start[i] == -1) ^ (end[i] == -1))
- {
- start[i] = -1;
- end[i] = -1;
- }
+ // If any subexpressions didn't terminate, they don't count
+ // TODO check if this code ever gets hit
+ if ((start[i] == -1) ^ (end[i] == -1))
+ {
+ start[i] = -1;
+ end[i] = -1;
+ }
}
backtrackStack = null;
}
@@ -151,7 +151,7 @@ public final class REMatch implements Serializable, Cloneable
this.index = 0;
for (int i = 0; i < start.length; i++)
{
- start[i] = start1[i] = end[i] = -1;
+ start[i] = start1[i] = end[i] = -1;
}
backtrackStack = null;
}
@@ -160,7 +160,7 @@ public final class REMatch implements Serializable, Cloneable
* Returns the string matching the pattern. This makes it convenient
* to write code like the following:
*
- *
+ *
* REMatch myMatch = myExpression.getMatch(myString);
* if (myMatch != null) System.out.println("Regexp found: "+myMatch);
*
@@ -194,7 +194,7 @@ public final class REMatch implements Serializable, Cloneable
* myMatch.getEndIndex());
*
* But you can save yourself that work, since the toString()
- * method (above) does exactly that for you.
+ * method (above) does exactly that for you.
*/
public int getEndIndex ()
{
@@ -219,21 +219,21 @@ public final class REMatch implements Serializable, Cloneable
return (matchedText.substring (start[sub], end[sub]));
else
{
- // This case occurs with RETokenLookAhead or RETokenLookBehind.
- CPStringBuilder sb = new CPStringBuilder ();
- int s = start[sub];
- int e = end[sub];
- if (s < 0)
- s += 1;
- if (e < 0)
- e += 1;
- for (int i = start[0] + s; i < start[0] + e; i++)
- sb.append (matchedCharIndexed.charAt (i));
- return sb.toString ();
+ // This case occurs with RETokenLookAhead or RETokenLookBehind.
+ CPStringBuilder sb = new CPStringBuilder ();
+ int s = start[sub];
+ int e = end[sub];
+ if (s < 0)
+ s += 1;
+ if (e < 0)
+ e += 1;
+ for (int i = start[0] + s; i < start[0] + e; i++)
+ sb.append (matchedCharIndexed.charAt (i));
+ return sb.toString ();
}
}
- /**
+ /**
* Returns the index within the input string used to generate this match
* where subexpression number sub begins, or -1 if
* the subexpression does not exist. The initial position is zero.
@@ -249,7 +249,7 @@ public final class REMatch implements Serializable, Cloneable
return (x == -1) ? x : (x >= 0) ? offset + x : offset + x + 1;
}
- /**
+ /**
* Returns the index within the input string used to generate this match
* where subexpression number sub begins, or -1 if
* the subexpression does not exist. The initial position is zero.
@@ -265,7 +265,7 @@ public final class REMatch implements Serializable, Cloneable
return (x == -1) ? x : (x >= 0) ? offset + x : offset + x + 1;
}
- /**
+ /**
* Returns the index within the input string used to generate this match
* where subexpression number sub ends, or -1 if
* the subexpression does not exist. The initial position is zero.
@@ -281,7 +281,7 @@ public final class REMatch implements Serializable, Cloneable
return (x == -1) ? x : (x >= 0) ? offset + x : offset + x + 1;
}
- /**
+ /**
* Returns the index within the input string used to generate this match
* where subexpression number sub ends, or -1 if
* the subexpression does not exist. The initial position is zero.
@@ -314,30 +314,30 @@ public final class REMatch implements Serializable, Cloneable
int pos;
for (pos = 0; pos < input.length () - 1; pos++)
{
- if ((input.charAt (pos) == '$')
- && (Character.isDigit (input.charAt (pos + 1))))
- {
- int val = Character.digit (input.charAt (++pos), 10);
- int pos1 = pos + 1;
- while (pos1 < input.length () &&
- Character.isDigit (input.charAt (pos1)))
- {
- int val1 =
- val * 10 + Character.digit (input.charAt (pos1), 10);
- if (val1 >= start.length)
- break;
- pos1++;
- val = val1;
- }
- pos = pos1 - 1;
-
- if (val < start.length)
- {
- output.append (toString (val));
- }
- }
- else
- output.append (input.charAt (pos));
+ if ((input.charAt (pos) == '$')
+ && (Character.isDigit (input.charAt (pos + 1))))
+ {
+ int val = Character.digit (input.charAt (++pos), 10);
+ int pos1 = pos + 1;
+ while (pos1 < input.length () &&
+ Character.isDigit (input.charAt (pos1)))
+ {
+ int val1 =
+ val * 10 + Character.digit (input.charAt (pos1), 10);
+ if (val1 >= start.length)
+ break;
+ pos1++;
+ val = val1;
+ }
+ pos = pos1 - 1;
+
+ if (val < start.length)
+ {
+ output.append (toString (val));
+ }
+ }
+ else
+ output.append (input.charAt (pos));
}
if (pos < input.length ())
output.append (input.charAt (pos));
@@ -346,16 +346,16 @@ public final class REMatch implements Serializable, Cloneable
/* The following are used for debugging purpose
public static String d(REMatch m) {
- if (m == null) return "null";
+ if (m == null) return "null";
else return "[" + m.index + "]";
}
public String substringUptoIndex(CharIndexed input) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < index; i++) {
- sb.append(input.charAt(i));
- }
- return sb.toString();
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < index; i++) {
+ sb.append(input.charAt(i));
+ }
+ return sb.toString();
}
*/
diff --git a/libjava/classpath/gnu/java/util/regex/REMatchEnumeration.java b/libjava/classpath/gnu/java/util/regex/REMatchEnumeration.java
index f0c78be..04432d0 100644
--- a/libjava/classpath/gnu/java/util/regex/REMatchEnumeration.java
+++ b/libjava/classpath/gnu/java/util/regex/REMatchEnumeration.java
@@ -47,7 +47,7 @@ import java.util.NoSuchElementException;
* An REMatchEnumeration enumerates regular expression matches over a
* given input text. You obtain a reference to an enumeration using
* the getMatchEnumeration() methods on an instance of
- * RE.
+ * RE.
*
*
*
@@ -59,15 +59,15 @@ import java.util.NoSuchElementException;
* not need to be searched immediately.
*
*
- *
+ *
* The enumerated type is especially useful when searching on a Reader
* or InputStream, because the InputStream read position cannot be
* guaranteed after calling getMatch() (see the
* description of that method for an explanation of why). Enumeration
* also saves a lot of overhead required when calling
* getMatch() multiple times.
- *
- * @author Wes Biggs
+ *
+ * @author Wes Biggs
*/
public class REMatchEnumeration
implements Enumeration < REMatch >, Serializable
@@ -113,17 +113,17 @@ public class REMatchEnumeration
{
if (more == MAYBE)
{
- match = expr.getMatchImpl (input, index, eflags, buffer);
- if (match != null)
- {
- input.move ((match.end[0] > 0) ? match.end[0] : 1);
-
- index =
- (match.end[0] > 0) ? match.end[0] + match.offset : index + 1;
- more = YES;
- }
- else
- more = NO;
+ match = expr.getMatchImpl (input, index, eflags, buffer);
+ if (match != null)
+ {
+ input.move ((match.end[0] > 0) ? match.end[0] : 1);
+
+ index =
+ (match.end[0] > 0) ? match.end[0] + match.offset : index + 1;
+ more = YES;
+ }
+ else
+ more = NO;
}
return (more == YES);
}
@@ -133,8 +133,8 @@ public class REMatchEnumeration
{
if (hasMoreElements ())
{
- more = (input.isValid ())? MAYBE : NO;
- return match;
+ more = (input.isValid ())? MAYBE : NO;
+ return match;
}
throw new NoSuchElementException ();
}
diff --git a/libjava/classpath/gnu/java/util/regex/RESyntax.java b/libjava/classpath/gnu/java/util/regex/RESyntax.java
index 38d7056..2080cb7 100644
--- a/libjava/classpath/gnu/java/util/regex/RESyntax.java
+++ b/libjava/classpath/gnu/java/util/regex/RESyntax.java
@@ -94,7 +94,7 @@ public final class RESyntax implements Serializable
/**
* Syntax bit. Repetition and alternation operators are invalid
- * at start and end of pattern and other places.
+ * at start and end of pattern and other places.
* Not implemented.
*/
public static final int RE_CONTEXT_INVALID_OPS = 5;
@@ -115,7 +115,7 @@ public final class RESyntax implements Serializable
public static final int RE_INTERVALS = 8;
/**
- * Syntax bit. No alternation (|), match one-or-more (+), or
+ * Syntax bit. No alternation (|), match one-or-more (+), or
* match zero-or-one (?) operators.
*/
public static final int RE_LIMITED_OPS = 9;
@@ -123,7 +123,7 @@ public final class RESyntax implements Serializable
/**
* Syntax bit. Newline is an alternation operator.
*/
- public static final int RE_NEWLINE_ALT = 10; // impl.
+ public static final int RE_NEWLINE_ALT = 10; // impl.
/**
* Syntax bit. Intervals use { } instead of \{ \}
@@ -317,7 +317,7 @@ public final class RESyntax implements Serializable
* Emulates regular expression support in Larry Wall's perl, version 4,
* using single line mode (/s modifier).
*/
- public static final RESyntax RE_SYNTAX_PERL4_S; // single line mode (/s)
+ public static final RESyntax RE_SYNTAX_PERL4_S; // single line mode (/s)
/**
* Predefined syntax.
@@ -403,23 +403,23 @@ public final class RESyntax implements Serializable
/* There is no official Perl spec, but here's a "best guess" */
- RE_SYNTAX_PERL4 = new RESyntax ().set (RE_BACKSLASH_ESCAPE_IN_LISTS).set (RE_CONTEXT_INDEP_ANCHORS).set (RE_CONTEXT_INDEP_OPS) // except for '{', apparently
- .set (RE_INTERVALS).set (RE_NO_BK_BRACES).set (RE_NO_BK_PARENS).set (RE_NO_BK_VBAR).set (RE_NO_EMPTY_RANGES).set (RE_CHAR_CLASS_ESCAPES) // \d,\D,\w,\W,\s,\S
+ RE_SYNTAX_PERL4 = new RESyntax ().set (RE_BACKSLASH_ESCAPE_IN_LISTS).set (RE_CONTEXT_INDEP_ANCHORS).set (RE_CONTEXT_INDEP_OPS) // except for '{', apparently
+ .set (RE_INTERVALS).set (RE_NO_BK_BRACES).set (RE_NO_BK_PARENS).set (RE_NO_BK_VBAR).set (RE_NO_EMPTY_RANGES).set (RE_CHAR_CLASS_ESCAPES) // \d,\D,\w,\W,\s,\S
.makeFinal ();
RE_SYNTAX_PERL4_S =
new RESyntax (RE_SYNTAX_PERL4).set (RE_DOT_NEWLINE).makeFinal ();
- RE_SYNTAX_PERL5 = new RESyntax (RE_SYNTAX_PERL4).set (RE_PURE_GROUPING) // (?:)
- .set (RE_STINGY_OPS) // *?,??,+?,{}?
- .set (RE_LOOKAHEAD) // (?=)(?!)
- .set (RE_STRING_ANCHORS) // \A,\Z
- .set (RE_CHAR_CLASS_ESC_IN_LISTS) // \d,\D,\w,\W,\s,\S within []
- .set (RE_COMMENTS) // (?#)
- .set (RE_EMBEDDED_FLAGS) // (?imsx-imsx)
- .set (RE_OCTAL_CHAR) // \0377
- .set (RE_HEX_CHAR) // \x1b
- .set (RE_NAMED_PROPERTY) // \p{prop}, \P{prop}
+ RE_SYNTAX_PERL5 = new RESyntax (RE_SYNTAX_PERL4).set (RE_PURE_GROUPING) // (?:)
+ .set (RE_STINGY_OPS) // *?,??,+?,{}?
+ .set (RE_LOOKAHEAD) // (?=)(?!)
+ .set (RE_STRING_ANCHORS) // \A,\Z
+ .set (RE_CHAR_CLASS_ESC_IN_LISTS) // \d,\D,\w,\W,\s,\S within []
+ .set (RE_COMMENTS) // (?#)
+ .set (RE_EMBEDDED_FLAGS) // (?imsx-imsx)
+ .set (RE_OCTAL_CHAR) // \0377
+ .set (RE_HEX_CHAR) // \x1b
+ .set (RE_NAMED_PROPERTY) // \p{prop}, \P{prop}
.makeFinal ();
RE_SYNTAX_PERL5_S =
@@ -427,9 +427,9 @@ public final class RESyntax implements Serializable
RE_SYNTAX_JAVA_1_4 = new RESyntax (RE_SYNTAX_PERL5)
// XXX
- .set (RE_POSSESSIVE_OPS) // *+,?+,++,{}+
- .set (RE_UNICODE_CHAR) // \u1234
- .set (RE_NESTED_CHARCLASS) // [a-z&&[^p-r]]
+ .set (RE_POSSESSIVE_OPS) // *+,?+,++,{}+
+ .set (RE_UNICODE_CHAR) // \u1234
+ .set (RE_NESTED_CHARCLASS) // [a-z&&[^p-r]]
.makeFinal ();
}
@@ -457,7 +457,7 @@ public final class RESyntax implements Serializable
}
/**
- * Construct a new syntax object with all bits set the same
+ * Construct a new syntax object with all bits set the same
* as the other syntax.
*/
public RESyntax (RESyntax other)
@@ -474,7 +474,7 @@ public final class RESyntax implements Serializable
}
/**
- * Set a given bit in this syntax.
+ * Set a given bit in this syntax.
*
* @param index the constant (RESyntax.RE_xxx) bit to set.
* @return a reference to this object for easy chaining.
@@ -488,7 +488,7 @@ public final class RESyntax implements Serializable
}
/**
- * Clear a given bit in this syntax.
+ * Clear a given bit in this syntax.
*
* @param index the constant (RESyntax.RE_xxx) bit to clear.
* @return a reference to this object for easy chaining.
@@ -516,7 +516,7 @@ public final class RESyntax implements Serializable
* characters that have specific meaning within the current syntax
* can cause unexpected chronosynclastic infundibula.
*
- * @return this object for convenient chaining
+ * @return this object for convenient chaining
*/
public RESyntax setLineSeparator (String aSeparator)
{
diff --git a/libjava/classpath/gnu/java/util/regex/REToken.java b/libjava/classpath/gnu/java/util/regex/REToken.java
index 681ac51..ed9b317 100644
--- a/libjava/classpath/gnu/java/util/regex/REToken.java
+++ b/libjava/classpath/gnu/java/util/regex/REToken.java
@@ -58,7 +58,7 @@ abstract class REToken implements Serializable, Cloneable
}
catch (CloneNotSupportedException e)
{
- throw new Error (); // doesn't happen
+ throw new Error (); // doesn't happen
}
}
@@ -96,15 +96,15 @@ abstract class REToken implements Serializable, Cloneable
{
if (!fake)
{
- setHitEnd (input, mymatch);
+ setHitEnd (input, mymatch);
}
REMatch m = matchThis (input, mymatch);
if (m == null)
return false;
if (next (input, m))
{
- mymatch.assignFrom (m);
- return true;
+ mymatch.assignFrom (m);
+ return true;
}
return false;
}
@@ -188,7 +188,7 @@ abstract class REToken implements Serializable, Cloneable
boolean chain (REToken token)
{
next = token;
- return true; // Token was accepted
+ return true; // Token was accepted
}
abstract void dump (CPStringBuilder os);
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenAny.java b/libjava/classpath/gnu/java/util/regex/RETokenAny.java
index c002d05..f503968 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenAny.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenAny.java
@@ -71,8 +71,8 @@ final class RETokenAny extends REToken
boolean retval = matchOneChar (ch);
if (retval)
{
- ++mymatch.index;
- return mymatch;
+ ++mymatch.index;
+ return mymatch;
}
return null;
}
@@ -80,9 +80,9 @@ final class RETokenAny extends REToken
boolean matchOneChar (char ch)
{
if ((ch == CharIndexed.OUT_OF_BOUNDS)
- || (!newline && (ch == '\n')) || (matchNull && (ch == 0)))
+ || (!newline && (ch == '\n')) || (matchNull && (ch == 0)))
{
- return false;
+ return false;
}
return true;
}
@@ -98,12 +98,12 @@ final class RETokenAny extends REToken
int numRepeats = 0;
while (true)
{
- if (numRepeats >= max)
- break;
- char ch = input.charAt (index++);
- if (!matchOneChar (ch))
- break;
- numRepeats++;
+ if (numRepeats >= max)
+ break;
+ char ch = input.charAt (index++);
+ if (!matchOneChar (ch))
+ break;
+ numRepeats++;
}
return numRepeats;
}
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenBackRef.java b/libjava/classpath/gnu/java/util/regex/RETokenBackRef.java
index 8f14622..52061ca 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenBackRef.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenBackRef.java
@@ -64,30 +64,30 @@ final class RETokenBackRef extends REToken
b = mymatch.start[num];
e = mymatch.end[num];
if ((b == -1) || (e == -1))
- return null; // this shouldn't happen, but...
+ return null; // this shouldn't happen, but...
if (b < 0)
b += 1;
if (e < 0)
e += 1;
for (int i = b; i < e; i++)
{
- char c1 = input.charAt (mymatch.index + i - b);
- char c2 = input.charAt (i);
- if (c1 != c2)
- {
- if (insens)
- {
- if (c1 != toLowerCase (c2, unicodeAware) &&
- c1 != toUpperCase (c2, unicodeAware))
- {
- return null;
- }
- }
- else
- {
- return null;
- }
- }
+ char c1 = input.charAt (mymatch.index + i - b);
+ char c2 = input.charAt (i);
+ if (c1 != c2)
+ {
+ if (insens)
+ {
+ if (c1 != toLowerCase (c2, unicodeAware) &&
+ c1 != toUpperCase (c2, unicodeAware))
+ {
+ return null;
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
}
mymatch.index += e - b;
return mymatch;
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenChar.java b/libjava/classpath/gnu/java/util/regex/RETokenChar.java
index babcf3e..3469ecf 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenChar.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenChar.java
@@ -67,8 +67,8 @@ final class RETokenChar extends REToken
{
if (matchOneString (input, mymatch.index))
{
- mymatch.index += matchedLength;
- return mymatch;
+ mymatch.index += matchedLength;
+ return mymatch;
}
// java.util.regex.Matcher#hitEnd() requires that the length of
// partial match be counted.
@@ -85,12 +85,12 @@ final class RETokenChar extends REToken
char c;
for (int i = 0; i < z; i++)
{
- c = input.charAt (index + i);
- if (!charEquals (c, ch[i]))
- {
- return false;
- }
- ++matchedLength;
+ c = input.charAt (index + i);
+ if (!charEquals (c, ch[i]))
+ {
+ return false;
+ }
+ ++matchedLength;
}
return true;
}
@@ -120,15 +120,15 @@ final class RETokenChar extends REToken
int z = ch.length;
while (true)
{
- if (numRepeats >= max)
- break;
- if (matchOneString (input, index))
- {
- index += z;
- numRepeats++;
- }
- else
- break;
+ if (numRepeats >= max)
+ break;
+ if (matchOneString (input, index))
+ {
+ index += z;
+ numRepeats++;
+ }
+ else
+ break;
}
return numRepeats;
}
@@ -138,18 +138,18 @@ final class RETokenChar extends REToken
{
if (next instanceof RETokenChar && ((RETokenChar) next).insens == insens)
{
- RETokenChar cnext = (RETokenChar) next;
- int newsize = ch.length + cnext.ch.length;
+ RETokenChar cnext = (RETokenChar) next;
+ int newsize = ch.length + cnext.ch.length;
- char[] chTemp = new char[newsize];
+ char[] chTemp = new char[newsize];
- System.arraycopy (ch, 0, chTemp, 0, ch.length);
- System.arraycopy (cnext.ch, 0, chTemp, ch.length, cnext.ch.length);
+ System.arraycopy (ch, 0, chTemp, 0, ch.length);
+ System.arraycopy (cnext.ch, 0, chTemp, ch.length, cnext.ch.length);
- ch = chTemp;
- if (cnext.next == null)
- return false;
- return chain (cnext.next);
+ ch = chTemp;
+ if (cnext.next == null)
+ return false;
+ return chain (cnext.next);
}
else
return super.chain (next);
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenEnd.java b/libjava/classpath/gnu/java/util/regex/RETokenEnd.java
index 33e0feb..28d7823 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenEnd.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenEnd.java
@@ -92,38 +92,38 @@ final class RETokenEnd extends REToken
return ((mymatch.eflags & RE.REG_NOTEOL) > 0) ? null : mymatch;
if (check_java_line_terminators)
{
- if (ch == '\n')
- {
- char ch1 = input.charAt (mymatch.index - 1);
- if (ch1 == '\r')
- return null;
- return mymatch;
- }
- if (ch == '\r')
- return mymatch;
- if (ch == '\u0085')
- return mymatch; // A next-line character
- if (ch == '\u2028')
- return mymatch; // A line-separator character
- if (ch == '\u2029')
- return mymatch; // A paragraph-separator character
- return null;
+ if (ch == '\n')
+ {
+ char ch1 = input.charAt (mymatch.index - 1);
+ if (ch1 == '\r')
+ return null;
+ return mymatch;
+ }
+ if (ch == '\r')
+ return mymatch;
+ if (ch == '\u0085')
+ return mymatch; // A next-line character
+ if (ch == '\u2028')
+ return mymatch; // A line-separator character
+ if (ch == '\u2029')
+ return mymatch; // A paragraph-separator character
+ return null;
}
if (newline != null)
{
- char z;
- int i = 0; // position in newline
- do
- {
- z = newline.charAt (i);
- if (ch != z)
- return null;
- ++i;
- ch = input.charAt (mymatch.index + i);
- }
- while (i < newline.length ());
-
- return mymatch;
+ char z;
+ int i = 0; // position in newline
+ do
+ {
+ z = newline.charAt (i);
+ if (ch != z)
+ return null;
+ ++i;
+ ch = input.charAt (mymatch.index + i);
+ }
+ while (i < newline.length ());
+
+ return mymatch;
}
return null;
}
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenEndOfPreviousMatch.java b/libjava/classpath/gnu/java/util/regex/RETokenEndOfPreviousMatch.java
index e4ad619..67a1b85 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenEndOfPreviousMatch.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenEndOfPreviousMatch.java
@@ -58,13 +58,13 @@ class RETokenEndOfPreviousMatch extends RETokenStart
if (lastMatch == null)
return super.matchThis (input, mymatch);
if (input.getAnchor () + mymatch.index ==
- lastMatch.anchor + lastMatch.index)
+ lastMatch.anchor + lastMatch.index)
{
- return mymatch;
+ return mymatch;
}
else
{
- return null;
+ return null;
}
}
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenIndependent.java b/libjava/classpath/gnu/java/util/regex/RETokenIndependent.java
index 8ad728d..089aa18 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenIndependent.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenIndependent.java
@@ -67,10 +67,10 @@ final class RETokenIndependent extends REToken
boolean b = re.match (input, mymatch);
if (b)
{
- // Once we have found a match, we do not see other possible matches.
- if (mymatch.backtrackStack != null)
- mymatch.backtrackStack.clear ();
- return mymatch;
+ // Once we have found a match, we do not see other possible matches.
+ if (mymatch.backtrackStack != null)
+ mymatch.backtrackStack.clear ();
+ return mymatch;
}
return null;
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenLookAhead.java b/libjava/classpath/gnu/java/util/regex/RETokenLookAhead.java
index 1dc6019..34625aa 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenLookAhead.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenLookAhead.java
@@ -65,16 +65,16 @@ final class RETokenLookAhead extends REToken
REMatch trymatch = (REMatch) mymatch.clone ();
if (re.match (input, trymatch))
{
- if (negative)
- return null;
- trymatch.index = mymatch.index;
- return trymatch;
+ if (negative)
+ return null;
+ trymatch.index = mymatch.index;
+ return trymatch;
}
else
{
- if (negative)
- return mymatch;
- return null;
+ if (negative)
+ return mymatch;
+ return null;
}
}
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenLookBehind.java b/libjava/classpath/gnu/java/util/regex/RETokenLookBehind.java
index f61c93c..c85e37f 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenLookBehind.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenLookBehind.java
@@ -73,29 +73,29 @@ final class RETokenLookBehind extends REToken
re1.chain (stopper);
if (re1.match (behind, trymatch))
{
- if (negative)
- return null;
- for (int i = 0; i < trymatch.start.length; i++)
- {
- if (trymatch.start[i] != -1 && trymatch.end[i] != -1)
- {
- trymatch.start[i] -= diff;
- if (trymatch.start[i] < 0)
- trymatch.start[i] -= 1;
- trymatch.end[i] -= diff;
- if (trymatch.end[i] < 0)
- trymatch.end[i] -= 1;
- }
- }
- trymatch.index = mymatch.index;
- trymatch.offset = mymatch.offset;
- return trymatch;
+ if (negative)
+ return null;
+ for (int i = 0; i < trymatch.start.length; i++)
+ {
+ if (trymatch.start[i] != -1 && trymatch.end[i] != -1)
+ {
+ trymatch.start[i] -= diff;
+ if (trymatch.start[i] < 0)
+ trymatch.start[i] -= 1;
+ trymatch.end[i] -= diff;
+ if (trymatch.end[i] < 0)
+ trymatch.end[i] -= 1;
+ }
+ }
+ trymatch.index = mymatch.index;
+ trymatch.offset = mymatch.offset;
+ return trymatch;
}
else
{
- if (negative)
- return mymatch;
- return null;
+ if (negative)
+ return mymatch;
+ return null;
}
}
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenNamedProperty.java b/libjava/classpath/gnu/java/util/regex/RETokenNamedProperty.java
index 1683cb1..340da03 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenNamedProperty.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenNamedProperty.java
@@ -96,7 +96,7 @@ final class RETokenNamedProperty extends REToken
};
RETokenNamedProperty (int subIndex, String name, boolean insens,
- boolean negate) throws REException
+ boolean negate) throws REException
{
super (subIndex);
this.name = name;
@@ -121,8 +121,8 @@ final class RETokenNamedProperty extends REToken
boolean retval = matchOneChar (ch);
if (retval)
{
- ++mymatch.index;
- return mymatch;
+ ++mymatch.index;
+ return mymatch;
}
return null;
}
@@ -135,9 +135,9 @@ final class RETokenNamedProperty extends REToken
boolean retval = handler.includes (ch);
if (insens)
{
- retval = retval ||
- handler.includes (toUpperCase (ch, unicodeAware)) ||
- handler.includes (toLowerCase (ch, unicodeAware));
+ retval = retval ||
+ handler.includes (toUpperCase (ch, unicodeAware)) ||
+ handler.includes (toLowerCase (ch, unicodeAware));
}
if (negate)
@@ -156,12 +156,12 @@ final class RETokenNamedProperty extends REToken
int numRepeats = 0;
while (true)
{
- if (numRepeats >= max)
- break;
- char ch = input.charAt (index++);
- if (!matchOneChar (ch))
- break;
- numRepeats++;
+ if (numRepeats >= max)
+ break;
+ char ch = input.charAt (index++);
+ if (!matchOneChar (ch))
+ break;
+ numRepeats++;
}
return numRepeats;
}
@@ -179,37 +179,37 @@ final class RETokenNamedProperty extends REToken
private Handler getHandler (String name) throws REException
{
if (name.equals ("Lower") || name.equals ("Upper") ||
- // name.equals("ASCII") ||
- name.equals ("Alpha") ||
- name.equals ("Digit") ||
- name.equals ("Alnum") ||
- name.equals ("Punct") ||
- name.equals ("Graph") ||
- name.equals ("Print") ||
- name.equals ("Blank") ||
- name.equals ("Cntrl") ||
- name.equals ("XDigit") || name.equals ("Space"))
+ // name.equals("ASCII") ||
+ name.equals ("Alpha") ||
+ name.equals ("Digit") ||
+ name.equals ("Alnum") ||
+ name.equals ("Punct") ||
+ name.equals ("Graph") ||
+ name.equals ("Print") ||
+ name.equals ("Blank") ||
+ name.equals ("Cntrl") ||
+ name.equals ("XDigit") || name.equals ("Space"))
{
- return new POSIXHandler (name);
+ return new POSIXHandler (name);
}
if (name.startsWith ("In"))
{
- try
- {
- name = name.substring (2);
- Character.UnicodeBlock block =
- Character.UnicodeBlock.forName (name);
- return new UnicodeBlockHandler (block);
- }
- catch (IllegalArgumentException e)
- {
- throw new REException ("Invalid Unicode block name: " + name,
- REException.REG_ESCAPE, 0);
- }
+ try
+ {
+ name = name.substring (2);
+ Character.UnicodeBlock block =
+ Character.UnicodeBlock.forName (name);
+ return new UnicodeBlockHandler (block);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new REException ("Invalid Unicode block name: " + name,
+ REException.REG_ESCAPE, 0);
+ }
}
if (name.startsWith ("Is"))
{
- name = name.substring (2);
+ name = name.substring (2);
}
// "grouped properties"
@@ -291,27 +291,27 @@ final class RETokenNamedProperty extends REToken
if (name.equals ("all"))
return new Handler ()
{
- public boolean includes (char c)
- {
- return true;
- }
+ public boolean includes (char c)
+ {
+ return true;
+ }
};
if (name.startsWith ("java"))
{
- try
- {
- Method m = Character.class.getMethod ("is" + name.substring (4),
- Character.TYPE);
- return new JavaCategoryHandler (m);
- }
- catch (NoSuchMethodException e)
- {
- throw new REException ("Unsupported Java handler: " + name, e,
- REException.REG_ESCAPE, 0);
- }
+ try
+ {
+ Method m = Character.class.getMethod ("is" + name.substring (4),
+ Character.TYPE);
+ return new JavaCategoryHandler (m);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new REException ("Unsupported Java handler: " + name, e,
+ REException.REG_ESCAPE, 0);
+ }
}
throw new REException ("unsupported name " + name, REException.REG_ESCAPE,
- 0);
+ 0);
}
private static class POSIXHandler extends Handler
@@ -321,9 +321,9 @@ final class RETokenNamedProperty extends REToken
{
int posixId = RETokenPOSIX.intValue (name.toLowerCase ());
if (posixId != -1)
- retoken = new RETokenPOSIX (0, posixId, false, false);
+ retoken = new RETokenPOSIX (0, posixId, false, false);
else
- throw new RuntimeException ("Unknown posix ID: " + name);
+ throw new RuntimeException ("Unknown posix ID: " + name);
}
public boolean includes (char c)
{
@@ -355,8 +355,8 @@ final class RETokenNamedProperty extends REToken
{
int category = Character.getType (c);
for (int i = 0; i < categories.length; i++)
- if (category == categories[i])
- return true;
+ if (category == categories[i])
+ return true;
return false;
}
}
@@ -394,15 +394,15 @@ final class RETokenNamedProperty extends REToken
{
try
{
- return (Boolean) method.invoke (null, c);
+ return (Boolean) method.invoke (null, c);
}
catch (IllegalAccessException e)
{
- throw new InternalError ("Unable to access method " + method);
+ throw new InternalError ("Unable to access method " + method);
}
catch (InvocationTargetException e)
{
- throw new InternalError ("Error invoking " + method);
+ throw new InternalError ("Error invoking " + method);
}
}
}
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenOneOf.java b/libjava/classpath/gnu/java/util/regex/RETokenOneOf.java
index fcae3c2..3bea889 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenOneOf.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenOneOf.java
@@ -59,7 +59,7 @@ final class RETokenOneOf extends REToken
// the basic part /2-7a-c/ is stored in the ArrayList options, and
// the additional part /[f-k][m-z]&&[^p-v][st]/ is stored in the
// ArrayList addition in the following order (Reverse Polish Notation):
- // -- The matching result of the basic part is assumed here.
+ // -- The matching result of the basic part is assumed here.
// [f-k] -- REToken
// "|" -- or
// [m-z] -- REToken
@@ -80,7 +80,7 @@ final class RETokenOneOf extends REToken
// \D --> new RETokenOneOf("0123456789",true, ..)
RETokenOneOf (int subIndex, String optionsStr, boolean negative,
- boolean insens)
+ boolean insens)
{
super (subIndex);
options = new ArrayList < REToken > ();
@@ -97,7 +97,7 @@ final class RETokenOneOf extends REToken
}
RETokenOneOf (int subIndex, List < REToken > options,
- List < Object > addition, boolean negative)
+ List < Object > addition, boolean negative)
{
super (subIndex);
this.options = options;
@@ -114,8 +114,8 @@ final class RETokenOneOf extends REToken
int x;
for (REToken t:options)
{
- if ((x = t.getMinimumLength ()) < min)
- min = x;
+ if ((x = t.getMinimumLength ()) < min)
+ min = x;
}
return min;
}
@@ -128,8 +128,8 @@ final class RETokenOneOf extends REToken
int x;
for (REToken t:options)
{
- if ((x = t.getMaximumLength ()) > max)
- max = x;
+ if ((x = t.getMaximumLength ()) > max)
+ max = x;
}
return max;
}
@@ -149,13 +149,13 @@ final class RETokenOneOf extends REToken
boolean tryOnly;
if (addition == null)
{
- tryMatch = mymatch;
- tryOnly = false;
+ tryMatch = mymatch;
+ tryOnly = false;
}
else
{
- tryMatch = (REMatch) mymatch.clone ();
- tryOnly = true;
+ tryMatch = (REMatch) mymatch.clone ();
+ tryOnly = true;
}
boolean b = negative ?
matchN (input, tryMatch, tryOnly) : matchP (input, tryMatch, tryOnly);
@@ -166,36 +166,36 @@ final class RETokenOneOf extends REToken
stack.push (new Boolean (b));
for (Object obj:addition)
{
- if (obj instanceof REToken)
- {
- b = ((REToken) obj).match (input, (REMatch) mymatch.clone ());
- stack.push (new Boolean (b));
- }
- else if (obj instanceof Boolean)
- {
- stack.push ((Boolean) obj);
- }
- else if (obj.equals ("|"))
- {
- b = stack.pop ();
- b = stack.pop () || b;
- stack.push (new Boolean (b));
- }
- else if (obj.equals ("&"))
- {
- b = stack.pop ();
- b = stack.pop () && b;
- stack.push (new Boolean (b));
- }
- else
- {
- throw new RuntimeException ("Invalid object found");
- }
+ if (obj instanceof REToken)
+ {
+ b = ((REToken) obj).match (input, (REMatch) mymatch.clone ());
+ stack.push (new Boolean (b));
+ }
+ else if (obj instanceof Boolean)
+ {
+ stack.push ((Boolean) obj);
+ }
+ else if (obj.equals ("|"))
+ {
+ b = stack.pop ();
+ b = stack.pop () || b;
+ stack.push (new Boolean (b));
+ }
+ else if (obj.equals ("&"))
+ {
+ b = stack.pop ();
+ b = stack.pop () && b;
+ stack.push (new Boolean (b));
+ }
+ else
+ {
+ throw new RuntimeException ("Invalid object found");
+ }
}
if (stack.pop ())
{
- ++mymatch.index;
- return next (input, mymatch);
+ ++mymatch.index;
+ return next (input, mymatch);
}
return false;
}
@@ -207,12 +207,12 @@ final class RETokenOneOf extends REToken
for (REToken tk:options)
{
- REMatch tryMatch = (REMatch) mymatch.clone ();
- if (tk.match (input, tryMatch))
- { // match was successful
- return false;
- } // is a match
- } // try next option
+ REMatch tryMatch = (REMatch) mymatch.clone ();
+ if (tk.match (input, tryMatch))
+ { // match was successful
+ return false;
+ } // is a match
+ } // try next option
if (tryOnly)
return true;
@@ -224,17 +224,17 @@ final class RETokenOneOf extends REToken
{
for (REToken tk:options)
{
- REMatch tryMatch = (REMatch) mymatch.clone ();
- if (tk.match (input, tryMatch))
- { // match was successful
- if (tryOnly)
- return true;
- if (next (input, tryMatch))
- {
- mymatch.assignFrom (tryMatch);
- return true;
- }
- }
+ REMatch tryMatch = (REMatch) mymatch.clone ();
+ if (tk.match (input, tryMatch))
+ { // match was successful
+ if (tryOnly)
+ return true;
+ if (next (input, tryMatch))
+ {
+ mymatch.assignFrom (tryMatch);
+ return true;
+ }
+ }
}
return false;
}
@@ -244,8 +244,8 @@ final class RETokenOneOf extends REToken
REMatch newMatch = findMatch (input, mymatch);
if (newMatch != null)
{
- mymatch.assignFrom (newMatch);
- return true;
+ mymatch.assignFrom (newMatch);
+ return true;
}
return false;
}
@@ -263,32 +263,32 @@ final class RETokenOneOf extends REToken
}
private REMatch findMatch (CharIndexed input, REMatch mymatch,
- int optionIndex)
+ int optionIndex)
{
for (int i = optionIndex; i < options.size (); i++)
{
- REToken tk = options.get (i);
- tk = (REToken) tk.clone ();
- tk.chain (getNext ());
- REMatch tryMatch = (REMatch) mymatch.clone ();
- if (tryMatch.backtrackStack == null)
- {
- tryMatch.backtrackStack = new BacktrackStack ();
- }
- boolean stackPushed = false;
- if (i + 1 < options.size ())
- {
- tryMatch.backtrackStack.push (new BacktrackStack.
- Backtrack (this, input, mymatch,
- i + 1));
- stackPushed = true;
- }
- if (tk.match (input, tryMatch))
- {
- return tryMatch;
- }
- if (stackPushed)
- tryMatch.backtrackStack.pop ();
+ REToken tk = options.get (i);
+ tk = (REToken) tk.clone ();
+ tk.chain (getNext ());
+ REMatch tryMatch = (REMatch) mymatch.clone ();
+ if (tryMatch.backtrackStack == null)
+ {
+ tryMatch.backtrackStack = new BacktrackStack ();
+ }
+ boolean stackPushed = false;
+ if (i + 1 < options.size ())
+ {
+ tryMatch.backtrackStack.push (new BacktrackStack.
+ Backtrack (this, input, mymatch,
+ i + 1));
+ stackPushed = true;
+ }
+ if (tk.match (input, tryMatch))
+ {
+ return tryMatch;
+ }
+ if (stackPushed)
+ tryMatch.backtrackStack.pop ();
}
return null;
}
@@ -308,12 +308,12 @@ final class RETokenOneOf extends REToken
tk.chain (null);
while (true)
{
- if (numRepeats >= max)
- break;
- m = tk.findMatch (input, m);
- if (m == null)
- break;
- numRepeats++;
+ if (numRepeats >= max)
+ break;
+ m = tk.findMatch (input, m);
+ if (m == null)
+ break;
+ numRepeats++;
}
return numRepeats;
}
@@ -323,9 +323,9 @@ final class RETokenOneOf extends REToken
os.append (negative ? "[^" : "(?:");
for (int i = 0; i < options.size (); i++)
{
- if (!negative && (i > 0))
- os.append ('|');
- options.get (i).dumpAll (os);
+ if (!negative && (i > 0))
+ os.append ('|');
+ options.get (i).dumpAll (os);
}
os.append (negative ? ']' : ')');
}
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenPOSIX.java b/libjava/classpath/gnu/java/util/regex/RETokenPOSIX.java
index 2c80957..f0fd04b 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenPOSIX.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenPOSIX.java
@@ -70,8 +70,8 @@ final class RETokenPOSIX extends REToken
{
for (int i = 0; i < s_nameTable.length; i++)
{
- if (s_nameTable[i].equals (key))
- return i;
+ if (s_nameTable[i].equals (key))
+ return i;
}
return -1;
}
@@ -100,8 +100,8 @@ final class RETokenPOSIX extends REToken
boolean retval = matchOneChar (ch);
if (retval)
{
- ++mymatch.index;
- return mymatch;
+ ++mymatch.index;
+ return mymatch;
}
return null;
}
@@ -115,49 +115,49 @@ final class RETokenPOSIX extends REToken
switch (type)
{
case ALNUM:
- // Note that there is some debate over whether '_' should be included
- retval = Character.isLetterOrDigit (ch) || (ch == '_');
- break;
+ // Note that there is some debate over whether '_' should be included
+ retval = Character.isLetterOrDigit (ch) || (ch == '_');
+ break;
case ALPHA:
- retval = Character.isLetter (ch);
- break;
+ retval = Character.isLetter (ch);
+ break;
case BLANK:
- retval = ((ch == ' ') || (ch == '\t'));
- break;
+ retval = ((ch == ' ') || (ch == '\t'));
+ break;
case CNTRL:
- retval = Character.isISOControl (ch);
- break;
+ retval = Character.isISOControl (ch);
+ break;
case DIGIT:
- retval = Character.isDigit (ch);
- break;
+ retval = Character.isDigit (ch);
+ break;
case GRAPH:
- retval =
- (!(Character.isWhitespace (ch) || Character.isISOControl (ch)));
- break;
+ retval =
+ (!(Character.isWhitespace (ch) || Character.isISOControl (ch)));
+ break;
case LOWER:
- retval = ((insens && Character.isLetter (ch))
- || Character.isLowerCase (ch));
- break;
+ retval = ((insens && Character.isLetter (ch))
+ || Character.isLowerCase (ch));
+ break;
case PRINT:
- retval =
- (!(Character.isWhitespace (ch) || Character.isISOControl (ch)))
- || (ch == ' ');
- break;
+ retval =
+ (!(Character.isWhitespace (ch) || Character.isISOControl (ch)))
+ || (ch == ' ');
+ break;
case PUNCT:
- // This feels sloppy, especially for non-U.S. locales.
- retval = ("`~!@#$%^&*()-_=+[]{}\\|;:'\"/?,.<>".indexOf (ch) != -1);
- break;
+ // This feels sloppy, especially for non-U.S. locales.
+ retval = ("`~!@#$%^&*()-_=+[]{}\\|;:'\"/?,.<>".indexOf (ch) != -1);
+ break;
case SPACE:
- retval = Character.isWhitespace (ch);
- break;
+ retval = Character.isWhitespace (ch);
+ break;
case UPPER:
- retval = ((insens && Character.isLetter (ch))
- || Character.isUpperCase (ch));
- break;
+ retval = ((insens && Character.isLetter (ch))
+ || Character.isUpperCase (ch));
+ break;
case XDIGIT:
- retval = (Character.isDigit (ch)
- || ("abcdefABCDEF".indexOf (ch) != -1));
- break;
+ retval = (Character.isDigit (ch)
+ || ("abcdefABCDEF".indexOf (ch) != -1));
+ break;
}
if (negated)
@@ -176,12 +176,12 @@ final class RETokenPOSIX extends REToken
int numRepeats = 0;
while (true)
{
- if (numRepeats >= max)
- break;
- char ch = input.charAt (index++);
- if (!matchOneChar (ch))
- break;
- numRepeats++;
+ if (numRepeats >= max)
+ break;
+ char ch = input.charAt (index++);
+ if (!matchOneChar (ch))
+ break;
+ numRepeats++;
}
return numRepeats;
}
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenRange.java b/libjava/classpath/gnu/java/util/regex/RETokenRange.java
index 2597d4d..8898ef5 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenRange.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenRange.java
@@ -67,8 +67,8 @@ final class RETokenRange extends REToken
char c = input.charAt (mymatch.index);
if (matchOneChar (c))
{
- ++mymatch.index;
- return mymatch;
+ ++mymatch.index;
+ return mymatch;
}
return null;
}
@@ -80,13 +80,13 @@ final class RETokenRange extends REToken
boolean matches = (c >= lo) && (c <= hi);
if (!matches && insens)
{
- char c1 = toLowerCase (c, unicodeAware);
- matches = (c1 >= lo) && (c1 <= hi);
- if (!matches)
- {
- c1 = toUpperCase (c, unicodeAware);
- matches = (c1 >= lo) && (c1 <= hi);
- }
+ char c1 = toLowerCase (c, unicodeAware);
+ matches = (c1 >= lo) && (c1 <= hi);
+ if (!matches)
+ {
+ c1 = toUpperCase (c, unicodeAware);
+ matches = (c1 >= lo) && (c1 <= hi);
+ }
}
return matches;
}
@@ -102,12 +102,12 @@ final class RETokenRange extends REToken
int numRepeats = 0;
while (true)
{
- if (numRepeats >= max)
- break;
- char ch = input.charAt (index++);
- if (!matchOneChar (ch))
- break;
- numRepeats++;
+ if (numRepeats >= max)
+ break;
+ char ch = input.charAt (index++);
+ if (!matchOneChar (ch))
+ break;
+ numRepeats++;
}
return numRepeats;
}
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenRepeated.java b/libjava/classpath/gnu/java/util/regex/RETokenRepeated.java
index 0ba880d..cd86353 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenRepeated.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenRepeated.java
@@ -59,11 +59,11 @@ final class RETokenRepeated extends REToken
this.max = max;
if (token.returnsFixedLengthMatches ())
{
- tokenFixedLength = token.getMaximumLength ();
+ tokenFixedLength = token.getMaximumLength ();
}
else
{
- tokenFixedLength = -1;
+ tokenFixedLength = -1;
}
}
@@ -125,7 +125,7 @@ final class RETokenRepeated extends REToken
{
this.tk = tk;
this.input = input;
- this.rematch = (REMatch) mymatch.clone (); // MUST make a clone
+ this.rematch = (REMatch) mymatch.clone (); // MUST make a clone
this.rematch.backtrackStack = new BacktrackStack ();
findFirst = true;
}
@@ -135,31 +135,31 @@ final class RETokenRepeated extends REToken
int origin = rematch.index;
REMatch rem;
if (findFirst)
- {
- rem = tk.findMatch (input, rematch);
- findFirst = false;
- }
+ {
+ rem = tk.findMatch (input, rematch);
+ findFirst = false;
+ }
else
- {
- while (true)
- {
- if (rematch.backtrackStack.empty ())
- {
- rem = null;
- break;
- }
- BacktrackStack.Backtrack bt = rematch.backtrackStack.pop ();
- rem = bt.token.backtrack (bt.input, bt.match, bt.param);
- if (rem != null)
- break;
- }
- }
+ {
+ while (true)
+ {
+ if (rematch.backtrackStack.empty ())
+ {
+ rem = null;
+ break;
+ }
+ BacktrackStack.Backtrack bt = rematch.backtrackStack.pop ();
+ rem = bt.token.backtrack (bt.input, bt.match, bt.param);
+ if (rem != null)
+ break;
+ }
+ }
if (rem == null)
- return null;
+ return null;
if (rem.index == origin)
- rem.empty = true;
+ rem.empty = true;
rematch = rem;
- return (REMatch) rem.clone (); // MUST make a clone.
+ return (REMatch) rem.clone (); // MUST make a clone.
}
boolean noMore ()
@@ -190,7 +190,7 @@ final class RETokenRepeated extends REToken
int[] visited;
DoablesFinder finder;
StackedInfo (CharIndexed input, int numRepeats, REMatch match,
- int[]visited, DoablesFinder finder)
+ int[]visited, DoablesFinder finder)
{
super (null, input, match, null);
this.numRepeats = numRepeats;
@@ -214,7 +214,7 @@ final class RETokenRepeated extends REToken
}
private REMatch findMatch (BacktrackStack stack,
- Deque < FindMatchControl > controlStack)
+ Deque < FindMatchControl > controlStack)
{
REMatch result = null;
StackedInfo si = null;
@@ -235,180 +235,180 @@ final class RETokenRepeated extends REToken
while (true)
{
- // This is the second entry point of this method.
- // If you want to call this method recursively but you do not need the
- // result returned, just continue from this point.
+ // This is the second entry point of this method.
+ // If you want to call this method recursively but you do not need the
+ // result returned, just continue from this point.
MAIN_LOOP:
- while (true)
- {
-
- if (stack.empty ())
- break MAIN_LOOP;
- si = (StackedInfo) (stack.peek ());
- input = si.input;
- numRepeats = si.numRepeats;
- mymatch = si.match;
- visited = si.visited;
- finder = si.finder;
-
- if (mymatch.backtrackStack == null)
- mymatch.backtrackStack = new BacktrackStack ();
-
- if (numRepeats >= max)
- {
- stack.pop ();
- REMatch m1 = matchRest (input, mymatch);
- if (m1 != null)
- {
- if (!stack.empty ())
- {
- m1.backtrackStack.push (new BacktrackStack.
- Backtrack (this, input,
- mymatch, stack));
- }
- result = m1;
- break MAIN_LOOP;
- }
- if (stingy)
- {
- continue MAIN_LOOP;
- }
- break MAIN_LOOP;
- }
-
- if (finder == null)
- {
- finder = new DoablesFinder (token, input, mymatch);
- si.finder = finder;
- }
-
- if (numRepeats < min)
- {
- while (true)
- {
- REMatch doable = finder.find ();
- if (doable == null)
- {
- if (stack.empty ())
- return null;
- stack.pop ();
- continue MAIN_LOOP;
- }
- if (finder.noMore ())
- stack.pop ();
- int newNumRepeats = (doable.empty ? min : numRepeats + 1);
- stack.
- push (new
- StackedInfo (input, newNumRepeats, doable,
- visited, null));
- continue MAIN_LOOP;
- }
- }
-
- if (visited == null)
- visited = initVisited ();
-
- if (stingy)
- {
- REMatch nextMatch = finder.find ();
- if (nextMatch != null && !nextMatch.empty)
- {
- stack.
- push (new
- StackedInfo (input, numRepeats + 1, nextMatch,
- visited, null));
- }
- else
- {
- stack.pop ();
- }
- REMatch m1 = matchRest (input, mymatch);
- if (m1 != null)
- {
- if (!stack.empty ())
- {
- m1.backtrackStack.push (new BacktrackStack.
- Backtrack (this, input,
- mymatch, stack));
- }
- result = m1;
- break MAIN_LOOP;
- }
- else
- {
- continue MAIN_LOOP;
- }
- }
-
- visited = addVisited (mymatch.index, visited);
-
- TryAnotherResult taresult =
- tryAnother (stack, input, mymatch, numRepeats, finder, visited);
- visited = taresult.visited;
- switch (taresult.status)
- {
- case TryAnotherResult.TRY_FURTHER:
- controlStack.push (new FindMatchControl (finder));
- continue MAIN_LOOP0;
- case TryAnotherResult.RESULT_FOUND:
- result = taresult.result;
- break MAIN_LOOP;
- }
-
- if (!stack.empty ())
- {
- stack.pop ();
- }
- if (possessive)
- {
- stack.clear ();
- }
- REMatch m1 = matchRest (input, mymatch);
- if (m1 != null)
- {
- if (!stack.empty ())
- {
- m1.backtrackStack.push (new BacktrackStack.
- Backtrack (this, input, mymatch,
- stack));
- }
- result = m1;
- break MAIN_LOOP;
- }
-
- } // MAIN_LOOP
-
- if (controlStack.isEmpty ())
- return result;
- FindMatchControl control = controlStack.pop ();
- if (possessive)
- {
- return result;
- }
- if (result != null)
- {
- result.backtrackStack.push (new BacktrackStack.
- Backtrack (this, input, mymatch,
- stack));
- return result;
- }
-
- finder = control.finder;
-
- TryAnotherResult taresult =
- tryAnother (stack, input, mymatch, numRepeats, finder, visited);
- visited = taresult.visited;
- switch (taresult.status)
- {
- case TryAnotherResult.TRY_FURTHER:
- controlStack.push (new FindMatchControl (finder));
- continue MAIN_LOOP0;
- case TryAnotherResult.RESULT_FOUND:
- return taresult.result;
- }
- continue MAIN_LOOP0;
-
- } // MAIN_LOOP0
+ while (true)
+ {
+
+ if (stack.empty ())
+ break MAIN_LOOP;
+ si = (StackedInfo) (stack.peek ());
+ input = si.input;
+ numRepeats = si.numRepeats;
+ mymatch = si.match;
+ visited = si.visited;
+ finder = si.finder;
+
+ if (mymatch.backtrackStack == null)
+ mymatch.backtrackStack = new BacktrackStack ();
+
+ if (numRepeats >= max)
+ {
+ stack.pop ();
+ REMatch m1 = matchRest (input, mymatch);
+ if (m1 != null)
+ {
+ if (!stack.empty ())
+ {
+ m1.backtrackStack.push (new BacktrackStack.
+ Backtrack (this, input,
+ mymatch, stack));
+ }
+ result = m1;
+ break MAIN_LOOP;
+ }
+ if (stingy)
+ {
+ continue MAIN_LOOP;
+ }
+ break MAIN_LOOP;
+ }
+
+ if (finder == null)
+ {
+ finder = new DoablesFinder (token, input, mymatch);
+ si.finder = finder;
+ }
+
+ if (numRepeats < min)
+ {
+ while (true)
+ {
+ REMatch doable = finder.find ();
+ if (doable == null)
+ {
+ if (stack.empty ())
+ return null;
+ stack.pop ();
+ continue MAIN_LOOP;
+ }
+ if (finder.noMore ())
+ stack.pop ();
+ int newNumRepeats = (doable.empty ? min : numRepeats + 1);
+ stack.
+ push (new
+ StackedInfo (input, newNumRepeats, doable,
+ visited, null));
+ continue MAIN_LOOP;
+ }
+ }
+
+ if (visited == null)
+ visited = initVisited ();
+
+ if (stingy)
+ {
+ REMatch nextMatch = finder.find ();
+ if (nextMatch != null && !nextMatch.empty)
+ {
+ stack.
+ push (new
+ StackedInfo (input, numRepeats + 1, nextMatch,
+ visited, null));
+ }
+ else
+ {
+ stack.pop ();
+ }
+ REMatch m1 = matchRest (input, mymatch);
+ if (m1 != null)
+ {
+ if (!stack.empty ())
+ {
+ m1.backtrackStack.push (new BacktrackStack.
+ Backtrack (this, input,
+ mymatch, stack));
+ }
+ result = m1;
+ break MAIN_LOOP;
+ }
+ else
+ {
+ continue MAIN_LOOP;
+ }
+ }
+
+ visited = addVisited (mymatch.index, visited);
+
+ TryAnotherResult taresult =
+ tryAnother (stack, input, mymatch, numRepeats, finder, visited);
+ visited = taresult.visited;
+ switch (taresult.status)
+ {
+ case TryAnotherResult.TRY_FURTHER:
+ controlStack.push (new FindMatchControl (finder));
+ continue MAIN_LOOP0;
+ case TryAnotherResult.RESULT_FOUND:
+ result = taresult.result;
+ break MAIN_LOOP;
+ }
+
+ if (!stack.empty ())
+ {
+ stack.pop ();
+ }
+ if (possessive)
+ {
+ stack.clear ();
+ }
+ REMatch m1 = matchRest (input, mymatch);
+ if (m1 != null)
+ {
+ if (!stack.empty ())
+ {
+ m1.backtrackStack.push (new BacktrackStack.
+ Backtrack (this, input, mymatch,
+ stack));
+ }
+ result = m1;
+ break MAIN_LOOP;
+ }
+
+ } // MAIN_LOOP
+
+ if (controlStack.isEmpty ())
+ return result;
+ FindMatchControl control = controlStack.pop ();
+ if (possessive)
+ {
+ return result;
+ }
+ if (result != null)
+ {
+ result.backtrackStack.push (new BacktrackStack.
+ Backtrack (this, input, mymatch,
+ stack));
+ return result;
+ }
+
+ finder = control.finder;
+
+ TryAnotherResult taresult =
+ tryAnother (stack, input, mymatch, numRepeats, finder, visited);
+ visited = taresult.visited;
+ switch (taresult.status)
+ {
+ case TryAnotherResult.TRY_FURTHER:
+ controlStack.push (new FindMatchControl (finder));
+ continue MAIN_LOOP0;
+ case TryAnotherResult.RESULT_FOUND:
+ return taresult.result;
+ }
+ continue MAIN_LOOP0;
+
+ } // MAIN_LOOP0
}
private static class TryAnotherResult
@@ -422,9 +422,9 @@ final class RETokenRepeated extends REToken
}
private TryAnotherResult tryAnother (BacktrackStack stack,
- CharIndexed input, REMatch mymatch,
- int numRepeats, DoablesFinder finder,
- int[]visited)
+ CharIndexed input, REMatch mymatch,
+ int numRepeats, DoablesFinder finder,
+ int[]visited)
{
TryAnotherResult taresult = new TryAnotherResult ();
@@ -437,58 +437,58 @@ final class RETokenRepeated extends REToken
DO_ONE_DOABLE:
while (true)
- {
-
- REMatch doable = finder.find ();
- if (doable == null)
- {
- break DO_THIS;
- }
- if (doable.empty)
- emptyMatchFound = true;
-
- if (!emptyMatchFound)
- {
- int n = doable.index;
- if (visitedContains (n, visited))
- {
- continue DO_ONE_DOABLE;
- }
- visited = addVisited (n, visited);
- stack.
- push (new
- StackedInfo (input, numRepeats + 1, doable, visited,
- null));
- taresult.visited = visited;
- taresult.status = TryAnotherResult.TRY_FURTHER;
- return taresult;
- }
- else
- {
- REMatch m1 = matchRest (input, doable);
- if (possessive)
- {
- taresult.result = m1;
- taresult.status = TryAnotherResult.RESULT_FOUND;
- return taresult;
- }
- if (m1 != null)
- {
- if (!stack.empty ())
- {
- m1.backtrackStack.push (new BacktrackStack.
- Backtrack (this, input, mymatch,
- stack));
- }
- taresult.result = m1;
- taresult.status = TryAnotherResult.RESULT_FOUND;
- return taresult;
- }
- }
-
- } // DO_ONE_DOABLE
-
- } // DO_THIS
+ {
+
+ REMatch doable = finder.find ();
+ if (doable == null)
+ {
+ break DO_THIS;
+ }
+ if (doable.empty)
+ emptyMatchFound = true;
+
+ if (!emptyMatchFound)
+ {
+ int n = doable.index;
+ if (visitedContains (n, visited))
+ {
+ continue DO_ONE_DOABLE;
+ }
+ visited = addVisited (n, visited);
+ stack.
+ push (new
+ StackedInfo (input, numRepeats + 1, doable, visited,
+ null));
+ taresult.visited = visited;
+ taresult.status = TryAnotherResult.TRY_FURTHER;
+ return taresult;
+ }
+ else
+ {
+ REMatch m1 = matchRest (input, doable);
+ if (possessive)
+ {
+ taresult.result = m1;
+ taresult.status = TryAnotherResult.RESULT_FOUND;
+ return taresult;
+ }
+ if (m1 != null)
+ {
+ if (!stack.empty ())
+ {
+ m1.backtrackStack.push (new BacktrackStack.
+ Backtrack (this, input, mymatch,
+ stack));
+ }
+ taresult.result = m1;
+ taresult.status = TryAnotherResult.RESULT_FOUND;
+ return taresult;
+ }
+ }
+
+ } // DO_ONE_DOABLE
+
+ } // DO_THIS
taresult.status = TryAnotherResult.NOTHING_FOUND;
return taresult;
@@ -501,8 +501,8 @@ final class RETokenRepeated extends REToken
REMatch m1 = findMatch (input, mymatch);
if (m1 != null)
{
- mymatch.assignFrom (m1);
- return true;
+ mymatch.assignFrom (m1);
+ return true;
}
return false;
}
@@ -523,8 +523,8 @@ final class RETokenRepeated extends REToken
// simple linear search is faster than binary search.
for (int i = 1; i < visited[0]; i++)
{
- if (n == visited[i])
- return true;
+ if (n == visited[i])
+ return true;
}
return false;
}
@@ -535,9 +535,9 @@ final class RETokenRepeated extends REToken
return visited;
if (visited[0] >= visited.length - 1)
{
- int[] newvisited = new int[visited.length + 32];
- System.arraycopy (visited, 0, newvisited, 0, visited.length);
- visited = newvisited;
+ int[] newvisited = new int[visited.length + 32];
+ System.arraycopy (visited, 0, newvisited, 0, visited.length);
+ visited = newvisited;
}
visited[0]++;
visited[visited[0]] = n;
@@ -548,7 +548,7 @@ final class RETokenRepeated extends REToken
{
if (next (input, newMatch))
{
- return newMatch;
+ return newMatch;
}
return null;
}
@@ -573,7 +573,7 @@ final class RETokenRepeated extends REToken
}
private REMatch backtrackFixedLength (CharIndexed input, REMatch mymatch,
- Object param)
+ Object param)
{
int[] params = (int[]) param;
int index = params[0];
@@ -582,34 +582,34 @@ final class RETokenRepeated extends REToken
}
private REMatch findMatchFixedLength (CharIndexed input, REMatch mymatch,
- int index, int count)
+ int index, int count)
{
REMatch tryMatch = (REMatch) mymatch.clone ();
while (true)
{
- tryMatch.index = index;
- REMatch m = matchRest (input, tryMatch);
- count--;
- if (stingy)
- index += tokenFixedLength;
- else
- index -= tokenFixedLength;
- if (possessive)
- return m;
- if (m != null)
- {
- if (count > 0)
- {
- m.backtrackStack.push (new BacktrackStack.
- Backtrack (this, input, mymatch,
- new int[]
- {
- index, count}));
- }
- return m;
- }
- if (count <= 0)
- return null;
+ tryMatch.index = index;
+ REMatch m = matchRest (input, tryMatch);
+ count--;
+ if (stingy)
+ index += tokenFixedLength;
+ else
+ index -= tokenFixedLength;
+ if (possessive)
+ return m;
+ if (m != null)
+ {
+ if (count > 0)
+ {
+ m.backtrackStack.push (new BacktrackStack.
+ Backtrack (this, input, mymatch,
+ new int[]
+ {
+ index, count}));
+ }
+ return m;
+ }
+ if (count <= 0)
+ return null;
}
}
@@ -624,14 +624,14 @@ final class RETokenRepeated extends REToken
os.append ('?');
else
{
- os.append ('{').append (min);
- if (max > min)
- {
- os.append (',');
- if (max != Integer.MAX_VALUE)
- os.append (max);
- }
- os.append ('}');
+ os.append ('{').append (min);
+ if (max > min)
+ {
+ os.append (',');
+ if (max != Integer.MAX_VALUE)
+ os.append (max);
+ }
+ os.append ('}');
}
if (stingy)
os.append ('?');
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenStart.java b/libjava/classpath/gnu/java/util/regex/RETokenStart.java
index 6a8d247..c57ba9c 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenStart.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenStart.java
@@ -41,7 +41,7 @@ import gnu.java.lang.CPStringBuilder;
class RETokenStart extends REToken
{
- private String newline; // matches after a newline
+ private String newline; // matches after a newline
private boolean check_java_line_terminators;
RETokenStart (int subIndex, String newline)
@@ -58,13 +58,13 @@ class RETokenStart extends REToken
this.check_java_line_terminators = b;
}
- @Override
+ @Override
int getMaximumLength ()
{
return 0;
}
- @Override
+ @Override
REMatch matchThis (CharIndexed input, REMatch mymatch)
{
// charAt(index-n) may be unknown on a Reader/InputStream. FIXME
@@ -72,52 +72,52 @@ class RETokenStart extends REToken
if (check_java_line_terminators)
{
- char ch = input.charAt (mymatch.index - 1);
- if (ch != CharIndexed.OUT_OF_BOUNDS)
- {
- if (ch == '\n')
- return mymatch;
- if (ch == '\r')
- {
- char ch1 = input.charAt (mymatch.index);
- if (ch1 != '\n')
- return mymatch;
- return null;
- }
- if (ch == '\u0085')
- return mymatch; // A next-line character
- if (ch == '\u2028')
- return mymatch; // A line-separator character
- if (ch == '\u2029')
- return mymatch; // A paragraph-separator character
- }
+ char ch = input.charAt (mymatch.index - 1);
+ if (ch != CharIndexed.OUT_OF_BOUNDS)
+ {
+ if (ch == '\n')
+ return mymatch;
+ if (ch == '\r')
+ {
+ char ch1 = input.charAt (mymatch.index);
+ if (ch1 != '\n')
+ return mymatch;
+ return null;
+ }
+ if (ch == '\u0085')
+ return mymatch; // A next-line character
+ if (ch == '\u2028')
+ return mymatch; // A line-separator character
+ if (ch == '\u2029')
+ return mymatch; // A paragraph-separator character
+ }
}
if (newline != null)
{
- int len = newline.length ();
- if (mymatch.offset >= len)
- {
- boolean found = true;
- char z;
- int i = 0; // position in REToken.newline
- char ch = input.charAt (mymatch.index - len);
- do
- {
- z = newline.charAt (i);
- if (ch != z)
- {
- found = false;
- break;
- }
- ++i;
- ch = input.charAt (mymatch.index - len + i);
- }
- while (i < len);
-
- if (found)
- return mymatch;
- }
+ int len = newline.length ();
+ if (mymatch.offset >= len)
+ {
+ boolean found = true;
+ char z;
+ int i = 0; // position in REToken.newline
+ char ch = input.charAt (mymatch.index - len);
+ do
+ {
+ z = newline.charAt (i);
+ if (ch != z)
+ {
+ found = false;
+ break;
+ }
+ ++i;
+ ch = input.charAt (mymatch.index - len + i);
+ }
+ while (i < len);
+
+ if (found)
+ return mymatch;
+ }
}
// Don't match at all if REG_NOTBOL is set.
@@ -130,7 +130,7 @@ class RETokenStart extends REToken
return ((mymatch.index == 0) && (mymatch.offset == 0)) ? mymatch : null;
}
- @Override
+ @Override
boolean returnsFixedLengthMatches ()
{
return true;
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenWordBoundary.java b/libjava/classpath/gnu/java/util/regex/RETokenWordBoundary.java
index 9f758b6..04fd839 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenWordBoundary.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenWordBoundary.java
@@ -71,24 +71,24 @@ final class RETokenWordBoundary extends REToken
// In the string "one two three", these positions match:
// |o|n|e| |t|w|o| |t|h|r|e|e|
// ^ ^ ^ ^ ^ ^
- boolean after = false; // is current character a letter or digit?
- boolean before = false; // is previous character a letter or digit?
+ boolean after = false; // is current character a letter or digit?
+ boolean before = false; // is previous character a letter or digit?
char ch;
// TODO: Also check REG_ANCHORINDEX vs. anchor
if (((mymatch.eflags & RE.REG_ANCHORINDEX) != RE.REG_ANCHORINDEX)
- || (mymatch.offset + mymatch.index > mymatch.anchor))
+ || (mymatch.offset + mymatch.index > mymatch.anchor))
{
- if ((ch =
- input.charAt (mymatch.index - 1)) != CharIndexed.OUT_OF_BOUNDS)
- {
- before = Character.isLetterOrDigit (ch) || (ch == '_');
- }
+ if ((ch =
+ input.charAt (mymatch.index - 1)) != CharIndexed.OUT_OF_BOUNDS)
+ {
+ before = Character.isLetterOrDigit (ch) || (ch == '_');
+ }
}
if ((ch = input.charAt (mymatch.index)) != CharIndexed.OUT_OF_BOUNDS)
{
- after = Character.isLetterOrDigit (ch) || (ch == '_');
+ after = Character.isLetterOrDigit (ch) || (ch == '_');
}
// if (before) and (!after), we're at end (\>)
@@ -97,11 +97,11 @@ final class RETokenWordBoundary extends REToken
if ((where & BEGIN) == BEGIN)
{
- doNext = after && !before;
+ doNext = after && !before;
}
if ((where & END) == END)
{
- doNext ^= before && !after;
+ doNext ^= before && !after;
}
if (negated)
@@ -127,15 +127,15 @@ final class RETokenWordBoundary extends REToken
{
if (where == (BEGIN | END))
{
- os.append (negated ? "\\B" : "\\b");
+ os.append (negated ? "\\B" : "\\b");
}
else if (where == BEGIN)
{
- os.append ("\\<");
+ os.append ("\\<");
}
else
{
- os.append ("\\>");
+ os.append ("\\>");
}
}
}
diff --git a/libjava/classpath/gnu/java/util/regex/UncheckedRE.java b/libjava/classpath/gnu/java/util/regex/UncheckedRE.java
index 5f8c749..7d215a6 100644
--- a/libjava/classpath/gnu/java/util/regex/UncheckedRE.java
+++ b/libjava/classpath/gnu/java/util/regex/UncheckedRE.java
@@ -47,11 +47,11 @@ package gnu.java.util.regex;
*
* Note that this makes UncheckedRE dangerous if constructed with
* dynamic data. Do not use UncheckedRE unless you are completely sure
- * that all input being passed to it contains valid, well-formed
+ * that all input being passed to it contains valid, well-formed
* regular expressions for the syntax specified.
*
* @author Wes Biggs
- * @see gnu.java.util.regex.RE
+ * @see gnu.java.util.regex.RE
* @since gnu.regexp 1.1.4
*/
@@ -105,7 +105,7 @@ public final class UncheckedRE extends RE
try
{
initialize (pattern, cflags, syntax, 0, 0);
- }
+ }
catch (REException e)
{
throw new RuntimeException (e.getMessage ());
--
cgit v1.1