提交 25a6838e 编写于 作者: L lana

Merge

......@@ -38,8 +38,14 @@ ifndef OPENJDK
endif
endif
JFR =
ifndef OPENJDK
ifndef JAVASE_EMBEDDED
JFR = jfr
endif
endif
SUBDIRS = net nio util $(UCRYPTO)
SUBDIRS = $(JFR) net nio util $(UCRYPTO)
include $(BUILDDIR)/common/Subdirs.gmk
......
#
# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
......@@ -21,34 +23,51 @@
# questions.
#
BUILDDIR = ../../..
PACKAGE = oracle.jrockit.jfr
LIBRARY = jfr
PRODUCT = oracle
include $(BUILDDIR)/common/Defs.gmk
#
# Use mapfile
#
FILES_m = $(CLOSED_SHARE_SRC)/native/oracle/jfr/mapfile-vers
include $(BUILDDIR)/common/Mapfile-vers.gmk
#
# Files to compile
#
FILES_c = VMJFR.c
AUTO_FILES_JAVA_DIRS = com/oracle/jrockit/jfr oracle/jrockit/jfr
# Find C source files
#
vpath %.c $(CLOSED_SHARE_SRC)/native/oracle/jfr
#
# Library to compile.
#
# This file is used by test i18nTest.sh; this file is called to use
# shell globbing to delete Java source and class files whose names
# include non-ASCII characters.
include $(BUILDDIR)/common/Library.gmk
JVMLIB =
JAVALIB =
OTHER_LDLIBS =
# Verify directory context variables are set
if [ "${TESTJAVA}" = "" ]
then
echo "TESTJAVA not set. Test cannot execute. Failed."
exit 1
fi
clean clobber::
$(RM) -r $(CLASSDESTDIR)/com/oracle/jrockit/jfr
$(RM) -r $(CLASSDESTDIR)/oracle/jrockit/jfr
if [ "${TESTSRC}" = "" ]
then
echo "TESTSRC not set. Test cannot execute. Failed."
exit 1
fi
# Copy pre-shipped .jfs files
JFR_LIBDIR = $(LIBDIR)/jfr
JFR_SRCDIR = $(CLOSED_SHARE_SRC)/lib/jfr
if [ "${TESTCLASSES}" = "" ]
then
echo "TESTCLASSES not set. Test cannot execute. Failed."
exit 1
fi
$(JFR_LIBDIR)/%.jfs: $(JFR_SRCDIR)/%.jfs
$(install-file)
rm -f i18n*.java
rm -f i18n*.class
JFS_FILES := $(subst $(JFR_SRCDIR),$(JFR_LIBDIR),$(wildcard $(JFR_SRCDIR)/*.jfs))
all build : $(JFS_FILES)
......@@ -425,7 +425,12 @@ vpath %.$(OBJECT_SUFFIX) $(OBJDIR)
# namely jni.h, jvm.h, and jni_utils.h, plus their platform-specific
# relatives.
#
VPATH.h = $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export
VPATH0.h = $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export
ifdef OPENJDK
VPATH.h = $(VPATH0.h)
else
VPATH.h = $(CLOSED_SHARE_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(VPATH0.h)
endif
vpath %.h $(VPATH.h)
#
......
......@@ -381,6 +381,11 @@ TOOLS = \
sun/tools/jinfo \
sun/tools/jmap
# classes that go into jfr.jar
JFR_CLASSES_DIRS= \
com/oracle/jrockit/jfr \
oracle/jrockit/jfr
# classes that go into jsse.jar
JSSE_CLASSES_DIRS = \
sun/security/provider/Sun.class \
......@@ -583,6 +588,23 @@ $(NOT_RT_JAR_LIST): FRC
$(ECHO) "sun/tools/jstack/" >> $@
$(ECHO) "sun/tools/jinfo/" >> $@
$(ECHO) "sun/tools/jmap/" >> $@
ifndef OPENJDK
ifndef JAVASE_EMBEDDED
$(ECHO) "com/oracle/jrockit/jfr/" >> $@
$(ECHO) "com/oracle/jrockit/jfr/client/" >> $@
$(ECHO) "com/oracle/jrockit/jfr/management/" >> $@
$(ECHO) "oracle/jrockit/jfr/" >> $@
$(ECHO) "oracle/jrockit/jfr/events/" >> $@
$(ECHO) "oracle/jrockit/jfr/openmbean/" >> $@
$(ECHO) "oracle/jrockit/jfr/parser/" >> $@
$(ECHO) "oracle/jrockit/jfr/settings/" >> $@
$(ECHO) "oracle/jrockit/jfr/tools/" >> $@
$(ECHO) "oracle/jrockit/jfr/util/" >> $@
$(ECHO) "oracle/jrockit/jfr/util/log/" >> $@
$(ECHO) "oracle/jrockit/jfr/util/os/" >> $@
$(ECHO) "oracle/jrockit/jfr/util/text/" >> $@
endif
endif
# File order list for rt.jar
......@@ -607,6 +629,20 @@ $(TOTAL_JAR_FILELIST): $(JARREORDER_JARFILE) $(NOT_RT_JAR_LIST)
$(MV) $@.temp $@
@($(CD) $(CLASSBINDIR) && $(java-vm-cleanup))
# Create the jfr.jar containing Java Flight Recorder implementation
JFR_JAR=
ifndef OPENJDK
ifndef JAVASE_EMBEDDED
JFR_JAR=$(ABS_TEMPDIR)/jfr-orig.jar
$(JFR_JAR): $(OTHER_JAR_MANIFEST_FILE)
$(prep-target)
$(CD) $(CLASSBINDIR) && \
$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(OTHER_JAR_MANIFEST_FILE) $@ \
$(JFR_CLASSES_DIRS) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
endif
endif
# Create the rt.jar file list & non-class files list
JARSPLIT_JARFILE = $(BUILDTOOLJARDIR)/jarsplit.jar
......@@ -741,7 +777,7 @@ initial-image-jre-sol64:: initial-image-jre-setup
# drive names like C:
initial-image-jre:: initial-image-jre-setup \
$(JRE_DOCFILES) \
$(RT_JAR) $(RESOURCES_JAR) $(JSSE_JAR) \
$(RT_JAR) $(RESOURCES_JAR) $(JSSE_JAR) $(JFR_JAR) \
$(BUILDMETAINDEX_JARFILE)
@# Copy in bin directory
$(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_IMAGE_DIR)
......@@ -769,6 +805,9 @@ initial-image-jre:: initial-image-jre-setup \
$(CP) $(RT_JAR) $(JRE_IMAGE_DIR)/lib/rt.jar
$(CP) $(RESOURCES_JAR) $(JRE_IMAGE_DIR)/lib/resources.jar
$(CP) $(JSSE_JAR) $(JRE_IMAGE_DIR)/lib/jsse.jar
ifneq ($(JFR_JAR),)
$(CP) $(JFR_JAR) $(JRE_IMAGE_DIR)/lib/jfr.jar
endif
@# Generate meta-index to make boot and extension class loaders lazier
$(CD) $(JRE_IMAGE_DIR)/lib && \
$(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \
......
......@@ -62,18 +62,32 @@ jprt.vm.default.test.targets= \
# Default jdk test targets (testset=default)
jprt.make.rule.default.test.targets= \
${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \
${jprt.my.test.target.set:TESTNAME=jdk_io}, \
${jprt.my.test.target.set:TESTNAME=jdk_lang}, \
${jprt.my.test.target.set:TESTNAME=jdk_math}, \
${jprt.my.test.target.set:TESTNAME=jdk_misc}, \
${jprt.my.test.target.set:TESTNAME=jdk_math}
# Default vm test targets (testset=core)
jprt.vm.core.test.targets= \
${jprt.vm.default.test.targets}
# Core jdk test targets (testset=core)
jprt.make.rule.core.test.targets= \
${jprt.make.rule.default.test.targets}, \
${jprt.my.test.target.set:TESTNAME=jdk_util}, \
${jprt.my.test.target.set:TESTNAME=jdk_io}, \
${jprt.my.test.target.set:TESTNAME=jdk_net}, \
${jprt.my.test.target.set:TESTNAME=jdk_nio1}, \
${jprt.my.test.target.set:TESTNAME=jdk_nio2}, \
${jprt.my.test.target.set:TESTNAME=jdk_nio3}, \
${jprt.my.test.target.set:TESTNAME=jdk_security1}, \
${jprt.my.test.target.set:TESTNAME=jdk_security2}, \
${jprt.my.test.target.set:TESTNAME=jdk_security3}, \
${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \
${jprt.my.test.target.set:TESTNAME=jdk_management1}, \
${jprt.my.test.target.set:TESTNAME=jdk_management2}, \
${jprt.my.test.target.set:TESTNAME=jdk_text}, \
${jprt.my.test.target.set:TESTNAME=jdk_util}
${jprt.my.test.target.set:TESTNAME=jdk_tools1}, \
${jprt.my.test.target.set:TESTNAME=jdk_tools2}, \
${jprt.my.test.target.set:TESTNAME=jdk_misc}
# All vm test targets (testset=all)
jprt.vm.all.test.targets= \
......@@ -83,19 +97,13 @@ jprt.vm.all.test.targets= \
# All jdk test targets (testset=all)
jprt.make.rule.all.test.targets= \
${jprt.make.rule.default.test.targets}, \
${jprt.make.rule.core.test.targets}, \
${jprt.my.test.target.set:TESTNAME=jdk_awt}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \
${jprt.my.test.target.set:TESTNAME=jdk_management1}, \
${jprt.my.test.target.set:TESTNAME=jdk_management2}, \
${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \
${jprt.my.test.target.set:TESTNAME=jdk_security2}, \
${jprt.my.test.target.set:TESTNAME=jdk_security3}, \
${jprt.my.test.target.set:TESTNAME=jdk_sound}, \
${jprt.my.test.target.set:TESTNAME=jdk_swing}, \
${jprt.my.test.target.set:TESTNAME=jdk_tools1}, \
${jprt.my.test.target.set:TESTNAME=jdk_tools2}
${jprt.my.test.target.set:TESTNAME=jdk_swing}
# JCK test targets in test/Makefile (no windows)
jprt.my.jck.test.target.set= \
......
......@@ -148,8 +148,8 @@ public class TransformXPath2Filter extends TransformSpi {
}
input.addNodeFilter(new XPath2NodeFilter(convertNodeListToSet(unionNodes),
convertNodeListToSet(substractNodes),convertNodeListToSet(intersectNodes)));
input.addNodeFilter(new XPath2NodeFilter(unionNodes, substractNodes,
intersectNodes));
input.setNodeSet(true);
return input;
} catch (TransformerException ex) {
......@@ -170,32 +170,20 @@ public class TransformXPath2Filter extends TransformSpi {
throw new TransformationException("empty", ex);
}
}
static Set<Node> convertNodeListToSet(List<NodeList> l){
Set<Node> result=new HashSet<Node>();
for (NodeList rootNodes : l) {
int length = rootNodes.getLength();
for (int i = 0; i < length; i++) {
Node rootNode = rootNodes.item(i);
result.add(rootNode);
}
}
return result;
}
}
class XPath2NodeFilter implements NodeFilter {
boolean hasUnionNodes;
boolean hasSubstractNodes;
boolean hasIntersectNodes;
XPath2NodeFilter(Set<Node> unionNodes, Set<Node> substractNodes,
Set<Node> intersectNodes) {
this.unionNodes=unionNodes;
hasUnionNodes=!unionNodes.isEmpty();
this.substractNodes=substractNodes;
hasSubstractNodes=!substractNodes.isEmpty();
this.intersectNodes=intersectNodes;
hasIntersectNodes=!intersectNodes.isEmpty();
boolean hasUnionFilter;
boolean hasSubstractFilter;
boolean hasIntersectFilter;
XPath2NodeFilter(List<NodeList> unionNodes, List<NodeList> substractNodes,
List<NodeList> intersectNodes) {
hasUnionFilter=!unionNodes.isEmpty();
this.unionNodes=convertNodeListToSet(unionNodes);
hasSubstractFilter=!substractNodes.isEmpty();
this.substractNodes=convertNodeListToSet(substractNodes);
hasIntersectFilter=!intersectNodes.isEmpty();
this.intersectNodes=convertNodeListToSet(intersectNodes);
}
Set<Node> unionNodes;
Set<Node> substractNodes;
......@@ -208,16 +196,16 @@ class XPath2NodeFilter implements NodeFilter {
public int isNodeInclude(Node currentNode) {
int result=1;
if (hasSubstractNodes && rooted(currentNode, substractNodes)) {
if (hasSubstractFilter && rooted(currentNode, substractNodes)) {
result = -1;
} else if (hasIntersectNodes && !rooted(currentNode, intersectNodes)) {
} else if (hasIntersectFilter && !rooted(currentNode, intersectNodes)) {
result = 0;
}
//TODO OPTIMIZE
if (result==1)
return 1;
if (hasUnionNodes) {
if (hasUnionFilter) {
if (rooted(currentNode, unionNodes)) {
return 1;
}
......@@ -231,7 +219,7 @@ class XPath2NodeFilter implements NodeFilter {
int inUnion=-1;
public int isNodeIncludeDO(Node n, int level) {
int result=1;
if (hasSubstractNodes) {
if (hasSubstractFilter) {
if ((inSubstract==-1) || (level<=inSubstract)) {
if (inList(n, substractNodes)) {
inSubstract=level;
......@@ -244,7 +232,7 @@ class XPath2NodeFilter implements NodeFilter {
}
}
if (result!=-1){
if (hasIntersectNodes) {
if (hasIntersectFilter) {
if ((inIntersect==-1) || (level<=inIntersect)) {
if (!inList(n, intersectNodes)) {
inIntersect=-1;
......@@ -260,7 +248,7 @@ class XPath2NodeFilter implements NodeFilter {
inUnion=-1;
if (result==1)
return 1;
if (hasUnionNodes) {
if (hasUnionFilter) {
if ((inUnion==-1) && inList(n, unionNodes)) {
inUnion=level;
}
......@@ -280,6 +268,9 @@ class XPath2NodeFilter implements NodeFilter {
* @return if rooted bye the rootnodes
*/
static boolean rooted(Node currentNode, Set<Node> nodeList ) {
if (nodeList.isEmpty()) {
return false;
}
if (nodeList.contains(currentNode)) {
return true;
}
......@@ -302,4 +293,17 @@ class XPath2NodeFilter implements NodeFilter {
static boolean inList(Node currentNode, Set<Node> nodeList ) {
return nodeList.contains(currentNode);
}
private static Set<Node> convertNodeListToSet(List<NodeList> l){
Set<Node> result=new HashSet<Node>();
for (NodeList rootNodes : l) {
int length = rootNodes.getLength();
for (int i = 0; i < length; i++) {
Node rootNode = rootNodes.item(i);
result.add(rootNode);
}
}
return result;
}
}
......@@ -6431,7 +6431,8 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
* @see #setKeyColumns
*/
public int[] getKeyColumns() throws SQLException {
return keyCols;
int[]keyColumns = this.keyCols;
return (keyColumns == null) ? null : Arrays.copyOf(keyColumns, keyColumns.length);
}
......
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -27,6 +27,7 @@ package com.sun.rowset.internal;
import java.sql.*;
import java.io.*;
import java.util.Arrays;
/**
* The abstract base class from which the classes <code>Row</code>
......@@ -65,7 +66,8 @@ public abstract class BaseRow implements Serializable, Cloneable {
* original values
*/
public Object[] getOrigRow() {
return origVals;
Object[] origRow = this.origVals;
return (origRow == null) ? null: Arrays.copyOf(origRow, origRow.length);
}
/**
......
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -48,7 +48,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
* for this field is set with the <code>java.io.Writer</code> object given
* as the second argument to the <code>writeXML</code> method.
*/
private java.io.Writer writer;
private transient java.io.Writer writer;
/**
* The <code>java.util.Stack</code> object that this <code>WebRowSetXmlWriter</code>
......@@ -205,16 +205,11 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
//Changed to beginSection and endSection for maps for proper indentation
beginSection("map");
java.util.Map<?,?> typeMap = caller.getTypeMap();
if (typeMap != null) {
Iterator<?> i = typeMap.keySet().iterator();
Class<?> c;
String type;
while (i.hasNext()) {
type = (String)i.next();
c = (Class)typeMap.get(type);
propString("type", type);
propString("class", c.getName());
Map<String, Class<?>> typeMap = caller.getTypeMap();
if(typeMap != null) {
for(Map.Entry<String, Class<?>> mm : typeMap.entrySet()) {
propString("type", mm.getKey());
propString("class", mm.getValue().getName());
}
}
endSection("map");
......
/*
* Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -30,13 +30,13 @@ package java.io;
* functionality of keeping track of the current line number.
* <p>
* A line is a sequence of bytes ending with a carriage return
* character (<code>'&#92;r'</code>), a newline character
* (<code>'&#92;n'</code>), or a carriage return character followed
* character ({@code '\u005Cr'}), a newline character
* ({@code '\u005Cn'}), or a carriage return character followed
* immediately by a linefeed character. In all three cases, the line
* terminating character(s) are returned as a single newline character.
* <p>
* The line number begins at <code>0</code>, and is incremented by
* <code>1</code> when a <code>read</code> returns a newline character.
* The line number begins at {@code 0}, and is incremented by
* {@code 1} when a {@code read} returns a newline character.
*
* @author Arthur van Hoff
* @see java.io.LineNumberReader
......@@ -66,22 +66,22 @@ class LineNumberInputStream extends FilterInputStream {
/**
* Reads the next byte of data from this input stream. The value
* byte is returned as an <code>int</code> in the range
* <code>0</code> to <code>255</code>. If no byte is available
* byte is returned as an {@code int} in the range
* {@code 0} to {@code 255}. If no byte is available
* because the end of the stream has been reached, the value
* <code>-1</code> is returned. This method blocks until input data
* {@code -1} is returned. This method blocks until input data
* is available, the end of the stream is detected, or an exception
* is thrown.
* <p>
* The <code>read</code> method of
* <code>LineNumberInputStream</code> calls the <code>read</code>
* The {@code read} method of
* {@code LineNumberInputStream} calls the {@code read}
* method of the underlying input stream. It checks for carriage
* returns and newline characters in the input, and modifies the
* current line number as appropriate. A carriage-return character or
* a carriage return followed by a newline character are both
* converted into a single newline character.
*
* @return the next byte of data, or <code>-1</code> if the end of this
* @return the next byte of data, or {@code -1} if the end of this
* stream is reached.
* @exception IOException if an I/O error occurs.
* @see java.io.FilterInputStream#in
......@@ -111,18 +111,18 @@ class LineNumberInputStream extends FilterInputStream {
}
/**
* Reads up to <code>len</code> bytes of data from this input stream
* Reads up to {@code len} bytes of data from this input stream
* into an array of bytes. This method blocks until some input is available.
* <p>
* The <code>read</code> method of
* <code>LineNumberInputStream</code> repeatedly calls the
* <code>read</code> method of zero arguments to fill in the byte array.
* The {@code read} method of
* {@code LineNumberInputStream} repeatedly calls the
* {@code read} method of zero arguments to fill in the byte array.
*
* @param b the buffer into which the data is read.
* @param off the start offset of the data.
* @param len the maximum number of bytes read.
* @return the total number of bytes read into the buffer, or
* <code>-1</code> if there is no more data because the end of
* {@code -1} if there is no more data because the end of
* this stream has been reached.
* @exception IOException if an I/O error occurs.
* @see java.io.LineNumberInputStream#read()
......@@ -160,15 +160,15 @@ class LineNumberInputStream extends FilterInputStream {
}
/**
* Skips over and discards <code>n</code> bytes of data from this
* input stream. The <code>skip</code> method may, for a variety of
* Skips over and discards {@code n} bytes of data from this
* input stream. The {@code skip} method may, for a variety of
* reasons, end up skipping over some smaller number of bytes,
* possibly <code>0</code>. The actual number of bytes skipped is
* returned. If <code>n</code> is negative, no bytes are skipped.
* possibly {@code 0}. The actual number of bytes skipped is
* returned. If {@code n} is negative, no bytes are skipped.
* <p>
* The <code>skip</code> method of <code>LineNumberInputStream</code> creates
* The {@code skip} method of {@code LineNumberInputStream} creates
* a byte array and then repeatedly reads into it until
* <code>n</code> bytes have been read or the end of the stream has
* {@code n} bytes have been read or the end of the stream has
* been reached.
*
* @param n the number of bytes to be skipped.
......@@ -225,12 +225,12 @@ class LineNumberInputStream extends FilterInputStream {
* <p>
* Note that if the underlying input stream is able to supply
* <i>k</i> input characters without blocking, the
* <code>LineNumberInputStream</code> can guarantee only to provide
* {@code LineNumberInputStream} can guarantee only to provide
* <i>k</i>/2 characters without blocking, because the
* <i>k</i> characters from the underlying input stream might
* consist of <i>k</i>/2 pairs of <code>'&#92;r'</code> and
* <code>'&#92;n'</code>, which are converted to just
* <i>k</i>/2 <code>'&#92;n'</code> characters.
* consist of <i>k</i>/2 pairs of {@code '\u005Cr'} and
* {@code '\u005Cn'}, which are converted to just
* <i>k</i>/2 {@code '\u005Cn'} characters.
*
* @return the number of bytes that can be read from this input stream
* without blocking.
......@@ -243,12 +243,12 @@ class LineNumberInputStream extends FilterInputStream {
/**
* Marks the current position in this input stream. A subsequent
* call to the <code>reset</code> method repositions this stream at
* call to the {@code reset} method repositions this stream at
* the last marked position so that subsequent reads re-read the same bytes.
* <p>
* The <code>mark</code> method of
* <code>LineNumberInputStream</code> remembers the current line
* number in a private variable, and then calls the <code>mark</code>
* The {@code mark} method of
* {@code LineNumberInputStream} remembers the current line
* number in a private variable, and then calls the {@code mark}
* method of the underlying input stream.
*
* @param readlimit the maximum limit of bytes that can be read before
......@@ -264,12 +264,12 @@ class LineNumberInputStream extends FilterInputStream {
/**
* Repositions this stream to the position at the time the
* <code>mark</code> method was last called on this input stream.
* {@code mark} method was last called on this input stream.
* <p>
* The <code>reset</code> method of
* <code>LineNumberInputStream</code> resets the line number to be
* the line number at the time the <code>mark</code> method was
* called, and then calls the <code>reset</code> method of the
* The {@code reset} method of
* {@code LineNumberInputStream} resets the line number to be
* the line number at the time the {@code mark} method was
* called, and then calls the {@code reset} method of the
* underlying input stream.
* <p>
* Stream marks are intended to be used in
......
/*
* Copyright (c) 1995, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -28,7 +28,7 @@ package java.io;
import java.util.Arrays;
/**
* The <code>StreamTokenizer</code> class takes an input stream and
* The {@code StreamTokenizer} class takes an input stream and
* parses it into "tokens", allowing the tokens to be
* read one at a time. The parsing process is controlled by a table
* and a number of flags that can be set to various states. The
......@@ -36,7 +36,7 @@ import java.util.Arrays;
* strings, and various comment styles.
* <p>
* Each byte read from the input stream is regarded as a character
* in the range <code>'&#92;u0000'</code> through <code>'&#92;u00FF'</code>.
* in the range {@code '\u005Cu0000'} through {@code '\u005Cu00FF'}.
* The character value is used to look up five possible attributes of
* the character: <i>white space</i>, <i>alphabetic</i>,
* <i>numeric</i>, <i>string quote</i>, and <i>comment character</i>.
......@@ -53,8 +53,8 @@ import java.util.Arrays;
* <p>
* A typical application first constructs an instance of this class,
* sets up the syntax tables, and then repeatedly loops calling the
* <code>nextToken</code> method in each iteration of the loop until
* it returns the value <code>TT_EOF</code>.
* {@code nextToken} method in each iteration of the loop until
* it returns the value {@code TT_EOF}.
*
* @author James Gosling
* @see java.io.StreamTokenizer#nextToken()
......@@ -99,19 +99,19 @@ public class StreamTokenizer {
private static final byte CT_COMMENT = 16;
/**
* After a call to the <code>nextToken</code> method, this field
* After a call to the {@code nextToken} method, this field
* contains the type of the token just read. For a single character
* token, its value is the single character, converted to an integer.
* For a quoted string token, its value is the quote character.
* Otherwise, its value is one of the following:
* <ul>
* <li><code>TT_WORD</code> indicates that the token is a word.
* <li><code>TT_NUMBER</code> indicates that the token is a number.
* <li><code>TT_EOL</code> indicates that the end of line has been read.
* <li>{@code TT_WORD} indicates that the token is a word.
* <li>{@code TT_NUMBER} indicates that the token is a number.
* <li>{@code TT_EOL} indicates that the end of line has been read.
* The field can only have this value if the
* <code>eolIsSignificant</code> method has been called with the
* argument <code>true</code>.
* <li><code>TT_EOF</code> indicates that the end of the input stream
* {@code eolIsSignificant} method has been called with the
* argument {@code true}.
* <li>{@code TT_EOF} indicates that the end of the input stream
* has been reached.
* </ul>
* <p>
......@@ -160,8 +160,8 @@ public class StreamTokenizer {
* the string.
* <p>
* The current token is a word when the value of the
* <code>ttype</code> field is <code>TT_WORD</code>. The current token is
* a quoted string token when the value of the <code>ttype</code> field is
* {@code ttype} field is {@code TT_WORD}. The current token is
* a quoted string token when the value of the {@code ttype} field is
* a quote character.
* <p>
* The initial value of this field is null.
......@@ -175,7 +175,7 @@ public class StreamTokenizer {
/**
* If the current token is a number, this field contains the value
* of that number. The current token is a number when the value of
* the <code>ttype</code> field is <code>TT_NUMBER</code>.
* the {@code ttype} field is {@code TT_NUMBER}.
* <p>
* The initial value of this field is 0.0.
*
......@@ -201,14 +201,14 @@ public class StreamTokenizer {
* stream. The stream tokenizer is initialized to the following
* default state:
* <ul>
* <li>All byte values <code>'A'</code> through <code>'Z'</code>,
* <code>'a'</code> through <code>'z'</code>, and
* <code>'&#92;u00A0'</code> through <code>'&#92;u00FF'</code> are
* <li>All byte values {@code 'A'} through {@code 'Z'},
* {@code 'a'} through {@code 'z'}, and
* {@code '\u005Cu00A0'} through {@code '\u005Cu00FF'} are
* considered to be alphabetic.
* <li>All byte values <code>'&#92;u0000'</code> through
* <code>'&#92;u0020'</code> are considered to be white space.
* <li><code>'/'</code> is a comment character.
* <li>Single quote <code>'&#92;''</code> and double quote <code>'"'</code>
* <li>All byte values {@code '\u005Cu0000'} through
* {@code '\u005Cu0020'} are considered to be white space.
* <li>{@code '/'} is a comment character.
* <li>Single quote {@code '\u005C''} and double quote {@code '"'}
* are string quote characters.
* <li>Numbers are parsed.
* <li>Ends of lines are treated as white space, not as separate tokens.
......@@ -252,7 +252,7 @@ public class StreamTokenizer {
/**
* Resets this tokenizer's syntax table so that all characters are
* "ordinary." See the <code>ordinaryChar</code> method
* "ordinary." See the {@code ordinaryChar} method
* for more information on a character being ordinary.
*
* @see java.io.StreamTokenizer#ordinaryChar(int)
......@@ -305,7 +305,7 @@ public class StreamTokenizer {
* Specifies that all characters <i>c</i> in the range
* <code>low&nbsp;&lt;=&nbsp;<i>c</i>&nbsp;&lt;=&nbsp;high</code>
* are "ordinary" in this tokenizer. See the
* <code>ordinaryChar</code> method for more information on a
* {@code ordinaryChar} method for more information on a
* character being ordinary.
*
* @param low the low end of the range.
......@@ -327,12 +327,12 @@ public class StreamTokenizer {
* character has as a comment character, word component, string
* delimiter, white space, or number character. When such a character
* is encountered by the parser, the parser treats it as a
* single-character token and sets <code>ttype</code> field to the
* single-character token and sets {@code ttype} field to the
* character value.
*
* <p>Making a line terminator character "ordinary" may interfere
* with the ability of a <code>StreamTokenizer</code> to count
* lines. The <code>lineno</code> method may no longer reflect
* with the ability of a {@code StreamTokenizer} to count
* lines. The {@code lineno} method may no longer reflect
* the presence of such terminator characters in its line count.
*
* @param ch the character.
......@@ -361,9 +361,9 @@ public class StreamTokenizer {
* Specifies that matching pairs of this character delimit string
* constants in this tokenizer.
* <p>
* When the <code>nextToken</code> method encounters a string
* constant, the <code>ttype</code> field is set to the string
* delimiter and the <code>sval</code> field is set to the body of
* When the {@code nextToken} method encounters a string
* constant, the {@code ttype} field is set to the string
* delimiter and the {@code sval} field is set to the body of
* the string.
* <p>
* If a string quote character is encountered, then a string is
......@@ -371,7 +371,7 @@ public class StreamTokenizer {
* the string quote character, up to (but not including) the next
* occurrence of that same string quote character, or a line
* terminator, or end of file. The usual escape sequences such as
* <code>"&#92;n"</code> and <code>"&#92;t"</code> are recognized and
* {@code "\u005Cn"} and {@code "\u005Ct"} are recognized and
* converted to single characters as the string is parsed.
*
* <p>Any other attribute settings for the specified character are cleared.
......@@ -398,9 +398,9 @@ public class StreamTokenizer {
* <p>
* When the parser encounters a word token that has the format of a
* double precision floating-point number, it treats the token as a
* number rather than a word, by setting the <code>ttype</code>
* field to the value <code>TT_NUMBER</code> and putting the numeric
* value of the token into the <code>nval</code> field.
* number rather than a word, by setting the {@code ttype}
* field to the value {@code TT_NUMBER} and putting the numeric
* value of the token into the {@code nval} field.
*
* @see java.io.StreamTokenizer#nval
* @see java.io.StreamTokenizer#TT_NUMBER
......@@ -416,21 +416,21 @@ public class StreamTokenizer {
/**
* Determines whether or not ends of line are treated as tokens.
* If the flag argument is true, this tokenizer treats end of lines
* as tokens; the <code>nextToken</code> method returns
* <code>TT_EOL</code> and also sets the <code>ttype</code> field to
* as tokens; the {@code nextToken} method returns
* {@code TT_EOL} and also sets the {@code ttype} field to
* this value when an end of line is read.
* <p>
* A line is a sequence of characters ending with either a
* carriage-return character (<code>'&#92;r'</code>) or a newline
* character (<code>'&#92;n'</code>). In addition, a carriage-return
* carriage-return character ({@code '\u005Cr'}) or a newline
* character ({@code '\u005Cn'}). In addition, a carriage-return
* character followed immediately by a newline character is treated
* as a single end-of-line token.
* <p>
* If the <code>flag</code> is false, end-of-line characters are
* If the {@code flag} is false, end-of-line characters are
* treated as white space and serve only to separate tokens.
*
* @param flag <code>true</code> indicates that end-of-line characters
* are separate tokens; <code>false</code> indicates that
* @param flag {@code true} indicates that end-of-line characters
* are separate tokens; {@code false} indicates that
* end-of-line characters are white space.
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#ttype
......@@ -442,14 +442,14 @@ public class StreamTokenizer {
/**
* Determines whether or not the tokenizer recognizes C-style comments.
* If the flag argument is <code>true</code>, this stream tokenizer
* If the flag argument is {@code true}, this stream tokenizer
* recognizes C-style comments. All text between successive
* occurrences of <code>/*</code> and <code>*&#47;</code> are discarded.
* occurrences of {@code /*} and <code>*&#47;</code> are discarded.
* <p>
* If the flag argument is <code>false</code>, then C-style comments
* If the flag argument is {@code false}, then C-style comments
* are not treated specially.
*
* @param flag <code>true</code> indicates to recognize and ignore
* @param flag {@code true} indicates to recognize and ignore
* C-style comments.
*/
public void slashStarComments(boolean flag) {
......@@ -458,15 +458,15 @@ public class StreamTokenizer {
/**
* Determines whether or not the tokenizer recognizes C++-style comments.
* If the flag argument is <code>true</code>, this stream tokenizer
* If the flag argument is {@code true}, this stream tokenizer
* recognizes C++-style comments. Any occurrence of two consecutive
* slash characters (<code>'/'</code>) is treated as the beginning of
* slash characters ({@code '/'}) is treated as the beginning of
* a comment that extends to the end of the line.
* <p>
* If the flag argument is <code>false</code>, then C++-style
* If the flag argument is {@code false}, then C++-style
* comments are not treated specially.
*
* @param flag <code>true</code> indicates to recognize and ignore
* @param flag {@code true} indicates to recognize and ignore
* C++-style comments.
*/
public void slashSlashComments(boolean flag) {
......@@ -475,16 +475,16 @@ public class StreamTokenizer {
/**
* Determines whether or not word token are automatically lowercased.
* If the flag argument is <code>true</code>, then the value in the
* <code>sval</code> field is lowercased whenever a word token is
* returned (the <code>ttype</code> field has the
* value <code>TT_WORD</code> by the <code>nextToken</code> method
* If the flag argument is {@code true}, then the value in the
* {@code sval} field is lowercased whenever a word token is
* returned (the {@code ttype} field has the
* value {@code TT_WORD} by the {@code nextToken} method
* of this tokenizer.
* <p>
* If the flag argument is <code>false</code>, then the
* <code>sval</code> field is not modified.
* If the flag argument is {@code false}, then the
* {@code sval} field is not modified.
*
* @param fl <code>true</code> indicates that all word tokens should
* @param fl {@code true} indicates that all word tokens should
* be lowercased.
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#ttype
......@@ -506,9 +506,9 @@ public class StreamTokenizer {
/**
* Parses the next token from the input stream of this tokenizer.
* The type of the next token is returned in the <code>ttype</code>
* The type of the next token is returned in the {@code ttype}
* field. Additional information about the token may be in the
* <code>nval</code> field or the <code>sval</code> field of this
* {@code nval} field or the {@code sval} field of this
* tokenizer.
* <p>
* Typical clients of this
......@@ -516,7 +516,7 @@ public class StreamTokenizer {
* calling nextToken to parse successive tokens until TT_EOF
* is returned.
*
* @return the value of the <code>ttype</code> field.
* @return the value of the {@code ttype} field.
* @exception IOException if an I/O error occurs.
* @see java.io.StreamTokenizer#nval
* @see java.io.StreamTokenizer#sval
......@@ -752,10 +752,10 @@ public class StreamTokenizer {
}
/**
* Causes the next call to the <code>nextToken</code> method of this
* tokenizer to return the current value in the <code>ttype</code>
* field, and not to modify the value in the <code>nval</code> or
* <code>sval</code> field.
* Causes the next call to the {@code nextToken} method of this
* tokenizer to return the current value in the {@code ttype}
* field, and not to modify the value in the {@code nval} or
* {@code sval} field.
*
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#nval
......
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -110,8 +110,8 @@ public final class Byte extends Number implements Comparable<Byte> {
* determined by whether {@link java.lang.Character#digit(char,
* int)} returns a nonnegative value) except that the first
* character may be an ASCII minus sign {@code '-'}
* (<code>'&#92;u002D'</code>) to indicate a negative value or an
* ASCII plus sign {@code '+'} (<code>'&#92;u002B'</code>) to
* ({@code '\u005Cu002D'}) to indicate a negative value or an
* ASCII plus sign {@code '+'} ({@code '\u005Cu002B'}) to
* indicate a positive value. The resulting {@code byte} value is
* returned.
*
......@@ -127,8 +127,8 @@ public final class Byte extends Number implements Comparable<Byte> {
*
* <li> Any character of the string is not a digit of the
* specified radix, except that the first character may be a minus
* sign {@code '-'} (<code>'&#92;u002D'</code>) or plus sign
* {@code '+'} (<code>'&#92;u002B'</code>) provided that the
* sign {@code '-'} ({@code '\u005Cu002D'}) or plus sign
* {@code '+'} ({@code '\u005Cu002B'}) provided that the
* string is longer than length 1.
*
* <li> The value represented by the string is not a value of type
......@@ -157,9 +157,9 @@ public final class Byte extends Number implements Comparable<Byte> {
* Parses the string argument as a signed decimal {@code
* byte}. The characters in the string must all be decimal digits,
* except that the first character may be an ASCII minus sign
* {@code '-'} (<code>'&#92;u002D'</code>) to indicate a negative
* {@code '-'} ({@code '\u005Cu002D'}) to indicate a negative
* value or an ASCII plus sign {@code '+'}
* (<code>'&#92;u002B'</code>) to indicate a positive value. The
* ({@code '\u005Cu002B'}) to indicate a positive value. The
* resulting {@code byte} value is returned, exactly as if the
* argument and the radix 10 were given as arguments to the {@link
* #parseByte(java.lang.String, int)} method.
......@@ -445,6 +445,47 @@ public final class Byte extends Number implements Comparable<Byte> {
return x - y;
}
/**
* Converts the argument to an {@code int} by an unsigned
* conversion. In an unsigned conversion to an {@code int}, the
* high-order 24 bits of the {@code int} are zero and the
* low-order 8 bits are equal to the bits of the {@code byte} argument.
*
* Consequently, zero and positive {@code byte} values are mapped
* to a numerically equal {@code int} value and negative {@code
* byte} values are mapped to an {@code int} value equal to the
* input plus 2<sup>8</sup>.
*
* @param x the value to convert to an unsigned {@code int}
* @return the argument converted to {@code int} by an unsigned
* conversion
* @since 1.8
*/
public static int toUnsignedInt(byte x) {
return ((int) x) & 0xff;
}
/**
* Converts the argument to a {@code long} by an unsigned
* conversion. In an unsigned conversion to a {@code long}, the
* high-order 56 bits of the {@code long} are zero and the
* low-order 8 bits are equal to the bits of the {@code byte} argument.
*
* Consequently, zero and positive {@code byte} values are mapped
* to a numerically equal {@code long} value and negative {@code
* byte} values are mapped to a {@code long} value equal to the
* input plus 2<sup>8</sup>.
*
* @param x the value to convert to an unsigned {@code long}
* @return the argument converted to {@code long} by an unsigned
* conversion
* @since 1.8
*/
public static long toUnsignedLong(byte x) {
return ((long) x) & 0xffL;
}
/**
* The number of bits used to represent a {@code byte} value in two's
* complement binary form.
......
/*
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -140,7 +140,7 @@ public final class Double extends Number implements Comparable<Double> {
* <li>Otherwise, the result is a string that represents the sign and
* magnitude (absolute value) of the argument. If the sign is negative,
* the first character of the result is '{@code -}'
* (<code>'&#92;u002D'</code>); if the sign is positive, no sign character
* ({@code '\u005Cu002D'}); if the sign is positive, no sign character
* appears in the result. As for the magnitude <i>m</i>:
* <ul>
* <li>If <i>m</i> is infinity, it is represented by the characters
......@@ -156,7 +156,7 @@ public final class Double extends Number implements Comparable<Double> {
* <li>If <i>m</i> is greater than or equal to 10<sup>-3</sup> but less
* than 10<sup>7</sup>, then it is represented as the integer part of
* <i>m</i>, in decimal form with no leading zeroes, followed by
* '{@code .}' (<code>'&#92;u002E'</code>), followed by one or
* '{@code .}' ({@code '\u005Cu002E'}), followed by one or
* more decimal digits representing the fractional part of <i>m</i>.
*
* <li>If <i>m</i> is less than 10<sup>-3</sup> or greater than or
......@@ -168,9 +168,9 @@ public final class Double extends Number implements Comparable<Double> {
* 10<sup><i>n</i></sup> so that 1 &le; <i>a</i> {@literal <} 10. The
* magnitude is then represented as the integer part of <i>a</i>,
* as a single decimal digit, followed by '{@code .}'
* (<code>'&#92;u002E'</code>), followed by decimal digits
* ({@code '\u005Cu002E'}), followed by decimal digits
* representing the fractional part of <i>a</i>, followed by the
* letter '{@code E}' (<code>'&#92;u0045'</code>), followed
* letter '{@code E}' ({@code '\u005Cu0045'}), followed
* by a representation of <i>n</i> as a decimal integer, as
* produced by the method {@link Integer#toString(int)}.
* </ul>
......@@ -208,7 +208,7 @@ public final class Double extends Number implements Comparable<Double> {
* <li>Otherwise, the result is a string that represents the sign
* and magnitude of the argument. If the sign is negative, the
* first character of the result is '{@code -}'
* (<code>'&#92;u002D'</code>); if the sign is positive, no sign
* ({@code '\u005Cu002D'}); if the sign is positive, no sign
* character appears in the result. As for the magnitude <i>m</i>:
*
* <ul>
......
/*
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -138,7 +138,7 @@ public final class Float extends Number implements Comparable<Float> {
* <li>Otherwise, the result is a string that represents the sign and
* magnitude (absolute value) of the argument. If the sign is
* negative, the first character of the result is
* '{@code -}' (<code>'&#92;u002D'</code>); if the sign is
* '{@code -}' ({@code '\u005Cu002D'}); if the sign is
* positive, no sign character appears in the result. As for
* the magnitude <i>m</i>:
* <ul>
......@@ -154,7 +154,7 @@ public final class Float extends Number implements Comparable<Float> {
* less than 10<sup>7</sup>, then it is represented as the
* integer part of <i>m</i>, in decimal form with no leading
* zeroes, followed by '{@code .}'
* (<code>'&#92;u002E'</code>), followed by one or more
* ({@code '\u005Cu002E'}), followed by one or more
* decimal digits representing the fractional part of
* <i>m</i>.
* <li> If <i>m</i> is less than 10<sup>-3</sup> or greater than or
......@@ -166,10 +166,10 @@ public final class Float extends Number implements Comparable<Float> {
* 10<sup><i>n</i></sup> so that 1 &le; <i>a</i> {@literal <} 10.
* The magnitude is then represented as the integer part of
* <i>a</i>, as a single decimal digit, followed by
* '{@code .}' (<code>'&#92;u002E'</code>), followed by
* '{@code .}' ({@code '\u005Cu002E'}), followed by
* decimal digits representing the fractional part of
* <i>a</i>, followed by the letter '{@code E}'
* (<code>'&#92;u0045'</code>), followed by a representation
* ({@code '\u005Cu0045'}), followed by a representation
* of <i>n</i> as a decimal integer, as produced by the
* method {@link java.lang.Integer#toString(int)}.
*
......@@ -210,7 +210,7 @@ public final class Float extends Number implements Comparable<Float> {
* <li>Otherwise, the result is a string that represents the sign and
* magnitude (absolute value) of the argument. If the sign is negative,
* the first character of the result is '{@code -}'
* (<code>'&#92;u002D'</code>); if the sign is positive, no sign character
* ({@code '\u005Cu002D'}); if the sign is positive, no sign character
* appears in the result. As for the magnitude <i>m</i>:
*
* <ul>
......
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -80,8 +80,8 @@ public final class Short extends Number implements Comparable<Short> {
* determined by whether {@link java.lang.Character#digit(char,
* int)} returns a nonnegative value) except that the first
* character may be an ASCII minus sign {@code '-'}
* (<code>'&#92;u002D'</code>) to indicate a negative value or an
* ASCII plus sign {@code '+'} (<code>'&#92;u002B'</code>) to
* ({@code '\u005Cu002D'}) to indicate a negative value or an
* ASCII plus sign {@code '+'} ({@code '\u005Cu002B'}) to
* indicate a positive value. The resulting {@code short} value
* is returned.
*
......@@ -97,8 +97,8 @@ public final class Short extends Number implements Comparable<Short> {
*
* <li> Any character of the string is not a digit of the
* specified radix, except that the first character may be a minus
* sign {@code '-'} (<code>'&#92;u002D'</code>) or plus sign
* {@code '+'} (<code>'&#92;u002B'</code>) provided that the
* sign {@code '-'} ({@code '\u005Cu002D'}) or plus sign
* {@code '+'} ({@code '\u005Cu002B'}) provided that the
* string is longer than length 1.
*
* <li> The value represented by the string is not a value of type
......@@ -126,9 +126,9 @@ public final class Short extends Number implements Comparable<Short> {
* Parses the string argument as a signed decimal {@code
* short}. The characters in the string must all be decimal
* digits, except that the first character may be an ASCII minus
* sign {@code '-'} (<code>'&#92;u002D'</code>) to indicate a
* sign {@code '-'} ({@code '\u005Cu002D'}) to indicate a
* negative value or an ASCII plus sign {@code '+'}
* (<code>'&#92;u002B'</code>) to indicate a positive value. The
* ({@code '\u005Cu002B'}) to indicate a positive value. The
* resulting {@code short} value is returned, exactly as if the
* argument and the radix 10 were given as arguments to the {@link
* #parseShort(java.lang.String, int)} method.
......@@ -469,6 +469,47 @@ public final class Short extends Number implements Comparable<Short> {
return (short) (((i & 0xFF00) >> 8) | (i << 8));
}
/**
* Converts the argument to an {@code int} by an unsigned
* conversion. In an unsigned conversion to an {@code int}, the
* high-order 16 bits of the {@code int} are zero and the
* low-order 16 bits are equal to the bits of the {@code short} argument.
*
* Consequently, zero and positive {@code short} values are mapped
* to a numerically equal {@code int} value and negative {@code
* short} values are mapped to an {@code int} value equal to the
* input plus 2<sup>16</sup>.
*
* @param x the value to convert to an unsigned {@code int}
* @return the argument converted to {@code int} by an unsigned
* conversion
* @since 1.8
*/
public static int toUnsignedInt(short x) {
return ((int) x) & 0xffff;
}
/**
* Converts the argument to a {@code long} by an unsigned
* conversion. In an unsigned conversion to a {@code long}, the
* high-order 48 bits of the {@code long} are zero and the
* low-order 16 bits are equal to the bits of the {@code short} argument.
*
* Consequently, zero and positive {@code short} values are mapped
* to a numerically equal {@code long} value and negative {@code
* short} values are mapped to a {@code long} value equal to the
* input plus 2<sup>16</sup>.
*
* @param x the value to convert to an unsigned {@code long}
* @return the argument converted to {@code long} by an unsigned
* conversion
* @since 1.8
*/
public static long toUnsignedLong(short x) {
return ((long) x) & 0xffffL;
}
/** use serialVersionUID from JDK 1.1. for interoperability */
private static final long serialVersionUID = 7515723908773894738L;
}
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -1646,8 +1646,7 @@ public class SimpleDateFormat extends DateFormat {
// determine the local time. (6645292)
int dstAmount = (nameIndex >= 3) ? tz.getDSTSavings() : 0;
if (!(useSameName || (nameIndex >= 3 && dstAmount == 0))) {
calb.set(Calendar.ZONE_OFFSET, tz.getRawOffset())
.set(Calendar.DST_OFFSET, dstAmount);
calb.set(Calendar.DST_OFFSET, dstAmount);
}
return (start + zoneNames[nameIndex].length());
}
......
......@@ -2705,7 +2705,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* removed from the serialization stream; this will probably happen in the
* near future.
*/
private void writeObject(ObjectOutputStream stream)
private synchronized void writeObject(ObjectOutputStream stream)
throws IOException
{
// Try to compute the time correctly, for the future (stream
......
......@@ -106,7 +106,15 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
/**
* Distinguished non-null value for representing null values.
*/
private static final Object NULL = new Integer(0);
private static final Object NULL = new Object() {
public int hashCode() {
return 0;
}
public String toString() {
return "java.util.EnumMap.NULL";
}
};
private Object maskNull(Object value) {
return (value == null ? NULL : value);
......
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -26,6 +26,8 @@
package javax.crypto;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.regex.*;
......@@ -389,16 +391,15 @@ public class Cipher {
return matches(regexp, value) ? S_YES : S_NO;
}
// Map<String,Pattern> for previously compiled patterns
// XXX use ConcurrentHashMap once available
private final static Map<String, Pattern> patternCache =
Collections.synchronizedMap(new HashMap<String, Pattern>());
// ConcurrentMap<String,Pattern> for previously compiled patterns
private final static ConcurrentMap<String, Pattern> patternCache =
new ConcurrentHashMap<String, Pattern>();
private static boolean matches(String regexp, String str) {
Pattern pattern = patternCache.get(regexp);
if (pattern == null) {
pattern = Pattern.compile(regexp);
patternCache.put(regexp, pattern);
patternCache.putIfAbsent(regexp, pattern);
}
return pattern.matcher(str.toUpperCase(Locale.ENGLISH)).matches();
}
......
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,6 +25,7 @@
package javax.sql.rowset.serial;
import java.sql.*;
import java.util.Arrays;
import java.util.Map;
/**
......@@ -119,7 +120,7 @@ public class SQLInputImpl implements SQLInput {
"object with null parameters");
}
// assign our local reference to the attribute stream
attrib = attributes;
attrib = Arrays.copyOf(attributes, attributes.length);
// init the index point before the head of the stream
idx = -1;
// set the map
......
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,11 +25,10 @@
package javax.sql.rowset.serial;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.*;
import javax.sql.*;
import java.io.*;
import java.lang.String;
import java.math.*;
import java.util.Map;
import java.util.Vector;
......@@ -444,16 +443,15 @@ public class SQLOutputImpl implements SQLOutput {
* will need to track if a field is SQL null for itself
*/
if (x == null) {
attribs.add(x);
return;
attribs.add(null);
} else {
/*
* We have to write out a SerialStruct that contains
* the name of this class otherwise we don't know
* what to re-instantiate during readSQL()
*/
attribs.add(new SerialStruct(x, map));
}
/*
* We have to write out a SerialStruct that contains
* the name of this class otherwise we don't know
* what to re-instantiate during readSQL()
*/
attribs.add(new SerialStruct(x, map));
}
/**
......@@ -470,10 +468,10 @@ public class SQLOutputImpl implements SQLOutput {
@SuppressWarnings("unchecked")
public void writeRef(Ref x) throws SQLException {
if (x == null) {
attribs.add(x);
return;
attribs.add(null);
} else {
attribs.add(new SerialRef(x));
}
attribs.add(new SerialRef(x));
}
/**
......@@ -490,10 +488,10 @@ public class SQLOutputImpl implements SQLOutput {
@SuppressWarnings("unchecked")
public void writeBlob(Blob x) throws SQLException {
if (x == null) {
attribs.add(x);
return;
attribs.add(null);
} else {
attribs.add(new SerialBlob(x));
}
attribs.add(new SerialBlob(x));
}
/**
......@@ -510,10 +508,10 @@ public class SQLOutputImpl implements SQLOutput {
@SuppressWarnings("unchecked")
public void writeClob(Clob x) throws SQLException {
if (x == null) {
attribs.add(x);
return;
attribs.add(null);
} else {
attribs.add(new SerialClob(x));
}
attribs.add(new SerialClob(x));
}
/**
......@@ -554,10 +552,10 @@ public class SQLOutputImpl implements SQLOutput {
@SuppressWarnings("unchecked")
public void writeArray(Array x) throws SQLException {
if (x == null) {
attribs.add(x);
return;
attribs.add(null);
} else {
attribs.add(new SerialArray(x, map));
}
attribs.add(new SerialArray(x, map));
}
/**
......@@ -574,11 +572,10 @@ public class SQLOutputImpl implements SQLOutput {
@SuppressWarnings("unchecked")
public void writeURL(java.net.URL url) throws SQLException {
if (url == null) {
attribs.add(url);
return;
attribs.add(null);
} else {
attribs.add(new SerialDatalink(url));
}
attribs.add(new SerialDatalink(url));
}
......
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -29,6 +29,7 @@ import java.sql.*;
import javax.sql.*;
import java.io.*;
import java.math.*;
import java.util.Arrays;
import java.util.Map;
import java.util.Vector;
......@@ -174,7 +175,8 @@ public class SerialStruct implements Struct, Serializable, Cloneable {
* @throws SerialException if an error occurs
*/
public Object[] getAttributes() throws SerialException {
return attribs;
Object[] val = this.attribs;
return (val == null) ? null : Arrays.copyOf(val, val.length);
}
/**
......@@ -197,7 +199,8 @@ public class SerialStruct implements Struct, Serializable, Cloneable {
public Object[] getAttributes(Map<String,Class<?>> map)
throws SerialException
{
return attribs;
Object[] val = this.attribs;
return (val == null) ? null : Arrays.copyOf(val, val.length);
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册