This commit is contained in:
Chris Hegarty 2013-08-09 14:30:08 +01:00
commit 9b9263731c
580 changed files with 28652 additions and 7680 deletions

View File

@ -222,3 +222,4 @@ ea73f01b9053e7165e7ba80f242bafecbc6af712 jdk8-b96
711eb4aa87de68de78250e0549980936bab53d54 jdk8-b98 711eb4aa87de68de78250e0549980936bab53d54 jdk8-b98
2d3875b0d18b3ad1c2bebf385a697e309e4005a4 jdk8-b99 2d3875b0d18b3ad1c2bebf385a697e309e4005a4 jdk8-b99
3d34036aae4ea90b2ca59712d5a69db3221f0875 jdk8-b100 3d34036aae4ea90b2ca59712d5a69db3221f0875 jdk8-b100
edb01c460d4cab21ff0ff13512df7b746efaa0e7 jdk8-b101

View File

@ -222,3 +222,4 @@ a1c1e8bf71f354f3aec0214cf13d6668811e021d jdk8-b97
0d0c983a817bbe8518a5ff201306334a8de267f2 jdk8-b98 0d0c983a817bbe8518a5ff201306334a8de267f2 jdk8-b98
59dc9da813794c924a0383c2a6241af94defdfed jdk8-b99 59dc9da813794c924a0383c2a6241af94defdfed jdk8-b99
d2dcb110e9dbaf9903c05b211df800e78e4b394e jdk8-b100 d2dcb110e9dbaf9903c05b211df800e78e4b394e jdk8-b100
9f74a220677dc265a724515d8e2617548cef62f1 jdk8-b101

View File

@ -222,3 +222,4 @@ c8286839d0df04aba819ec4bef12b86babccf30e jdk8-b90
3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98 3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98
3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99 3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99
8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100 8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100
a013024b07475782f1fa8e196e950b34b4077663 jdk8-b101

View File

@ -364,3 +364,5 @@ c9dd82da51ed34a28f7c6b3245163ee962e94572 hs25-b40
5787fac72e760c6a5fd9efa113b0c75caf554136 jdk8-b100 5787fac72e760c6a5fd9efa113b0c75caf554136 jdk8-b100
46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43 46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43
f6921c876db192bba389cec062855a66372da01c jdk8-b101 f6921c876db192bba389cec062855a66372da01c jdk8-b101
530fe88b3b2c710f42810b3580d86a0d83ad6c1c hs25-b44
c4697c1c448416108743b59118b4a2498b339d0c jdk8-b102

View File

@ -24,16 +24,20 @@
TYPE=MINIMAL1 TYPE=MINIMAL1
INCLUDE_JVMTI ?= false # Force all variables to false, overriding any other
INCLUDE_FPROF ?= false # setting that may have occurred in the makefiles. These
INCLUDE_VM_STRUCTS ?= false # can still be overridden by passing the variable as an
INCLUDE_JNI_CHECK ?= false # argument to 'make'
INCLUDE_SERVICES ?= false INCLUDE_JVMTI := false
INCLUDE_MANAGEMENT ?= false INCLUDE_FPROF := false
INCLUDE_ALL_GCS ?= false INCLUDE_VM_STRUCTS := false
INCLUDE_NMT ?= false INCLUDE_JNI_CHECK := false
INCLUDE_TRACE ?= false INCLUDE_SERVICES := false
INCLUDE_CDS ?= false INCLUDE_MANAGEMENT := false
INCLUDE_ALL_GCS := false
INCLUDE_NMT := false
INCLUDE_TRACE := false
INCLUDE_CDS := false
CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013
HS_MAJOR_VER=25 HS_MAJOR_VER=25
HS_MINOR_VER=0 HS_MINOR_VER=0
HS_BUILD_NUMBER=43 HS_BUILD_NUMBER=44
JDK_MAJOR_VER=1 JDK_MAJOR_VER=1
JDK_MINOR_VER=8 JDK_MINOR_VER=8

View File

@ -24,16 +24,20 @@
TYPE=MINIMAL1 TYPE=MINIMAL1
INCLUDE_JVMTI ?= false # Force all variables to false, overriding any other
INCLUDE_FPROF ?= false # setting that may have occurred in the makefiles. These
INCLUDE_VM_STRUCTS ?= false # can still be overridden by passing the variable as an
INCLUDE_JNI_CHECK ?= false # argument to 'make'
INCLUDE_SERVICES ?= false INCLUDE_JVMTI := false
INCLUDE_MANAGEMENT ?= false INCLUDE_FPROF := false
INCLUDE_ALL_GCS ?= false INCLUDE_VM_STRUCTS := false
INCLUDE_NMT ?= false INCLUDE_JNI_CHECK := false
INCLUDE_TRACE ?= false INCLUDE_SERVICES := false
INCLUDE_CDS ?= false INCLUDE_MANAGEMENT := false
INCLUDE_ALL_GCS := false
INCLUDE_NMT := false
INCLUDE_TRACE := false
INCLUDE_CDS := false
CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"

View File

@ -42,7 +42,7 @@ define_pd_global(bool, ProfileInterpreter, false);
#else #else
define_pd_global(bool, ProfileInterpreter, true); define_pd_global(bool, ProfileInterpreter, true);
#endif // CC_INTERP #endif // CC_INTERP
define_pd_global(bool, TieredCompilation, false); define_pd_global(bool, TieredCompilation, trueInTiered);
define_pd_global(intx, CompileThreshold, 10000); define_pd_global(intx, CompileThreshold, 10000);
define_pd_global(intx, BackEdgeThreshold, 140000); define_pd_global(intx, BackEdgeThreshold, 140000);

View File

@ -44,7 +44,7 @@ define_pd_global(bool, ProfileInterpreter, false);
#else #else
define_pd_global(bool, ProfileInterpreter, true); define_pd_global(bool, ProfileInterpreter, true);
#endif // CC_INTERP #endif // CC_INTERP
define_pd_global(bool, TieredCompilation, false); define_pd_global(bool, TieredCompilation, trueInTiered);
define_pd_global(intx, CompileThreshold, 10000); define_pd_global(intx, CompileThreshold, 10000);
define_pd_global(intx, BackEdgeThreshold, 100000); define_pd_global(intx, BackEdgeThreshold, 100000);

View File

@ -299,7 +299,7 @@ class CompileReplay : public StackObj {
Symbol* method_signature = parse_symbol(CHECK_NULL); Symbol* method_signature = parse_symbol(CHECK_NULL);
Method* m = k->find_method(method_name, method_signature); Method* m = k->find_method(method_name, method_signature);
if (m == NULL) { if (m == NULL) {
report_error("can't find method"); report_error("Can't find method");
} }
return m; return m;
} }
@ -398,8 +398,8 @@ class CompileReplay : public StackObj {
// compile <klass> <name> <signature> <entry_bci> <comp_level> // compile <klass> <name> <signature> <entry_bci> <comp_level>
void process_compile(TRAPS) { void process_compile(TRAPS) {
// methodHandle method;
Method* method = parse_method(CHECK); Method* method = parse_method(CHECK);
if (had_error()) return;
int entry_bci = parse_int("entry_bci"); int entry_bci = parse_int("entry_bci");
const char* comp_level_label = "comp_level"; const char* comp_level_label = "comp_level";
int comp_level = parse_int(comp_level_label); int comp_level = parse_int(comp_level_label);
@ -440,6 +440,7 @@ class CompileReplay : public StackObj {
// //
void process_ciMethod(TRAPS) { void process_ciMethod(TRAPS) {
Method* method = parse_method(CHECK); Method* method = parse_method(CHECK);
if (had_error()) return;
ciMethodRecord* rec = new_ciMethod(method); ciMethodRecord* rec = new_ciMethod(method);
rec->invocation_counter = parse_int("invocation_counter"); rec->invocation_counter = parse_int("invocation_counter");
rec->backedge_counter = parse_int("backedge_counter"); rec->backedge_counter = parse_int("backedge_counter");
@ -451,6 +452,7 @@ class CompileReplay : public StackObj {
// ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length> // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length>
void process_ciMethodData(TRAPS) { void process_ciMethodData(TRAPS) {
Method* method = parse_method(CHECK); Method* method = parse_method(CHECK);
if (had_error()) return;
/* jsut copied from Method, to build interpret data*/ /* jsut copied from Method, to build interpret data*/
if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) { if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
return; return;

View File

@ -122,6 +122,22 @@ class MarkRefsIntoClosure: public CMSOopsInGenClosure {
} }
}; };
class Par_MarkRefsIntoClosure: public CMSOopsInGenClosure {
private:
const MemRegion _span;
CMSBitMap* _bitMap;
protected:
DO_OOP_WORK_DEFN
public:
Par_MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
Prefetch::style prefetch_style() {
return Prefetch::do_read;
}
};
// A variant of the above used in certain kinds of CMS // A variant of the above used in certain kinds of CMS
// marking verification. // marking verification.
class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure { class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure {

View File

@ -569,6 +569,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
_restart_addr(NULL), _restart_addr(NULL),
_overflow_list(NULL), _overflow_list(NULL),
_stats(cmsGen), _stats(cmsGen),
_eden_chunk_lock(new Mutex(Mutex::leaf + 1, "CMS_eden_chunk_lock", true)),
_eden_chunk_array(NULL), // may be set in ctor body _eden_chunk_array(NULL), // may be set in ctor body
_eden_chunk_capacity(0), // -- ditto -- _eden_chunk_capacity(0), // -- ditto --
_eden_chunk_index(0), // -- ditto -- _eden_chunk_index(0), // -- ditto --
@ -732,7 +733,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
assert(_eden_chunk_array != NULL || _eden_chunk_capacity == 0, "Error"); assert(_eden_chunk_array != NULL || _eden_chunk_capacity == 0, "Error");
// Support for parallelizing survivor space rescan // Support for parallelizing survivor space rescan
if (CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) { if ((CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) || CMSParallelInitialMarkEnabled) {
const size_t max_plab_samples = const size_t max_plab_samples =
((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize; ((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize;
@ -2137,6 +2138,39 @@ void CMSCollector::do_mark_sweep_work(bool clear_all_soft_refs,
} }
void CMSCollector::print_eden_and_survivor_chunk_arrays() {
DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
EdenSpace* eden_space = dng->eden();
ContiguousSpace* from_space = dng->from();
ContiguousSpace* to_space = dng->to();
// Eden
if (_eden_chunk_array != NULL) {
gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
eden_space->bottom(), eden_space->top(),
eden_space->end(), eden_space->capacity());
gclog_or_tty->print_cr("_eden_chunk_index=" SIZE_FORMAT ", "
"_eden_chunk_capacity=" SIZE_FORMAT,
_eden_chunk_index, _eden_chunk_capacity);
for (size_t i = 0; i < _eden_chunk_index; i++) {
gclog_or_tty->print_cr("_eden_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
i, _eden_chunk_array[i]);
}
}
// Survivor
if (_survivor_chunk_array != NULL) {
gclog_or_tty->print_cr("survivor " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
from_space->bottom(), from_space->top(),
from_space->end(), from_space->capacity());
gclog_or_tty->print_cr("_survivor_chunk_index=" SIZE_FORMAT ", "
"_survivor_chunk_capacity=" SIZE_FORMAT,
_survivor_chunk_index, _survivor_chunk_capacity);
for (size_t i = 0; i < _survivor_chunk_index; i++) {
gclog_or_tty->print_cr("_survivor_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
i, _survivor_chunk_array[i]);
}
}
}
void CMSCollector::getFreelistLocks() const { void CMSCollector::getFreelistLocks() const {
// Get locks for all free lists in all generations that this // Get locks for all free lists in all generations that this
// collector is responsible for // collector is responsible for
@ -3549,6 +3583,31 @@ CMSPhaseAccounting::~CMSPhaseAccounting() {
// CMS work // CMS work
// The common parts of CMSParInitialMarkTask and CMSParRemarkTask.
class CMSParMarkTask : public AbstractGangTask {
protected:
CMSCollector* _collector;
int _n_workers;
CMSParMarkTask(const char* name, CMSCollector* collector, int n_workers) :
AbstractGangTask(name),
_collector(collector),
_n_workers(n_workers) {}
// Work method in support of parallel rescan ... of young gen spaces
void do_young_space_rescan(uint worker_id, OopsInGenClosure* cl,
ContiguousSpace* space,
HeapWord** chunk_array, size_t chunk_top);
void work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl);
};
// Parallel initial mark task
class CMSParInitialMarkTask: public CMSParMarkTask {
public:
CMSParInitialMarkTask(CMSCollector* collector, int n_workers) :
CMSParMarkTask("Scan roots and young gen for initial mark in parallel",
collector, n_workers) {}
void work(uint worker_id);
};
// Checkpoint the roots into this generation from outside // Checkpoint the roots into this generation from outside
// this generation. [Note this initial checkpoint need only // this generation. [Note this initial checkpoint need only
// be approximate -- we'll do a catch up phase subsequently.] // be approximate -- we'll do a catch up phase subsequently.]
@ -3646,19 +3705,42 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) {
// the klasses. The claimed marks need to be cleared before marking starts. // the klasses. The claimed marks need to be cleared before marking starts.
ClassLoaderDataGraph::clear_claimed_marks(); ClassLoaderDataGraph::clear_claimed_marks();
CMKlassClosure klass_closure(&notOlder); if (CMSPrintEdenSurvivorChunks) {
print_eden_and_survivor_chunk_arrays();
}
{ {
COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;) COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. if (CMSParallelInitialMarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
gch->gen_process_strong_roots(_cmsGen->level(), // The parallel version.
true, // younger gens are roots FlexibleWorkGang* workers = gch->workers();
true, // activate StrongRootsScope assert(workers != NULL, "Need parallel worker threads.");
false, // not scavenging int n_workers = workers->active_workers();
SharedHeap::ScanningOption(roots_scanning_options()), CMSParInitialMarkTask tsk(this, n_workers);
&notOlder, gch->set_par_threads(n_workers);
true, // walk all of code cache if (so & SO_CodeCache) initialize_sequential_subtasks_for_young_gen_rescan(n_workers);
NULL, if (n_workers > 1) {
&klass_closure); GenCollectedHeap::StrongRootsScope srs(gch);
workers->run_task(&tsk);
} else {
GenCollectedHeap::StrongRootsScope srs(gch);
tsk.work(0);
}
gch->set_par_threads(0);
} else {
// The serial version.
CMKlassClosure klass_closure(&notOlder);
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
gch->gen_process_strong_roots(_cmsGen->level(),
true, // younger gens are roots
true, // activate StrongRootsScope
false, // not scavenging
SharedHeap::ScanningOption(roots_scanning_options()),
&notOlder,
true, // walk all of code cache if (so & SO_CodeCache)
NULL,
&klass_closure);
}
} }
// Clear mod-union table; it will be dirtied in the prologue of // Clear mod-union table; it will be dirtied in the prologue of
@ -4417,7 +4499,9 @@ void CMSCollector::preclean() {
verify_overflow_empty(); verify_overflow_empty();
_abort_preclean = false; _abort_preclean = false;
if (CMSPrecleaningEnabled) { if (CMSPrecleaningEnabled) {
_eden_chunk_index = 0; if (!CMSEdenChunksRecordAlways) {
_eden_chunk_index = 0;
}
size_t used = get_eden_used(); size_t used = get_eden_used();
size_t capacity = get_eden_capacity(); size_t capacity = get_eden_capacity();
// Don't start sampling unless we will get sufficiently // Don't start sampling unless we will get sufficiently
@ -4526,7 +4610,9 @@ void CMSCollector::sample_eden() {
if (!_start_sampling) { if (!_start_sampling) {
return; return;
} }
if (_eden_chunk_array) { // When CMSEdenChunksRecordAlways is true, the eden chunk array
// is populated by the young generation.
if (_eden_chunk_array != NULL && !CMSEdenChunksRecordAlways) {
if (_eden_chunk_index < _eden_chunk_capacity) { if (_eden_chunk_index < _eden_chunk_capacity) {
_eden_chunk_array[_eden_chunk_index] = *_top_addr; // take sample _eden_chunk_array[_eden_chunk_index] = *_top_addr; // take sample
assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr, assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr,
@ -5010,6 +5096,10 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch,
// Update the saved marks which may affect the root scans. // Update the saved marks which may affect the root scans.
gch->save_marks(); gch->save_marks();
if (CMSPrintEdenSurvivorChunks) {
print_eden_and_survivor_chunk_arrays();
}
{ {
COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;) COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
@ -5116,10 +5206,53 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch,
} }
} }
void CMSParInitialMarkTask::work(uint worker_id) {
elapsedTimer _timer;
ResourceMark rm;
HandleMark hm;
// ---------- scan from roots --------------
_timer.start();
GenCollectedHeap* gch = GenCollectedHeap::heap();
Par_MarkRefsIntoClosure par_mri_cl(_collector->_span, &(_collector->_markBitMap));
CMKlassClosure klass_closure(&par_mri_cl);
// ---------- young gen roots --------------
{
work_on_young_gen_roots(worker_id, &par_mri_cl);
_timer.stop();
if (PrintCMSStatistics != 0) {
gclog_or_tty->print_cr(
"Finished young gen initial mark scan work in %dth thread: %3.3f sec",
worker_id, _timer.seconds());
}
}
// ---------- remaining roots --------------
_timer.reset();
_timer.start();
gch->gen_process_strong_roots(_collector->_cmsGen->level(),
false, // yg was scanned above
false, // this is parallel code
false, // not scavenging
SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
&par_mri_cl,
true, // walk all of code cache if (so & SO_CodeCache)
NULL,
&klass_closure);
assert(_collector->should_unload_classes()
|| (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_CodeCache),
"if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
_timer.stop();
if (PrintCMSStatistics != 0) {
gclog_or_tty->print_cr(
"Finished remaining root initial mark scan work in %dth thread: %3.3f sec",
worker_id, _timer.seconds());
}
}
// Parallel remark task // Parallel remark task
class CMSParRemarkTask: public AbstractGangTask { class CMSParRemarkTask: public CMSParMarkTask {
CMSCollector* _collector;
int _n_workers;
CompactibleFreeListSpace* _cms_space; CompactibleFreeListSpace* _cms_space;
// The per-thread work queues, available here for stealing. // The per-thread work queues, available here for stealing.
@ -5133,10 +5266,9 @@ class CMSParRemarkTask: public AbstractGangTask {
CompactibleFreeListSpace* cms_space, CompactibleFreeListSpace* cms_space,
int n_workers, FlexibleWorkGang* workers, int n_workers, FlexibleWorkGang* workers,
OopTaskQueueSet* task_queues): OopTaskQueueSet* task_queues):
AbstractGangTask("Rescan roots and grey objects in parallel"), CMSParMarkTask("Rescan roots and grey objects in parallel",
_collector(collector), collector, n_workers),
_cms_space(cms_space), _cms_space(cms_space),
_n_workers(n_workers),
_task_queues(task_queues), _task_queues(task_queues),
_term(n_workers, task_queues) { } _term(n_workers, task_queues) { }
@ -5150,11 +5282,6 @@ class CMSParRemarkTask: public AbstractGangTask {
void work(uint worker_id); void work(uint worker_id);
private: private:
// Work method in support of parallel rescan ... of young gen spaces
void do_young_space_rescan(int i, Par_MarkRefsIntoAndScanClosure* cl,
ContiguousSpace* space,
HeapWord** chunk_array, size_t chunk_top);
// ... of dirty cards in old space // ... of dirty cards in old space
void do_dirty_card_rescan_tasks(CompactibleFreeListSpace* sp, int i, void do_dirty_card_rescan_tasks(CompactibleFreeListSpace* sp, int i,
Par_MarkRefsIntoAndScanClosure* cl); Par_MarkRefsIntoAndScanClosure* cl);
@ -5186,6 +5313,25 @@ class RemarkKlassClosure : public KlassClosure {
} }
}; };
void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) {
DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
EdenSpace* eden_space = dng->eden();
ContiguousSpace* from_space = dng->from();
ContiguousSpace* to_space = dng->to();
HeapWord** eca = _collector->_eden_chunk_array;
size_t ect = _collector->_eden_chunk_index;
HeapWord** sca = _collector->_survivor_chunk_array;
size_t sct = _collector->_survivor_chunk_index;
assert(ect <= _collector->_eden_chunk_capacity, "out of bounds");
assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds");
do_young_space_rescan(worker_id, cl, to_space, NULL, 0);
do_young_space_rescan(worker_id, cl, from_space, sca, sct);
do_young_space_rescan(worker_id, cl, eden_space, eca, ect);
}
// work_queue(i) is passed to the closure // work_queue(i) is passed to the closure
// Par_MarkRefsIntoAndScanClosure. The "i" parameter // Par_MarkRefsIntoAndScanClosure. The "i" parameter
// also is passed to do_dirty_card_rescan_tasks() and to // also is passed to do_dirty_card_rescan_tasks() and to
@ -5210,23 +5356,7 @@ void CMSParRemarkTask::work(uint worker_id) {
// work first. // work first.
// ---------- young gen roots -------------- // ---------- young gen roots --------------
{ {
DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration(); work_on_young_gen_roots(worker_id, &par_mrias_cl);
EdenSpace* eden_space = dng->eden();
ContiguousSpace* from_space = dng->from();
ContiguousSpace* to_space = dng->to();
HeapWord** eca = _collector->_eden_chunk_array;
size_t ect = _collector->_eden_chunk_index;
HeapWord** sca = _collector->_survivor_chunk_array;
size_t sct = _collector->_survivor_chunk_index;
assert(ect <= _collector->_eden_chunk_capacity, "out of bounds");
assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds");
do_young_space_rescan(worker_id, &par_mrias_cl, to_space, NULL, 0);
do_young_space_rescan(worker_id, &par_mrias_cl, from_space, sca, sct);
do_young_space_rescan(worker_id, &par_mrias_cl, eden_space, eca, ect);
_timer.stop(); _timer.stop();
if (PrintCMSStatistics != 0) { if (PrintCMSStatistics != 0) {
gclog_or_tty->print_cr( gclog_or_tty->print_cr(
@ -5334,8 +5464,8 @@ void CMSParRemarkTask::work(uint worker_id) {
// Note that parameter "i" is not used. // Note that parameter "i" is not used.
void void
CMSParRemarkTask::do_young_space_rescan(int i, CMSParMarkTask::do_young_space_rescan(uint worker_id,
Par_MarkRefsIntoAndScanClosure* cl, ContiguousSpace* space, OopsInGenClosure* cl, ContiguousSpace* space,
HeapWord** chunk_array, size_t chunk_top) { HeapWord** chunk_array, size_t chunk_top) {
// Until all tasks completed: // Until all tasks completed:
// . claim an unclaimed task // . claim an unclaimed task
@ -5530,6 +5660,32 @@ CMSParRemarkTask::do_work_steal(int i, Par_MarkRefsIntoAndScanClosure* cl,
"Else our work is not yet done"); "Else our work is not yet done");
} }
// Record object boundaries in _eden_chunk_array by sampling the eden
// top in the slow-path eden object allocation code path and record
// the boundaries, if CMSEdenChunksRecordAlways is true. If
// CMSEdenChunksRecordAlways is false, we use the other asynchronous
// sampling in sample_eden() that activates during the part of the
// preclean phase.
void CMSCollector::sample_eden_chunk() {
if (CMSEdenChunksRecordAlways && _eden_chunk_array != NULL) {
if (_eden_chunk_lock->try_lock()) {
// Record a sample. This is the critical section. The contents
// of the _eden_chunk_array have to be non-decreasing in the
// address order.
_eden_chunk_array[_eden_chunk_index] = *_top_addr;
assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr,
"Unexpected state of Eden");
if (_eden_chunk_index == 0 ||
((_eden_chunk_array[_eden_chunk_index] > _eden_chunk_array[_eden_chunk_index-1]) &&
(pointer_delta(_eden_chunk_array[_eden_chunk_index],
_eden_chunk_array[_eden_chunk_index-1]) >= CMSSamplingGrain))) {
_eden_chunk_index++; // commit sample
}
_eden_chunk_lock->unlock();
}
}
}
// Return a thread-local PLAB recording array, as appropriate. // Return a thread-local PLAB recording array, as appropriate.
void* CMSCollector::get_data_recorder(int thr_num) { void* CMSCollector::get_data_recorder(int thr_num) {
if (_survivor_plab_array != NULL && if (_survivor_plab_array != NULL &&
@ -5553,12 +5709,13 @@ void CMSCollector::reset_survivor_plab_arrays() {
// Merge the per-thread plab arrays into the global survivor chunk // Merge the per-thread plab arrays into the global survivor chunk
// array which will provide the partitioning of the survivor space // array which will provide the partitioning of the survivor space
// for CMS rescan. // for CMS initial scan and rescan.
void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv, void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv,
int no_of_gc_threads) { int no_of_gc_threads) {
assert(_survivor_plab_array != NULL, "Error"); assert(_survivor_plab_array != NULL, "Error");
assert(_survivor_chunk_array != NULL, "Error"); assert(_survivor_chunk_array != NULL, "Error");
assert(_collectorState == FinalMarking, "Error"); assert(_collectorState == FinalMarking ||
(CMSParallelInitialMarkEnabled && _collectorState == InitialMarking), "Error");
for (int j = 0; j < no_of_gc_threads; j++) { for (int j = 0; j < no_of_gc_threads; j++) {
_cursor[j] = 0; _cursor[j] = 0;
} }
@ -5621,7 +5778,7 @@ void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv,
} }
// Set up the space's par_seq_tasks structure for work claiming // Set up the space's par_seq_tasks structure for work claiming
// for parallel rescan of young gen. // for parallel initial scan and rescan of young gen.
// See ParRescanTask where this is currently used. // See ParRescanTask where this is currently used.
void void
CMSCollector:: CMSCollector::
@ -6748,6 +6905,28 @@ void MarkRefsIntoClosure::do_oop(oop obj) {
void MarkRefsIntoClosure::do_oop(oop* p) { MarkRefsIntoClosure::do_oop_work(p); } void MarkRefsIntoClosure::do_oop(oop* p) { MarkRefsIntoClosure::do_oop_work(p); }
void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_work(p); } void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_work(p); }
Par_MarkRefsIntoClosure::Par_MarkRefsIntoClosure(
MemRegion span, CMSBitMap* bitMap):
_span(span),
_bitMap(bitMap)
{
assert(_ref_processor == NULL, "deliberately left NULL");
assert(_bitMap->covers(_span), "_bitMap/_span mismatch");
}
void Par_MarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
assert(obj->is_oop(), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
// this should be made more efficient
_bitMap->par_mark(addr);
}
}
void Par_MarkRefsIntoClosure::do_oop(oop* p) { Par_MarkRefsIntoClosure::do_oop_work(p); }
void Par_MarkRefsIntoClosure::do_oop(narrowOop* p) { Par_MarkRefsIntoClosure::do_oop_work(p); }
// A variant of the above, used for CMS marking verification. // A variant of the above, used for CMS marking verification.
MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure( MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure(
MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm): MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm):
@ -9305,7 +9484,6 @@ void ASConcurrentMarkSweepGeneration::shrink_by(size_t desired_bytes) {
return; return;
} }
} }
// Transfer some number of overflown objects to usual marking // Transfer some number of overflown objects to usual marking
// stack. Return true if some objects were transferred. // stack. Return true if some objects were transferred.
bool MarkRefsIntoAndScanClosure::take_from_overflow_list() { bool MarkRefsIntoAndScanClosure::take_from_overflow_list() {
@ -9377,4 +9555,3 @@ TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorSt
ShouldNotReachHere(); ShouldNotReachHere();
} }
} }

View File

@ -515,6 +515,8 @@ class CMSCollector: public CHeapObj<mtGC> {
friend class ConcurrentMarkSweepThread; friend class ConcurrentMarkSweepThread;
friend class ConcurrentMarkSweepGeneration; friend class ConcurrentMarkSweepGeneration;
friend class CompactibleFreeListSpace; friend class CompactibleFreeListSpace;
friend class CMSParMarkTask;
friend class CMSParInitialMarkTask;
friend class CMSParRemarkTask; friend class CMSParRemarkTask;
friend class CMSConcMarkingTask; friend class CMSConcMarkingTask;
friend class CMSRefProcTaskProxy; friend class CMSRefProcTaskProxy;
@ -749,6 +751,7 @@ class CMSCollector: public CHeapObj<mtGC> {
Generation* _young_gen; // the younger gen Generation* _young_gen; // the younger gen
HeapWord** _top_addr; // ... Top of Eden HeapWord** _top_addr; // ... Top of Eden
HeapWord** _end_addr; // ... End of Eden HeapWord** _end_addr; // ... End of Eden
Mutex* _eden_chunk_lock;
HeapWord** _eden_chunk_array; // ... Eden partitioning array HeapWord** _eden_chunk_array; // ... Eden partitioning array
size_t _eden_chunk_index; // ... top (exclusive) of array size_t _eden_chunk_index; // ... top (exclusive) of array
size_t _eden_chunk_capacity; // ... max entries in array size_t _eden_chunk_capacity; // ... max entries in array
@ -950,6 +953,7 @@ class CMSCollector: public CHeapObj<mtGC> {
// Support for parallel remark of survivor space // Support for parallel remark of survivor space
void* get_data_recorder(int thr_num); void* get_data_recorder(int thr_num);
void sample_eden_chunk();
CMSBitMap* markBitMap() { return &_markBitMap; } CMSBitMap* markBitMap() { return &_markBitMap; }
void directAllocated(HeapWord* start, size_t size); void directAllocated(HeapWord* start, size_t size);
@ -1027,6 +1031,8 @@ class CMSCollector: public CHeapObj<mtGC> {
// Initialization errors // Initialization errors
bool completed_initialization() { return _completed_initialization; } bool completed_initialization() { return _completed_initialization; }
void print_eden_and_survivor_chunk_arrays();
}; };
class CMSExpansionCause : public AllStatic { class CMSExpansionCause : public AllStatic {
@ -1317,6 +1323,10 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
//Delegate to collector //Delegate to collector
return collector()->get_data_recorder(thr_num); return collector()->get_data_recorder(thr_num);
} }
void sample_eden_chunk() {
//Delegate to collector
return collector()->sample_eden_chunk();
}
// Printing // Printing
const char* name() const; const char* name() const;

View File

@ -96,11 +96,6 @@
"the buffer will be enqueued for processing. A value of 0 " \ "the buffer will be enqueued for processing. A value of 0 " \
"specifies that mutator threads should not do such filtering.") \ "specifies that mutator threads should not do such filtering.") \
\ \
develop(intx, G1ExtraRegionSurvRate, 33, \
"If the young survival rate is S, and there's room left in " \
"to-space, we will allow regions whose survival rate is up to " \
"S + (1 - S)*X, where X is this parameter (as a fraction.)") \
\
develop(bool, G1SATBPrintStubs, false, \ develop(bool, G1SATBPrintStubs, false, \
"If true, print generated stubs for the SATB barrier") \ "If true, print generated stubs for the SATB barrier") \
\ \
@ -110,9 +105,6 @@
develop(bool, G1RSBarrierRegionFilter, true, \ develop(bool, G1RSBarrierRegionFilter, true, \
"If true, generate region filtering code in RS barrier") \ "If true, generate region filtering code in RS barrier") \
\ \
develop(bool, G1RSBarrierNullFilter, true, \
"If true, generate null-pointer filtering code in RS barrier") \
\
develop(bool, G1DeferredRSUpdate, true, \ develop(bool, G1DeferredRSUpdate, true, \
"If true, use deferred RS updates") \ "If true, use deferred RS updates") \
\ \
@ -120,9 +112,6 @@
"If true, verify that no dirty cards remain after RS log " \ "If true, verify that no dirty cards remain after RS log " \
"processing.") \ "processing.") \
\ \
develop(bool, G1RSCountHisto, false, \
"If true, print a histogram of RS occupancies after each pause") \
\
diagnostic(bool, G1PrintRegionLivenessInfo, false, \ diagnostic(bool, G1PrintRegionLivenessInfo, false, \
"Prints the liveness information for all regions in the heap " \ "Prints the liveness information for all regions in the heap " \
"at the end of a marking cycle.") \ "at the end of a marking cycle.") \
@ -169,9 +158,6 @@
product(uintx, G1ConcRSHotCardLimit, 4, \ product(uintx, G1ConcRSHotCardLimit, 4, \
"The threshold that defines (>=) a hot card.") \ "The threshold that defines (>=) a hot card.") \
\ \
develop(bool, G1PrintOopAppls, false, \
"When true, print applications of closures to external locs.") \
\
develop(intx, G1RSetRegionEntriesBase, 256, \ develop(intx, G1RSetRegionEntriesBase, 256, \
"Max number of regions in a fine-grain table per MB.") \ "Max number of regions in a fine-grain table per MB.") \
\ \

View File

@ -314,6 +314,11 @@ void HeapRegion::setup_heap_region_size(uintx min_heap_size) {
region_size = MAX_REGION_SIZE; region_size = MAX_REGION_SIZE;
} }
if (region_size != G1HeapRegionSize) {
// Update the flag to make sure that PrintFlagsFinal logs the correct value
FLAG_SET_ERGO(uintx, G1HeapRegionSize, region_size);
}
// And recalculate the log. // And recalculate the log.
region_size_log = log2_long((jlong) region_size); region_size_log = log2_long((jlong) region_size);

View File

@ -1033,6 +1033,9 @@ HeapWord* DefNewGeneration::allocate(size_t word_size,
// have to use it here, as well. // have to use it here, as well.
HeapWord* result = eden()->par_allocate(word_size); HeapWord* result = eden()->par_allocate(word_size);
if (result != NULL) { if (result != NULL) {
if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
_next_gen->sample_eden_chunk();
}
return result; return result;
} }
do { do {
@ -1063,13 +1066,19 @@ HeapWord* DefNewGeneration::allocate(size_t word_size,
// circular dependency at compile time. // circular dependency at compile time.
if (result == NULL) { if (result == NULL) {
result = allocate_from_space(word_size); result = allocate_from_space(word_size);
} else if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
_next_gen->sample_eden_chunk();
} }
return result; return result;
} }
HeapWord* DefNewGeneration::par_allocate(size_t word_size, HeapWord* DefNewGeneration::par_allocate(size_t word_size,
bool is_tlab) { bool is_tlab) {
return eden()->par_allocate(word_size); HeapWord* res = eden()->par_allocate(word_size);
if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
_next_gen->sample_eden_chunk();
}
return res;
} }
void DefNewGeneration::gc_prologue(bool full) { void DefNewGeneration::gc_prologue(bool full) {

View File

@ -455,6 +455,7 @@ class Generation: public CHeapObj<mtGC> {
// expected to be GC worker thread-local, with the worker index // expected to be GC worker thread-local, with the worker index
// indicated by "thr_num". // indicated by "thr_num".
virtual void* get_data_recorder(int thr_num) { return NULL; } virtual void* get_data_recorder(int thr_num) { return NULL; }
virtual void sample_eden_chunk() {}
// Some generations may require some cleanup actions before allowing // Some generations may require some cleanup actions before allowing
// a verification. // a verification.

View File

@ -2254,10 +2254,11 @@ ChunkIndex ChunkManager::list_index(size_t size) {
void SpaceManager::deallocate(MetaWord* p, size_t word_size) { void SpaceManager::deallocate(MetaWord* p, size_t word_size) {
assert_lock_strong(_lock); assert_lock_strong(_lock);
size_t raw_word_size = get_raw_word_size(word_size);
size_t min_size = TreeChunk<Metablock, FreeList>::min_size(); size_t min_size = TreeChunk<Metablock, FreeList>::min_size();
assert(word_size >= min_size, assert(raw_word_size >= min_size,
err_msg("Should not deallocate dark matter " SIZE_FORMAT, word_size)); err_msg("Should not deallocate dark matter " SIZE_FORMAT, word_size));
block_freelists()->return_block(p, word_size); block_freelists()->return_block(p, raw_word_size);
} }
// Adds a chunk to the list of chunks in use. // Adds a chunk to the list of chunks in use.

View File

@ -65,7 +65,8 @@ SharedHeap::SharedHeap(CollectorPolicy* policy_) :
} }
_sh = this; // ch is static, should be set only once. _sh = this; // ch is static, should be set only once.
if ((UseParNewGC || if ((UseParNewGC ||
(UseConcMarkSweepGC && CMSParallelRemarkEnabled) || (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled ||
CMSParallelRemarkEnabled)) ||
UseG1GC) && UseG1GC) &&
ParallelGCThreads > 0) { ParallelGCThreads > 0) {
_workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads, _workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads,

View File

@ -1891,6 +1891,10 @@ void Arguments::check_deprecated_gc_flags() {
warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated" warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
"and will likely be removed in future release"); "and will likely be removed in future release");
} }
if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) {
warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
"Use MaxRAMFraction instead.");
}
} }
// Check stack pages settings // Check stack pages settings

View File

@ -1689,6 +1689,9 @@ class CommandLineFlags {
product(bool, CMSAbortSemantics, false, \ product(bool, CMSAbortSemantics, false, \
"Whether abort-on-overflow semantics is implemented") \ "Whether abort-on-overflow semantics is implemented") \
\ \
product(bool, CMSParallelInitialMarkEnabled, true, \
"Use the parallel initial mark.") \
\
product(bool, CMSParallelRemarkEnabled, true, \ product(bool, CMSParallelRemarkEnabled, true, \
"Whether parallel remark enabled (only if ParNewGC)") \ "Whether parallel remark enabled (only if ParNewGC)") \
\ \
@ -1700,6 +1703,14 @@ class CommandLineFlags {
"Whether to always record survivor space PLAB bdries" \ "Whether to always record survivor space PLAB bdries" \
" (effective only if CMSParallelSurvivorRemarkEnabled)") \ " (effective only if CMSParallelSurvivorRemarkEnabled)") \
\ \
product(bool, CMSEdenChunksRecordAlways, true, \
"Whether to always record eden chunks used for " \
"the parallel initial mark or remark of eden" ) \
\
product(bool, CMSPrintEdenSurvivorChunks, false, \
"Print the eden and the survivor chunks used for the parallel " \
"initial mark or remark of the eden/survivor spaces") \
\
product(bool, CMSConcurrentMTEnabled, true, \ product(bool, CMSConcurrentMTEnabled, true, \
"Whether multi-threaded concurrent work enabled (if ParNewGC)") \ "Whether multi-threaded concurrent work enabled (if ParNewGC)") \
\ \

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2013, 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.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test TestG1HeapRegionSize
* @key gc
* @bug 8021879
* @summary Verify that the flag G1HeapRegionSize is updated properly
* @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576
* @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152
* @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152
* @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432
*/
import sun.management.ManagementFactoryHelper;
import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.management.VMOption;
public class TestG1HeapRegionSize {
public static void main(String[] args) {
HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
VMOption option = diagnostic.getVMOption("UseG1GC");
if (option.getValue().equals("false")) {
System.out.println("Skipping this test. It is only a G1 test.");
return;
}
String expectedValue = getExpectedValue(args);
option = diagnostic.getVMOption("G1HeapRegionSize");
if (!expectedValue.equals(option.getValue())) {
throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
}
}
private static String getExpectedValue(String[] args) {
if (args.length != 1) {
throw new RuntimeException("Wrong number of arguments. Expected 1 but got " + args.length);
}
return args[0];
}
}

View File

@ -27,7 +27,7 @@
* @bug 8014240 * @bug 8014240
* @summary Test output of G1PrintRegionRememberedSetInfo * @summary Test output of G1PrintRegionRememberedSetInfo
* @library /testlibrary * @library /testlibrary
* @build TestPrintRegionRememberedSetInfo * @run main TestPrintRegionRememberedSetInfo
* @author thomas.schatzl@oracle.com * @author thomas.schatzl@oracle.com
*/ */

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2013, 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.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test TestDefaultMaxRAMFraction
* @key gc
* @bug 8021967
* @summary Test that the deprecated TestDefaultMaxRAMFraction flag print a warning message
* @library /testlibrary
*/
import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.ProcessTools;
public class TestDefaultMaxRAMFraction {
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:DefaultMaxRAMFraction=4", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("warning: DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. Use MaxRAMFraction instead.");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
}

View File

@ -3,6 +3,7 @@
## ##
## @test Test6929067.sh ## @test Test6929067.sh
## @bug 6929067 ## @bug 6929067
## @bug 8021296
## @summary Stack guard pages should be removed when thread is detached ## @summary Stack guard pages should be removed when thread is detached
## @compile T.java ## @compile T.java
## @run shell Test6929067.sh ## @run shell Test6929067.sh
@ -21,6 +22,11 @@ echo "TESTSRC=${TESTSRC}"
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
Linux) Linux)
gcc_cmd=`which gcc`
if [ "x$gcc_cmd" == "x" ]; then
echo "WARNING: gcc not found. Cannot execute test." 2>&1
exit 0;
fi
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
@ -119,10 +125,10 @@ echo "VM type: ${VMTYPE}"
# Check to ensure you have a /usr/lib/libpthread.so if you don't please look # Check to ensure you have a /usr/lib/libpthread.so if you don't please look
# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation. # for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
gcc -DLINUX ${COMP_FLAG} -o invoke \ $gcc_cmd -DLINUX ${COMP_FLAG} -o invoke \
-I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \ -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
-L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \ -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
-ljvm -lpthread invoke.c -ljvm -lpthread invoke.c
./invoke ./invoke
exit $? exit $?

View File

@ -27,6 +27,7 @@
## ##
## @test Test7107135.sh ## @test Test7107135.sh
## @bug 7107135 ## @bug 7107135
## @bug 8021296
## @summary Stack guard pages lost after loading library with executable stack. ## @summary Stack guard pages lost after loading library with executable stack.
## @run shell Test7107135.sh ## @run shell Test7107135.sh
## ##
@ -45,6 +46,11 @@ OS=`uname -s`
case "$OS" in case "$OS" in
Linux) Linux)
echo "Testing on Linux" echo "Testing on Linux"
gcc_cmd=`which gcc`
if [ "x$gcc_cmd" == "x" ]; then
echo "WARNING: gcc not found. Cannot execute test." 2>&1
exit 0;
fi
;; ;;
*) *)
NULL=NUL NULL=NUL
@ -62,7 +68,10 @@ THIS_DIR=.
cp ${TESTSRC}${FS}*.java ${THIS_DIR} cp ${TESTSRC}${FS}*.java ${THIS_DIR}
${TESTJAVA}${FS}bin${FS}javac *.java ${TESTJAVA}${FS}bin${FS}javac *.java
gcc -fPIC -shared -c -o test.o -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux ${TESTSRC}${FS}test.c $gcc_cmd -fPIC -shared -c -o test.o \
-I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \
${TESTSRC}${FS}test.c
ld -shared -z execstack -o libtest-rwx.so test.o ld -shared -z execstack -o libtest-rwx.so test.o
ld -shared -z noexecstack -o libtest-rw.so test.o ld -shared -z noexecstack -o libtest-rw.so test.o

View File

@ -27,6 +27,7 @@
## @test Test8017498.sh ## @test Test8017498.sh
## @bug 8017498 ## @bug 8017498
## @bug 8020791 ## @bug 8020791
## @bug 8021296
## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX ## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
## @run shell/timeout=30 Test8017498.sh ## @run shell/timeout=30 Test8017498.sh
## ##
@ -45,6 +46,11 @@ OS=`uname -s`
case "$OS" in case "$OS" in
Linux) Linux)
echo "Testing on Linux" echo "Testing on Linux"
gcc_cmd=`which gcc`
if [ "x$gcc_cmd" == "x" ]; then
echo "WARNING: gcc not found. Cannot execute test." 2>&1
exit 0;
fi
if [ "$VM_BITS" = "64" ] if [ "$VM_BITS" = "64" ]
then then
MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so
@ -64,15 +70,11 @@ THIS_DIR=.
cp ${TESTSRC}${FS}*.java ${THIS_DIR} cp ${TESTSRC}${FS}*.java ${THIS_DIR}
${TESTJAVA}${FS}bin${FS}javac *.java ${TESTJAVA}${FS}bin${FS}javac *.java
gcc -DLINUX -fPIC -shared \ $gcc_cmd -DLINUX -fPIC -shared \
-o ${TESTSRC}${FS}libTestJNI.so \ -o ${TESTSRC}${FS}libTestJNI.so \
-I${TESTJAVA}${FS}include \ -I${TESTJAVA}${FS}include \
-I${TESTJAVA}${FS}include${FS}linux \ -I${TESTJAVA}${FS}include${FS}linux \
${TESTSRC}${FS}TestJNI.c ${TESTSRC}${FS}TestJNI.c
if [ $? != 0 ]
then
echo "WARNING: the gcc command failed." 2>&1
fi
# run the java test in the background # run the java test in the background
cmd="LD_PRELOAD=$MY_LD_PRELOAD \ cmd="LD_PRELOAD=$MY_LD_PRELOAD \

View File

@ -21,7 +21,6 @@
* questions. * questions.
*/ */
#define _GNU_SOURCE // for the definition of REG_RIP in ucontext.h
#include <stdio.h> #include <stdio.h>
#include <jni.h> #include <jni.h>
#include <signal.h> #include <signal.h>
@ -32,11 +31,8 @@ extern "C" {
#endif #endif
void sig_handler(int sig, siginfo_t *info, ucontext_t *context) { void sig_handler(int sig, siginfo_t *info, ucontext_t *context) {
int thrNum;
printf( " HANDLER (1) " ); printf( " HANDLER (1) " );
// Move forward RIP to skip failing instruction
context->uc_mcontext.gregs[REG_RIP] += 6;
} }
JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) { JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) {

View File

@ -222,3 +222,4 @@ b8c5f4b6f0fffb44618fc609a584953c4ed67c0b jdk8-b95
15e5bb51bc0cd89304dc2f7f29b4c8002e632353 jdk8-b98 15e5bb51bc0cd89304dc2f7f29b4c8002e632353 jdk8-b98
adf49c3ef83c160d53ece623049b2cdccaf78fc7 jdk8-b99 adf49c3ef83c160d53ece623049b2cdccaf78fc7 jdk8-b99
5d1974c1d7b9a86431bc253dc5a6a52d4586622e jdk8-b100 5d1974c1d7b9a86431bc253dc5a6a52d4586622e jdk8-b100
0a7432f898e579ea35e8c51e3edab37f949168e4 jdk8-b101

View File

@ -112,7 +112,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
/** Initial EntityResolver */ /** Initial EntityResolver */
private final EntityResolver fInitEntityResolver; private final EntityResolver fInitEntityResolver;
private XMLSecurityPropertyManager fSecurityPropertyMgr; private final XMLSecurityPropertyManager fSecurityPropertyMgr;
/** /**
* Create a SAX parser with the associated features * Create a SAX parser with the associated features
@ -130,8 +130,10 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
SAXParserImpl(SAXParserFactoryImpl spf, Hashtable features, boolean secureProcessing) SAXParserImpl(SAXParserFactoryImpl spf, Hashtable features, boolean secureProcessing)
throws SAXException throws SAXException
{ {
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
// Instantiate a SAXParser directly and not through SAX so that we use the right ClassLoader // Instantiate a SAXParser directly and not through SAX so that we use the right ClassLoader
xmlReader = new JAXPSAXParser(this); xmlReader = new JAXPSAXParser(this, fSecurityPropertyMgr);
// JAXP "namespaceAware" == SAX Namespaces feature // JAXP "namespaceAware" == SAX Namespaces feature
// Note: there is a compatibility problem here with default values: // Note: there is a compatibility problem here with default values:
@ -150,7 +152,6 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
xmlReader.setFeature0(XINCLUDE_FEATURE, true); xmlReader.setFeature0(XINCLUDE_FEATURE, true);
} }
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
xmlReader.setProperty0(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); xmlReader.setProperty0(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
// If the secure processing feature is on set a security manager. // If the secure processing feature is on set a security manager.
@ -397,14 +398,30 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
private final HashMap fInitFeatures = new HashMap(); private final HashMap fInitFeatures = new HashMap();
private final HashMap fInitProperties = new HashMap(); private final HashMap fInitProperties = new HashMap();
private final SAXParserImpl fSAXParser; private final SAXParserImpl fSAXParser;
private XMLSecurityPropertyManager fSecurityPropertyMgr;
public JAXPSAXParser() { public JAXPSAXParser() {
this(null); this(null, null);
} }
JAXPSAXParser(SAXParserImpl saxParser) { JAXPSAXParser(SAXParserImpl saxParser, XMLSecurityPropertyManager spm) {
super(); super();
fSAXParser = saxParser; fSAXParser = saxParser;
fSecurityPropertyMgr = spm;
/**
* This class may be used directly. So initialize the security manager if
* it is null.
*/
if (fSecurityPropertyMgr == null) {
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
try {
super.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
} catch (Exception ex) {
//shall not happen
}
}
} }
/** /**
@ -542,9 +559,9 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
setSchemaValidatorProperty(name, value); setSchemaValidatorProperty(name, value);
} }
/** Check to see if the property is managed by the property manager **/ /** Check to see if the property is managed by the property manager **/
int index = fSAXParser.fSecurityPropertyMgr.getIndex(name); int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1;
if (index > -1) { if (index > -1) {
fSAXParser.fSecurityPropertyMgr.setValue(index, fSecurityPropertyMgr.setValue(index,
XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
} else { } else {
if (!fInitProperties.containsKey(name)) { if (!fInitProperties.containsKey(name)) {
@ -564,9 +581,9 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
// JAXP 1.2 support // JAXP 1.2 support
return fSAXParser.schemaLanguage; return fSAXParser.schemaLanguage;
} }
int index = fSAXParser.fSecurityPropertyMgr.getIndex(name); int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1;
if (index > -1) { if (index > -1) {
return fSAXParser.fSecurityPropertyMgr.getValueByIndex(index); return fSecurityPropertyMgr.getValueByIndex(index);
} }
return super.getProperty(name); return super.getProperty(name);

View File

@ -222,3 +222,4 @@ dcde7f049111353ad23175f54985a4f6bfea720c jdk8-b97
b1fb4612a2caea52b5661b87509e560fa044b194 jdk8-b98 b1fb4612a2caea52b5661b87509e560fa044b194 jdk8-b98
8ef83d4b23c933935e28f59b282cea920b1b1f5f jdk8-b99 8ef83d4b23c933935e28f59b282cea920b1b1f5f jdk8-b99
4fd722afae5c02f00bbd44c3a34425ee474afb1c jdk8-b100 4fd722afae5c02f00bbd44c3a34425ee474afb1c jdk8-b100
60b623a361642a0f5aef5f06dad9e5f279b9d9a9 jdk8-b101

View File

@ -222,3 +222,4 @@ a2a2a91075ad85becbe10a39d7fd04ef9bea8df5 jdk8-b92
c4908732fef5235f1b98cafe0ce507771ef7892c jdk8-b98 c4908732fef5235f1b98cafe0ce507771ef7892c jdk8-b98
6a099a36589bd933957272ba63e5263bede29971 jdk8-b99 6a099a36589bd933957272ba63e5263bede29971 jdk8-b99
5be9c5bfcfe9b2a40412b4fb364377d49de014eb jdk8-b100 5be9c5bfcfe9b2a40412b4fb364377d49de014eb jdk8-b100
6901612328239fbd471d20823113c1cf3fdaebee jdk8-b101

View File

@ -31,6 +31,7 @@ import java.awt.peer.MenuComponentPeer;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.MenuBarUI; import javax.swing.plaf.MenuBarUI;
import com.apple.laf.ScreenMenuBar;
import sun.lwawt.macosx.CMenuBar; import sun.lwawt.macosx.CMenuBar;
import com.apple.laf.AquaMenuBarUI; import com.apple.laf.AquaMenuBarUI;
@ -72,12 +73,15 @@ class _AppMenuBarHandler {
// scan the current frames, and see if any are foreground // scan the current frames, and see if any are foreground
final Frame[] frames = Frame.getFrames(); final Frame[] frames = Frame.getFrames();
for (final Frame frame : frames) { for (final Frame frame : frames) {
if (frame.isVisible() && !isFrameMinimized(frame)) return; if (frame.isVisible() && !isFrameMinimized(frame)) {
return;
}
} }
// if we have no foreground frames, then we have to "kick" the menubar // if we have no foreground frames, then we have to "kick" the menubar
final JFrame pingFrame = new JFrame(); final JFrame pingFrame = new JFrame();
pingFrame.getRootPane().putClientProperty("Window.alpha", new Float(0.0f)); pingFrame.getRootPane().putClientProperty("Window.alpha", new Float(0.0f));
pingFrame.setUndecorated(true);
pingFrame.setVisible(true); pingFrame.setVisible(true);
pingFrame.toFront(); pingFrame.toFront();
pingFrame.setVisible(false); pingFrame.setVisible(false);
@ -101,7 +105,6 @@ class _AppMenuBarHandler {
// Aqua was not installed // Aqua was not installed
throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel");
} }
/* TODO: disabled until ScreenMenuBar is working
final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui;
final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar();
@ -118,8 +121,7 @@ class _AppMenuBarHandler {
} }
// grab the pointer to the CMenuBar, and retain it in native // grab the pointer to the CMenuBar, and retain it in native
nativeSetDefaultMenuBar(((CMenuBar)peer).getNativeMenuBarPeer()); nativeSetDefaultMenuBar(((CMenuBar)peer).getModel());
*/
} }
void setAboutMenuItemVisible(final boolean present) { void setAboutMenuItemVisible(final boolean present) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ import java.util.*;
import sun.awt.SunHints; import sun.awt.SunHints;
public class CStrike extends FontStrike { public final class CStrike extends FontStrike {
// Creates the native strike // Creates the native strike
private static native long createNativeStrikePtr(long nativeFontPtr, private static native long createNativeStrikePtr(long nativeFontPtr,
@ -68,10 +68,10 @@ public class CStrike extends FontStrike {
Rectangle2D.Float result, Rectangle2D.Float result,
double x, double y); double x, double y);
private CFont nativeFont; private final CFont nativeFont;
private AffineTransform invDevTx; private AffineTransform invDevTx;
private GlyphInfoCache glyphInfoCache; private final GlyphInfoCache glyphInfoCache;
private GlyphAdvanceCache glyphAdvanceCache; private final GlyphAdvanceCache glyphAdvanceCache;
private long nativeStrikePtr; private long nativeStrikePtr;
CStrike(final CFont font, final FontStrikeDesc inDesc) { CStrike(final CFont font, final FontStrikeDesc inDesc) {
@ -84,11 +84,11 @@ public class CStrike extends FontStrike {
// Normally the device transform should be the identity transform // Normally the device transform should be the identity transform
// for screen operations. The device transform only becomes // for screen operations. The device transform only becomes
// interesting when we are outputting between different dpi surfaces, // interesting when we are outputting between different dpi surfaces,
// like when we are printing to postscript. // like when we are printing to postscript or use retina.
if (inDesc.devTx != null && !inDesc.devTx.isIdentity()) { if (inDesc.devTx != null && !inDesc.devTx.isIdentity()) {
try { try {
invDevTx = inDesc.devTx.createInverse(); invDevTx = inDesc.devTx.createInverse();
} catch (NoninvertibleTransformException e) { } catch (NoninvertibleTransformException ignored) {
// ignored, since device transforms should not be that // ignored, since device transforms should not be that
// complicated, and if they are - there is nothing we can do, // complicated, and if they are - there is nothing we can do,
// so we won't worry about it. // so we won't worry about it.
@ -134,15 +134,13 @@ public class CStrike extends FontStrike {
nativeStrikePtr = 0; nativeStrikePtr = 0;
} }
// the fractional metrics default on our platform is OFF
private boolean useFractionalMetrics() {
return desc.fmHint == SunHints.INTVAL_FRACTIONALMETRICS_ON;
}
@Override
public int getNumGlyphs() { public int getNumGlyphs() {
return nativeFont.getNumGlyphs(); return nativeFont.getNumGlyphs();
} }
@Override
StrikeMetrics getFontMetrics() { StrikeMetrics getFontMetrics() {
if (strikeMetrics == null) { if (strikeMetrics == null) {
StrikeMetrics metrics = getFontMetrics(getNativeStrikePtr()); StrikeMetrics metrics = getFontMetrics(getNativeStrikePtr());
@ -155,74 +153,24 @@ public class CStrike extends FontStrike {
return strikeMetrics; return strikeMetrics;
} }
float getGlyphAdvance(int glyphCode) { @Override
return getScaledAdvanceForAdvance(getCachedNativeGlyphAdvance(glyphCode)); float getGlyphAdvance(final int glyphCode) {
return getCachedNativeGlyphAdvance(glyphCode);
} }
float getCodePointAdvance(int cp) { @Override
float advance = getCachedNativeGlyphAdvance(nativeFont.getMapper().charToGlyph(cp)); float getCodePointAdvance(final int cp) {
return getGlyphAdvance(nativeFont.getMapper().charToGlyph(cp));
double glyphScaleX = desc.glyphTx.getScaleX();
double devScaleX = desc.devTx.getScaleX();
if (devScaleX == 0) {
glyphScaleX = Math.sqrt(desc.glyphTx.getDeterminant());
devScaleX = Math.sqrt(desc.devTx.getDeterminant());
}
if (devScaleX == 0) {
devScaleX = Double.NaN; // this an undefined graphics state
}
advance = (float) (advance * glyphScaleX / devScaleX);
return useFractionalMetrics() ? advance : Math.round(advance);
} }
// calculate an advance, and round if not using fractional metrics @Override
private float getScaledAdvanceForAdvance(float advance) { Point2D.Float getCharMetrics(final char ch) {
if (invDevTx != null) { return getGlyphMetrics(nativeFont.getMapper().charToGlyph(ch));
advance *= invDevTx.getScaleX();
}
advance *= desc.glyphTx.getScaleX();
return useFractionalMetrics() ? advance : Math.round(advance);
} }
Point2D.Float getCharMetrics(char ch) { @Override
return getScaledPointForAdvance(getCachedNativeGlyphAdvance(nativeFont.getMapper().charToGlyph(ch))); Point2D.Float getGlyphMetrics(final int glyphCode) {
} return new Point2D.Float(getGlyphAdvance(glyphCode), 0.0f);
Point2D.Float getGlyphMetrics(int glyphCode) {
return getScaledPointForAdvance(getCachedNativeGlyphAdvance(glyphCode));
}
// calculate an advance point, and round if not using fractional metrics
private Point2D.Float getScaledPointForAdvance(float advance) {
Point2D.Float pt = new Point2D.Float(advance, 0);
if (!desc.glyphTx.isIdentity()) {
return scalePoint(pt);
}
if (!useFractionalMetrics()) {
pt.x = Math.round(pt.x);
}
return pt;
}
private Point2D.Float scalePoint(Point2D.Float pt) {
if (invDevTx != null) {
// transform the point out of the device space first
invDevTx.transform(pt, pt);
}
desc.glyphTx.transform(pt, pt);
pt.x -= desc.glyphTx.getTranslateX();
pt.y -= desc.glyphTx.getTranslateY();
if (!useFractionalMetrics()) {
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
}
return pt;
} }
Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) { Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) {
@ -414,9 +362,7 @@ public class CStrike extends FontStrike {
private SparseBitShiftingTwoLayerArray secondLayerCache; private SparseBitShiftingTwoLayerArray secondLayerCache;
private HashMap<Integer, Long> generalCache; private HashMap<Integer, Long> generalCache;
public GlyphInfoCache(final Font2D nativeFont, GlyphInfoCache(final Font2D nativeFont, final FontStrikeDesc desc) {
final FontStrikeDesc desc)
{
super(nativeFont, desc); super(nativeFont, desc);
firstLayerCache = new long[FIRST_LAYER_SIZE]; firstLayerCache = new long[FIRST_LAYER_SIZE];
} }
@ -527,7 +473,7 @@ public class CStrike extends FontStrike {
final int shift; final int shift;
final int secondLayerLength; final int secondLayerLength;
public SparseBitShiftingTwoLayerArray(final int size, final int shift) { SparseBitShiftingTwoLayerArray(final int size, final int shift) {
this.shift = shift; this.shift = shift;
this.cache = new long[1 << shift][]; this.cache = new long[1 << shift][];
this.secondLayerLength = size >> shift; this.secondLayerLength = size >> shift;
@ -559,6 +505,12 @@ public class CStrike extends FontStrike {
private SparseBitShiftingTwoLayerArray secondLayerCache; private SparseBitShiftingTwoLayerArray secondLayerCache;
private HashMap<Integer, Float> generalCache; private HashMap<Integer, Float> generalCache;
// Empty non private constructor was added because access to this
// class shouldn't be emulated by a synthetic accessor method.
GlyphAdvanceCache() {
super();
}
public synchronized float get(final int index) { public synchronized float get(final int index) {
if (index < 0) { if (index < 0) {
if (-index < SECOND_LAYER_SIZE) { if (-index < SECOND_LAYER_SIZE) {
@ -609,9 +561,7 @@ public class CStrike extends FontStrike {
final int shift; final int shift;
final int secondLayerLength; final int secondLayerLength;
public SparseBitShiftingTwoLayerArray(final int size, SparseBitShiftingTwoLayerArray(final int size, final int shift) {
final int shift)
{
this.shift = shift; this.shift = shift;
this.cache = new float[1 << shift][]; this.cache = new float[1 << shift][];
this.secondLayerLength = size >> shift; this.secondLayerLength = size >> shift;

View File

@ -182,7 +182,11 @@ public class CDataTransferer extends DataTransferer {
Long format = predefinedClipboardNameMap.get(str); Long format = predefinedClipboardNameMap.get(str);
if (format == null) { if (format == null) {
format = new Long(registerFormatWithPasteboard(str)); if (java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
// Do not try to access native system for the unknown format
return -1L;
}
format = registerFormatWithPasteboard(str);
predefinedClipboardNameMap.put(str, format); predefinedClipboardNameMap.put(str, format);
predefinedClipboardFormatMap.put(format, str); predefinedClipboardFormatMap.put(format, str);
} }

View File

@ -43,7 +43,7 @@ public abstract class CMenuComponent implements MenuComponentPeer {
return target; return target;
} }
long getModel() { public long getModel() {
return modelPtr; return modelPtr;
} }

View File

@ -47,7 +47,7 @@ import com.apple.laf.ClientPropertyApplicator.Property;
import com.sun.awt.AWTUtilities; import com.sun.awt.AWTUtilities;
public class CPlatformWindow extends CFRetainedResource implements PlatformWindow { public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h); private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h);
private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data); private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr); private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
private static native Insets nativeGetNSWindowInsets(long nsWindowPtr); private static native Insets nativeGetNSWindowInsets(long nsWindowPtr);
@ -230,7 +230,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
contentView = createContentView(); contentView = createContentView();
contentView.initialize(peer, responder); contentView.initialize(peer, responder);
final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0); final long ownerPtr = owner != null ? owner.getNSWindowPtr() : 0L;
final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), ownerPtr, styleBits, 0, 0, 0, 0);
setPtr(nativeWindowPtr); setPtr(nativeWindowPtr);
if (target instanceof javax.swing.RootPaneContainer) { if (target instanceof javax.swing.RootPaneContainer) {

View File

@ -44,6 +44,7 @@
jint styleBits; jint styleBits;
BOOL isEnabled; BOOL isEnabled;
NSWindow *nsWindow; NSWindow *nsWindow;
AWTWindow *ownerWindow;
} }
// An instance of either AWTWindow_Normal or AWTWindow_Panel // An instance of either AWTWindow_Normal or AWTWindow_Panel
@ -51,12 +52,15 @@
@property (nonatomic, retain) JNFWeakJObjectWrapper *javaPlatformWindow; @property (nonatomic, retain) JNFWeakJObjectWrapper *javaPlatformWindow;
@property (nonatomic, retain) CMenuBar *javaMenuBar; @property (nonatomic, retain) CMenuBar *javaMenuBar;
@property (nonatomic, retain) AWTWindow *ownerWindow;
@property (nonatomic) NSSize javaMinSize; @property (nonatomic) NSSize javaMinSize;
@property (nonatomic) NSSize javaMaxSize; @property (nonatomic) NSSize javaMaxSize;
@property (nonatomic) jint styleBits; @property (nonatomic) jint styleBits;
@property (nonatomic) BOOL isEnabled; @property (nonatomic) BOOL isEnabled;
- (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow
ownerWindow:owner
styleBits:(jint)styleBits styleBits:(jint)styleBits
frameRect:(NSRect)frameRect frameRect:(NSRect)frameRect
contentView:(NSView *)contentView; contentView:(NSView *)contentView;

View File

@ -30,6 +30,7 @@
#import "sun_lwawt_macosx_CPlatformWindow.h" #import "sun_lwawt_macosx_CPlatformWindow.h"
#import "com_apple_eawt_event_GestureHandler.h" #import "com_apple_eawt_event_GestureHandler.h"
#import "com_apple_eawt_FullScreenHandler.h" #import "com_apple_eawt_FullScreenHandler.h"
#import "ApplicationDelegate.h"
#import "AWTWindow.h" #import "AWTWindow.h"
#import "AWTView.h" #import "AWTView.h"
@ -120,6 +121,7 @@ AWT_NS_WINDOW_IMPLEMENTATION
@synthesize javaMaxSize; @synthesize javaMaxSize;
@synthesize styleBits; @synthesize styleBits;
@synthesize isEnabled; @synthesize isEnabled;
@synthesize ownerWindow;
- (void) updateMinMaxSize:(BOOL)resizable { - (void) updateMinMaxSize:(BOOL)resizable {
if (resizable) { if (resizable) {
@ -201,6 +203,7 @@ AWT_NS_WINDOW_IMPLEMENTATION
} }
- (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)platformWindow - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)platformWindow
ownerWindow:owner
styleBits:(jint)bits styleBits:(jint)bits
frameRect:(NSRect)rect frameRect:(NSRect)rect
contentView:(NSView *)view contentView:(NSView *)view
@ -245,6 +248,7 @@ AWT_ASSERT_APPKIT_THREAD;
self.isEnabled = YES; self.isEnabled = YES;
self.javaPlatformWindow = platformWindow; self.javaPlatformWindow = platformWindow;
self.styleBits = bits; self.styleBits = bits;
self.ownerWindow = owner;
[self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)]; [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)];
return self; return self;
@ -350,7 +354,7 @@ AWT_ASSERT_APPKIT_THREAD;
[self.javaPlatformWindow setJObject:nil withEnv:env]; [self.javaPlatformWindow setJObject:nil withEnv:env];
self.nsWindow = nil; self.nsWindow = nil;
self.ownerWindow = nil;
[super dealloc]; [super dealloc];
} }
@ -539,11 +543,27 @@ AWT_ASSERT_APPKIT_THREAD;
AWT_ASSERT_APPKIT_THREAD; AWT_ASSERT_APPKIT_THREAD;
[AWTToolkit eventCountPlusPlus]; [AWTToolkit eventCountPlusPlus];
AWTWindow *opposite = [AWTWindow lastKeyWindow]; AWTWindow *opposite = [AWTWindow lastKeyWindow];
if (!IS(self.styleBits, IS_DIALOG)) {
[CMenuBar activate:self.javaMenuBar modallyDisabled:NO]; // Finds appropriate menubar in our hierarchy,
} else if ((opposite != NULL) && IS(self.styleBits, IS_MODAL)) { AWTWindow *awtWindow = self;
[CMenuBar activate:opposite->javaMenuBar modallyDisabled:YES]; while (awtWindow.ownerWindow != nil) {
awtWindow = awtWindow.ownerWindow;
} }
CMenuBar *menuBar = nil;
BOOL isDisabled = NO;
if ([awtWindow.nsWindow isVisible]){
menuBar = awtWindow.javaMenuBar;
isDisabled = !awtWindow.isEnabled;
}
if (menuBar == nil) {
menuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
isDisabled = NO;
}
[CMenuBar activate:menuBar modallyDisabled:isDisabled];
[AWTWindow setLastKeyWindow:nil]; [AWTWindow setLastKeyWindow:nil];
[self _deliverWindowFocusEvent:YES oppositeWindow: opposite]; [self _deliverWindowFocusEvent:YES oppositeWindow: opposite];
@ -555,6 +575,14 @@ AWT_ASSERT_APPKIT_THREAD;
[AWTToolkit eventCountPlusPlus]; [AWTToolkit eventCountPlusPlus];
[self.javaMenuBar deactivate]; [self.javaMenuBar deactivate];
// In theory, this might cause flickering if the window gaining focus
// has its own menu. However, I couldn't reproduce it on practice, so
// perhaps this is a non issue.
CMenuBar* defaultMenu = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
if (defaultMenu != nil) {
[CMenuBar activate:defaultMenu modallyDisabled:NO];
}
// the new key window // the new key window
NSWindow *keyWindow = [NSApp keyWindow]; NSWindow *keyWindow = [NSApp keyWindow];
AWTWindow *opposite = nil; AWTWindow *opposite = nil;
@ -741,7 +769,7 @@ AWT_ASSERT_APPKIT_THREAD;
* Signature: (JJIIII)J * Signature: (JJIIII)J
*/ */
JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeCreateNSWindow JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeCreateNSWindow
(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h) (JNIEnv *env, jobject obj, jlong contentViewPtr, jlong ownerPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h)
{ {
__block AWTWindow *window = nil; __block AWTWindow *window = nil;
@ -750,13 +778,14 @@ JNF_COCOA_ENTER(env);
JNFWeakJObjectWrapper *platformWindow = [JNFWeakJObjectWrapper wrapperWithJObject:obj withEnv:env]; JNFWeakJObjectWrapper *platformWindow = [JNFWeakJObjectWrapper wrapperWithJObject:obj withEnv:env];
NSView *contentView = OBJC(contentViewPtr); NSView *contentView = OBJC(contentViewPtr);
NSRect frameRect = NSMakeRect(x, y, w, h); NSRect frameRect = NSMakeRect(x, y, w, h);
AWTWindow *owner = [OBJC(ownerPtr) delegate];
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow
styleBits:styleBits ownerWindow:owner
frameRect:frameRect styleBits:styleBits
contentView:contentView]; frameRect:frameRect
contentView:contentView];
// the window is released is CPlatformWindow.nativeDispose() // the window is released is CPlatformWindow.nativeDispose()
if (window) CFRetain(window.nsWindow); if (window) CFRetain(window.nsWindow);
@ -818,11 +847,19 @@ JNF_COCOA_ENTER(env);
AWTWindow *window = (AWTWindow*)[nsWindow delegate]; AWTWindow *window = (AWTWindow*)[nsWindow delegate];
if ([nsWindow isKeyWindow]) [window.javaMenuBar deactivate]; if ([nsWindow isKeyWindow]) {
[window.javaMenuBar deactivate];
}
window.javaMenuBar = menuBar; window.javaMenuBar = menuBar;
CMenuBar* actualMenuBar = menuBar;
if (actualMenuBar == nil) {
actualMenuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
}
if ([nsWindow isKeyWindow]) { if ([nsWindow isKeyWindow]) {
[CMenuBar activate:window.javaMenuBar modallyDisabled:NO]; [CMenuBar activate:actualMenuBar modallyDisabled:NO];
} }
}]; }];

View File

@ -63,7 +63,7 @@ static BOOL sSetupHelpMenu = NO;
if (excludingAppleMenu && ![currMenu isJavaMenu]) { if (excludingAppleMenu && ![currMenu isJavaMenu]) {
continue; continue;
} }
[currItem setSubmenu:nil];
[theMainMenu removeItemAtIndex:index]; [theMainMenu removeItemAtIndex:index];
} }
@ -154,7 +154,10 @@ static BOOL sSetupHelpMenu = NO;
// Clean up extra items // Clean up extra items
NSUInteger removedIndex, removedCount = [removedMenuArray count]; NSUInteger removedIndex, removedCount = [removedMenuArray count];
for (removedIndex=removedCount; removedIndex > 0; removedIndex--) { for (removedIndex=removedCount; removedIndex > 0; removedIndex--) {
[theMainMenu removeItemAtIndex:[[removedMenuArray objectAtIndex:(removedIndex-1)] integerValue]]; NSUInteger index = [[removedMenuArray objectAtIndex:(removedIndex-1)] integerValue];
NSMenuItem *currItem = [theMainMenu itemAtIndex:index];
[currItem setSubmenu:nil];
[theMainMenu removeItemAtIndex:index];
} }
i = cmenuIndex; i = cmenuIndex;

View File

@ -70,9 +70,15 @@ AWT_ASSERT_APPKIT_THREAD;
JNIEnv *env = [ThreadUtilities getJNIEnv]; JNIEnv *env = [ThreadUtilities getJNIEnv];
JNF_COCOA_ENTER(env); JNF_COCOA_ENTER(env);
// If we are called as a result of user pressing a shorcut, do nothing, // If we are called as a result of user pressing a shortcut, do nothing,
// because AVTView has already sent corresponding key event to the Java // because AVTView has already sent corresponding key event to the Java
// layer from performKeyEquivalent // layer from performKeyEquivalent.
// There is an exception from the rule above, though: if a window with
// a menu gets minimized by user and there are no other windows to take
// focus, the window's menu won't be removed from the global menu bar.
// However, the Java layer won't handle invocation by a shortcut coming
// from this "frameless" menu, because there are no active windows. This
// means we have to handle it here.
NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent]; NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent];
if ([currEvent type] == NSKeyDown) { if ([currEvent type] == NSKeyDown) {
NSString *menuKey = [sender keyEquivalent]; NSString *menuKey = [sender keyEquivalent];
@ -91,7 +97,8 @@ JNF_COCOA_ENTER(env);
eventKey = [NSString stringWithCharacters: &newChar length: 1]; eventKey = [NSString stringWithCharacters: &newChar length: 1];
} }
if ([menuKey isEqualToString:eventKey]) { NSWindow *keyWindow = [NSApp keyWindow];
if ([menuKey isEqualToString:eventKey] && keyWindow != nil) {
return; return;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,11 +31,12 @@
@interface AWTStrike : NSObject { @interface AWTStrike : NSObject {
@public @public
AWTFont * fAWTFont; AWTFont * fAWTFont;
CGFloat fSize; CGFloat fSize;
JRSFontRenderingStyle fStyle; JRSFontRenderingStyle fStyle;
jint fAAStyle; jint fAAStyle;
CGAffineTransform fTx; CGAffineTransform fTx;
CGAffineTransform fDevTx;
CGAffineTransform fAltTx; // alternate strike tx used for Sun2D CGAffineTransform fAltTx; // alternate strike tx used for Sun2D
CGAffineTransform fFontTx; CGAffineTransform fFontTx;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -65,6 +65,7 @@ static CGAffineTransform sInverseTX = { 1, 0, 0, -1, 0, 0 };
invDevTx.b *= -1; invDevTx.b *= -1;
invDevTx.c *= -1; invDevTx.c *= -1;
fFontTx = CGAffineTransformConcat(CGAffineTransformConcat(tx, invDevTx), sInverseTX); fFontTx = CGAffineTransformConcat(CGAffineTransformConcat(tx, invDevTx), sInverseTX);
fDevTx = CGAffineTransformInvert(invDevTx);
// the "font size" is the square root of the determinant of the matrix // the "font size" is the square root of the determinant of the matrix
fSize = sqrt(abs(fFontTx.a * fFontTx.d - fFontTx.b * fFontTx.c)); fSize = sqrt(abs(fFontTx.a * fFontTx.d - fFontTx.b * fFontTx.c));
@ -148,7 +149,8 @@ Java_sun_font_CStrike_getNativeGlyphAdvance
{ {
CGSize advance; CGSize advance;
JNF_COCOA_ENTER(env); JNF_COCOA_ENTER(env);
AWTFont *awtFont = ((AWTStrike *)jlong_to_ptr(awtStrikePtr))->fAWTFont; AWTStrike *awtStrike = (AWTStrike *)jlong_to_ptr(awtStrikePtr);
AWTFont *awtFont = awtStrike->fAWTFont;
// negative glyph codes are really unicodes, which were placed there by the mapper // negative glyph codes are really unicodes, which were placed there by the mapper
// to indicate we should use CoreText to substitute the character // to indicate we should use CoreText to substitute the character
@ -156,6 +158,10 @@ JNF_COCOA_ENTER(env);
const CTFontRef fallback = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtFont, glyphCode, &glyph); const CTFontRef fallback = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtFont, glyphCode, &glyph);
CTFontGetAdvancesForGlyphs(fallback, kCTFontDefaultOrientation, &glyph, &advance, 1); CTFontGetAdvancesForGlyphs(fallback, kCTFontDefaultOrientation, &glyph, &advance, 1);
CFRelease(fallback); CFRelease(fallback);
advance = CGSizeApplyAffineTransform(advance, awtStrike->fFontTx);
if (!JRSFontStyleUsesFractionalMetrics(awtStrike->fStyle)) {
advance.width = round(advance.width);
}
JNF_COCOA_EXIT(env); JNF_COCOA_EXIT(env);
return advance.width; return advance.width;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -455,6 +455,7 @@ CGGI_ClearCanvas(CGGI_GlyphCanvas *canvas, GlyphInfo *info)
#define CGGI_GLYPH_BBOX_PADDING 2.0f #define CGGI_GLYPH_BBOX_PADDING 2.0f
static inline GlyphInfo * static inline GlyphInfo *
CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox, CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox,
const AWTStrike *strike,
const CGGI_RenderingMode *mode) const CGGI_RenderingMode *mode)
{ {
size_t pixelSize = mode->glyphDescriptor->pixelSize; size_t pixelSize = mode->glyphDescriptor->pixelSize;
@ -477,6 +478,12 @@ CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox,
width = 1; width = 1;
height = 1; height = 1;
} }
advance = CGSizeApplyAffineTransform(advance, strike->fFontTx);
if (!JRSFontStyleUsesFractionalMetrics(strike->fStyle)) {
advance.width = round(advance.width);
advance.height = round(advance.height);
}
advance = CGSizeApplyAffineTransform(advance, strike->fDevTx);
#ifdef USE_IMAGE_ALIGNED_MEMORY #ifdef USE_IMAGE_ALIGNED_MEMORY
// create separate memory // create separate memory
@ -564,10 +571,10 @@ CGGI_CreateImageForUnicode
JRSFontGetBoundingBoxesForGlyphsAndStyle(fallback, &tx, style, &glyph, 1, &bbox); JRSFontGetBoundingBoxesForGlyphsAndStyle(fallback, &tx, style, &glyph, 1, &bbox);
CGSize advance; CGSize advance;
JRSFontGetAdvancesForGlyphsAndStyle(fallback, &tx, strike->fStyle, &glyph, 1, &advance); CTFontGetAdvancesForGlyphs(fallback, kCTFontDefaultOrientation, &glyph, &advance, 1);
// create the Sun2D GlyphInfo we are going to strike into // create the Sun2D GlyphInfo we are going to strike into
GlyphInfo *info = CGGI_CreateNewGlyphInfoFrom(advance, bbox, mode); GlyphInfo *info = CGGI_CreateNewGlyphInfoFrom(advance, bbox, strike, mode);
// fix the context size, just in case the substituted character is unexpectedly large // fix the context size, just in case the substituted character is unexpectedly large
CGGI_SizeCanvas(canvas, info->width, info->height, mode->cgFontMode); CGGI_SizeCanvas(canvas, info->width, info->height, mode->cgFontMode);
@ -715,7 +722,7 @@ CGGI_CreateGlyphInfos(jlong *glyphInfos, const AWTStrike *strike,
JRSFontRenderingStyle bboxCGMode = JRSFontAlignStyleForFractionalMeasurement(strike->fStyle); JRSFontRenderingStyle bboxCGMode = JRSFontAlignStyleForFractionalMeasurement(strike->fStyle);
JRSFontGetBoundingBoxesForGlyphsAndStyle((CTFontRef)font->fFont, &tx, bboxCGMode, glyphs, len, bboxes); JRSFontGetBoundingBoxesForGlyphsAndStyle((CTFontRef)font->fFont, &tx, bboxCGMode, glyphs, len, bboxes);
JRSFontGetAdvancesForGlyphsAndStyle((CTFontRef)font->fFont, &tx, strike->fStyle, glyphs, len, advances); CTFontGetAdvancesForGlyphs((CTFontRef)font->fFont, kCTFontDefaultOrientation, glyphs, advances, len);
size_t maxWidth = 1; size_t maxWidth = 1;
size_t maxHeight = 1; size_t maxHeight = 1;
@ -732,7 +739,7 @@ CGGI_CreateGlyphInfos(jlong *glyphInfos, const AWTStrike *strike,
CGSize advance = advances[i]; CGSize advance = advances[i];
CGRect bbox = bboxes[i]; CGRect bbox = bboxes[i];
GlyphInfo *glyphInfo = CGGI_CreateNewGlyphInfoFrom(advance, bbox, mode); GlyphInfo *glyphInfo = CGGI_CreateNewGlyphInfoFrom(advance, bbox, strike, mode);
if (maxWidth < glyphInfo->width) maxWidth = glyphInfo->width; if (maxWidth < glyphInfo->width) maxWidth = glyphInfo->width;
if (maxHeight < glyphInfo->height) maxHeight = glyphInfo->height; if (maxHeight < glyphInfo->height) maxHeight = glyphInfo->height;

View File

@ -499,7 +499,8 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
public void setItem(Object item) { public void setItem(Object item) {
super.setItem(item); super.setItem(item);
if (editor.hasFocus()) { Object focus = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if ((focus == editor) || (focus == editor.getParent())) {
editor.selectAll(); editor.selectAll();
} }
} }

View File

@ -332,7 +332,7 @@ function streamClose(stream) {
* @param str input from which script is loaded and evaluated * @param str input from which script is loaded and evaluated
*/ */
if (typeof(load) == 'undefined') { if (typeof(load) == 'undefined') {
var load = function(str) { this.load = function(str) {
var stream = inStream(str); var stream = inStream(str);
var bstream = new BufferedInputStream(stream); var bstream = new BufferedInputStream(stream);
var reader = new BufferedReader(new InputStreamReader(bstream)); var reader = new BufferedReader(new InputStreamReader(bstream));
@ -712,7 +712,7 @@ if (typeof(exit) == 'undefined') {
* @param exitCode integer code returned to OS shell. * @param exitCode integer code returned to OS shell.
* optional, defaults to 0 * optional, defaults to 0
*/ */
var exit = function (code) { this.exit = function (code) {
if (code) { if (code) {
java.lang.System.exit(code + 0); java.lang.System.exit(code + 0);
} else { } else {
@ -725,7 +725,7 @@ if (typeof(quit) == 'undefined') {
/** /**
* synonym for exit * synonym for exit
*/ */
var quit = function (code) { this.quit = function (code) {
exit(code); exit(code);
} }
} }
@ -881,7 +881,7 @@ if (typeof(printf) == 'undefined') {
* @param format string to format the rest of the print items * @param format string to format the rest of the print items
* @param args variadic argument list * @param args variadic argument list
*/ */
var printf = function (format, args/*, more args*/) { this.printf = function (format, args/*, more args*/) {
var array = java.lang.reflect.Array.newInstance(java.lang.Object, var array = java.lang.reflect.Array.newInstance(java.lang.Object,
arguments.length - 1); arguments.length - 1);
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
@ -921,25 +921,7 @@ function read(prompt, multiline) {
} }
if (typeof(println) == 'undefined') { if (typeof(println) == 'undefined') {
var print = function(str, newline) { // just synonym to print
if (typeof(str) == 'undefined') { this.println = print;
str = 'undefined';
} else if (str == null) {
str = 'null';
}
if (!(out instanceof java.io.PrintWriter)) {
out = new java.io.PrintWriter(out);
}
out.print(String(str));
if (newline) {
out.print('\n');
}
out.flush();
}
var println = function(str) {
print(str, true);
};
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@ package java.awt;
/** /**
* Signals that an Absract Window Toolkit exception has occurred. * Signals that an Abstract Window Toolkit exception has occurred.
* *
* @author Arthur van Hoff * @author Arthur van Hoff
*/ */

View File

@ -48,132 +48,87 @@ package java.io;
* may be thrown if the input stream has been * may be thrown if the input stream has been
* closed. * closed.
* *
* <h4><a name="modified-utf-8">Modified UTF-8</a></h4> * <h3><a name="modified-utf-8">Modified UTF-8</a></h3>
* <p> * <p>
* Implementations of the DataInput and DataOutput interfaces represent * Implementations of the DataInput and DataOutput interfaces represent
* Unicode strings in a format that is a slight modification of UTF-8. * Unicode strings in a format that is a slight modification of UTF-8.
* (For information regarding the standard UTF-8 format, see section * (For information regarding the standard UTF-8 format, see section
* <i>3.9 Unicode Encoding Forms</i> of <i>The Unicode Standard, Version * <i>3.9 Unicode Encoding Forms</i> of <i>The Unicode Standard, Version
* 4.0</i>). * 4.0</i>).
* Note that in the following tables, the most significant bit appears in the * Note that in the following table, the most significant bit appears in the
* far left-hand column. * far left-hand column.
* <p>
* All characters in the range {@code '\u005Cu0001'} to
* {@code '\u005Cu007F'} are represented by a single byte:
* *
* <blockquote> * <blockquote>
* <table border="1" cellspacing="0" cellpadding="8" width="50%" * <table border="1" cellspacing="0" cellpadding="8"
* summary="Bit values and bytes"> * summary="Bit values and bytes">
* <tr> * <tr>
* <th colspan="9"><span style="font-weight:normal">
* All characters in the range {@code '\u005Cu0001'} to
* {@code '\u005Cu007F'} are represented by a single byte:</span></th>
* </tr>
* <tr>
* <td></td> * <td></td>
* <th id="bit_a">Bit Values</th> * <th colspan="8" id="bit_a">Bit Values</th>
* </tr> * </tr>
* <tr> * <tr>
* <th id="byte1_a">Byte 1</th> * <th id="byte1_a">Byte 1</th>
* <td> * <td><center>0</center>
* <table border="1" cellspacing="0" width="100%"> * <td colspan="7"><center>bits 6-0</center>
* <tr> * </tr>
* <td width="12%"><center>0</center> * <tr>
* <td colspan="7"><center>bits 6-0</center> * <th colspan="9"><span style="font-weight:normal">
* </tr> * The null character {@code '\u005Cu0000'} and characters
* </table> * in the range {@code '\u005Cu0080'} to {@code '\u005Cu07FF'} are
* </td> * represented by a pair of bytes:</span></th>
* </tr> * </tr>
* </table>
* </blockquote>
*
* <p>
* The null character {@code '\u005Cu0000'} and characters in the
* range {@code '\u005Cu0080'} to {@code '\u005Cu07FF'} are
* represented by a pair of bytes:
*
* <blockquote>
* <table border="1" cellspacing="0" cellpadding="8" width="50%"
* summary="Bit values and bytes">
* <tr> * <tr>
* <td></td> * <td></td>
* <th id="bit_b">Bit Values</th> * <th colspan="8" id="bit_b">Bit Values</th>
* </tr> * </tr>
* <tr> * <tr>
* <th id="byte1_b">Byte 1</th> * <th id="byte1_b">Byte 1</th>
* <td> * <td><center>1</center>
* <table border="1" cellspacing="0" width="100%"> * <td><center>1</center>
* <tr> * <td><center>0</center>
* <td width="12%"><center>1</center> * <td colspan="5"><center>bits 10-6</center>
* <td width="13%"><center>1</center>
* <td width="12%"><center>0</center>
* <td colspan="5"><center>bits 10-6</center>
* </tr>
* </table>
* </td>
* </tr> * </tr>
* <tr> * <tr>
* <th id="byte2_a">Byte 2</th> * <th id="byte2_a">Byte 2</th>
* <td> * <td><center>1</center>
* <table border="1" cellspacing="0" width="100%"> * <td><center>0</center>
* <tr> * <td colspan="6"><center>bits 5-0</center>
* <td width="12%"><center>1</center> * </tr>
* <td width="13%"><center>0</center> * <tr>
* <td colspan="6"><center>bits 5-0</center> * <th colspan="9"><span style="font-weight:normal">
* </tr> * {@code char} values in the range {@code '\u005Cu0800'}
* </table> * to {@code '\u005CuFFFF'} are represented by three bytes:</span></th>
* </td>
* </tr> * </tr>
* </table>
* </blockquote>
*
* <br>
* {@code char} values in the range {@code '\u005Cu0800'} to
* {@code '\u005CuFFFF'} are represented by three bytes:
*
* <blockquote>
* <table border="1" cellspacing="0" cellpadding="8" width="50%"
* summary="Bit values and bytes">
* <tr> * <tr>
* <td></td> * <td></td>
* <th id="bit_c">Bit Values</th> * <th colspan="8"id="bit_c">Bit Values</th>
* </tr> * </tr>
* <tr> * <tr>
* <th id="byte1_c">Byte 1</th> * <th id="byte1_c">Byte 1</th>
* <td> * <td><center>1</center>
* <table border="1" cellspacing="0" width="100%"> * <td><center>1</center>
* <tr> * <td><center>1</center>
* <td width="12%"><center>1</center> * <td><center>0</center>
* <td width="13%"><center>1</center> * <td colspan="4"><center>bits 15-12</center>
* <td width="12%"><center>1</center>
* <td width="13%"><center>0</center>
* <td colspan="4"><center>bits 15-12</center>
* </tr>
* </table>
* </td>
* </tr> * </tr>
* <tr> * <tr>
* <th id="byte2_b">Byte 2</th> * <th id="byte2_b">Byte 2</th>
* <td> * <td><center>1</center>
* <table border="1" cellspacing="0" width="100%"> * <td><center>0</center>
* <tr> * <td colspan="6"><center>bits 11-6</center>
* <td width="12%"><center>1</center>
* <td width="13%"><center>0</center>
* <td colspan="6"><center>bits 11-6</center>
* </tr>
* </table>
* </td>
* </tr> * </tr>
* <tr> * <tr>
* <th id="byte3">Byte 3</th> * <th id="byte3">Byte 3</th>
* <td> * <td><center>1</center>
* <table border="1" cellspacing="0" width="100%"> * <td><center>0</center>
* <tr> * <td colspan="6"><center>bits 5-0</center>
* <td width="12%"><center>1</center>
* <td width="13%"><center>0</center>
* <td colspan="6"><center>bits 5-0</center>
* </tr>
* </table>
* </td>
* </tr> * </tr>
* </table> * </table>
* </blockquote> * </blockquote>
*
* <p> * <p>
* The differences between this format and the * The differences between this format and the
* standard UTF-8 format are the following: * standard UTF-8 format are the following:

View File

@ -129,7 +129,7 @@ import sun.security.action.GetPropertyAction;
* created, the abstract pathname represented by a <code>File</code> object * created, the abstract pathname represented by a <code>File</code> object
* will never change. * will never change.
* *
* <h4>Interoperability with {@code java.nio.file} package</h4> * <h3>Interoperability with {@code java.nio.file} package</h3>
* *
* <p> The <a href="../../java/nio/file/package-summary.html">{@code java.nio.file}</a> * <p> The <a href="../../java/nio/file/package-summary.html">{@code java.nio.file}</a>
* package defines interfaces and classes for the Java virtual machine to access * package defines interfaces and classes for the Java virtual machine to access

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -313,6 +313,7 @@ public class ObjectInputStream
* @throws SecurityException if a security manager exists and its * @throws SecurityException if a security manager exists and its
* <code>checkPermission</code> method denies enabling * <code>checkPermission</code> method denies enabling
* subclassing. * subclassing.
* @throws IOException if an I/O error occurs while creating this stream
* @see SecurityManager#checkPermission * @see SecurityManager#checkPermission
* @see java.io.SerializablePermission * @see java.io.SerializablePermission
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -265,6 +265,7 @@ public class ObjectOutputStream
* @throws SecurityException if a security manager exists and its * @throws SecurityException if a security manager exists and its
* <code>checkPermission</code> method denies enabling * <code>checkPermission</code> method denies enabling
* subclassing. * subclassing.
* @throws IOException if an I/O error occurs while creating this stream
* @see SecurityManager#checkPermission * @see SecurityManager#checkPermission
* @see java.io.SerializablePermission * @see java.io.SerializablePermission
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -240,6 +240,8 @@ public class ObjectStreamField
* Returns boolean value indicating whether or not the serializable field * Returns boolean value indicating whether or not the serializable field
* represented by this ObjectStreamField instance is unshared. * represented by this ObjectStreamField instance is unshared.
* *
* @return {@code true} if this field is unshared
*
* @since 1.4 * @since 1.4
*/ */
public boolean isUnshared() { public boolean isUnshared() {

View File

@ -128,7 +128,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* meanings are: * meanings are:
* *
* <table summary="Access mode permitted values and meanings"> * <table summary="Access mode permitted values and meanings">
* <tr><th><p align="left">Value</p></th><th><p align="left">Meaning</p></th></tr> * <tr><th align="left">Value</th><th align="left">Meaning</th></tr>
* <tr><td valign="top"><tt>"r"</tt></td> * <tr><td valign="top"><tt>"r"</tt></td>
* <td> Open for reading only. Invoking any of the <tt>write</tt> * <td> Open for reading only. Invoking any of the <tt>write</tt>
* methods of the resulting object will cause an {@link * methods of the resulting object will cause an {@link

View File

@ -157,10 +157,10 @@ public final class Class<T> implements java.io.Serializable,
* *
* The string is formatted as a list of type modifiers, if any, * The string is formatted as a list of type modifiers, if any,
* followed by the kind of type (empty string for primitive types * followed by the kind of type (empty string for primitive types
* and {@code class}, {@code enum}, {@code interface}, or {@code * and {@code class}, {@code enum}, {@code interface}, or
* &#64;interface}, as appropriate), followed by the type's name, * <code>&#64;</code>{@code interface}, as appropriate), followed
* followed by an angle-bracketed comma-separated list of the * by the type's name, followed by an angle-bracketed
* type's type parameters, if any. * comma-separated list of the type's type parameters, if any.
* *
* A space is used to separate modifiers from one another and to * A space is used to separate modifiers from one another and to
* separate any modifiers from the kind of type. The modifiers * separate any modifiers from the kind of type. The modifiers

View File

@ -29,6 +29,8 @@ package java.lang.invoke;
* LambdaConversionException * LambdaConversionException
*/ */
public class LambdaConversionException extends Exception { public class LambdaConversionException extends Exception {
private static final long serialVersionUID = 292L + 8L;
/** /**
* Constructs a {@code LambdaConversionException}. * Constructs a {@code LambdaConversionException}.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,13 +25,12 @@
package java.lang.ref; package java.lang.ref;
/**
/* Final references, used to implement finalization */ * Final references, used to implement finalization
*/
class FinalReference<T> extends Reference<T> { class FinalReference<T> extends Reference<T> {
public FinalReference(T referent, ReferenceQueue<? super T> q) { public FinalReference(T referent, ReferenceQueue<? super T> q) {
super(referent, q); super(referent, q);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,16 +29,16 @@ import java.security.PrivilegedAction;
import java.security.AccessController; import java.security.AccessController;
final class Finalizer extends FinalReference { /* Package-private; must be in final class Finalizer extends FinalReference<Object> { /* Package-private; must be in
same package as the Reference same package as the Reference
class */ class */
/* A native method that invokes an arbitrary object's finalize method is /* A native method that invokes an arbitrary object's finalize method is
required since the finalize method is protected required since the finalize method is protected
*/ */
static native void invokeFinalizeMethod(Object o) throws Throwable; static native void invokeFinalizeMethod(Object o) throws Throwable;
private static ReferenceQueue queue = new ReferenceQueue(); private static ReferenceQueue<Object> queue = new ReferenceQueue<>();
private static Finalizer unfinalized = null; private static Finalizer unfinalized = null;
private static final Object lock = new Object(); private static final Object lock = new Object();

View File

@ -96,6 +96,7 @@ public abstract class Reference<T> {
* Enqueued: next reference in queue (or this if last) * Enqueued: next reference in queue (or this if last)
* Inactive: this * Inactive: this
*/ */
@SuppressWarnings("rawtypes")
Reference next; Reference next;
/* When active: next element in a discovered reference list maintained by GC (or this if last) /* When active: next element in a discovered reference list maintained by GC (or this if last)
@ -119,7 +120,7 @@ public abstract class Reference<T> {
* them. This list is protected by the above lock object. The * them. This list is protected by the above lock object. The
* list uses the discovered field to link its elements. * list uses the discovered field to link its elements.
*/ */
private static Reference pending = null; private static Reference<Object> pending = null;
/* High-priority thread to enqueue pending References /* High-priority thread to enqueue pending References
*/ */
@ -131,7 +132,7 @@ public abstract class Reference<T> {
public void run() { public void run() {
for (;;) { for (;;) {
Reference r; Reference<Object> r;
synchronized (lock) { synchronized (lock) {
if (pending != null) { if (pending != null) {
r = pending; r = pending;
@ -166,7 +167,7 @@ public abstract class Reference<T> {
continue; continue;
} }
ReferenceQueue q = r.queue; ReferenceQueue<Object> q = r.queue;
if (q != ReferenceQueue.NULL) q.enqueue(r); if (q != ReferenceQueue.NULL) q.enqueue(r);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,14 +40,14 @@ public class ReferenceQueue<T> {
*/ */
public ReferenceQueue() { } public ReferenceQueue() { }
private static class Null extends ReferenceQueue { private static class Null<S> extends ReferenceQueue<S> {
boolean enqueue(Reference r) { boolean enqueue(Reference<? extends S> r) {
return false; return false;
} }
} }
static ReferenceQueue NULL = new Null(); static ReferenceQueue<Object> NULL = new Null<>();
static ReferenceQueue ENQUEUED = new Null(); static ReferenceQueue<Object> ENQUEUED = new Null<>();
static private class Lock { }; static private class Lock { };
private Lock lock = new Lock(); private Lock lock = new Lock();
@ -58,7 +58,7 @@ public class ReferenceQueue<T> {
synchronized (lock) { synchronized (lock) {
// Check that since getting the lock this reference hasn't already been // Check that since getting the lock this reference hasn't already been
// enqueued (and even then removed) // enqueued (and even then removed)
ReferenceQueue queue = r.queue; ReferenceQueue<?> queue = r.queue;
if ((queue == NULL) || (queue == ENQUEUED)) { if ((queue == NULL) || (queue == ENQUEUED)) {
return false; return false;
} }
@ -75,10 +75,13 @@ public class ReferenceQueue<T> {
} }
} }
@SuppressWarnings("unchecked")
private Reference<? extends T> reallyPoll() { /* Must hold lock */ private Reference<? extends T> reallyPoll() { /* Must hold lock */
Reference<? extends T> r = head; Reference<? extends T> r = head;
if (r != null) { if (r != null) {
head = (r.next == r) ? null : r.next; head = (r.next == r) ?
null :
r.next; // Unchecked due to the next field having a raw type in Reference
r.queue = NULL; r.queue = NULL;
r.next = r; r.next = r;
queueLength--; queueLength--;

View File

@ -162,7 +162,7 @@ public final class Parameter implements AnnotatedElement {
/** /**
* Returns the name of the parameter. If the parameter's name is * Returns the name of the parameter. If the parameter's name is
* {@linkplain isNamePresent() present}, then this method returns * {@linkplain #isNamePresent() present}, then this method returns
* the name provided by the class file. Otherwise, this method * the name provided by the class file. Otherwise, this method
* synthesizes a name of the form argN, where N is the index of * synthesizes a name of the form argN, where N is the index of
* the parameter in the descriptor of the method which declares * the parameter in the descriptor of the method which declares

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -38,13 +38,13 @@ package java.math;
* *
* @see BigInteger * @see BigInteger
* @author Michael McCloskey * @author Michael McCloskey
* @author Timothy Buktu
* @since 1.3 * @since 1.3
*/ */
import java.util.Arrays;
import static java.math.BigInteger.LONG_MASK;
import static java.math.BigDecimal.INFLATED; import static java.math.BigDecimal.INFLATED;
import static java.math.BigInteger.LONG_MASK;
import java.util.Arrays;
class MutableBigInteger { class MutableBigInteger {
/** /**
@ -75,6 +75,24 @@ class MutableBigInteger {
*/ */
static final MutableBigInteger ONE = new MutableBigInteger(1); static final MutableBigInteger ONE = new MutableBigInteger(1);
/**
* The minimum {@code intLen} for cancelling powers of two before
* dividing.
* If the number of ints is less than this threshold,
* {@code divideKnuth} does not eliminate common powers of two from
* the dividend and divisor.
*/
static final int KNUTH_POW2_THRESH_LEN = 6;
/**
* The minimum number of trailing zero ints for cancelling powers of two
* before dividing.
* If the dividend and divisor don't share at least this many zero ints
* at the end, {@code divideKnuth} does not eliminate common powers
* of two from the dividend and divisor.
*/
static final int KNUTH_POW2_THRESH_ZEROS = 3;
// Constructors // Constructors
/** /**
@ -123,6 +141,20 @@ class MutableBigInteger {
value = Arrays.copyOfRange(val.value, val.offset, val.offset + intLen); value = Arrays.copyOfRange(val.value, val.offset, val.offset + intLen);
} }
/**
* Makes this number an {@code n}-int number all of whose bits are ones.
* Used by Burnikel-Ziegler division.
* @param n number of ints in the {@code value} array
* @return a number equal to {@code ((1<<(32*n)))-1}
*/
private void ones(int n) {
if (n > value.length)
value = new int[n];
Arrays.fill(value, -1);
offset = 0;
intLen = n;
}
/** /**
* Internal helper method to return the magnitude array. The caller is not * Internal helper method to return the magnitude array. The caller is not
* supposed to modify the returned array. * supposed to modify the returned array.
@ -154,6 +186,14 @@ class MutableBigInteger {
return new BigInteger(getMagnitudeArray(), sign); return new BigInteger(getMagnitudeArray(), sign);
} }
/**
* Converts this number to a nonnegative {@code BigInteger}.
*/
BigInteger toBigInteger() {
normalize();
return toBigInteger(isZero() ? 0 : 1);
}
/** /**
* Convert this MutableBigInteger to BigDecimal object with the specified sign * Convert this MutableBigInteger to BigDecimal object with the specified sign
* and scale. * and scale.
@ -237,6 +277,32 @@ class MutableBigInteger {
return 0; return 0;
} }
/**
* Returns a value equal to what {@code b.leftShift(32*ints); return compare(b);}
* would return, but doesn't change the value of {@code b}.
*/
private int compareShifted(MutableBigInteger b, int ints) {
int blen = b.intLen;
int alen = intLen - ints;
if (alen < blen)
return -1;
if (alen > blen)
return 1;
// Add Integer.MIN_VALUE to make the comparison act as unsigned integer
// comparison.
int[] bval = b.value;
for (int i = offset, j = b.offset; i < alen + offset; i++, j++) {
int b1 = value[i] + 0x80000000;
int b2 = bval[j] + 0x80000000;
if (b1 < b2)
return -1;
if (b1 > b2)
return 1;
}
return 0;
}
/** /**
* Compare this against half of a MutableBigInteger object (Needed for * Compare this against half of a MutableBigInteger object (Needed for
* remainder tests). * remainder tests).
@ -247,7 +313,7 @@ class MutableBigInteger {
int blen = b.intLen; int blen = b.intLen;
int len = intLen; int len = intLen;
if (len <= 0) if (len <= 0)
return blen <=0 ? 0 : -1; return blen <= 0 ? 0 : -1;
if (len > blen) if (len > blen)
return 1; return 1;
if (len < blen - 1) if (len < blen - 1)
@ -274,7 +340,7 @@ class MutableBigInteger {
return v < hb ? -1 : 1; return v < hb ? -1 : 1;
carry = (bv & 1) << 31; // carray will be either 0x80000000 or 0 carry = (bv & 1) << 31; // carray will be either 0x80000000 or 0
} }
return carry == 0? 0 : -1; return carry == 0 ? 0 : -1;
} }
/** /**
@ -285,10 +351,10 @@ class MutableBigInteger {
if (intLen == 0) if (intLen == 0)
return -1; return -1;
int j, b; int j, b;
for (j=intLen-1; (j>0) && (value[j+offset]==0); j--) for (j=intLen-1; (j > 0) && (value[j+offset] == 0); j--)
; ;
b = value[j+offset]; b = value[j+offset];
if (b==0) if (b == 0)
return -1; return -1;
return ((intLen-1-j)<<5) + Integer.numberOfTrailingZeros(b); return ((intLen-1-j)<<5) + Integer.numberOfTrailingZeros(b);
} }
@ -329,11 +395,11 @@ class MutableBigInteger {
int indexBound = index+intLen; int indexBound = index+intLen;
do { do {
index++; index++;
} while(index < indexBound && value[index]==0); } while(index < indexBound && value[index] == 0);
int numZeros = index - offset; int numZeros = index - offset;
intLen -= numZeros; intLen -= numZeros;
offset = (intLen==0 ? 0 : offset+numZeros); offset = (intLen == 0 ? 0 : offset+numZeros);
} }
/** /**
@ -354,7 +420,7 @@ class MutableBigInteger {
*/ */
int[] toIntArray() { int[] toIntArray() {
int[] result = new int[intLen]; int[] result = new int[intLen];
for(int i=0; i<intLen; i++) for(int i=0; i < intLen; i++)
result[i] = value[offset+i]; result[i] = value[offset+i];
return result; return result;
} }
@ -440,7 +506,7 @@ class MutableBigInteger {
boolean isNormal() { boolean isNormal() {
if (intLen + offset > value.length) if (intLen + offset > value.length)
return false; return false;
if (intLen ==0) if (intLen == 0)
return true; return true;
return (value[offset] != 0); return (value[offset] != 0);
} }
@ -453,6 +519,17 @@ class MutableBigInteger {
return b.toString(); return b.toString();
} }
/**
* Like {@link #rightShift(int)} but {@code n} can be greater than the length of the number.
*/
void safeRightShift(int n) {
if (n/32 >= intLen) {
reset();
} else {
rightShift(n);
}
}
/** /**
* Right shift this MutableBigInteger n bits. The MutableBigInteger is left * Right shift this MutableBigInteger n bits. The MutableBigInteger is left
* in normal form. * in normal form.
@ -474,6 +551,15 @@ class MutableBigInteger {
} }
} }
/**
* Like {@link #leftShift(int)} but {@code n} can be zero.
*/
void safeLeftShift(int n) {
if (n > 0) {
leftShift(n);
}
}
/** /**
* Left shift this MutableBigInteger n bits. * Left shift this MutableBigInteger n bits.
*/ */
@ -502,18 +588,18 @@ class MutableBigInteger {
if (value.length < newLen) { if (value.length < newLen) {
// The array must grow // The array must grow
int[] result = new int[newLen]; int[] result = new int[newLen];
for (int i=0; i<intLen; i++) for (int i=0; i < intLen; i++)
result[i] = value[offset+i]; result[i] = value[offset+i];
setValue(result, newLen); setValue(result, newLen);
} else if (value.length - offset >= newLen) { } else if (value.length - offset >= newLen) {
// Use space on right // Use space on right
for(int i=0; i<newLen - intLen; i++) for(int i=0; i < newLen - intLen; i++)
value[offset+intLen+i] = 0; value[offset+intLen+i] = 0;
} else { } else {
// Must use space on left // Must use space on left
for (int i=0; i<intLen; i++) for (int i=0; i < intLen; i++)
value[i] = value[offset+i]; value[i] = value[offset+i];
for (int i=intLen; i<newLen; i++) for (int i=intLen; i < newLen; i++)
value[i] = 0; value[i] = 0;
offset = 0; offset = 0;
} }
@ -590,7 +676,7 @@ class MutableBigInteger {
private final void primitiveRightShift(int n) { private final void primitiveRightShift(int n) {
int[] val = value; int[] val = value;
int n2 = 32 - n; int n2 = 32 - n;
for (int i=offset+intLen-1, c=val[i]; i>offset; i--) { for (int i=offset+intLen-1, c=val[i]; i > offset; i--) {
int b = c; int b = c;
c = val[i-1]; c = val[i-1];
val[i] = (c << n2) | (b >>> n); val[i] = (c << n2) | (b >>> n);
@ -606,7 +692,7 @@ class MutableBigInteger {
private final void primitiveLeftShift(int n) { private final void primitiveLeftShift(int n) {
int[] val = value; int[] val = value;
int n2 = 32 - n; int n2 = 32 - n;
for (int i=offset, c=val[i], m=i+intLen-1; i<m; i++) { for (int i=offset, c=val[i], m=i+intLen-1; i < m; i++) {
int b = c; int b = c;
c = val[i+1]; c = val[i+1];
val[i] = (b << n) | (c >>> n2); val[i] = (b << n) | (c >>> n2);
@ -614,6 +700,35 @@ class MutableBigInteger {
val[offset+intLen-1] <<= n; val[offset+intLen-1] <<= n;
} }
/**
* Returns a {@code BigInteger} equal to the {@code n}
* low ints of this number.
*/
private BigInteger getLower(int n) {
if (isZero()) {
return BigInteger.ZERO;
} else if (intLen < n) {
return toBigInteger(1);
} else {
// strip zeros
int len = n;
while (len > 0 && value[offset+intLen-len] == 0)
len--;
int sign = len > 0 ? 1 : 0;
return new BigInteger(Arrays.copyOfRange(value, offset+intLen-len, offset+intLen), sign);
}
}
/**
* Discards all ints whose index is greater than {@code n}.
*/
private void keepLower(int n) {
if (intLen >= n) {
offset += intLen - n;
intLen = n;
}
}
/** /**
* Adds the contents of two MutableBigInteger objects.The result * Adds the contents of two MutableBigInteger objects.The result
* is placed within this MutableBigInteger. * is placed within this MutableBigInteger.
@ -630,7 +745,7 @@ class MutableBigInteger {
long carry = 0; long carry = 0;
// Add common parts of both numbers // Add common parts of both numbers
while(x>0 && y>0) { while(x > 0 && y > 0) {
x--; y--; x--; y--;
sum = (value[x+offset] & LONG_MASK) + sum = (value[x+offset] & LONG_MASK) +
(addend.value[y+addend.offset] & LONG_MASK) + carry; (addend.value[y+addend.offset] & LONG_MASK) + carry;
@ -639,7 +754,7 @@ class MutableBigInteger {
} }
// Add remainder of the longer number // Add remainder of the longer number
while(x>0) { while(x > 0) {
x--; x--;
if (carry == 0 && result == value && rstart == (x + offset)) if (carry == 0 && result == value && rstart == (x + offset))
return; return;
@ -647,7 +762,7 @@ class MutableBigInteger {
result[rstart--] = (int)sum; result[rstart--] = (int)sum;
carry = sum >>> 32; carry = sum >>> 32;
} }
while(y>0) { while(y > 0) {
y--; y--;
sum = (addend.value[y+addend.offset] & LONG_MASK) + carry; sum = (addend.value[y+addend.offset] & LONG_MASK) + carry;
result[rstart--] = (int)sum; result[rstart--] = (int)sum;
@ -673,6 +788,123 @@ class MutableBigInteger {
offset = result.length - resultLen; offset = result.length - resultLen;
} }
/**
* Adds the value of {@code addend} shifted {@code n} ints to the left.
* Has the same effect as {@code addend.leftShift(32*ints); add(addend);}
* but doesn't change the value of {@code addend}.
*/
void addShifted(MutableBigInteger addend, int n) {
if (addend.isZero()) {
return;
}
int x = intLen;
int y = addend.intLen + n;
int resultLen = (intLen > y ? intLen : y);
int[] result = (value.length < resultLen ? new int[resultLen] : value);
int rstart = result.length-1;
long sum;
long carry = 0;
// Add common parts of both numbers
while (x > 0 && y > 0) {
x--; y--;
int bval = y+addend.offset < addend.value.length ? addend.value[y+addend.offset] : 0;
sum = (value[x+offset] & LONG_MASK) +
(bval & LONG_MASK) + carry;
result[rstart--] = (int)sum;
carry = sum >>> 32;
}
// Add remainder of the longer number
while (x > 0) {
x--;
if (carry == 0 && result == value && rstart == (x + offset)) {
return;
}
sum = (value[x+offset] & LONG_MASK) + carry;
result[rstart--] = (int)sum;
carry = sum >>> 32;
}
while (y > 0) {
y--;
int bval = y+addend.offset < addend.value.length ? addend.value[y+addend.offset] : 0;
sum = (bval & LONG_MASK) + carry;
result[rstart--] = (int)sum;
carry = sum >>> 32;
}
if (carry > 0) { // Result must grow in length
resultLen++;
if (result.length < resultLen) {
int temp[] = new int[resultLen];
// Result one word longer from carry-out; copy low-order
// bits into new result.
System.arraycopy(result, 0, temp, 1, result.length);
temp[0] = 1;
result = temp;
} else {
result[rstart--] = 1;
}
}
value = result;
intLen = resultLen;
offset = result.length - resultLen;
}
/**
* Like {@link #addShifted(MutableBigInteger, int)} but {@code this.intLen} must
* not be greater than {@code n}. In other words, concatenates {@code this}
* and {@code addend}.
*/
void addDisjoint(MutableBigInteger addend, int n) {
if (addend.isZero())
return;
int x = intLen;
int y = addend.intLen + n;
int resultLen = (intLen > y ? intLen : y);
int[] result;
if (value.length < resultLen)
result = new int[resultLen];
else {
result = value;
Arrays.fill(value, offset+intLen, value.length, 0);
}
int rstart = result.length-1;
// copy from this if needed
System.arraycopy(value, offset, result, rstart+1-x, x);
y -= x;
rstart -= x;
int len = Math.min(y, addend.value.length-addend.offset);
System.arraycopy(addend.value, addend.offset, result, rstart+1-y, len);
// zero the gap
for (int i=rstart+1-y+len; i < rstart+1; i++)
result[i] = 0;
value = result;
intLen = resultLen;
offset = result.length - resultLen;
}
/**
* Adds the low {@code n} ints of {@code addend}.
*/
void addLower(MutableBigInteger addend, int n) {
MutableBigInteger a = new MutableBigInteger(addend);
if (a.offset + a.intLen >= n) {
a.offset = a.offset + a.intLen - n;
a.intLen = n;
}
a.normalize();
add(a);
}
/** /**
* Subtracts the smaller of this and b from the larger and places the * Subtracts the smaller of this and b from the larger and places the
@ -704,7 +936,7 @@ class MutableBigInteger {
int rstart = result.length - 1; int rstart = result.length - 1;
// Subtract common parts of both numbers // Subtract common parts of both numbers
while (y>0) { while (y > 0) {
x--; y--; x--; y--;
diff = (a.value[x+a.offset] & LONG_MASK) - diff = (a.value[x+a.offset] & LONG_MASK) -
@ -712,7 +944,7 @@ class MutableBigInteger {
result[rstart--] = (int)diff; result[rstart--] = (int)diff;
} }
// Subtract remainder of longer number // Subtract remainder of longer number
while (x>0) { while (x > 0) {
x--; x--;
diff = (a.value[x+a.offset] & LONG_MASK) - ((int)-(diff>>32)); diff = (a.value[x+a.offset] & LONG_MASK) - ((int)-(diff>>32));
result[rstart--] = (int)diff; result[rstart--] = (int)diff;
@ -733,7 +965,7 @@ class MutableBigInteger {
private int difference(MutableBigInteger b) { private int difference(MutableBigInteger b) {
MutableBigInteger a = this; MutableBigInteger a = this;
int sign = a.compare(b); int sign = a.compare(b);
if (sign ==0) if (sign == 0)
return 0; return 0;
if (sign < 0) { if (sign < 0) {
MutableBigInteger tmp = a; MutableBigInteger tmp = a;
@ -746,14 +978,14 @@ class MutableBigInteger {
int y = b.intLen; int y = b.intLen;
// Subtract common parts of both numbers // Subtract common parts of both numbers
while (y>0) { while (y > 0) {
x--; y--; x--; y--;
diff = (a.value[a.offset+ x] & LONG_MASK) - diff = (a.value[a.offset+ x] & LONG_MASK) -
(b.value[b.offset+ y] & LONG_MASK) - ((int)-(diff>>32)); (b.value[b.offset+ y] & LONG_MASK) - ((int)-(diff>>32));
a.value[a.offset+x] = (int)diff; a.value[a.offset+x] = (int)diff;
} }
// Subtract remainder of longer number // Subtract remainder of longer number
while (x>0) { while (x > 0) {
x--; x--;
diff = (a.value[a.offset+ x] & LONG_MASK) - ((int)-(diff>>32)); diff = (a.value[a.offset+ x] & LONG_MASK) - ((int)-(diff>>32));
a.value[a.offset+x] = (int)diff; a.value[a.offset+x] = (int)diff;
@ -822,7 +1054,7 @@ class MutableBigInteger {
// Perform the multiplication word by word // Perform the multiplication word by word
long ylong = y & LONG_MASK; long ylong = y & LONG_MASK;
int[] zval = (z.value.length<intLen+1 ? new int[intLen + 1] int[] zval = (z.value.length < intLen+1 ? new int[intLen + 1]
: z.value); : z.value);
long carry = 0; long carry = 0;
for (int i = intLen-1; i >= 0; i--) { for (int i = intLen-1; i >= 0; i--) {
@ -906,6 +1138,31 @@ class MutableBigInteger {
return rem; return rem;
} }
/**
* Calculates the quotient of this div b and places the quotient in the
* provided MutableBigInteger objects and the remainder object is returned.
*
*/
MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient) {
return divide(b,quotient,true);
}
MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient, boolean needRemainder) {
if (intLen < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD ||
b.intLen < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD) {
return divideKnuth(b, quotient, needRemainder);
} else {
return divideAndRemainderBurnikelZiegler(b, quotient);
}
}
/**
* @see #divideKnuth(MutableBigInteger, MutableBigInteger, boolean)
*/
MutableBigInteger divideKnuth(MutableBigInteger b, MutableBigInteger quotient) {
return divideKnuth(b,quotient,true);
}
/** /**
* Calculates the quotient of this div b and places the quotient in the * Calculates the quotient of this div b and places the quotient in the
* provided MutableBigInteger objects and the remainder object is returned. * provided MutableBigInteger objects and the remainder object is returned.
@ -917,38 +1174,34 @@ class MutableBigInteger {
* changed. * changed.
* *
*/ */
MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient) { MutableBigInteger divideKnuth(MutableBigInteger b, MutableBigInteger quotient, boolean needRemainder) {
return divide(b,quotient,true);
}
MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient, boolean needReminder) {
if (b.intLen == 0) if (b.intLen == 0)
throw new ArithmeticException("BigInteger divide by zero"); throw new ArithmeticException("BigInteger divide by zero");
// Dividend is zero // Dividend is zero
if (intLen == 0) { if (intLen == 0) {
quotient.intLen = quotient.offset; quotient.intLen = quotient.offset = 0;
return needReminder ? new MutableBigInteger() : null; return needRemainder ? new MutableBigInteger() : null;
} }
int cmp = compare(b); int cmp = compare(b);
// Dividend less than divisor // Dividend less than divisor
if (cmp < 0) { if (cmp < 0) {
quotient.intLen = quotient.offset = 0; quotient.intLen = quotient.offset = 0;
return needReminder ? new MutableBigInteger(this) : null; return needRemainder ? new MutableBigInteger(this) : null;
} }
// Dividend equal to divisor // Dividend equal to divisor
if (cmp == 0) { if (cmp == 0) {
quotient.value[0] = quotient.intLen = 1; quotient.value[0] = quotient.intLen = 1;
quotient.offset = 0; quotient.offset = 0;
return needReminder ? new MutableBigInteger() : null; return needRemainder ? new MutableBigInteger() : null;
} }
quotient.clear(); quotient.clear();
// Special case one word divisor // Special case one word divisor
if (b.intLen == 1) { if (b.intLen == 1) {
int r = divideOneWord(b.value[b.offset], quotient); int r = divideOneWord(b.value[b.offset], quotient);
if(needReminder) { if(needRemainder) {
if (r == 0) if (r == 0)
return new MutableBigInteger(); return new MutableBigInteger();
return new MutableBigInteger(r); return new MutableBigInteger(r);
@ -956,7 +1209,220 @@ class MutableBigInteger {
return null; return null;
} }
} }
return divideMagnitude(b, quotient, needReminder);
// Cancel common powers of two if we're above the KNUTH_POW2_* thresholds
if (intLen >= KNUTH_POW2_THRESH_LEN) {
int trailingZeroBits = Math.min(getLowestSetBit(), b.getLowestSetBit());
if (trailingZeroBits >= KNUTH_POW2_THRESH_ZEROS*32) {
MutableBigInteger a = new MutableBigInteger(this);
b = new MutableBigInteger(b);
a.rightShift(trailingZeroBits);
b.rightShift(trailingZeroBits);
MutableBigInteger r = a.divideKnuth(b, quotient);
r.leftShift(trailingZeroBits);
return r;
}
}
return divideMagnitude(b, quotient, needRemainder);
}
/**
* Computes {@code this/b} and {@code this%b} using the
* <a href="http://cr.yp.to/bib/1998/burnikel.ps"> Burnikel-Ziegler algorithm</a>.
* This method implements algorithm 3 from pg. 9 of the Burnikel-Ziegler paper.
* The parameter beta was chosen to b 2<sup>32</sup> so almost all shifts are
* multiples of 32 bits.<br/>
* {@code this} and {@code b} must be nonnegative.
* @param b the divisor
* @param quotient output parameter for {@code this/b}
* @return the remainder
*/
MutableBigInteger divideAndRemainderBurnikelZiegler(MutableBigInteger b, MutableBigInteger quotient) {
int r = intLen;
int s = b.intLen;
if (r < s) {
return this;
} else {
// Unlike Knuth division, we don't check for common powers of two here because
// BZ already runs faster if both numbers contain powers of two and cancelling them has no
// additional benefit.
// step 1: let m = min{2^k | (2^k)*BURNIKEL_ZIEGLER_THRESHOLD > s}
int m = 1 << (32-Integer.numberOfLeadingZeros(s/BigInteger.BURNIKEL_ZIEGLER_THRESHOLD));
int j = (s+m-1) / m; // step 2a: j = ceil(s/m)
int n = j * m; // step 2b: block length in 32-bit units
int n32 = 32 * n; // block length in bits
int sigma = Math.max(0, n32 - b.bitLength()); // step 3: sigma = max{T | (2^T)*B < beta^n}
MutableBigInteger bShifted = new MutableBigInteger(b);
bShifted.safeLeftShift(sigma); // step 4a: shift b so its length is a multiple of n
safeLeftShift(sigma); // step 4b: shift this by the same amount
// step 5: t is the number of blocks needed to accommodate this plus one additional bit
int t = (bitLength()+n32) / n32;
if (t < 2) {
t = 2;
}
// step 6: conceptually split this into blocks a[t-1], ..., a[0]
MutableBigInteger a1 = getBlock(t-1, t, n); // the most significant block of this
// step 7: z[t-2] = [a[t-1], a[t-2]]
MutableBigInteger z = getBlock(t-2, t, n); // the second to most significant block
z.addDisjoint(a1, n); // z[t-2]
// do schoolbook division on blocks, dividing 2-block numbers by 1-block numbers
MutableBigInteger qi = new MutableBigInteger();
MutableBigInteger ri;
quotient.offset = quotient.intLen = 0;
for (int i=t-2; i > 0; i--) {
// step 8a: compute (qi,ri) such that z=b*qi+ri
ri = z.divide2n1n(bShifted, qi);
// step 8b: z = [ri, a[i-1]]
z = getBlock(i-1, t, n); // a[i-1]
z.addDisjoint(ri, n);
quotient.addShifted(qi, i*n); // update q (part of step 9)
}
// final iteration of step 8: do the loop one more time for i=0 but leave z unchanged
ri = z.divide2n1n(bShifted, qi);
quotient.add(qi);
ri.rightShift(sigma); // step 9: this and b were shifted, so shift back
return ri;
}
}
/**
* This method implements algorithm 1 from pg. 4 of the Burnikel-Ziegler paper.
* It divides a 2n-digit number by a n-digit number.<br/>
* The parameter beta is 2<sup>32</sup> so all shifts are multiples of 32 bits.
* <br/>
* {@code this} must be a nonnegative number such that {@code this.bitLength() <= 2*b.bitLength()}
* @param b a positive number such that {@code b.bitLength()} is even
* @param quotient output parameter for {@code this/b}
* @return {@code this%b}
*/
private MutableBigInteger divide2n1n(MutableBigInteger b, MutableBigInteger quotient) {
int n = b.intLen;
// step 1: base case
if (n%2 != 0 || n < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD) {
return divideKnuth(b, quotient);
}
// step 2: view this as [a1,a2,a3,a4] where each ai is n/2 ints or less
MutableBigInteger aUpper = new MutableBigInteger(this);
aUpper.safeRightShift(32*(n/2)); // aUpper = [a1,a2,a3]
keepLower(n/2); // this = a4
// step 3: q1=aUpper/b, r1=aUpper%b
MutableBigInteger q1 = new MutableBigInteger();
MutableBigInteger r1 = aUpper.divide3n2n(b, q1);
// step 4: quotient=[r1,this]/b, r2=[r1,this]%b
addDisjoint(r1, n/2); // this = [r1,this]
MutableBigInteger r2 = divide3n2n(b, quotient);
// step 5: let quotient=[q1,quotient] and return r2
quotient.addDisjoint(q1, n/2);
return r2;
}
/**
* This method implements algorithm 2 from pg. 5 of the Burnikel-Ziegler paper.
* It divides a 3n-digit number by a 2n-digit number.<br/>
* The parameter beta is 2<sup>32</sup> so all shifts are multiples of 32 bits.<br/>
* <br/>
* {@code this} must be a nonnegative number such that {@code 2*this.bitLength() <= 3*b.bitLength()}
* @param quotient output parameter for {@code this/b}
* @return {@code this%b}
*/
private MutableBigInteger divide3n2n(MutableBigInteger b, MutableBigInteger quotient) {
int n = b.intLen / 2; // half the length of b in ints
// step 1: view this as [a1,a2,a3] where each ai is n ints or less; let a12=[a1,a2]
MutableBigInteger a12 = new MutableBigInteger(this);
a12.safeRightShift(32*n);
// step 2: view b as [b1,b2] where each bi is n ints or less
MutableBigInteger b1 = new MutableBigInteger(b);
b1.safeRightShift(n * 32);
BigInteger b2 = b.getLower(n);
MutableBigInteger r;
MutableBigInteger d;
if (compareShifted(b, n) < 0) {
// step 3a: if a1<b1, let quotient=a12/b1 and r=a12%b1
r = a12.divide2n1n(b1, quotient);
// step 4: d=quotient*b2
d = new MutableBigInteger(quotient.toBigInteger().multiply(b2));
} else {
// step 3b: if a1>=b1, let quotient=beta^n-1 and r=a12-b1*2^n+b1
quotient.ones(n);
a12.add(b1);
b1.leftShift(32*n);
a12.subtract(b1);
r = a12;
// step 4: d=quotient*b2=(b2 << 32*n) - b2
d = new MutableBigInteger(b2);
d.leftShift(32 * n);
d.subtract(new MutableBigInteger(b2));
}
// step 5: r = r*beta^n + a3 - d (paper says a4)
// However, don't subtract d until after the while loop so r doesn't become negative
r.leftShift(32 * n);
r.addLower(this, n);
// step 6: add b until r>=d
while (r.compare(d) < 0) {
r.add(b);
quotient.subtract(MutableBigInteger.ONE);
}
r.subtract(d);
return r;
}
/**
* Returns a {@code MutableBigInteger} containing {@code blockLength} ints from
* {@code this} number, starting at {@code index*blockLength}.<br/>
* Used by Burnikel-Ziegler division.
* @param index the block index
* @param numBlocks the total number of blocks in {@code this} number
* @param blockLength length of one block in units of 32 bits
* @return
*/
private MutableBigInteger getBlock(int index, int numBlocks, int blockLength) {
int blockStart = index * blockLength;
if (blockStart >= intLen) {
return new MutableBigInteger();
}
int blockEnd;
if (index == numBlocks-1) {
blockEnd = intLen;
} else {
blockEnd = (index+1) * blockLength;
}
if (blockEnd > intLen) {
return new MutableBigInteger();
}
int[] newVal = Arrays.copyOfRange(value, offset+intLen-blockEnd, offset+intLen-blockStart);
return new MutableBigInteger(newVal);
}
/** @see BigInteger#bitLength() */
int bitLength() {
if (intLen == 0)
return 0;
return intLen*32 - Integer.numberOfLeadingZeros(value[offset]);
} }
/** /**
@ -1006,7 +1472,7 @@ class MutableBigInteger {
*/ */
private MutableBigInteger divideMagnitude(MutableBigInteger div, private MutableBigInteger divideMagnitude(MutableBigInteger div,
MutableBigInteger quotient, MutableBigInteger quotient,
boolean needReminder ) { boolean needRemainder ) {
// assert div.intLen > 1 // assert div.intLen > 1
// D1 normalize the divisor // D1 normalize the divisor
int shift = Integer.numberOfLeadingZeros(div.value[div.offset]); int shift = Integer.numberOfLeadingZeros(div.value[div.offset]);
@ -1017,7 +1483,7 @@ class MutableBigInteger {
if (shift > 0) { if (shift > 0) {
divisor = new int[dlen]; divisor = new int[dlen];
copyAndShift(div.value,div.offset,dlen,divisor,0,shift); copyAndShift(div.value,div.offset,dlen,divisor,0,shift);
if(Integer.numberOfLeadingZeros(value[offset])>=shift) { if (Integer.numberOfLeadingZeros(value[offset]) >= shift) {
int[] remarr = new int[intLen + 1]; int[] remarr = new int[intLen + 1];
rem = new MutableBigInteger(remarr); rem = new MutableBigInteger(remarr);
rem.intLen = intLen; rem.intLen = intLen;
@ -1070,7 +1536,7 @@ class MutableBigInteger {
int dl = divisor[1]; int dl = divisor[1];
// D2 Initialize j // D2 Initialize j
for(int j=0; j<limit-1; j++) { for (int j=0; j < limit-1; j++) {
// D3 Calculate qhat // D3 Calculate qhat
// estimate qhat // estimate qhat
int qhat = 0; int qhat = 0;
@ -1176,7 +1642,7 @@ class MutableBigInteger {
// D4 Multiply and subtract // D4 Multiply and subtract
int borrow; int borrow;
rem.value[limit - 1 + rem.offset] = 0; rem.value[limit - 1 + rem.offset] = 0;
if(needReminder) if(needRemainder)
borrow = mulsub(rem.value, divisor, qhat, dlen, limit - 1 + rem.offset); borrow = mulsub(rem.value, divisor, qhat, dlen, limit - 1 + rem.offset);
else else
borrow = mulsubBorrow(rem.value, divisor, qhat, dlen, limit - 1 + rem.offset); borrow = mulsubBorrow(rem.value, divisor, qhat, dlen, limit - 1 + rem.offset);
@ -1184,7 +1650,7 @@ class MutableBigInteger {
// D5 Test remainder // D5 Test remainder
if (borrow + 0x80000000 > nh2) { if (borrow + 0x80000000 > nh2) {
// D6 Add back // D6 Add back
if(needReminder) if(needRemainder)
divadd(divisor, rem.value, limit - 1 + 1 + rem.offset); divadd(divisor, rem.value, limit - 1 + 1 + rem.offset);
qhat--; qhat--;
} }
@ -1194,14 +1660,14 @@ class MutableBigInteger {
} }
if(needReminder) { if (needRemainder) {
// D8 Unnormalize // D8 Unnormalize
if (shift > 0) if (shift > 0)
rem.rightShift(shift); rem.rightShift(shift);
rem.normalize(); rem.normalize();
} }
quotient.normalize(); quotient.normalize();
return needReminder ? rem : null; return needRemainder ? rem : null;
} }
/** /**
@ -1367,7 +1833,7 @@ class MutableBigInteger {
* This method divides a long quantity by an int to estimate * This method divides a long quantity by an int to estimate
* qhat for two multi precision numbers. It is used when * qhat for two multi precision numbers. It is used when
* the signed value of n is less than zero. * the signed value of n is less than zero.
* Returns long value where high 32 bits contain reminder value and * Returns long value where high 32 bits contain remainder value and
* low 32 bits contain quotient value. * low 32 bits contain quotient value.
*/ */
static long divWord(long n, int d) { static long divWord(long n, int d) {
@ -1436,7 +1902,7 @@ class MutableBigInteger {
} }
// step B2 // step B2
boolean uOdd = (k==s1); boolean uOdd = (k == s1);
MutableBigInteger t = uOdd ? v: u; MutableBigInteger t = uOdd ? v: u;
int tsign = uOdd ? -1 : 1; int tsign = uOdd ? -1 : 1;
@ -1478,9 +1944,9 @@ class MutableBigInteger {
* Calculate GCD of a and b interpreted as unsigned integers. * Calculate GCD of a and b interpreted as unsigned integers.
*/ */
static int binaryGcd(int a, int b) { static int binaryGcd(int a, int b) {
if (b==0) if (b == 0)
return a; return a;
if (a==0) if (a == 0)
return b; return b;
// Right shift a & b till their last bits equal to 1. // Right shift a & b till their last bits equal to 1.
@ -1582,7 +2048,7 @@ class MutableBigInteger {
return result; return result;
} }
/* /**
* Returns the multiplicative inverse of val mod 2^32. Assumes val is odd. * Returns the multiplicative inverse of val mod 2^32. Assumes val is odd.
*/ */
static int inverseMod32(int val) { static int inverseMod32(int val) {
@ -1595,7 +2061,7 @@ class MutableBigInteger {
return t; return t;
} }
/* /**
* Calculate the multiplicative inverse of 2^k mod mod, where mod is odd. * Calculate the multiplicative inverse of 2^k mod mod, where mod is odd.
*/ */
static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) { static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) {
@ -1631,7 +2097,7 @@ class MutableBigInteger {
} }
// The Almost Inverse Algorithm // The Almost Inverse Algorithm
while(!f.isOne()) { while (!f.isOne()) {
// If gcd(f, g) != 1, number is not invertible modulo mod // If gcd(f, g) != 1, number is not invertible modulo mod
if (f.isZero()) if (f.isZero())
throw new ArithmeticException("BigInteger not invertible."); throw new ArithmeticException("BigInteger not invertible.");
@ -1665,7 +2131,7 @@ class MutableBigInteger {
return fixup(c, p, k); return fixup(c, p, k);
} }
/* /**
* The Fixup Algorithm * The Fixup Algorithm
* Calculates X such that X = C * 2^(-k) (mod P) * Calculates X such that X = C * 2^(-k) (mod P)
* Assumes C<P and P is odd. * Assumes C<P and P is odd.
@ -1676,7 +2142,7 @@ class MutableBigInteger {
// Set r to the multiplicative inverse of p mod 2^32 // Set r to the multiplicative inverse of p mod 2^32
int r = -inverseMod32(p.value[p.offset+p.intLen-1]); int r = -inverseMod32(p.value[p.offset+p.intLen-1]);
for(int i=0, numWords = k >> 5; i<numWords; i++) { for (int i=0, numWords = k >> 5; i < numWords; i++) {
// V = R * c (mod 2^j) // V = R * c (mod 2^j)
int v = r * c.value[c.offset + c.intLen-1]; int v = r * c.value[c.offset + c.intLen-1];
// c = c + (v * p) // c = c + (v * p)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -103,17 +103,17 @@ class Authenticator {
* Sets the authenticator that will be used by the networking code * Sets the authenticator that will be used by the networking code
* when a proxy or an HTTP server asks for authentication. * when a proxy or an HTTP server asks for authentication.
* <p> * <p>
* First, if there is a security manager, its <code>checkPermission</code> * First, if there is a security manager, its {@code checkPermission}
* method is called with a * method is called with a
* <code>NetPermission("setDefaultAuthenticator")</code> permission. * {@code NetPermission("setDefaultAuthenticator")} permission.
* This may result in a java.lang.SecurityException. * This may result in a java.lang.SecurityException.
* *
* @param a The authenticator to be set. If a is <code>null</code> then * @param a The authenticator to be set. If a is {@code null} then
* any previously set authenticator is removed. * any previously set authenticator is removed.
* *
* @throws SecurityException * @throws SecurityException
* if a security manager exists and its * if a security manager exists and its
* <code>checkPermission</code> method doesn't allow * {@code checkPermission} method doesn't allow
* setting the default authenticator. * setting the default authenticator.
* *
* @see SecurityManager#checkPermission * @see SecurityManager#checkPermission
@ -134,9 +134,9 @@ class Authenticator {
* Ask the authenticator that has been registered with the system * Ask the authenticator that has been registered with the system
* for a password. * for a password.
* <p> * <p>
* First, if there is a security manager, its <code>checkPermission</code> * First, if there is a security manager, its {@code checkPermission}
* method is called with a * method is called with a
* <code>NetPermission("requestPasswordAuthentication")</code> permission. * {@code NetPermission("requestPasswordAuthentication")} permission.
* This may result in a java.lang.SecurityException. * This may result in a java.lang.SecurityException.
* *
* @param addr The InetAddress of the site requesting authorization, * @param addr The InetAddress of the site requesting authorization,
@ -151,7 +151,7 @@ class Authenticator {
* *
* @throws SecurityException * @throws SecurityException
* if a security manager exists and its * if a security manager exists and its
* <code>checkPermission</code> method doesn't allow * {@code checkPermission} method doesn't allow
* the password authentication request. * the password authentication request.
* *
* @see SecurityManager#checkPermission * @see SecurityManager#checkPermission
@ -193,9 +193,9 @@ class Authenticator {
* because the hostname can be provided in cases where the InetAddress * because the hostname can be provided in cases where the InetAddress
* is not available. * is not available.
* <p> * <p>
* First, if there is a security manager, its <code>checkPermission</code> * First, if there is a security manager, its {@code checkPermission}
* method is called with a * method is called with a
* <code>NetPermission("requestPasswordAuthentication")</code> permission. * {@code NetPermission("requestPasswordAuthentication")} permission.
* This may result in a java.lang.SecurityException. * This may result in a java.lang.SecurityException.
* *
* @param host The hostname of the site requesting authentication. * @param host The hostname of the site requesting authentication.
@ -211,7 +211,7 @@ class Authenticator {
* *
* @throws SecurityException * @throws SecurityException
* if a security manager exists and its * if a security manager exists and its
* <code>checkPermission</code> method doesn't allow * {@code checkPermission} method doesn't allow
* the password authentication request. * the password authentication request.
* *
* @see SecurityManager#checkPermission * @see SecurityManager#checkPermission
@ -254,9 +254,9 @@ class Authenticator {
* Ask the authenticator that has been registered with the system * Ask the authenticator that has been registered with the system
* for a password. * for a password.
* <p> * <p>
* First, if there is a security manager, its <code>checkPermission</code> * First, if there is a security manager, its {@code checkPermission}
* method is called with a * method is called with a
* <code>NetPermission("requestPasswordAuthentication")</code> permission. * {@code NetPermission("requestPasswordAuthentication")} permission.
* This may result in a java.lang.SecurityException. * This may result in a java.lang.SecurityException.
* *
* @param host The hostname of the site requesting authentication. * @param host The hostname of the site requesting authentication.
@ -275,7 +275,7 @@ class Authenticator {
* *
* @throws SecurityException * @throws SecurityException
* if a security manager exists and its * if a security manager exists and its
* <code>checkPermission</code> method doesn't allow * {@code checkPermission} method doesn't allow
* the password authentication request. * the password authentication request.
* *
* @see SecurityManager#checkPermission * @see SecurityManager#checkPermission
@ -320,8 +320,8 @@ class Authenticator {
} }
/** /**
* Gets the <code>hostname</code> of the * Gets the {@code hostname} of the
* site or proxy requesting authentication, or <code>null</code> * site or proxy requesting authentication, or {@code null}
* if not available. * if not available.
* *
* @return the hostname of the connection requiring authentication, or null * @return the hostname of the connection requiring authentication, or null
@ -333,8 +333,8 @@ class Authenticator {
} }
/** /**
* Gets the <code>InetAddress</code> of the * Gets the {@code InetAddress} of the
* site requesting authorization, or <code>null</code> * site requesting authorization, or {@code null}
* if not available. * if not available.
* *
* @return the InetAddress of the site requesting authorization, or null * @return the InetAddress of the site requesting authorization, or null
@ -346,7 +346,7 @@ class Authenticator {
/** /**
* Gets the port number for the requested connection. * Gets the port number for the requested connection.
* @return an <code>int</code> indicating the * @return an {@code int} indicating the
* port for the requested connection. * port for the requested connection.
*/ */
protected final int getRequestingPort() { protected final int getRequestingPort() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,21 +28,21 @@ package java.net;
import java.io.IOException; import java.io.IOException;
/** /**
* The abstract class <code>ContentHandler</code> is the superclass * The abstract class {@code ContentHandler} is the superclass
* of all classes that read an <code>Object</code> from a * of all classes that read an {@code Object} from a
* <code>URLConnection</code>. * {@code URLConnection}.
* <p> * <p>
* An application does not generally call the * An application does not generally call the
* <code>getContent</code> method in this class directly. Instead, an * {@code getContent} method in this class directly. Instead, an
* application calls the <code>getContent</code> method in class * application calls the {@code getContent} method in class
* <code>URL</code> or in <code>URLConnection</code>. * {@code URL} or in {@code URLConnection}.
* The application's content handler factory (an instance of a class that * The application's content handler factory (an instance of a class that
* implements the interface <code>ContentHandlerFactory</code> set * implements the interface {@code ContentHandlerFactory} set
* up by a call to <code>setContentHandler</code>) is * up by a call to {@code setContentHandler}) is
* called with a <code>String</code> giving the MIME type of the * called with a {@code String} giving the MIME type of the
* object being received on the socket. The factory returns an * object being received on the socket. The factory returns an
* instance of a subclass of <code>ContentHandler</code>, and its * instance of a subclass of {@code ContentHandler}, and its
* <code>getContent</code> method is called to create the object. * {@code getContent} method is called to create the object.
* <p> * <p>
* If no content handler could be found, URLConnection will * If no content handler could be found, URLConnection will
* look for a content handler in a user-defineable set of places. * look for a content handler in a user-defineable set of places.
@ -75,7 +75,7 @@ abstract public class ContentHandler {
* creates an object from it. * creates an object from it.
* *
* @param urlc a URL connection. * @param urlc a URL connection.
* @return the object read by the <code>ContentHandler</code>. * @return the object read by the {@code ContentHandler}.
* @exception IOException if an I/O error occurs while reading the object. * @exception IOException if an I/O error occurs while reading the object.
*/ */
abstract public Object getContent(URLConnection urlc) throws IOException; abstract public Object getContent(URLConnection urlc) throws IOException;
@ -90,7 +90,7 @@ abstract public class ContentHandler {
* *
* @param urlc a URL connection. * @param urlc a URL connection.
* @param classes an array of types requested * @param classes an array of types requested
* @return the object read by the <code>ContentHandler</code> that is * @return the object read by the {@code ContentHandler} that is
* the first match of the suggested types. * the first match of the suggested types.
* null if none of the requested are supported. * null if none of the requested are supported.
* @exception IOException if an I/O error occurs while reading the object. * @exception IOException if an I/O error occurs while reading the object.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,10 +28,10 @@ package java.net;
/** /**
* This interface defines a factory for content handlers. An * This interface defines a factory for content handlers. An
* implementation of this interface should map a MIME type into an * implementation of this interface should map a MIME type into an
* instance of <code>ContentHandler</code>. * instance of {@code ContentHandler}.
* <p> * <p>
* This interface is used by the <code>URLStreamHandler</code> class * This interface is used by the {@code URLStreamHandler} class
* to create a <code>ContentHandler</code> for a MIME type. * to create a {@code ContentHandler} for a MIME type.
* *
* @author James Gosling * @author James Gosling
* @see java.net.ContentHandler * @see java.net.ContentHandler
@ -40,13 +40,13 @@ package java.net;
*/ */
public interface ContentHandlerFactory { public interface ContentHandlerFactory {
/** /**
* Creates a new <code>ContentHandler</code> to read an object from * Creates a new {@code ContentHandler} to read an object from
* a <code>URLStreamHandler</code>. * a {@code URLStreamHandler}.
* *
* @param mimetype the MIME type for which a content handler is desired. * @param mimetype the MIME type for which a content handler is desired.
* @return a new <code>ContentHandler</code> to read an object from a * @return a new {@code ContentHandler} to read an object from a
* <code>URLStreamHandler</code>. * {@code URLStreamHandler}.
* @see java.net.ContentHandler * @see java.net.ContentHandler
* @see java.net.URLStreamHandler * @see java.net.URLStreamHandler
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -66,7 +66,7 @@ public abstract class CookieHandler {
* there is no system-wide cookie handler currently set. * there is no system-wide cookie handler currently set.
* @throws SecurityException * @throws SecurityException
* If a security manager has been installed and it denies * If a security manager has been installed and it denies
* {@link NetPermission}<tt>("getCookieHandler")</tt> * {@link NetPermission}{@code ("getCookieHandler")}
* @see #setDefault(CookieHandler) * @see #setDefault(CookieHandler)
*/ */
public synchronized static CookieHandler getDefault() { public synchronized static CookieHandler getDefault() {
@ -83,10 +83,10 @@ public abstract class CookieHandler {
* Note: non-standard http protocol handlers may ignore this setting. * Note: non-standard http protocol handlers may ignore this setting.
* *
* @param cHandler The HTTP cookie handler, or * @param cHandler The HTTP cookie handler, or
* <code>null</code> to unset. * {@code null} to unset.
* @throws SecurityException * @throws SecurityException
* If a security manager has been installed and it denies * If a security manager has been installed and it denies
* {@link NetPermission}<tt>("setCookieHandler")</tt> * {@link NetPermission}{@code ("setCookieHandler")}
* @see #getDefault() * @see #getDefault()
*/ */
public synchronized static void setDefault(CookieHandler cHandler) { public synchronized static void setDefault(CookieHandler cHandler) {
@ -114,7 +114,7 @@ public abstract class CookieHandler {
* called after all request headers related to choosing cookies * called after all request headers related to choosing cookies
* are added, and before the request is sent.</P> * are added, and before the request is sent.</P>
* *
* @param uri a <code>URI</code> representing the intended use for the * @param uri a {@code URI} representing the intended use for the
* cookies * cookies
* @param requestHeaders - a Map from request header * @param requestHeaders - a Map from request header
* field names to lists of field values representing * field names to lists of field values representing
@ -136,7 +136,7 @@ public abstract class CookieHandler {
* fields that are named Set-Cookie2, present in the response * fields that are named Set-Cookie2, present in the response
* headers into a cookie cache. * headers into a cookie cache.
* *
* @param uri a <code>URI</code> where the cookies come from * @param uri a {@code URI} where the cookies come from
* @param responseHeaders an immutable map from field names to * @param responseHeaders an immutable map from field names to
* lists of field values representing the response * lists of field values representing the response
* header fields returned * header fields returned

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -131,7 +131,7 @@ public class CookieManager extends CookieHandler
* *
* <p>This constructor will create new cookie manager with default * <p>This constructor will create new cookie manager with default
* cookie store and accept policy. The effect is same as * cookie store and accept policy. The effect is same as
* <tt>CookieManager(null, null)</tt>. * {@code CookieManager(null, null)}.
*/ */
public CookieManager() { public CookieManager() {
this(null, null); this(null, null);
@ -141,12 +141,12 @@ public class CookieManager extends CookieHandler
/** /**
* Create a new cookie manager with specified cookie store and cookie policy. * Create a new cookie manager with specified cookie store and cookie policy.
* *
* @param store a <tt>CookieStore</tt> to be used by cookie manager. * @param store a {@code CookieStore} to be used by cookie manager.
* if <tt>null</tt>, cookie manager will use a default one, * if {@code null}, cookie manager will use a default one,
* which is an in-memory CookieStore implmentation. * which is an in-memory CookieStore implmentation.
* @param cookiePolicy a <tt>CookiePolicy</tt> instance * @param cookiePolicy a {@code CookiePolicy} instance
* to be used by cookie manager as policy callback. * to be used by cookie manager as policy callback.
* if <tt>null</tt>, ACCEPT_ORIGINAL_SERVER will * if {@code null}, ACCEPT_ORIGINAL_SERVER will
* be used. * be used.
*/ */
public CookieManager(CookieStore store, public CookieManager(CookieStore store,
@ -170,11 +170,11 @@ public class CookieManager extends CookieHandler
/** /**
* To set the cookie policy of this cookie manager. * To set the cookie policy of this cookie manager.
* *
* <p> A instance of <tt>CookieManager</tt> will have * <p> A instance of {@code CookieManager} will have
* cookie policy ACCEPT_ORIGINAL_SERVER by default. Users always * cookie policy ACCEPT_ORIGINAL_SERVER by default. Users always
* can call this method to set another cookie policy. * can call this method to set another cookie policy.
* *
* @param cookiePolicy the cookie policy. Can be <tt>null</tt>, which * @param cookiePolicy the cookie policy. Can be {@code null}, which
* has no effects on current cookie policy. * has no effects on current cookie policy.
*/ */
public void setCookiePolicy(CookiePolicy cookiePolicy) { public void setCookiePolicy(CookiePolicy cookiePolicy) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -71,8 +71,8 @@ public interface CookiePolicy {
* *
* @param uri the URI to consult accept policy with * @param uri the URI to consult accept policy with
* @param cookie the HttpCookie object in question * @param cookie the HttpCookie object in question
* @return <tt>true</tt> if this cookie should be accepted; * @return {@code true} if this cookie should be accepted;
* otherwise, <tt>false</tt> * otherwise, {@code false}
*/ */
public boolean shouldAccept(URI uri, HttpCookie cookie); public boolean shouldAccept(URI uri, HttpCookie cookie);
} }

View File

@ -32,8 +32,8 @@ import java.util.Map;
* A CookieStore object represents a storage for cookie. Can store and retrieve * A CookieStore object represents a storage for cookie. Can store and retrieve
* cookies. * cookies.
* *
* <p>{@link CookieManager} will call <tt>CookieStore.add</tt> to save cookies * <p>{@link CookieManager} will call {@code CookieStore.add} to save cookies
* for every incoming HTTP response, and call <tt>CookieStore.get</tt> to * for every incoming HTTP response, and call {@code CookieStore.get} to
* retrieve cookie for every outgoing HTTP request. A CookieStore * retrieve cookie for every outgoing HTTP request. A CookieStore
* is responsible for removing HttpCookie instances which have expired. * is responsible for removing HttpCookie instances which have expired.
* *
@ -55,11 +55,11 @@ public interface CookieStore {
* then it is replaced with the new one. * then it is replaced with the new one.
* *
* @param uri the uri this cookie associated with. * @param uri the uri this cookie associated with.
* if <tt>null</tt>, this cookie will not be associated * if {@code null}, this cookie will not be associated
* with an URI * with an URI
* @param cookie the cookie to store * @param cookie the cookie to store
* *
* @throws NullPointerException if <tt>cookie</tt> is <tt>null</tt> * @throws NullPointerException if {@code cookie} is {@code null}
* *
* @see #get * @see #get
* *
@ -77,7 +77,7 @@ public interface CookieStore {
* *
* @param uri the uri associated with the cookies to be returned * @param uri the uri associated with the cookies to be returned
* *
* @throws NullPointerException if <tt>uri</tt> is <tt>null</tt> * @throws NullPointerException if {@code uri} is {@code null}
* *
* @see #add * @see #add
* *
@ -108,14 +108,14 @@ public interface CookieStore {
* Remove a cookie from store. * Remove a cookie from store.
* *
* @param uri the uri this cookie associated with. * @param uri the uri this cookie associated with.
* if <tt>null</tt>, the cookie to be removed is not associated * if {@code null}, the cookie to be removed is not associated
* with an URI when added; if not <tt>null</tt>, the cookie * with an URI when added; if not {@code null}, the cookie
* to be removed is associated with the given URI when added. * to be removed is associated with the given URI when added.
* @param cookie the cookie to remove * @param cookie the cookie to remove
* *
* @return <tt>true</tt> if this store contained the specified cookie * @return {@code true} if this store contained the specified cookie
* *
* @throws NullPointerException if <tt>cookie</tt> is <tt>null</tt> * @throws NullPointerException if {@code cookie} is {@code null}
*/ */
public boolean remove(URI uri, HttpCookie cookie); public boolean remove(URI uri, HttpCookie cookie);
@ -123,7 +123,7 @@ public interface CookieStore {
/** /**
* Remove all cookies in this cookie store. * Remove all cookies in this cookie store.
* *
* @return <tt>true</tt> if this store changed as a result of the call * @return {@code true} if this store changed as a result of the call
*/ */
public boolean removeAll(); public boolean removeAll();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -68,11 +68,11 @@ class DatagramPacket {
int port; int port;
/** /**
* Constructs a <code>DatagramPacket</code> for receiving packets of * Constructs a {@code DatagramPacket} for receiving packets of
* length <code>length</code>, specifying an offset into the buffer. * length {@code length}, specifying an offset into the buffer.
* <p> * <p>
* The <code>length</code> argument must be less than or equal to * The {@code length} argument must be less than or equal to
* <code>buf.length</code>. * {@code buf.length}.
* *
* @param buf buffer for holding the incoming datagram. * @param buf buffer for holding the incoming datagram.
* @param offset the offset for the buffer * @param offset the offset for the buffer
@ -87,11 +87,11 @@ class DatagramPacket {
} }
/** /**
* Constructs a <code>DatagramPacket</code> for receiving packets of * Constructs a {@code DatagramPacket} for receiving packets of
* length <code>length</code>. * length {@code length}.
* <p> * <p>
* The <code>length</code> argument must be less than or equal to * The {@code length} argument must be less than or equal to
* <code>buf.length</code>. * {@code buf.length}.
* *
* @param buf buffer for holding the incoming datagram. * @param buf buffer for holding the incoming datagram.
* @param length the number of bytes to read. * @param length the number of bytes to read.
@ -102,10 +102,10 @@ class DatagramPacket {
/** /**
* Constructs a datagram packet for sending packets of length * Constructs a datagram packet for sending packets of length
* <code>length</code> with offset <code>ioffset</code>to the * {@code length} with offset {@code ioffset}to the
* specified port number on the specified host. The * specified port number on the specified host. The
* <code>length</code> argument must be less than or equal to * {@code length} argument must be less than or equal to
* <code>buf.length</code>. * {@code buf.length}.
* *
* @param buf the packet data. * @param buf the packet data.
* @param offset the packet data offset. * @param offset the packet data offset.
@ -125,10 +125,10 @@ class DatagramPacket {
/** /**
* Constructs a datagram packet for sending packets of length * Constructs a datagram packet for sending packets of length
* <code>length</code> with offset <code>ioffset</code>to the * {@code length} with offset {@code ioffset}to the
* specified port number on the specified host. The * specified port number on the specified host. The
* <code>length</code> argument must be less than or equal to * {@code length} argument must be less than or equal to
* <code>buf.length</code>. * {@code buf.length}.
* *
* @param buf the packet data. * @param buf the packet data.
* @param offset the packet data offset. * @param offset the packet data offset.
@ -147,9 +147,9 @@ class DatagramPacket {
/** /**
* Constructs a datagram packet for sending packets of length * Constructs a datagram packet for sending packets of length
* <code>length</code> to the specified port number on the specified * {@code length} to the specified port number on the specified
* host. The <code>length</code> argument must be less than or equal * host. The {@code length} argument must be less than or equal
* to <code>buf.length</code>. * to {@code buf.length}.
* *
* @param buf the packet data. * @param buf the packet data.
* @param length the packet length. * @param length the packet length.
@ -164,9 +164,9 @@ class DatagramPacket {
/** /**
* Constructs a datagram packet for sending packets of length * Constructs a datagram packet for sending packets of length
* <code>length</code> to the specified port number on the specified * {@code length} to the specified port number on the specified
* host. The <code>length</code> argument must be less than or equal * host. The {@code length} argument must be less than or equal
* to <code>buf.length</code>. * to {@code buf.length}.
* *
* @param buf the packet data. * @param buf the packet data.
* @param length the packet length. * @param length the packet length.
@ -207,8 +207,8 @@ class DatagramPacket {
/** /**
* Returns the data buffer. The data received or the data to be sent * Returns the data buffer. The data received or the data to be sent
* starts from the <code>offset</code> in the buffer, * starts from the {@code offset} in the buffer,
* and runs for <code>length</code> long. * and runs for {@code length} long.
* *
* @return the buffer used to receive or send data * @return the buffer used to receive or send data
* @see #setData(byte[], int, int) * @see #setData(byte[], int, int)
@ -277,7 +277,7 @@ class DatagramPacket {
/** /**
* Sets the IP address of the machine to which this datagram * Sets the IP address of the machine to which this datagram
* is being sent. * is being sent.
* @param iaddr the <code>InetAddress</code> * @param iaddr the {@code InetAddress}
* @since JDK1.1 * @since JDK1.1
* @see #getAddress() * @see #getAddress()
*/ */
@ -303,7 +303,7 @@ class DatagramPacket {
* Sets the SocketAddress (usually IP address + port number) of the remote * Sets the SocketAddress (usually IP address + port number) of the remote
* host to which this datagram is being sent. * host to which this datagram is being sent.
* *
* @param address the <code>SocketAddress</code> * @param address the {@code SocketAddress}
* @throws IllegalArgumentException if address is null or is a * @throws IllegalArgumentException if address is null or is a
* SocketAddress subclass not supported by this socket * SocketAddress subclass not supported by this socket
* *
@ -324,7 +324,7 @@ class DatagramPacket {
* Gets the SocketAddress (usually IP address + port number) of the remote * Gets the SocketAddress (usually IP address + port number) of the remote
* host that this packet is being sent to or is coming from. * host that this packet is being sent to or is coming from.
* *
* @return the <code>SocketAddress</code> * @return the {@code SocketAddress}
* @since 1.4 * @since 1.4
* @see #setSocketAddress * @see #setSocketAddress
*/ */
@ -335,7 +335,7 @@ class DatagramPacket {
/** /**
* Set the data buffer for this packet. With the offset of * Set the data buffer for this packet. With the offset of
* this DatagramPacket set to 0, and the length set to * this DatagramPacket set to 0, and the length set to
* the length of <code>buf</code>. * the length of {@code buf}.
* *
* @param buf the buffer to set for this packet. * @param buf the buffer to set for this packet.
* *

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,14 +47,14 @@ import java.security.PrivilegedExceptionAction;
* a DatagramSocket is bound to a more specific address. * a DatagramSocket is bound to a more specific address.
* <p> * <p>
* Example: * Example:
* <code> * {@code
* DatagramSocket s = new DatagramSocket(null); * DatagramSocket s = new DatagramSocket(null);
* s.bind(new InetSocketAddress(8888)); * s.bind(new InetSocketAddress(8888));
* </code> * }
* Which is equivalent to: * Which is equivalent to:
* <code> * {@code
* DatagramSocket s = new DatagramSocket(8888); * DatagramSocket s = new DatagramSocket(8888);
* </code> * }
* Both cases will create a DatagramSocket able to receive broadcasts on * Both cases will create a DatagramSocket able to receive broadcasts on
* UDP port 8888. * UDP port 8888.
* *
@ -161,14 +161,14 @@ class DatagramSocket implements java.io.Closeable {
* an IP address chosen by the kernel. * an IP address chosen by the kernel.
* *
* <p>If there is a security manager, * <p>If there is a security manager,
* its <code>checkListen</code> method is first called * its {@code checkListen} method is first called
* with 0 as its argument to ensure the operation is allowed. * with 0 as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
* @exception SocketException if the socket could not be opened, * @exception SocketException if the socket could not be opened,
* or the socket could not bind to the specified local port. * or the socket could not bind to the specified local port.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation. * {@code checkListen} method doesn't allow the operation.
* *
* @see SecurityManager#checkListen * @see SecurityManager#checkListen
*/ */
@ -195,21 +195,21 @@ class DatagramSocket implements java.io.Closeable {
* Creates a datagram socket, bound to the specified local * Creates a datagram socket, bound to the specified local
* socket address. * socket address.
* <p> * <p>
* If, if the address is <code>null</code>, creates an unbound socket. * If, if the address is {@code null}, creates an unbound socket.
* <p> * <p>
* <p>If there is a security manager, * <p>If there is a security manager,
* its <code>checkListen</code> method is first called * its {@code checkListen} method is first called
* with the port from the socket address * with the port from the socket address
* as its argument to ensure the operation is allowed. * as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
* @param bindaddr local socket address to bind, or <code>null</code> * @param bindaddr local socket address to bind, or {@code null}
* for an unbound socket. * for an unbound socket.
* *
* @exception SocketException if the socket could not be opened, * @exception SocketException if the socket could not be opened,
* or the socket could not bind to the specified local port. * or the socket could not bind to the specified local port.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation. * {@code checkListen} method doesn't allow the operation.
* *
* @see SecurityManager#checkListen * @see SecurityManager#checkListen
* @since 1.4 * @since 1.4
@ -234,8 +234,8 @@ class DatagramSocket implements java.io.Closeable {
* an IP address chosen by the kernel. * an IP address chosen by the kernel.
* *
* <p>If there is a security manager, * <p>If there is a security manager,
* its <code>checkListen</code> method is first called * its {@code checkListen} method is first called
* with the <code>port</code> argument * with the {@code port} argument
* as its argument to ensure the operation is allowed. * as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
@ -243,7 +243,7 @@ class DatagramSocket implements java.io.Closeable {
* @exception SocketException if the socket could not be opened, * @exception SocketException if the socket could not be opened,
* or the socket could not bind to the specified local port. * or the socket could not bind to the specified local port.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation. * {@code checkListen} method doesn't allow the operation.
* *
* @see SecurityManager#checkListen * @see SecurityManager#checkListen
*/ */
@ -259,8 +259,8 @@ class DatagramSocket implements java.io.Closeable {
* an IP address chosen by the kernel. * an IP address chosen by the kernel.
* *
* <p>If there is a security manager, * <p>If there is a security manager,
* its <code>checkListen</code> method is first called * its {@code checkListen} method is first called
* with the <code>port</code> argument * with the {@code port} argument
* as its argument to ensure the operation is allowed. * as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
@ -270,7 +270,7 @@ class DatagramSocket implements java.io.Closeable {
* @exception SocketException if the socket could not be opened, * @exception SocketException if the socket could not be opened,
* or the socket could not bind to the specified local port. * or the socket could not bind to the specified local port.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation. * {@code checkListen} method doesn't allow the operation.
* *
* @see SecurityManager#checkListen * @see SecurityManager#checkListen
* @since JDK1.1 * @since JDK1.1
@ -319,10 +319,10 @@ class DatagramSocket implements java.io.Closeable {
} }
/** /**
* Get the <code>DatagramSocketImpl</code> attached to this socket, * Get the {@code DatagramSocketImpl} attached to this socket,
* creating it if necessary. * creating it if necessary.
* *
* @return the <code>DatagramSocketImpl</code> attached to that * @return the {@code DatagramSocketImpl} attached to that
* DatagramSocket * DatagramSocket
* @throws SocketException if creation fails. * @throws SocketException if creation fails.
* @since 1.4 * @since 1.4
@ -336,14 +336,14 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Binds this DatagramSocket to a specific address and port. * Binds this DatagramSocket to a specific address and port.
* <p> * <p>
* If the address is <code>null</code>, then the system will pick up * If the address is {@code null}, then the system will pick up
* an ephemeral port and a valid local address to bind the socket. * an ephemeral port and a valid local address to bind the socket.
*<p> *<p>
* @param addr The address and port to bind to. * @param addr The address and port to bind to.
* @throws SocketException if any error happens during the bind, or if the * @throws SocketException if any error happens during the bind, or if the
* socket is already bound. * socket is already bound.
* @throws SecurityException if a security manager exists and its * @throws SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation. * {@code checkListen} method doesn't allow the operation.
* @throws IllegalArgumentException if addr is a SocketAddress subclass * @throws IllegalArgumentException if addr is a SocketAddress subclass
* not supported by this socket. * not supported by this socket.
* @since 1.4 * @since 1.4
@ -496,7 +496,7 @@ class DatagramSocket implements java.io.Closeable {
* Returns the binding state of the socket. * Returns the binding state of the socket.
* <p> * <p>
* If the socket was bound prior to being {@link #close closed}, * If the socket was bound prior to being {@link #close closed},
* then this method will continue to return <code>true</code> * then this method will continue to return {@code true}
* after the socket is closed. * after the socket is closed.
* *
* @return true if the socket successfully bound to an address * @return true if the socket successfully bound to an address
@ -510,7 +510,7 @@ class DatagramSocket implements java.io.Closeable {
* Returns the connection state of the socket. * Returns the connection state of the socket.
* <p> * <p>
* If the socket was connected prior to being {@link #close closed}, * If the socket was connected prior to being {@link #close closed},
* then this method will continue to return <code>true</code> * then this method will continue to return {@code true}
* after the socket is closed. * after the socket is closed.
* *
* @return true if the socket successfully connected to a server * @return true if the socket successfully connected to a server
@ -522,7 +522,7 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Returns the address to which this socket is connected. Returns * Returns the address to which this socket is connected. Returns
* <code>null</code> if the socket is not connected. * {@code null} if the socket is not connected.
* <p> * <p>
* If the socket was connected prior to being {@link #close closed}, * If the socket was connected prior to being {@link #close closed},
* then this method will continue to return the connected address * then this method will continue to return the connected address
@ -536,7 +536,7 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Returns the port number to which this socket is connected. * Returns the port number to which this socket is connected.
* Returns <code>-1</code> if the socket is not connected. * Returns {@code -1} if the socket is not connected.
* <p> * <p>
* If the socket was connected prior to being {@link #close closed}, * If the socket was connected prior to being {@link #close closed},
* then this method will continue to return the connected port number * then this method will continue to return the connected port number
@ -550,14 +550,14 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Returns the address of the endpoint this socket is connected to, or * Returns the address of the endpoint this socket is connected to, or
* <code>null</code> if it is unconnected. * {@code null} if it is unconnected.
* <p> * <p>
* If the socket was connected prior to being {@link #close closed}, * If the socket was connected prior to being {@link #close closed},
* then this method will continue to return the connected address * then this method will continue to return the connected address
* after the socket is closed. * after the socket is closed.
* *
* @return a <code>SocketAddress</code> representing the remote * @return a {@code SocketAddress} representing the remote
* endpoint of this socket, or <code>null</code> if it is * endpoint of this socket, or {@code null} if it is
* not connected yet. * not connected yet.
* @see #getInetAddress() * @see #getInetAddress()
* @see #getPort() * @see #getPort()
@ -573,8 +573,8 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Returns the address of the endpoint this socket is bound to. * Returns the address of the endpoint this socket is bound to.
* *
* @return a <code>SocketAddress</code> representing the local endpoint of this * @return a {@code SocketAddress} representing the local endpoint of this
* socket, or <code>null</code> if it is closed or not bound yet. * socket, or {@code null} if it is closed or not bound yet.
* @see #getLocalAddress() * @see #getLocalAddress()
* @see #getLocalPort() * @see #getLocalPort()
* @see #bind(SocketAddress) * @see #bind(SocketAddress)
@ -591,28 +591,28 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Sends a datagram packet from this socket. The * Sends a datagram packet from this socket. The
* <code>DatagramPacket</code> includes information indicating the * {@code DatagramPacket} includes information indicating the
* data to be sent, its length, the IP address of the remote host, * data to be sent, its length, the IP address of the remote host,
* and the port number on the remote host. * and the port number on the remote host.
* *
* <p>If there is a security manager, and the socket is not currently * <p>If there is a security manager, and the socket is not currently
* connected to a remote address, this method first performs some * connected to a remote address, this method first performs some
* security checks. First, if <code>p.getAddress().isMulticastAddress()</code> * security checks. First, if {@code p.getAddress().isMulticastAddress()}
* is true, this method calls the * is true, this method calls the
* security manager's <code>checkMulticast</code> method * security manager's {@code checkMulticast} method
* with <code>p.getAddress()</code> as its argument. * with {@code p.getAddress()} as its argument.
* If the evaluation of that expression is false, * If the evaluation of that expression is false,
* this method instead calls the security manager's * this method instead calls the security manager's
* <code>checkConnect</code> method with arguments * {@code checkConnect} method with arguments
* <code>p.getAddress().getHostAddress()</code> and * {@code p.getAddress().getHostAddress()} and
* <code>p.getPort()</code>. Each call to a security manager method * {@code p.getPort()}. Each call to a security manager method
* could result in a SecurityException if the operation is not allowed. * could result in a SecurityException if the operation is not allowed.
* *
* @param p the <code>DatagramPacket</code> to be sent. * @param p the {@code DatagramPacket} to be sent.
* *
* @exception IOException if an I/O error occurs. * @exception IOException if an I/O error occurs.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkMulticast</code> or <code>checkConnect</code> * {@code checkMulticast} or {@code checkConnect}
* method doesn't allow the send. * method doesn't allow the send.
* @exception PortUnreachableException may be thrown if the socket is connected * @exception PortUnreachableException may be thrown if the socket is connected
* to a currently unreachable destination. Note, there is no * to a currently unreachable destination. Note, there is no
@ -674,20 +674,20 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Receives a datagram packet from this socket. When this method * Receives a datagram packet from this socket. When this method
* returns, the <code>DatagramPacket</code>'s buffer is filled with * returns, the {@code DatagramPacket}'s buffer is filled with
* the data received. The datagram packet also contains the sender's * the data received. The datagram packet also contains the sender's
* IP address, and the port number on the sender's machine. * IP address, and the port number on the sender's machine.
* <p> * <p>
* This method blocks until a datagram is received. The * This method blocks until a datagram is received. The
* <code>length</code> field of the datagram packet object contains * {@code length} field of the datagram packet object contains
* the length of the received message. If the message is longer than * the length of the received message. If the message is longer than
* the packet's length, the message is truncated. * the packet's length, the message is truncated.
* <p> * <p>
* If there is a security manager, a packet cannot be received if the * If there is a security manager, a packet cannot be received if the
* security manager's <code>checkAccept</code> method * security manager's {@code checkAccept} method
* does not allow it. * does not allow it.
* *
* @param p the <code>DatagramPacket</code> into which to place * @param p the {@code DatagramPacket} into which to place
* the incoming data. * the incoming data.
* @exception IOException if an I/O error occurs. * @exception IOException if an I/O error occurs.
* @exception SocketTimeoutException if setSoTimeout was previously called * @exception SocketTimeoutException if setSoTimeout was previously called
@ -786,17 +786,17 @@ class DatagramSocket implements java.io.Closeable {
* Gets the local address to which the socket is bound. * Gets the local address to which the socket is bound.
* *
* <p>If there is a security manager, its * <p>If there is a security manager, its
* <code>checkConnect</code> method is first called * {@code checkConnect} method is first called
* with the host address and <code>-1</code> * with the host address and {@code -1}
* as its arguments to see if the operation is allowed. * as its arguments to see if the operation is allowed.
* *
* @see SecurityManager#checkConnect * @see SecurityManager#checkConnect
* @return the local address to which the socket is bound, * @return the local address to which the socket is bound,
* <code>null</code> if the socket is closed, or * {@code null} if the socket is closed, or
* an <code>InetAddress</code> representing * an {@code InetAddress} representing
* {@link InetAddress#isAnyLocalAddress wildcard} * {@link InetAddress#isAnyLocalAddress wildcard}
* address if either the socket is not bound, or * address if either the socket is not bound, or
* the security manager <code>checkConnect</code> * the security manager {@code checkConnect}
* method does not allow the operation * method does not allow the operation
* @since 1.1 * @since 1.1
*/ */
@ -824,8 +824,8 @@ class DatagramSocket implements java.io.Closeable {
* is bound. * is bound.
* *
* @return the port number on the local host to which this socket is bound, * @return the port number on the local host to which this socket is bound,
<code>-1</code> if the socket is closed, or {@code -1} if the socket is closed, or
<code>0</code> if it is not bound yet. {@code 0} if it is not bound yet.
*/ */
public int getLocalPort() { public int getLocalPort() {
if (isClosed()) if (isClosed())
@ -883,7 +883,7 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Sets the SO_SNDBUF option to the specified value for this * Sets the SO_SNDBUF option to the specified value for this
* <tt>DatagramSocket</tt>. The SO_SNDBUF option is used by the * {@code DatagramSocket}. The SO_SNDBUF option is used by the
* network implementation as a hint to size the underlying * network implementation as a hint to size the underlying
* network I/O buffers. The SO_SNDBUF setting may also be used * network I/O buffers. The SO_SNDBUF setting may also be used
* by the network implementation to determine the maximum size * by the network implementation to determine the maximum size
@ -897,7 +897,7 @@ class DatagramSocket implements java.io.Closeable {
* is high. * is high.
* <p> * <p>
* Note: If {@link #send(DatagramPacket)} is used to send a * Note: If {@link #send(DatagramPacket)} is used to send a
* <code>DatagramPacket</code> that is larger than the setting * {@code DatagramPacket} that is larger than the setting
* of SO_SNDBUF then it is implementation specific if the * of SO_SNDBUF then it is implementation specific if the
* packet is sent or discarded. * packet is sent or discarded.
* *
@ -921,10 +921,10 @@ class DatagramSocket implements java.io.Closeable {
} }
/** /**
* Get value of the SO_SNDBUF option for this <tt>DatagramSocket</tt>, that is the * Get value of the SO_SNDBUF option for this {@code DatagramSocket}, that is the
* buffer size used by the platform for output on this <tt>DatagramSocket</tt>. * buffer size used by the platform for output on this {@code DatagramSocket}.
* *
* @return the value of the SO_SNDBUF option for this <tt>DatagramSocket</tt> * @return the value of the SO_SNDBUF option for this {@code DatagramSocket}
* @exception SocketException if there is an error in * @exception SocketException if there is an error in
* the underlying protocol, such as an UDP error. * the underlying protocol, such as an UDP error.
* @see #setSendBufferSize * @see #setSendBufferSize
@ -942,7 +942,7 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Sets the SO_RCVBUF option to the specified value for this * Sets the SO_RCVBUF option to the specified value for this
* <tt>DatagramSocket</tt>. The SO_RCVBUF option is used by the * {@code DatagramSocket}. The SO_RCVBUF option is used by the
* the network implementation as a hint to size the underlying * the network implementation as a hint to size the underlying
* network I/O buffers. The SO_RCVBUF setting may also be used * network I/O buffers. The SO_RCVBUF setting may also be used
* by the network implementation to determine the maximum size * by the network implementation to determine the maximum size
@ -979,10 +979,10 @@ class DatagramSocket implements java.io.Closeable {
} }
/** /**
* Get value of the SO_RCVBUF option for this <tt>DatagramSocket</tt>, that is the * Get value of the SO_RCVBUF option for this {@code DatagramSocket}, that is the
* buffer size used by the platform for input on this <tt>DatagramSocket</tt>. * buffer size used by the platform for input on this {@code DatagramSocket}.
* *
* @return the value of the SO_RCVBUF option for this <tt>DatagramSocket</tt> * @return the value of the SO_RCVBUF option for this {@code DatagramSocket}
* @exception SocketException if there is an error in the underlying protocol, such as an UDP error. * @exception SocketException if there is an error in the underlying protocol, such as an UDP error.
* @see #setReceiveBufferSize(int) * @see #setReceiveBufferSize(int)
*/ */
@ -1005,26 +1005,26 @@ class DatagramSocket implements java.io.Closeable {
* socket to the same socket address. This is typically for the * socket to the same socket address. This is typically for the
* purpose of receiving multicast packets * purpose of receiving multicast packets
* (See {@link java.net.MulticastSocket}). The * (See {@link java.net.MulticastSocket}). The
* <tt>SO_REUSEADDR</tt> socket option allows multiple * {@code SO_REUSEADDR} socket option allows multiple
* sockets to be bound to the same socket address if the * sockets to be bound to the same socket address if the
* <tt>SO_REUSEADDR</tt> socket option is enabled prior * {@code SO_REUSEADDR} socket option is enabled prior
* to binding the socket using {@link #bind(SocketAddress)}. * to binding the socket using {@link #bind(SocketAddress)}.
* <p> * <p>
* Note: This functionality is not supported by all existing platforms, * Note: This functionality is not supported by all existing platforms,
* so it is implementation specific whether this option will be ignored * so it is implementation specific whether this option will be ignored
* or not. However, if it is not supported then * or not. However, if it is not supported then
* {@link #getReuseAddress()} will always return <code>false</code>. * {@link #getReuseAddress()} will always return {@code false}.
* <p> * <p>
* When a <tt>DatagramSocket</tt> is created the initial setting * When a {@code DatagramSocket} is created the initial setting
* of <tt>SO_REUSEADDR</tt> is disabled. * of {@code SO_REUSEADDR} is disabled.
* <p> * <p>
* The behaviour when <tt>SO_REUSEADDR</tt> is enabled or * The behaviour when {@code SO_REUSEADDR} is enabled or
* disabled after a socket is bound (See {@link #isBound()}) * disabled after a socket is bound (See {@link #isBound()})
* is not defined. * is not defined.
* *
* @param on whether to enable or disable the * @param on whether to enable or disable the
* @exception SocketException if an error occurs enabling or * @exception SocketException if an error occurs enabling or
* disabling the <tt>SO_RESUEADDR</tt> socket option, * disabling the {@code SO_RESUEADDR} socket option,
* or the socket is closed. * or the socket is closed.
* @since 1.4 * @since 1.4
* @see #getReuseAddress() * @see #getReuseAddress()
@ -1045,7 +1045,7 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Tests if SO_REUSEADDR is enabled. * Tests if SO_REUSEADDR is enabled.
* *
* @return a <code>boolean</code> indicating whether or not SO_REUSEADDR is enabled. * @return a {@code boolean} indicating whether or not SO_REUSEADDR is enabled.
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as an UDP error. * in the underlying protocol, such as an UDP error.
* @since 1.4 * @since 1.4
@ -1083,7 +1083,7 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Tests if SO_BROADCAST is enabled. * Tests if SO_BROADCAST is enabled.
* @return a <code>boolean</code> indicating whether or not SO_BROADCAST is enabled. * @return a {@code boolean} indicating whether or not SO_BROADCAST is enabled.
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as an UDP error. * in the underlying protocol, such as an UDP error.
* @since 1.4 * @since 1.4
@ -1105,7 +1105,7 @@ class DatagramSocket implements java.io.Closeable {
* 255} or an IllegalArgumentException will be thrown. * 255} or an IllegalArgumentException will be thrown.
* <p>Notes: * <p>Notes:
* <p>For Internet Protocol v4 the value consists of an * <p>For Internet Protocol v4 the value consists of an
* <code>integer</code>, the least significant 8 bits of which * {@code integer}, the least significant 8 bits of which
* represent the value of the TOS octet in IP packets sent by * represent the value of the TOS octet in IP packets sent by
* the socket. * the socket.
* RFC 1349 defines the TOS values as follows: * RFC 1349 defines the TOS values as follows:
@ -1123,10 +1123,10 @@ class DatagramSocket implements java.io.Closeable {
* SocketException indicating that the operation is not * SocketException indicating that the operation is not
* permitted. * permitted.
* <p> * <p>
* for Internet Protocol v6 <code>tc</code> is the value that * for Internet Protocol v6 {@code tc} is the value that
* would be placed into the sin6_flowinfo field of the IP header. * would be placed into the sin6_flowinfo field of the IP header.
* *
* @param tc an <code>int</code> value for the bitset. * @param tc an {@code int} value for the bitset.
* @throws SocketException if there is an error setting the * @throws SocketException if there is an error setting the
* traffic class or type-of-service * traffic class or type-of-service
* @since 1.4 * @since 1.4
@ -1205,7 +1205,7 @@ class DatagramSocket implements java.io.Closeable {
* DatagramChannel.open} method. * DatagramChannel.open} method.
* *
* @return the datagram channel associated with this datagram socket, * @return the datagram channel associated with this datagram socket,
* or <tt>null</tt> if this socket was not created for a channel * or {@code null} if this socket was not created for a channel
* *
* @since 1.4 * @since 1.4
* @spec JSR-51 * @spec JSR-51
@ -1224,14 +1224,14 @@ class DatagramSocket implements java.io.Closeable {
* application. The factory can be specified only once. * application. The factory can be specified only once.
* <p> * <p>
* When an application creates a new datagram socket, the socket * When an application creates a new datagram socket, the socket
* implementation factory's <code>createDatagramSocketImpl</code> method is * implementation factory's {@code createDatagramSocketImpl} method is
* called to create the actual datagram socket implementation. * called to create the actual datagram socket implementation.
* <p> * <p>
* Passing <code>null</code> to the method is a no-op unless the factory * Passing {@code null} to the method is a no-op unless the factory
* was already set. * was already set.
* *
* <p>If there is a security manager, this method first calls * <p>If there is a security manager, this method first calls
* the security manager's <code>checkSetFactory</code> method * the security manager's {@code checkSetFactory} method
* to ensure the operation is allowed. * to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
@ -1240,7 +1240,7 @@ class DatagramSocket implements java.io.Closeable {
* datagram socket factory. * datagram socket factory.
* @exception SocketException if the factory is already defined. * @exception SocketException if the factory is already defined.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkSetFactory</code> method doesn't allow the * {@code checkSetFactory} method doesn't allow the
operation. operation.
* @see * @see
java.net.DatagramSocketImplFactory#createDatagramSocketImpl() java.net.DatagramSocketImplFactory#createDatagramSocketImpl()

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -101,7 +101,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
protected void disconnect() {} protected void disconnect() {}
/** /**
* Peek at the packet to see who it is from. Updates the specified <code>InetAddress</code> * Peek at the packet to see who it is from. Updates the specified {@code InetAddress}
* to the address which the packet came from. * to the address which the packet came from.
* @param i an InetAddress object * @param i an InetAddress object
* @return the port number which the packet came from. * @return the port number which the packet came from.
@ -114,7 +114,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
/** /**
* Peek at the packet to see who it is from. The data is copied into the specified * Peek at the packet to see who it is from. The data is copied into the specified
* <code>DatagramPacket</code>. The data is returned, * {@code DatagramPacket}. The data is returned,
* but not consumed, so that a subsequent peekData/receive operation * but not consumed, so that a subsequent peekData/receive operation
* will see the same data. * will see the same data.
* @param p the Packet Received. * @param p the Packet Received.
@ -163,7 +163,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
/** /**
* Set the TTL (time-to-live) option. * Set the TTL (time-to-live) option.
* @param ttl an <tt>int</tt> specifying the time-to-live value * @param ttl an {@code int} specifying the time-to-live value
* @exception IOException if an I/O exception occurs * @exception IOException if an I/O exception occurs
* while setting the time-to-live option. * while setting the time-to-live option.
* @see #getTimeToLive() * @see #getTimeToLive()
@ -174,7 +174,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
* Retrieve the TTL (time-to-live) option. * Retrieve the TTL (time-to-live) option.
* @exception IOException if an I/O exception occurs * @exception IOException if an I/O exception occurs
* while retrieving the time-to-live option * while retrieving the time-to-live option
* @return an <tt>int</tt> representing the time-to-live value * @return an {@code int} representing the time-to-live value
* @see #setTimeToLive(int) * @see #setTimeToLive(int)
*/ */
protected abstract int getTimeToLive() throws IOException; protected abstract int getTimeToLive() throws IOException;
@ -227,7 +227,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
/** /**
* Gets the local port. * Gets the local port.
* @return an <tt>int</tt> representing the local port value * @return an {@code int} representing the local port value
*/ */
protected int getLocalPort() { protected int getLocalPort() {
return localPort; return localPort;
@ -235,7 +235,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
/** /**
* Gets the datagram socket file descriptor. * Gets the datagram socket file descriptor.
* @return a <tt>FileDescriptor</tt> object representing the datagram socket * @return a {@code FileDescriptor} object representing the datagram socket
* file descriptor * file descriptor
*/ */
protected FileDescriptor getFileDescriptor() { protected FileDescriptor getFileDescriptor() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@ package java.net;
/** /**
* This interface defines a factory for datagram socket implementations. It * This interface defines a factory for datagram socket implementations. It
* is used by the classes <code>DatagramSocket</code> to create actual socket * is used by the classes {@code DatagramSocket} to create actual socket
* implementations. * implementations.
* *
* @author Yingxian Wang * @author Yingxian Wang
@ -37,9 +37,9 @@ package java.net;
public public
interface DatagramSocketImplFactory { interface DatagramSocketImplFactory {
/** /**
* Creates a new <code>DatagramSocketImpl</code> instance. * Creates a new {@code DatagramSocketImpl} instance.
* *
* @return a new instance of <code>DatagramSocketImpl</code>. * @return a new instance of {@code DatagramSocketImpl}.
* @see java.net.DatagramSocketImpl * @see java.net.DatagramSocketImpl
*/ */
DatagramSocketImpl createDatagramSocketImpl(); DatagramSocketImpl createDatagramSocketImpl();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,7 +37,7 @@ public interface FileNameMap {
/** /**
* Gets the MIME type for the specified file name. * Gets the MIME type for the specified file name.
* @param fileName the specified file name * @param fileName the specified file name
* @return a <code>String</code> indicating the MIME * @return a {@code String} indicating the MIME
* type for the specified file name. * type for the specified file name.
*/ */
public String getContentTypeFor(String fileName); public String getContentTypeFor(String fileName);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -470,7 +470,7 @@ public final class HttpCookie implements Cloneable {
* protocol. * protocol.
* *
* @return {@code false} if the cookie can be sent over any standard * @return {@code false} if the cookie can be sent over any standard
* protocol; otherwise, <code>true</code> * protocol; otherwise, {@code true}
* *
* @see #setSecure * @see #setSecure
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ class HttpRetryException extends IOException {
private String location; private String location;
/** /**
* Constructs a new <code>HttpRetryException</code> from the * Constructs a new {@code HttpRetryException} from the
* specified response code and exception detail message * specified response code and exception detail message
* *
* @param detail the detail message. * @param detail the detail message.
@ -55,7 +55,7 @@ class HttpRetryException extends IOException {
} }
/** /**
* Constructs a new <code>HttpRetryException</code> with detail message * Constructs a new {@code HttpRetryException} with detail message
* responseCode and the contents of the Location response header field. * responseCode and the contents of the Location response header field.
* *
* @param detail the detail message. * @param detail the detail message.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -76,14 +76,14 @@ abstract public class HttpURLConnection extends URLConnection {
/** /**
* The chunk-length when using chunked encoding streaming mode for output. * The chunk-length when using chunked encoding streaming mode for output.
* A value of <code>-1</code> means chunked encoding is disabled for output. * A value of {@code -1} means chunked encoding is disabled for output.
* @since 1.5 * @since 1.5
*/ */
protected int chunkLength = -1; protected int chunkLength = -1;
/** /**
* The fixed content-length when using fixed-length streaming mode. * The fixed content-length when using fixed-length streaming mode.
* A value of <code>-1</code> means fixed-length streaming mode is disabled * A value of {@code -1} means fixed-length streaming mode is disabled
* for output. * for output.
* *
* <P> <B>NOTE:</B> {@link #fixedContentLengthLong} is recommended instead * <P> <B>NOTE:</B> {@link #fixedContentLengthLong} is recommended instead
@ -103,15 +103,15 @@ abstract public class HttpURLConnection extends URLConnection {
protected long fixedContentLengthLong = -1; protected long fixedContentLengthLong = -1;
/** /**
* Returns the key for the <code>n</code><sup>th</sup> header field. * Returns the key for the {@code n}<sup>th</sup> header field.
* Some implementations may treat the <code>0</code><sup>th</sup> * Some implementations may treat the {@code 0}<sup>th</sup>
* header field as special, i.e. as the status line returned by the HTTP * header field as special, i.e. as the status line returned by the HTTP
* server. In this case, {@link #getHeaderField(int) getHeaderField(0)} returns the status * server. In this case, {@link #getHeaderField(int) getHeaderField(0)} returns the status
* line, but <code>getHeaderFieldKey(0)</code> returns null. * line, but {@code getHeaderFieldKey(0)} returns null.
* *
* @param n an index, where {@code n >=0}. * @param n an index, where {@code n >=0}.
* @return the key for the <code>n</code><sup>th</sup> header field, * @return the key for the {@code n}<sup>th</sup> header field,
* or <code>null</code> if the key does not exist. * or {@code null} if the key does not exist.
*/ */
public String getHeaderFieldKey (int n) { public String getHeaderFieldKey (int n) {
return null; return null;
@ -251,8 +251,8 @@ abstract public class HttpURLConnection extends URLConnection {
} }
/** /**
* Returns the value for the <code>n</code><sup>th</sup> header field. * Returns the value for the {@code n}<sup>th</sup> header field.
* Some implementations may treat the <code>0</code><sup>th</sup> * Some implementations may treat the {@code 0}<sup>th</sup>
* header field as special, i.e. as the status line returned by the HTTP * header field as special, i.e. as the status line returned by the HTTP
* server. * server.
* <p> * <p>
@ -261,8 +261,8 @@ abstract public class HttpURLConnection extends URLConnection {
* the headers in the message. * the headers in the message.
* *
* @param n an index, where {@code n>=0}. * @param n an index, where {@code n>=0}.
* @return the value of the <code>n</code><sup>th</sup> header field, * @return the value of the {@code n}<sup>th</sup> header field,
* or <code>null</code> if the value does not exist. * or {@code null} if the value does not exist.
* @see java.net.HttpURLConnection#getHeaderFieldKey(int) * @see java.net.HttpURLConnection#getHeaderFieldKey(int)
*/ */
public String getHeaderField(int n) { public String getHeaderField(int n) {
@ -270,7 +270,7 @@ abstract public class HttpURLConnection extends URLConnection {
} }
/** /**
* An <code>int</code> representing the three digit HTTP Status-Code. * An {@code int} representing the three digit HTTP Status-Code.
* <ul> * <ul>
* <li> 1xx: Informational * <li> 1xx: Informational
* <li> 2xx: Success * <li> 2xx: Success
@ -292,12 +292,12 @@ abstract public class HttpURLConnection extends URLConnection {
private static boolean followRedirects = true; private static boolean followRedirects = true;
/** /**
* If <code>true</code>, the protocol will automatically follow redirects. * If {@code true}, the protocol will automatically follow redirects.
* If <code>false</code>, the protocol will not automatically follow * If {@code false}, the protocol will not automatically follow
* redirects. * redirects.
* <p> * <p>
* This field is set by the <code>setInstanceFollowRedirects</code> * This field is set by the {@code setInstanceFollowRedirects}
* method. Its value is returned by the <code>getInstanceFollowRedirects</code> * method. Its value is returned by the {@code getInstanceFollowRedirects}
* method. * method.
* <p> * <p>
* Its default value is based on the value of the static followRedirects * Its default value is based on the value of the static followRedirects
@ -328,14 +328,14 @@ abstract public class HttpURLConnection extends URLConnection {
* cannot change this variable. * cannot change this variable.
* <p> * <p>
* If there is a security manager, this method first calls * If there is a security manager, this method first calls
* the security manager's <code>checkSetFactory</code> method * the security manager's {@code checkSetFactory} method
* to ensure the operation is allowed. * to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
* @param set a <code>boolean</code> indicating whether or not * @param set a {@code boolean} indicating whether or not
* to follow HTTP redirects. * to follow HTTP redirects.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkSetFactory</code> method doesn't * {@code checkSetFactory} method doesn't
* allow the operation. * allow the operation.
* @see SecurityManager#checkSetFactory * @see SecurityManager#checkSetFactory
* @see #getFollowRedirects() * @see #getFollowRedirects()
@ -350,12 +350,12 @@ abstract public class HttpURLConnection extends URLConnection {
} }
/** /**
* Returns a <code>boolean</code> indicating * Returns a {@code boolean} indicating
* whether or not HTTP redirects (3xx) should * whether or not HTTP redirects (3xx) should
* be automatically followed. * be automatically followed.
* *
* @return <code>true</code> if HTTP redirects should * @return {@code true} if HTTP redirects should
* be automatically followed, <tt>false</tt> if not. * be automatically followed, {@code false} if not.
* @see #setFollowRedirects(boolean) * @see #setFollowRedirects(boolean)
*/ */
public static boolean getFollowRedirects() { public static boolean getFollowRedirects() {
@ -364,13 +364,13 @@ abstract public class HttpURLConnection extends URLConnection {
/** /**
* Sets whether HTTP redirects (requests with response code 3xx) should * Sets whether HTTP redirects (requests with response code 3xx) should
* be automatically followed by this <code>HttpURLConnection</code> * be automatically followed by this {@code HttpURLConnection}
* instance. * instance.
* <p> * <p>
* The default value comes from followRedirects, which defaults to * The default value comes from followRedirects, which defaults to
* true. * true.
* *
* @param followRedirects a <code>boolean</code> indicating * @param followRedirects a {@code boolean} indicating
* whether or not to follow HTTP redirects. * whether or not to follow HTTP redirects.
* *
* @see java.net.HttpURLConnection#instanceFollowRedirects * @see java.net.HttpURLConnection#instanceFollowRedirects
@ -382,11 +382,11 @@ abstract public class HttpURLConnection extends URLConnection {
} }
/** /**
* Returns the value of this <code>HttpURLConnection</code>'s * Returns the value of this {@code HttpURLConnection}'s
* <code>instanceFollowRedirects</code> field. * {@code instanceFollowRedirects} field.
* *
* @return the value of this <code>HttpURLConnection</code>'s * @return the value of this {@code HttpURLConnection}'s
* <code>instanceFollowRedirects</code> field. * {@code instanceFollowRedirects} field.
* @see java.net.HttpURLConnection#instanceFollowRedirects * @see java.net.HttpURLConnection#instanceFollowRedirects
* @see #setInstanceFollowRedirects(boolean) * @see #setInstanceFollowRedirects(boolean)
* @since 1.3 * @since 1.3
@ -540,7 +540,7 @@ abstract public class HttpURLConnection extends URLConnection {
* Returns null if none could be discerned from the responses * Returns null if none could be discerned from the responses
* (the result was not valid HTTP). * (the result was not valid HTTP).
* @throws IOException if an error occurred connecting to the server. * @throws IOException if an error occurred connecting to the server.
* @return the HTTP response message, or <code>null</code> * @return the HTTP response message, or {@code null}
*/ */
public String getResponseMessage() throws IOException { public String getResponseMessage() throws IOException {
getResponseCode(); getResponseCode();
@ -583,7 +583,7 @@ abstract public class HttpURLConnection extends URLConnection {
* @exception IOException if an error occurs while computing * @exception IOException if an error occurs while computing
* the permission. * the permission.
* *
* @return a <code>SocketPermission</code> object representing the * @return a {@code SocketPermission} object representing the
* permission necessary to connect to the destination * permission necessary to connect to the destination
* host and port. * host and port.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -104,7 +104,7 @@ public final class IDN {
* @param input the string to be processed * @param input the string to be processed
* @param flag process flag; can be 0 or any logical OR of possible flags * @param flag process flag; can be 0 or any logical OR of possible flags
* *
* @return the translated <tt>String</tt> * @return the translated {@code String}
* *
* @throws IllegalArgumentException if the input string doesn't conform to RFC 3490 specification * @throws IllegalArgumentException if the input string doesn't conform to RFC 3490 specification
*/ */
@ -130,13 +130,13 @@ public final class IDN {
* *
* <p> This convenience method works as if by invoking the * <p> This convenience method works as if by invoking the
* two-argument counterpart as follows: * two-argument counterpart as follows:
* <blockquote><tt> * <blockquote>
* {@link #toASCII(String, int) toASCII}(input,&nbsp;0); * {@link #toASCII(String, int) toASCII}(input,&nbsp;0);
* </tt></blockquote> * </blockquote>
* *
* @param input the string to be processed * @param input the string to be processed
* *
* @return the translated <tt>String</tt> * @return the translated {@code String}
* *
* @throws IllegalArgumentException if the input string doesn't conform to RFC 3490 specification * @throws IllegalArgumentException if the input string doesn't conform to RFC 3490 specification
*/ */
@ -161,7 +161,7 @@ public final class IDN {
* @param input the string to be processed * @param input the string to be processed
* @param flag process flag; can be 0 or any logical OR of possible flags * @param flag process flag; can be 0 or any logical OR of possible flags
* *
* @return the translated <tt>String</tt> * @return the translated {@code String}
*/ */
public static String toUnicode(String input, int flag) { public static String toUnicode(String input, int flag) {
int p = 0, q = 0; int p = 0, q = 0;
@ -184,13 +184,13 @@ public final class IDN {
* *
* <p> This convenience method works as if by invoking the * <p> This convenience method works as if by invoking the
* two-argument counterpart as follows: * two-argument counterpart as follows:
* <blockquote><tt> * <blockquote>
* {@link #toUnicode(String, int) toUnicode}(input,&nbsp;0); * {@link #toUnicode(String, int) toUnicode}(input,&nbsp;0);
* </tt></blockquote> * </blockquote>
* *
* @param input the string to be processed * @param input the string to be processed
* *
* @return the translated <tt>String</tt> * @return the translated {@code String}
*/ */
public static String toUnicode(String input) { public static String toUnicode(String input) {
return toUnicode(input, 0); return toUnicode(input, 0);

View File

@ -42,10 +42,10 @@ import java.io.ObjectStreamException;
* takes one of the following forms: * takes one of the following forms:
* *
* <blockquote><table cellpadding=0 cellspacing=0 summary="layout"> * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
* <tr><td><tt>d.d.d.d</tt></td></tr> * <tr><td>{@code d.d.d.d}</td></tr>
* <tr><td><tt>d.d.d</tt></td></tr> * <tr><td>{@code d.d.d}</td></tr>
* <tr><td><tt>d.d</tt></td></tr> * <tr><td>{@code d.d}</td></tr>
* <tr><td><tt>d</tt></td></tr> * <tr><td>{@code d}</td></tr>
* </table></blockquote> * </table></blockquote>
* *
* <p> When four parts are specified, each is interpreted as a byte of * <p> When four parts are specified, each is interpreted as a byte of
@ -153,7 +153,7 @@ class Inet4Address extends InetAddress {
* Utility routine to check if the InetAddress is an * Utility routine to check if the InetAddress is an
* IP multicast address. IP multicast address is a Class D * IP multicast address. IP multicast address is a Class D
* address i.e first four bits of the address are 1110. * address i.e first four bits of the address are 1110.
* @return a <code>boolean</code> indicating if the InetAddress is * @return a {@code boolean} indicating if the InetAddress is
* an IP multicast address * an IP multicast address
* @since JDK1.1 * @since JDK1.1
*/ */
@ -163,7 +163,7 @@ class Inet4Address extends InetAddress {
/** /**
* Utility routine to check if the InetAddress in a wildcard address. * Utility routine to check if the InetAddress in a wildcard address.
* @return a <code>boolean</code> indicating if the Inetaddress is * @return a {@code boolean} indicating if the Inetaddress is
* a wildcard address. * a wildcard address.
* @since 1.4 * @since 1.4
*/ */
@ -174,7 +174,7 @@ class Inet4Address extends InetAddress {
/** /**
* Utility routine to check if the InetAddress is a loopback address. * Utility routine to check if the InetAddress is a loopback address.
* *
* @return a <code>boolean</code> indicating if the InetAddress is * @return a {@code boolean} indicating if the InetAddress is
* a loopback address; or false otherwise. * a loopback address; or false otherwise.
* @since 1.4 * @since 1.4
*/ */
@ -187,7 +187,7 @@ class Inet4Address extends InetAddress {
/** /**
* Utility routine to check if the InetAddress is an link local address. * Utility routine to check if the InetAddress is an link local address.
* *
* @return a <code>boolean</code> indicating if the InetAddress is * @return a {@code boolean} indicating if the InetAddress is
* a link local address; or false if address is not a link local unicast address. * a link local address; or false if address is not a link local unicast address.
* @since 1.4 * @since 1.4
*/ */
@ -204,7 +204,7 @@ class Inet4Address extends InetAddress {
/** /**
* Utility routine to check if the InetAddress is a site local address. * Utility routine to check if the InetAddress is a site local address.
* *
* @return a <code>boolean</code> indicating if the InetAddress is * @return a {@code boolean} indicating if the InetAddress is
* a site local address; or false if address is not a site local unicast address. * a site local address; or false if address is not a site local unicast address.
* @since 1.4 * @since 1.4
*/ */
@ -224,7 +224,7 @@ class Inet4Address extends InetAddress {
/** /**
* Utility routine to check if the multicast address has global scope. * Utility routine to check if the multicast address has global scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of global scope, false if it is not * is a multicast address of global scope, false if it is not
* of global scope or it is not a multicast address * of global scope or it is not a multicast address
* @since 1.4 * @since 1.4
@ -240,7 +240,7 @@ class Inet4Address extends InetAddress {
/** /**
* Utility routine to check if the multicast address has node scope. * Utility routine to check if the multicast address has node scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of node-local scope, false if it is not * is a multicast address of node-local scope, false if it is not
* of node-local scope or it is not a multicast address * of node-local scope or it is not a multicast address
* @since 1.4 * @since 1.4
@ -253,7 +253,7 @@ class Inet4Address extends InetAddress {
/** /**
* Utility routine to check if the multicast address has link scope. * Utility routine to check if the multicast address has link scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of link-local scope, false if it is not * is a multicast address of link-local scope, false if it is not
* of link-local scope or it is not a multicast address * of link-local scope or it is not a multicast address
* @since 1.4 * @since 1.4
@ -269,7 +269,7 @@ class Inet4Address extends InetAddress {
/** /**
* Utility routine to check if the multicast address has site scope. * Utility routine to check if the multicast address has site scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of site-local scope, false if it is not * is a multicast address of site-local scope, false if it is not
* of site-local scope or it is not a multicast address * of site-local scope or it is not a multicast address
* @since 1.4 * @since 1.4
@ -284,7 +284,7 @@ class Inet4Address extends InetAddress {
/** /**
* Utility routine to check if the multicast address has organization scope. * Utility routine to check if the multicast address has organization scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of organization-local scope, * is a multicast address of organization-local scope,
* false if it is not of organization-local scope * false if it is not of organization-local scope
* or it is not a multicast address * or it is not a multicast address
@ -299,9 +299,9 @@ class Inet4Address extends InetAddress {
} }
/** /**
* Returns the raw IP address of this <code>InetAddress</code> * Returns the raw IP address of this {@code InetAddress}
* object. The result is in network byte order: the highest order * object. The result is in network byte order: the highest order
* byte of the address is in <code>getAddress()[0]</code>. * byte of the address is in {@code getAddress()[0]}.
* *
* @return the raw IP address of this object. * @return the raw IP address of this object.
*/ */
@ -337,18 +337,18 @@ class Inet4Address extends InetAddress {
/** /**
* Compares this object against the specified object. * Compares this object against the specified object.
* The result is <code>true</code> if and only if the argument is * The result is {@code true} if and only if the argument is
* not <code>null</code> and it represents the same IP address as * not {@code null} and it represents the same IP address as
* this object. * this object.
* <p> * <p>
* Two instances of <code>InetAddress</code> represent the same IP * Two instances of {@code InetAddress} represent the same IP
* address if the length of the byte arrays returned by * address if the length of the byte arrays returned by
* <code>getAddress</code> is the same for both, and each of the * {@code getAddress} is the same for both, and each of the
* array components is the same for the byte arrays. * array components is the same for the byte arrays.
* *
* @param obj the object to compare against. * @param obj the object to compare against.
* @return <code>true</code> if the objects are the same; * @return {@code true} if the objects are the same;
* <code>false</code> otherwise. * {@code false} otherwise.
* @see java.net.InetAddress#getAddress() * @see java.net.InetAddress#getAddress()
*/ */
public boolean equals(Object obj) { public boolean equals(Object obj) {

View File

@ -47,7 +47,7 @@ import java.util.Enumeration;
* address. This is the full form. For example, * address. This is the full form. For example,
* *
* <blockquote><table cellpadding=0 cellspacing=0 summary="layout"> * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
* <tr><td><tt>1080:0:0:0:8:800:200C:417A</tt><td></tr> * <tr><td>{@code 1080:0:0:0:8:800:200C:417A}<td></tr>
* </table></blockquote> * </table></blockquote>
* *
* <p> Note that it is not necessary to write the leading zeros in * <p> Note that it is not necessary to write the leading zeros in
@ -64,7 +64,7 @@ import java.util.Enumeration;
* zeros in an address. For example, * zeros in an address. For example,
* *
* <blockquote><table cellpadding=0 cellspacing=0 summary="layout"> * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
* <tr><td><tt>1080::8:800:200C:417A</tt><td></tr> * <tr><td>{@code 1080::8:800:200C:417A}<td></tr>
* </table></blockquote> * </table></blockquote>
* *
* <li><p> An alternative form that is sometimes more convenient * <li><p> An alternative form that is sometimes more convenient
@ -75,8 +75,8 @@ import java.util.Enumeration;
* standard IPv4 representation address, for example, * standard IPv4 representation address, for example,
* *
* <blockquote><table cellpadding=0 cellspacing=0 summary="layout"> * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
* <tr><td><tt>::FFFF:129.144.52.38</tt><td></tr> * <tr><td>{@code ::FFFF:129.144.52.38}<td></tr>
* <tr><td><tt>::129.144.52.38</tt><td></tr> * <tr><td>{@code ::129.144.52.38}<td></tr>
* </table></blockquote> * </table></blockquote>
* *
* <p> where "::FFFF:d.d.d.d" and "::d.d.d.d" are, respectively, the * <p> where "::FFFF:d.d.d.d" and "::d.d.d.d" are, respectively, the
@ -85,23 +85,23 @@ import java.util.Enumeration;
* in the "d.d.d.d" form. The following forms are invalid: * in the "d.d.d.d" form. The following forms are invalid:
* *
* <blockquote><table cellpadding=0 cellspacing=0 summary="layout"> * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
* <tr><td><tt>::FFFF:d.d.d</tt><td></tr> * <tr><td>{@code ::FFFF:d.d.d}<td></tr>
* <tr><td><tt>::FFFF:d.d</tt><td></tr> * <tr><td>{@code ::FFFF:d.d}<td></tr>
* <tr><td><tt>::d.d.d</tt><td></tr> * <tr><td>{@code ::d.d.d}<td></tr>
* <tr><td><tt>::d.d</tt><td></tr> * <tr><td>{@code ::d.d}<td></tr>
* </table></blockquote> * </table></blockquote>
* *
* <p> The following form: * <p> The following form:
* *
* <blockquote><table cellpadding=0 cellspacing=0 summary="layout"> * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
* <tr><td><tt>::FFFF:d</tt><td></tr> * <tr><td>{@code ::FFFF:d}<td></tr>
* </table></blockquote> * </table></blockquote>
* *
* <p> is valid, however it is an unconventional representation of * <p> is valid, however it is an unconventional representation of
* the IPv4-compatible IPv6 address, * the IPv4-compatible IPv6 address,
* *
* <blockquote><table cellpadding=0 cellspacing=0 summary="layout"> * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
* <tr><td><tt>::255.255.0.d</tt><td></tr> * <tr><td>{@code ::255.255.0.d}<td></tr>
* </table></blockquote> * </table></blockquote>
* *
* <p> while "::d" corresponds to the general IPv6 address * <p> while "::d" corresponds to the general IPv6 address
@ -258,7 +258,7 @@ class Inet6Address extends InetAddress {
* Create an Inet6Address in the exact manner of {@link * Create an Inet6Address in the exact manner of {@link
* InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is * InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is
* set to the value corresponding to the given interface for the address * set to the value corresponding to the given interface for the address
* type specified in <code>addr</code>. The call will fail with an * type specified in {@code addr}. The call will fail with an
* UnknownHostException if the given interface does not have a numeric * UnknownHostException if the given interface does not have a numeric
* scope_id assigned for the given address type (eg. link-local or site-local). * scope_id assigned for the given address type (eg. link-local or site-local).
* See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6 * See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6

View File

@ -296,7 +296,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the InetAddress is an * Utility routine to check if the InetAddress is an
* IP multicast address. * IP multicast address.
* @return a <code>boolean</code> indicating if the InetAddress is * @return a {@code boolean} indicating if the InetAddress is
* an IP multicast address * an IP multicast address
* @since JDK1.1 * @since JDK1.1
*/ */
@ -306,7 +306,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the InetAddress in a wildcard address. * Utility routine to check if the InetAddress in a wildcard address.
* @return a <code>boolean</code> indicating if the Inetaddress is * @return a {@code boolean} indicating if the Inetaddress is
* a wildcard address. * a wildcard address.
* @since 1.4 * @since 1.4
*/ */
@ -317,7 +317,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the InetAddress is a loopback address. * Utility routine to check if the InetAddress is a loopback address.
* *
* @return a <code>boolean</code> indicating if the InetAddress is * @return a {@code boolean} indicating if the InetAddress is
* a loopback address; or false otherwise. * a loopback address; or false otherwise.
* @since 1.4 * @since 1.4
*/ */
@ -328,7 +328,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the InetAddress is an link local address. * Utility routine to check if the InetAddress is an link local address.
* *
* @return a <code>boolean</code> indicating if the InetAddress is * @return a {@code boolean} indicating if the InetAddress is
* a link local address; or false if address is not a link local unicast address. * a link local address; or false if address is not a link local unicast address.
* @since 1.4 * @since 1.4
*/ */
@ -339,7 +339,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the InetAddress is a site local address. * Utility routine to check if the InetAddress is a site local address.
* *
* @return a <code>boolean</code> indicating if the InetAddress is * @return a {@code boolean} indicating if the InetAddress is
* a site local address; or false if address is not a site local unicast address. * a site local address; or false if address is not a site local unicast address.
* @since 1.4 * @since 1.4
*/ */
@ -350,7 +350,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the multicast address has global scope. * Utility routine to check if the multicast address has global scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of global scope, false if it is not * is a multicast address of global scope, false if it is not
* of global scope or it is not a multicast address * of global scope or it is not a multicast address
* @since 1.4 * @since 1.4
@ -362,7 +362,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the multicast address has node scope. * Utility routine to check if the multicast address has node scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of node-local scope, false if it is not * is a multicast address of node-local scope, false if it is not
* of node-local scope or it is not a multicast address * of node-local scope or it is not a multicast address
* @since 1.4 * @since 1.4
@ -374,7 +374,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the multicast address has link scope. * Utility routine to check if the multicast address has link scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of link-local scope, false if it is not * is a multicast address of link-local scope, false if it is not
* of link-local scope or it is not a multicast address * of link-local scope or it is not a multicast address
* @since 1.4 * @since 1.4
@ -386,7 +386,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the multicast address has site scope. * Utility routine to check if the multicast address has site scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of site-local scope, false if it is not * is a multicast address of site-local scope, false if it is not
* of site-local scope or it is not a multicast address * of site-local scope or it is not a multicast address
* @since 1.4 * @since 1.4
@ -398,7 +398,7 @@ class InetAddress implements java.io.Serializable {
/** /**
* Utility routine to check if the multicast address has organization scope. * Utility routine to check if the multicast address has organization scope.
* *
* @return a <code>boolean</code> indicating if the address has * @return a {@code boolean} indicating if the address has
* is a multicast address of organization-local scope, * is a multicast address of organization-local scope,
* false if it is not of organization-local scope * false if it is not of organization-local scope
* or it is not a multicast address * or it is not a multicast address
@ -424,9 +424,9 @@ class InetAddress implements java.io.Serializable {
* in an IllegalArgumentException being thrown. * in an IllegalArgumentException being thrown.
* *
* @param timeout the time, in milliseconds, before the call aborts * @param timeout the time, in milliseconds, before the call aborts
* @return a <code>boolean</code> indicating if the address is reachable. * @return a {@code boolean} indicating if the address is reachable.
* @throws IOException if a network error occurs * @throws IOException if a network error occurs
* @throws IllegalArgumentException if <code>timeout</code> is negative. * @throws IllegalArgumentException if {@code timeout} is negative.
* @since 1.5 * @since 1.5
*/ */
public boolean isReachable(int timeout) throws IOException { public boolean isReachable(int timeout) throws IOException {
@ -442,10 +442,10 @@ class InetAddress implements java.io.Serializable {
* privilege can be obtained, otherwise it will try to establish * privilege can be obtained, otherwise it will try to establish
* a TCP connection on port 7 (Echo) of the destination host. * a TCP connection on port 7 (Echo) of the destination host.
* <p> * <p>
* The <code>network interface</code> and <code>ttl</code> parameters * The {@code network interface} and {@code ttl} parameters
* let the caller specify which network interface the test will go through * let the caller specify which network interface the test will go through
* and the maximum number of hops the packets should go through. * and the maximum number of hops the packets should go through.
* A negative value for the <code>ttl</code> will result in an * A negative value for the {@code ttl} will result in an
* IllegalArgumentException being thrown. * IllegalArgumentException being thrown.
* <p> * <p>
* The timeout value, in milliseconds, indicates the maximum amount of time * The timeout value, in milliseconds, indicates the maximum amount of time
@ -458,9 +458,9 @@ class InetAddress implements java.io.Serializable {
* @param ttl the maximum numbers of hops to try or 0 for the * @param ttl the maximum numbers of hops to try or 0 for the
* default * default
* @param timeout the time, in milliseconds, before the call aborts * @param timeout the time, in milliseconds, before the call aborts
* @throws IllegalArgumentException if either <code>timeout</code> * @throws IllegalArgumentException if either {@code timeout}
* or <code>ttl</code> are negative. * or {@code ttl} are negative.
* @return a <code>boolean</code>indicating if the address is reachable. * @return a {@code boolean}indicating if the address is reachable.
* @throws IOException if a network error occurs * @throws IOException if a network error occurs
* @since 1.5 * @since 1.5
*/ */
@ -486,8 +486,8 @@ class InetAddress implements java.io.Serializable {
* {@link #getCanonicalHostName() getCanonicalHostName}. * {@link #getCanonicalHostName() getCanonicalHostName}.
* *
* <p>If there is a security manager, its * <p>If there is a security manager, its
* <code>checkConnect</code> method is first called * {@code checkConnect} method is first called
* with the hostname and <code>-1</code> * with the hostname and {@code -1}
* as its arguments to see if the operation is allowed. * as its arguments to see if the operation is allowed.
* If the operation is not allowed, it will return * If the operation is not allowed, it will return
* the textual representation of the IP address. * the textual representation of the IP address.
@ -511,8 +511,8 @@ class InetAddress implements java.io.Serializable {
* here without a security check. * here without a security check.
* *
* <p>If there is a security manager, this method first * <p>If there is a security manager, this method first
* calls its <code>checkConnect</code> method * calls its {@code checkConnect} method
* with the hostname and <code>-1</code> * with the hostname and {@code -1}
* as its arguments to see if the calling code is allowed to know * as its arguments to see if the calling code is allowed to know
* the hostname for this IP address, i.e., to connect to the host. * the hostname for this IP address, i.e., to connect to the host.
* If the operation is not allowed, it will return * If the operation is not allowed, it will return
@ -539,8 +539,8 @@ class InetAddress implements java.io.Serializable {
* the FQDN depending on the underlying system configuration. * the FQDN depending on the underlying system configuration.
* *
* <p>If there is a security manager, this method first * <p>If there is a security manager, this method first
* calls its <code>checkConnect</code> method * calls its {@code checkConnect} method
* with the hostname and <code>-1</code> * with the hostname and {@code -1}
* as its arguments to see if the calling code is allowed to know * as its arguments to see if the calling code is allowed to know
* the hostname for this IP address, i.e., to connect to the host. * the hostname for this IP address, i.e., to connect to the host.
* If the operation is not allowed, it will return * If the operation is not allowed, it will return
@ -566,8 +566,8 @@ class InetAddress implements java.io.Serializable {
* Returns the hostname for this address. * Returns the hostname for this address.
* *
* <p>If there is a security manager, this method first * <p>If there is a security manager, this method first
* calls its <code>checkConnect</code> method * calls its {@code checkConnect} method
* with the hostname and <code>-1</code> * with the hostname and {@code -1}
* as its arguments to see if the calling code is allowed to know * as its arguments to see if the calling code is allowed to know
* the hostname for this IP address, i.e., to connect to the host. * the hostname for this IP address, i.e., to connect to the host.
* If the operation is not allowed, it will return * If the operation is not allowed, it will return
@ -633,9 +633,9 @@ class InetAddress implements java.io.Serializable {
} }
/** /**
* Returns the raw IP address of this <code>InetAddress</code> * Returns the raw IP address of this {@code InetAddress}
* object. The result is in network byte order: the highest order * object. The result is in network byte order: the highest order
* byte of the address is in <code>getAddress()[0]</code>. * byte of the address is in {@code getAddress()[0]}.
* *
* @return the raw IP address of this object. * @return the raw IP address of this object.
*/ */
@ -664,18 +664,18 @@ class InetAddress implements java.io.Serializable {
/** /**
* Compares this object against the specified object. * Compares this object against the specified object.
* The result is <code>true</code> if and only if the argument is * The result is {@code true} if and only if the argument is
* not <code>null</code> and it represents the same IP address as * not {@code null} and it represents the same IP address as
* this object. * this object.
* <p> * <p>
* Two instances of <code>InetAddress</code> represent the same IP * Two instances of {@code InetAddress} represent the same IP
* address if the length of the byte arrays returned by * address if the length of the byte arrays returned by
* <code>getAddress</code> is the same for both, and each of the * {@code getAddress} is the same for both, and each of the
* array components is the same for the byte arrays. * array components is the same for the byte arrays.
* *
* @param obj the object to compare against. * @param obj the object to compare against.
* @return <code>true</code> if the objects are the same; * @return {@code true} if the objects are the same;
* <code>false</code> otherwise. * {@code false} otherwise.
* @see java.net.InetAddress#getAddress() * @see java.net.InetAddress#getAddress()
*/ */
public boolean equals(Object obj) { public boolean equals(Object obj) {
@ -683,7 +683,7 @@ class InetAddress implements java.io.Serializable {
} }
/** /**
* Converts this IP address to a <code>String</code>. The * Converts this IP address to a {@code String}. The
* string returned is of the form: hostname / literal IP * string returned is of the form: hostname / literal IP
* address. * address.
* *
@ -974,7 +974,7 @@ class InetAddress implements java.io.Serializable {
* No name service is checked for the validity of the address. * No name service is checked for the validity of the address.
* *
* <p> The host name can either be a machine name, such as * <p> The host name can either be a machine name, such as
* "<code>java.sun.com</code>", or a textual representation of its IP * "{@code java.sun.com}", or a textual representation of its IP
* address. * address.
* <p> No validity checking is done on the host name either. * <p> No validity checking is done on the host name either.
* *
@ -1019,26 +1019,26 @@ class InetAddress implements java.io.Serializable {
* Determines the IP address of a host, given the host's name. * Determines the IP address of a host, given the host's name.
* *
* <p> The host name can either be a machine name, such as * <p> The host name can either be a machine name, such as
* "<code>java.sun.com</code>", or a textual representation of its * "{@code java.sun.com}", or a textual representation of its
* IP address. If a literal IP address is supplied, only the * IP address. If a literal IP address is supplied, only the
* validity of the address format is checked. * validity of the address format is checked.
* *
* <p> For <code>host</code> specified in literal IPv6 address, * <p> For {@code host} specified in literal IPv6 address,
* either the form defined in RFC 2732 or the literal IPv6 address * either the form defined in RFC 2732 or the literal IPv6 address
* format defined in RFC 2373 is accepted. IPv6 scoped addresses are also * format defined in RFC 2373 is accepted. IPv6 scoped addresses are also
* supported. See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6 * supported. See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6
* scoped addresses. * scoped addresses.
* *
* <p> If the host is <tt>null</tt> then an <tt>InetAddress</tt> * <p> If the host is {@code null} then an {@code InetAddress}
* representing an address of the loopback interface is returned. * representing an address of the loopback interface is returned.
* See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC&nbsp;3330</a> * See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC&nbsp;3330</a>
* section&nbsp;2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a> * section&nbsp;2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a>
* section&nbsp;2.5.3. </p> * section&nbsp;2.5.3. </p>
* *
* @param host the specified host, or <code>null</code>. * @param host the specified host, or {@code null}.
* @return an IP address for the given host name. * @return an IP address for the given host name.
* @exception UnknownHostException if no IP address for the * @exception UnknownHostException if no IP address for the
* <code>host</code> could be found, or if a scope_id was specified * {@code host} could be found, or if a scope_id was specified
* for a global IPv6 address. * for a global IPv6 address.
* @exception SecurityException if a security manager exists * @exception SecurityException if a security manager exists
* and its checkConnect method doesn't allow the operation * and its checkConnect method doesn't allow the operation
@ -1059,37 +1059,37 @@ class InetAddress implements java.io.Serializable {
* based on the configured name service on the system. * based on the configured name service on the system.
* *
* <p> The host name can either be a machine name, such as * <p> The host name can either be a machine name, such as
* "<code>java.sun.com</code>", or a textual representation of its IP * "{@code java.sun.com}", or a textual representation of its IP
* address. If a literal IP address is supplied, only the * address. If a literal IP address is supplied, only the
* validity of the address format is checked. * validity of the address format is checked.
* *
* <p> For <code>host</code> specified in <i>literal IPv6 address</i>, * <p> For {@code host} specified in <i>literal IPv6 address</i>,
* either the form defined in RFC 2732 or the literal IPv6 address * either the form defined in RFC 2732 or the literal IPv6 address
* format defined in RFC 2373 is accepted. A literal IPv6 address may * format defined in RFC 2373 is accepted. A literal IPv6 address may
* also be qualified by appending a scoped zone identifier or scope_id. * also be qualified by appending a scoped zone identifier or scope_id.
* The syntax and usage of scope_ids is described * The syntax and usage of scope_ids is described
* <a href="Inet6Address.html#scoped">here</a>. * <a href="Inet6Address.html#scoped">here</a>.
* <p> If the host is <tt>null</tt> then an <tt>InetAddress</tt> * <p> If the host is {@code null} then an {@code InetAddress}
* representing an address of the loopback interface is returned. * representing an address of the loopback interface is returned.
* See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC&nbsp;3330</a> * See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC&nbsp;3330</a>
* section&nbsp;2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a> * section&nbsp;2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a>
* section&nbsp;2.5.3. </p> * section&nbsp;2.5.3. </p>
* *
* <p> If there is a security manager and <code>host</code> is not * <p> If there is a security manager and {@code host} is not
* null and <code>host.length() </code> is not equal to zero, the * null and {@code host.length() } is not equal to zero, the
* security manager's * security manager's
* <code>checkConnect</code> method is called * {@code checkConnect} method is called
* with the hostname and <code>-1</code> * with the hostname and {@code -1}
* as its arguments to see if the operation is allowed. * as its arguments to see if the operation is allowed.
* *
* @param host the name of the host, or <code>null</code>. * @param host the name of the host, or {@code null}.
* @return an array of all the IP addresses for a given host name. * @return an array of all the IP addresses for a given host name.
* *
* @exception UnknownHostException if no IP address for the * @exception UnknownHostException if no IP address for the
* <code>host</code> could be found, or if a scope_id was specified * {@code host} could be found, or if a scope_id was specified
* for a global IPv6 address. * for a global IPv6 address.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkConnect</code> method doesn't allow the operation. * {@code checkConnect} method doesn't allow the operation.
* *
* @see SecurityManager#checkConnect * @see SecurityManager#checkConnect
*/ */
@ -1389,9 +1389,9 @@ class InetAddress implements java.io.Serializable {
} }
/** /**
* Returns an <code>InetAddress</code> object given the raw IP address . * Returns an {@code InetAddress} object given the raw IP address .
* The argument is in network byte order: the highest order * The argument is in network byte order: the highest order
* byte of the address is in <code>getAddress()[0]</code>. * byte of the address is in {@code getAddress()[0]}.
* *
* <p> This method doesn't block, i.e. no reverse name service lookup * <p> This method doesn't block, i.e. no reverse name service lookup
* is performed. * is performed.
@ -1417,14 +1417,14 @@ class InetAddress implements java.io.Serializable {
/** /**
* Returns the address of the local host. This is achieved by retrieving * Returns the address of the local host. This is achieved by retrieving
* the name of the host from the system, then resolving that name into * the name of the host from the system, then resolving that name into
* an <code>InetAddress</code>. * an {@code InetAddress}.
* *
* <P>Note: The resolved address may be cached for a short period of time. * <P>Note: The resolved address may be cached for a short period of time.
* </P> * </P>
* *
* <p>If there is a security manager, its * <p>If there is a security manager, its
* <code>checkConnect</code> method is called * {@code checkConnect} method is called
* with the local host name and <code>-1</code> * with the local host name and {@code -1}
* as its arguments to see if the operation is allowed. * as its arguments to see if the operation is allowed.
* If the operation is not allowed, an InetAddress representing * If the operation is not allowed, an InetAddress representing
* the loopback address is returned. * the loopback address is returned.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ import java.io.ObjectStreamField;
* as returned values. * as returned values.
* <p> * <p>
* The <i>wildcard</i> is a special local IP address. It usually means "any" * The <i>wildcard</i> is a special local IP address. It usually means "any"
* and can only be used for <code>bind</code> operations. * and can only be used for {@code bind} operations.
* *
* @see java.net.Socket * @see java.net.Socket
* @see java.net.ServerSocket * @see java.net.ServerSocket
@ -155,8 +155,8 @@ public class InetSocketAddress
* and the port number a specified value. * and the port number a specified value.
* <p> * <p>
* A valid port value is between 0 and 65535. * A valid port value is between 0 and 65535.
* A port number of <code>zero</code> will let the system pick up an * A port number of {@code zero} will let the system pick up an
* ephemeral port in a <code>bind</code> operation. * ephemeral port in a {@code bind} operation.
* <p> * <p>
* @param port The port number * @param port The port number
* @throws IllegalArgumentException if the port parameter is outside the specified * @throws IllegalArgumentException if the port parameter is outside the specified
@ -171,10 +171,10 @@ public class InetSocketAddress
* Creates a socket address from an IP address and a port number. * Creates a socket address from an IP address and a port number.
* <p> * <p>
* A valid port value is between 0 and 65535. * A valid port value is between 0 and 65535.
* A port number of <code>zero</code> will let the system pick up an * A port number of {@code zero} will let the system pick up an
* ephemeral port in a <code>bind</code> operation. * ephemeral port in a {@code bind} operation.
* <P> * <P>
* A <code>null</code> address will assign the <i>wildcard</i> address. * A {@code null} address will assign the <i>wildcard</i> address.
* <p> * <p>
* @param addr The IP address * @param addr The IP address
* @param port The port number * @param port The port number
@ -195,13 +195,13 @@ public class InetSocketAddress
* An attempt will be made to resolve the hostname into an InetAddress. * An attempt will be made to resolve the hostname into an InetAddress.
* If that attempt fails, the address will be flagged as <I>unresolved</I>. * If that attempt fails, the address will be flagged as <I>unresolved</I>.
* <p> * <p>
* If there is a security manager, its <code>checkConnect</code> method * If there is a security manager, its {@code checkConnect} method
* is called with the host name as its argument to check the permissiom * is called with the host name as its argument to check the permissiom
* to resolve it. This could result in a SecurityException. * to resolve it. This could result in a SecurityException.
* <P> * <P>
* A valid port value is between 0 and 65535. * A valid port value is between 0 and 65535.
* A port number of <code>zero</code> will let the system pick up an * A port number of {@code zero} will let the system pick up an
* ephemeral port in a <code>bind</code> operation. * ephemeral port in a {@code bind} operation.
* <P> * <P>
* @param hostname the Host name * @param hostname the Host name
* @param port The port number * @param port The port number
@ -237,8 +237,8 @@ public class InetSocketAddress
* The address will be flagged as <I>unresolved</I>. * The address will be flagged as <I>unresolved</I>.
* <p> * <p>
* A valid port value is between 0 and 65535. * A valid port value is between 0 and 65535.
* A port number of <code>zero</code> will let the system pick up an * A port number of {@code zero} will let the system pick up an
* ephemeral port in a <code>bind</code> operation. * ephemeral port in a {@code bind} operation.
* <P> * <P>
* @param host the Host name * @param host the Host name
* @param port The port number * @param port The port number
@ -246,7 +246,7 @@ public class InetSocketAddress
* the range of valid port values, or if the hostname * the range of valid port values, or if the hostname
* parameter is <TT>null</TT>. * parameter is <TT>null</TT>.
* @see #isUnresolved() * @see #isUnresolved()
* @return a <code>InetSocketAddress</code> representing the unresolved * @return a {@code InetSocketAddress} representing the unresolved
* socket address * socket address
* @since 1.5 * @since 1.5
*/ */
@ -326,16 +326,16 @@ public class InetSocketAddress
/** /**
* *
* Gets the <code>InetAddress</code>. * Gets the {@code InetAddress}.
* *
* @return the InetAdress or <code>null</code> if it is unresolved. * @return the InetAdress or {@code null} if it is unresolved.
*/ */
public final InetAddress getAddress() { public final InetAddress getAddress() {
return holder.getAddress(); return holder.getAddress();
} }
/** /**
* Gets the <code>hostname</code>. * Gets the {@code hostname}.
* Note: This method may trigger a name service reverse lookup if the * Note: This method may trigger a name service reverse lookup if the
* address was created with a literal IP address. * address was created with a literal IP address.
* *
@ -360,8 +360,8 @@ public class InetSocketAddress
/** /**
* Checks whether the address has been resolved or not. * Checks whether the address has been resolved or not.
* *
* @return <code>true</code> if the hostname couldn't be resolved into * @return {@code true} if the hostname couldn't be resolved into
* an <code>InetAddress</code>. * an {@code InetAddress}.
*/ */
public final boolean isUnresolved() { public final boolean isUnresolved() {
return holder.isUnresolved(); return holder.isUnresolved();
@ -382,11 +382,11 @@ public class InetSocketAddress
/** /**
* Compares this object against the specified object. * Compares this object against the specified object.
* The result is <code>true</code> if and only if the argument is * The result is {@code true} if and only if the argument is
* not <code>null</code> and it represents the same address as * not {@code null} and it represents the same address as
* this object. * this object.
* <p> * <p>
* Two instances of <code>InetSocketAddress</code> represent the same * Two instances of {@code InetSocketAddress} represent the same
* address if both the InetAddresses (or hostnames if it is unresolved) and port * address if both the InetAddresses (or hostnames if it is unresolved) and port
* numbers are equal. * numbers are equal.
* If both addresses are unresolved, then the hostname and the port number * If both addresses are unresolved, then the hostname and the port number
@ -396,8 +396,8 @@ public class InetSocketAddress
* considered equal. * considered equal.
* *
* @param obj the object to compare against. * @param obj the object to compare against.
* @return <code>true</code> if the objects are the same; * @return {@code true} if the objects are the same;
* <code>false</code> otherwise. * {@code false} otherwise.
* @see java.net.InetAddress#equals(java.lang.Object) * @see java.net.InetAddress#equals(java.lang.Object)
*/ */
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,23 +47,23 @@ public class InterfaceAddress {
} }
/** /**
* Returns an <code>InetAddress</code> for this address. * Returns an {@code InetAddress} for this address.
* *
* @return the <code>InetAddress</code> for this address. * @return the {@code InetAddress} for this address.
*/ */
public InetAddress getAddress() { public InetAddress getAddress() {
return address; return address;
} }
/** /**
* Returns an <code>InetAddress</code> for the brodcast address * Returns an {@code InetAddress} for the brodcast address
* for this InterfaceAddress. * for this InterfaceAddress.
* <p> * <p>
* Only IPv4 networks have broadcast address therefore, in the case * Only IPv4 networks have broadcast address therefore, in the case
* of an IPv6 network, <code>null</code> will be returned. * of an IPv6 network, {@code null} will be returned.
* *
* @return the <code>InetAddress</code> representing the broadcast * @return the {@code InetAddress} representing the broadcast
* address or <code>null</code> if there is no broadcast address. * address or {@code null} if there is no broadcast address.
*/ */
public InetAddress getBroadcast() { public InetAddress getBroadcast() {
return broadcast; return broadcast;
@ -76,7 +76,7 @@ public class InterfaceAddress {
* or 24 (255.255.255.0). <p> * or 24 (255.255.255.0). <p>
* Typical IPv6 values would be 128 (::1/128) or 10 (fe80::203:baff:fe27:1243/10) * Typical IPv6 values would be 128 (::1/128) or 10 (fe80::203:baff:fe27:1243/10)
* *
* @return a <code>short</code> representing the prefix length for the * @return a {@code short} representing the prefix length for the
* subnet of that address. * subnet of that address.
*/ */
public short getNetworkPrefixLength() { public short getNetworkPrefixLength() {
@ -85,17 +85,17 @@ public class InterfaceAddress {
/** /**
* Compares this object against the specified object. * Compares this object against the specified object.
* The result is <code>true</code> if and only if the argument is * The result is {@code true} if and only if the argument is
* not <code>null</code> and it represents the same interface address as * not {@code null} and it represents the same interface address as
* this object. * this object.
* <p> * <p>
* Two instances of <code>InterfaceAddress</code> represent the same * Two instances of {@code InterfaceAddress} represent the same
* address if the InetAddress, the prefix length and the broadcast are * address if the InetAddress, the prefix length and the broadcast are
* the same for both. * the same for both.
* *
* @param obj the object to compare against. * @param obj the object to compare against.
* @return <code>true</code> if the objects are the same; * @return {@code true} if the objects are the same;
* <code>false</code> otherwise. * {@code false} otherwise.
* @see java.net.InterfaceAddress#hashCode() * @see java.net.InterfaceAddress#hashCode()
*/ */
public boolean equals(Object obj) { public boolean equals(Object obj) {
@ -122,7 +122,7 @@ public class InterfaceAddress {
} }
/** /**
* Converts this Interface address to a <code>String</code>. The * Converts this Interface address to a {@code String}. The
* string returned is of the form: InetAddress / prefix length [ broadcast address ]. * string returned is of the form: InetAddress / prefix length [ broadcast address ].
* *
* @return a string representation of this Interface address. * @return a string representation of this Interface address.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -45,18 +45,14 @@ import sun.net.www.ParseUtil;
* *
* <p>for example: * <p>for example:
* *
* <p><code> * <p>{@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class}
* jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class<br>
* </code>
* *
* <p>Jar URLs should be used to refer to a JAR file or entries in * <p>Jar URLs should be used to refer to a JAR file or entries in
* a JAR file. The example above is a JAR URL which refers to a JAR * a JAR file. The example above is a JAR URL which refers to a JAR
* entry. If the entry name is omitted, the URL refers to the whole * entry. If the entry name is omitted, the URL refers to the whole
* JAR file: * JAR file:
* *
* <code> * {@code jar:http://www.foo.com/bar/baz.jar!/}
* jar:http://www.foo.com/bar/baz.jar!/
* </code>
* *
* <p>Users should cast the generic URLConnection to a * <p>Users should cast the generic URLConnection to a
* JarURLConnection when they know that the URL they created is a JAR * JarURLConnection when they know that the URL they created is a JAR
@ -76,19 +72,19 @@ import sun.net.www.ParseUtil;
* <dl> * <dl>
* *
* <dt>A Jar entry * <dt>A Jar entry
* <dd><code>jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class</code> * <dd>{@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class}
* *
* <dt>A Jar file * <dt>A Jar file
* <dd><code>jar:http://www.foo.com/bar/baz.jar!/</code> * <dd>{@code jar:http://www.foo.com/bar/baz.jar!/}
* *
* <dt>A Jar directory * <dt>A Jar directory
* <dd><code>jar:http://www.foo.com/bar/baz.jar!/COM/foo/</code> * <dd>{@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/}
* *
* </dl> * </dl>
* *
* <p><code>!/</code> is refered to as the <em>separator</em>. * <p>{@code !/} is refered to as the <em>separator</em>.
* *
* <p>When constructing a JAR url via <code>new URL(context, spec)</code>, * <p>When constructing a JAR url via {@code new URL(context, spec)},
* the following rules apply: * the following rules apply:
* *
* <ul> * <ul>
@ -294,7 +290,7 @@ public abstract class JarURLConnection extends URLConnection {
* can only be called once * can only be called once
* the connection has been completely verified by reading * the connection has been completely verified by reading
* from the input stream until the end of the stream has been * from the input stream until the end of the stream has been
* reached. Otherwise, this method will return <code>null</code> * reached. Otherwise, this method will return {@code null}
* *
* @return the Certificate object for this connection if the URL * @return the Certificate object for this connection if the URL
* for it points to a JAR file entry, null otherwise. * for it points to a JAR file entry, null otherwise.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -39,13 +39,13 @@ public class MalformedURLException extends IOException {
private static final long serialVersionUID = -182787522200415866L; private static final long serialVersionUID = -182787522200415866L;
/** /**
* Constructs a <code>MalformedURLException</code> with no detail message. * Constructs a {@code MalformedURLException} with no detail message.
*/ */
public MalformedURLException() { public MalformedURLException() {
} }
/** /**
* Constructs a <code>MalformedURLException</code> with the * Constructs a {@code MalformedURLException} with the
* specified detail message. * specified detail message.
* *
* @param msg the detail message. * @param msg the detail message.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -92,7 +92,7 @@ class MulticastSocket extends DatagramSocket {
* Create a multicast socket. * Create a multicast socket.
* *
* <p>If there is a security manager, * <p>If there is a security manager,
* its <code>checkListen</code> method is first called * its {@code checkListen} method is first called
* with 0 as its argument to ensure the operation is allowed. * with 0 as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* <p> * <p>
@ -103,7 +103,7 @@ class MulticastSocket extends DatagramSocket {
* @exception IOException if an I/O exception occurs * @exception IOException if an I/O exception occurs
* while creating the MulticastSocket * while creating the MulticastSocket
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation. * {@code checkListen} method doesn't allow the operation.
* @see SecurityManager#checkListen * @see SecurityManager#checkListen
* @see java.net.DatagramSocket#setReuseAddress(boolean) * @see java.net.DatagramSocket#setReuseAddress(boolean)
*/ */
@ -115,8 +115,8 @@ class MulticastSocket extends DatagramSocket {
* Create a multicast socket and bind it to a specific port. * Create a multicast socket and bind it to a specific port.
* *
* <p>If there is a security manager, * <p>If there is a security manager,
* its <code>checkListen</code> method is first called * its {@code checkListen} method is first called
* with the <code>port</code> argument * with the {@code port} argument
* as its argument to ensure the operation is allowed. * as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* <p> * <p>
@ -128,7 +128,7 @@ class MulticastSocket extends DatagramSocket {
* @exception IOException if an I/O exception occurs * @exception IOException if an I/O exception occurs
* while creating the MulticastSocket * while creating the MulticastSocket
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation. * {@code checkListen} method doesn't allow the operation.
* @see SecurityManager#checkListen * @see SecurityManager#checkListen
* @see java.net.DatagramSocket#setReuseAddress(boolean) * @see java.net.DatagramSocket#setReuseAddress(boolean)
*/ */
@ -139,10 +139,10 @@ class MulticastSocket extends DatagramSocket {
/** /**
* Create a MulticastSocket bound to the specified socket address. * Create a MulticastSocket bound to the specified socket address.
* <p> * <p>
* Or, if the address is <code>null</code>, create an unbound socket. * Or, if the address is {@code null}, create an unbound socket.
* <p> * <p>
* <p>If there is a security manager, * <p>If there is a security manager,
* its <code>checkListen</code> method is first called * its {@code checkListen} method is first called
* with the SocketAddress port as its argument to ensure the operation is allowed. * with the SocketAddress port as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* <p> * <p>
@ -150,12 +150,12 @@ class MulticastSocket extends DatagramSocket {
* {@link DatagramSocket#setReuseAddress(boolean)} method is * {@link DatagramSocket#setReuseAddress(boolean)} method is
* called to enable the SO_REUSEADDR socket option. * called to enable the SO_REUSEADDR socket option.
* *
* @param bindaddr Socket address to bind to, or <code>null</code> for * @param bindaddr Socket address to bind to, or {@code null} for
* an unbound socket. * an unbound socket.
* @exception IOException if an I/O exception occurs * @exception IOException if an I/O exception occurs
* while creating the MulticastSocket * while creating the MulticastSocket
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation. * {@code checkListen} method doesn't allow the operation.
* @see SecurityManager#checkListen * @see SecurityManager#checkListen
* @see java.net.DatagramSocket#setReuseAddress(boolean) * @see java.net.DatagramSocket#setReuseAddress(boolean)
* *
@ -197,7 +197,7 @@ class MulticastSocket extends DatagramSocket {
/** /**
* Set the default time-to-live for multicast packets sent out * Set the default time-to-live for multicast packets sent out
* on this <code>MulticastSocket</code> in order to control the * on this {@code MulticastSocket} in order to control the
* scope of the multicasts. * scope of the multicasts.
* *
* <p>The ttl is an <b>unsigned</b> 8-bit quantity, and so <B>must</B> be * <p>The ttl is an <b>unsigned</b> 8-bit quantity, and so <B>must</B> be
@ -279,11 +279,11 @@ class MulticastSocket extends DatagramSocket {
/** /**
* Joins a multicast group. Its behavior may be affected by * Joins a multicast group. Its behavior may be affected by
* <code>setInterface</code> or <code>setNetworkInterface</code>. * {@code setInterface} or {@code setNetworkInterface}.
* *
* <p>If there is a security manager, this method first * <p>If there is a security manager, this method first
* calls its <code>checkMulticast</code> method * calls its {@code checkMulticast} method
* with the <code>mcastaddr</code> argument * with the {@code mcastaddr} argument
* as its argument. * as its argument.
* *
* @param mcastaddr is the multicast address to join * @param mcastaddr is the multicast address to join
@ -291,7 +291,7 @@ class MulticastSocket extends DatagramSocket {
* @exception IOException if there is an error joining * @exception IOException if there is an error joining
* or when the address is not a multicast address. * or when the address is not a multicast address.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkMulticast</code> method doesn't allow the join. * {@code checkMulticast} method doesn't allow the join.
* *
* @see SecurityManager#checkMulticast(InetAddress) * @see SecurityManager#checkMulticast(InetAddress)
*/ */
@ -325,18 +325,18 @@ class MulticastSocket extends DatagramSocket {
/** /**
* Leave a multicast group. Its behavior may be affected by * Leave a multicast group. Its behavior may be affected by
* <code>setInterface</code> or <code>setNetworkInterface</code>. * {@code setInterface} or {@code setNetworkInterface}.
* *
* <p>If there is a security manager, this method first * <p>If there is a security manager, this method first
* calls its <code>checkMulticast</code> method * calls its {@code checkMulticast} method
* with the <code>mcastaddr</code> argument * with the {@code mcastaddr} argument
* as its argument. * as its argument.
* *
* @param mcastaddr is the multicast address to leave * @param mcastaddr is the multicast address to leave
* @exception IOException if there is an error leaving * @exception IOException if there is an error leaving
* or when the address is not a multicast address. * or when the address is not a multicast address.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkMulticast</code> method doesn't allow the operation. * {@code checkMulticast} method doesn't allow the operation.
* *
* @see SecurityManager#checkMulticast(InetAddress) * @see SecurityManager#checkMulticast(InetAddress)
*/ */
@ -362,8 +362,8 @@ class MulticastSocket extends DatagramSocket {
* Joins the specified multicast group at the specified interface. * Joins the specified multicast group at the specified interface.
* *
* <p>If there is a security manager, this method first * <p>If there is a security manager, this method first
* calls its <code>checkMulticast</code> method * calls its {@code checkMulticast} method
* with the <code>mcastaddr</code> argument * with the {@code mcastaddr} argument
* as its argument. * as its argument.
* *
* @param mcastaddr is the multicast address to join * @param mcastaddr is the multicast address to join
@ -375,7 +375,7 @@ class MulticastSocket extends DatagramSocket {
* @exception IOException if there is an error joining * @exception IOException if there is an error joining
* or when the address is not a multicast address. * or when the address is not a multicast address.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkMulticast</code> method doesn't allow the join. * {@code checkMulticast} method doesn't allow the join.
* @throws IllegalArgumentException if mcastaddr is null or is a * @throws IllegalArgumentException if mcastaddr is null or is a
* SocketAddress subclass not supported by this socket * SocketAddress subclass not supported by this socket
* *
@ -410,8 +410,8 @@ class MulticastSocket extends DatagramSocket {
* Leave a multicast group on a specified local interface. * Leave a multicast group on a specified local interface.
* *
* <p>If there is a security manager, this method first * <p>If there is a security manager, this method first
* calls its <code>checkMulticast</code> method * calls its {@code checkMulticast} method
* with the <code>mcastaddr</code> argument * with the {@code mcastaddr} argument
* as its argument. * as its argument.
* *
* @param mcastaddr is the multicast address to leave * @param mcastaddr is the multicast address to leave
@ -422,7 +422,7 @@ class MulticastSocket extends DatagramSocket {
* @exception IOException if there is an error leaving * @exception IOException if there is an error leaving
* or when the address is not a multicast address. * or when the address is not a multicast address.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkMulticast</code> method doesn't allow the operation. * {@code checkMulticast} method doesn't allow the operation.
* @throws IllegalArgumentException if mcastaddr is null or is a * @throws IllegalArgumentException if mcastaddr is null or is a
* SocketAddress subclass not supported by this socket * SocketAddress subclass not supported by this socket
* *
@ -478,7 +478,7 @@ class MulticastSocket extends DatagramSocket {
* Retrieve the address of the network interface used for * Retrieve the address of the network interface used for
* multicast packets. * multicast packets.
* *
* @return An <code>InetAddress</code> representing * @return An {@code InetAddress} representing
* the address of the network interface used for * the address of the network interface used for
* multicast packets. * multicast packets.
* *
@ -562,7 +562,7 @@ class MulticastSocket extends DatagramSocket {
* *
* @exception SocketException if there is an error in * @exception SocketException if there is an error in
* the underlying protocol, such as a TCP error. * the underlying protocol, such as a TCP error.
* @return the multicast <code>NetworkInterface</code> currently set * @return the multicast {@code NetworkInterface} currently set
* @see #setNetworkInterface(NetworkInterface) * @see #setNetworkInterface(NetworkInterface)
* @since 1.4 * @since 1.4
*/ */
@ -587,7 +587,7 @@ class MulticastSocket extends DatagramSocket {
* <p>Because this option is a hint, applications that want to * <p>Because this option is a hint, applications that want to
* verify what loopback mode is set to should call * verify what loopback mode is set to should call
* {@link #getLoopbackMode()} * {@link #getLoopbackMode()}
* @param disable <code>true</code> to disable the LoopbackMode * @param disable {@code true} to disable the LoopbackMode
* @throws SocketException if an error occurs while setting the value * @throws SocketException if an error occurs while setting the value
* @since 1.4 * @since 1.4
* @see #getLoopbackMode * @see #getLoopbackMode
@ -615,18 +615,18 @@ class MulticastSocket extends DatagramSocket {
* otherwise it is preferable to set a TTL once on the socket, and * otherwise it is preferable to set a TTL once on the socket, and
* use that default TTL for all packets. This method does <B>not * use that default TTL for all packets. This method does <B>not
* </B> alter the default TTL for the socket. Its behavior may be * </B> alter the default TTL for the socket. Its behavior may be
* affected by <code>setInterface</code>. * affected by {@code setInterface}.
* *
* <p>If there is a security manager, this method first performs some * <p>If there is a security manager, this method first performs some
* security checks. First, if <code>p.getAddress().isMulticastAddress()</code> * security checks. First, if {@code p.getAddress().isMulticastAddress()}
* is true, this method calls the * is true, this method calls the
* security manager's <code>checkMulticast</code> method * security manager's {@code checkMulticast} method
* with <code>p.getAddress()</code> and <code>ttl</code> as its arguments. * with {@code p.getAddress()} and {@code ttl} as its arguments.
* If the evaluation of that expression is false, * If the evaluation of that expression is false,
* this method instead calls the security manager's * this method instead calls the security manager's
* <code>checkConnect</code> method with arguments * {@code checkConnect} method with arguments
* <code>p.getAddress().getHostAddress()</code> and * {@code p.getAddress().getHostAddress()} and
* <code>p.getPort()</code>. Each call to a security manager method * {@code p.getPort()}. Each call to a security manager method
* could result in a SecurityException if the operation is not allowed. * could result in a SecurityException if the operation is not allowed.
* *
* @param p is the packet to be sent. The packet should contain * @param p is the packet to be sent. The packet should contain
@ -639,7 +639,7 @@ class MulticastSocket extends DatagramSocket {
* @exception IOException is raised if an error occurs i.e * @exception IOException is raised if an error occurs i.e
* error while setting ttl. * error while setting ttl.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkMulticast</code> or <code>checkConnect</code> * {@code checkMulticast} or {@code checkConnect}
* method doesn't allow the send. * method doesn't allow the send.
* *
* @deprecated Use the following code or its equivalent instead: * @deprecated Use the following code or its equivalent instead:

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -177,8 +177,8 @@ public final class NetPermission extends BasicPermission {
* *
* @param name the name of the NetPermission. * @param name the name of the NetPermission.
* *
* @throws NullPointerException if <code>name</code> is <code>null</code>. * @throws NullPointerException if {@code name} is {@code null}.
* @throws IllegalArgumentException if <code>name</code> is empty. * @throws IllegalArgumentException if {@code name} is empty.
*/ */
public NetPermission(String name) public NetPermission(String name)
@ -194,8 +194,8 @@ public final class NetPermission extends BasicPermission {
* @param name the name of the NetPermission. * @param name the name of the NetPermission.
* @param actions should be null. * @param actions should be null.
* *
* @throws NullPointerException if <code>name</code> is <code>null</code>. * @throws NullPointerException if {@code name} is {@code null}.
* @throws IllegalArgumentException if <code>name</code> is empty. * @throws IllegalArgumentException if {@code name} is empty.
*/ */
public NetPermission(String name, String actions) public NetPermission(String name, String actions)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -98,9 +98,9 @@ public final class NetworkInterface {
* Convenience method to return an Enumeration with all or a * Convenience method to return an Enumeration with all or a
* subset of the InetAddresses bound to this network interface. * subset of the InetAddresses bound to this network interface.
* <p> * <p>
* If there is a security manager, its <code>checkConnect</code> * If there is a security manager, its {@code checkConnect}
* method is called for each InetAddress. Only InetAddresses where * method is called for each InetAddress. Only InetAddresses where
* the <code>checkConnect</code> doesn't throw a SecurityException * the {@code checkConnect} doesn't throw a SecurityException
* will be returned in the Enumeration. However, if the caller has the * will be returned in the Enumeration. However, if the caller has the
* {@link NetPermission}("getNetworkInformation") permission, then all * {@link NetPermission}("getNetworkInformation") permission, then all
* InetAddresses are returned. * InetAddresses are returned.
@ -154,15 +154,15 @@ public final class NetworkInterface {
} }
/** /**
* Get a List of all or a subset of the <code>InterfaceAddresses</code> * Get a List of all or a subset of the {@code InterfaceAddresses}
* of this network interface. * of this network interface.
* <p> * <p>
* If there is a security manager, its <code>checkConnect</code> * If there is a security manager, its {@code checkConnect}
* method is called with the InetAddress for each InterfaceAddress. * method is called with the InetAddress for each InterfaceAddress.
* Only InterfaceAddresses where the <code>checkConnect</code> doesn't throw * Only InterfaceAddresses where the {@code checkConnect} doesn't throw
* a SecurityException will be returned in the List. * a SecurityException will be returned in the List.
* *
* @return a <code>List</code> object with all or a subset of the * @return a {@code List} object with all or a subset of the
* InterfaceAddresss of this network interface * InterfaceAddresss of this network interface
* @since 1.6 * @since 1.6
*/ */
@ -216,10 +216,10 @@ public final class NetworkInterface {
/** /**
* Returns the parent NetworkInterface of this interface if this is * Returns the parent NetworkInterface of this interface if this is
* a subinterface, or <code>null</code> if it is a physical * a subinterface, or {@code null} if it is a physical
* (non virtual) interface or has no parent. * (non virtual) interface or has no parent.
* *
* @return The <code>NetworkInterface</code> this interface is attached to. * @return The {@code NetworkInterface} this interface is attached to.
* @since 1.6 * @since 1.6
*/ */
public NetworkInterface getParent() { public NetworkInterface getParent() {
@ -260,15 +260,15 @@ public final class NetworkInterface {
* @param name * @param name
* The name of the network interface. * The name of the network interface.
* *
* @return A <tt>NetworkInterface</tt> with the specified name, * @return A {@code NetworkInterface} with the specified name,
* or <tt>null</tt> if there is no network interface * or {@code null} if there is no network interface
* with the specified name. * with the specified name.
* *
* @throws SocketException * @throws SocketException
* If an I/O error occurs. * If an I/O error occurs.
* *
* @throws NullPointerException * @throws NullPointerException
* If the specified name is <tt>null</tt>. * If the specified name is {@code null}.
*/ */
public static NetworkInterface getByName(String name) throws SocketException { public static NetworkInterface getByName(String name) throws SocketException {
if (name == null) if (name == null)
@ -303,17 +303,17 @@ public final class NetworkInterface {
* returned. * returned.
* *
* @param addr * @param addr
* The <tt>InetAddress</tt> to search with. * The {@code InetAddress} to search with.
* *
* @return A <tt>NetworkInterface</tt> * @return A {@code NetworkInterface}
* or <tt>null</tt> if there is no network interface * or {@code null} if there is no network interface
* with the specified IP address. * with the specified IP address.
* *
* @throws SocketException * @throws SocketException
* If an I/O error occurs. * If an I/O error occurs.
* *
* @throws NullPointerException * @throws NullPointerException
* If the specified address is <tt>null</tt>. * If the specified address is {@code null}.
*/ */
public static NetworkInterface getByInetAddress(InetAddress addr) throws SocketException { public static NetworkInterface getByInetAddress(InetAddress addr) throws SocketException {
if (addr == null) { if (addr == null) {
@ -378,7 +378,7 @@ public final class NetworkInterface {
/** /**
* Returns whether a network interface is up and running. * Returns whether a network interface is up and running.
* *
* @return <code>true</code> if the interface is up and running. * @return {@code true} if the interface is up and running.
* @exception SocketException if an I/O error occurs. * @exception SocketException if an I/O error occurs.
* @since 1.6 * @since 1.6
*/ */
@ -390,7 +390,7 @@ public final class NetworkInterface {
/** /**
* Returns whether a network interface is a loopback interface. * Returns whether a network interface is a loopback interface.
* *
* @return <code>true</code> if the interface is a loopback interface. * @return {@code true} if the interface is a loopback interface.
* @exception SocketException if an I/O error occurs. * @exception SocketException if an I/O error occurs.
* @since 1.6 * @since 1.6
*/ */
@ -404,7 +404,7 @@ public final class NetworkInterface {
* A typical point to point interface would be a PPP connection through * A typical point to point interface would be a PPP connection through
* a modem. * a modem.
* *
* @return <code>true</code> if the interface is a point to point * @return {@code true} if the interface is a point to point
* interface. * interface.
* @exception SocketException if an I/O error occurs. * @exception SocketException if an I/O error occurs.
* @since 1.6 * @since 1.6
@ -417,7 +417,7 @@ public final class NetworkInterface {
/** /**
* Returns whether a network interface supports multicasting or not. * Returns whether a network interface supports multicasting or not.
* *
* @return <code>true</code> if the interface supports Multicasting. * @return {@code true} if the interface supports Multicasting.
* @exception SocketException if an I/O error occurs. * @exception SocketException if an I/O error occurs.
* @since 1.6 * @since 1.6
*/ */
@ -432,7 +432,7 @@ public final class NetworkInterface {
* If a security manager is set, then the caller must have * If a security manager is set, then the caller must have
* the permission {@link NetPermission}("getNetworkInformation"). * the permission {@link NetPermission}("getNetworkInformation").
* *
* @return a byte array containing the address, or <code>null</code> if * @return a byte array containing the address, or {@code null} if
* the address doesn't exist, is not accessible or a security * the address doesn't exist, is not accessible or a security
* manager is set and the caller does not have the permission * manager is set and the caller does not have the permission
* NetPermission("getNetworkInformation") * NetPermission("getNetworkInformation")
@ -481,7 +481,7 @@ public final class NetworkInterface {
* can be several virtual interfaces attached to a single physical * can be several virtual interfaces attached to a single physical
* interface. * interface.
* *
* @return <code>true</code> if this interface is a virtual interface. * @return {@code true} if this interface is a virtual interface.
* @since 1.6 * @since 1.6
*/ */
public boolean isVirtual() { public boolean isVirtual() {
@ -497,16 +497,16 @@ public final class NetworkInterface {
/** /**
* Compares this object against the specified object. * Compares this object against the specified object.
* The result is <code>true</code> if and only if the argument is * The result is {@code true} if and only if the argument is
* not <code>null</code> and it represents the same NetworkInterface * not {@code null} and it represents the same NetworkInterface
* as this object. * as this object.
* <p> * <p>
* Two instances of <code>NetworkInterface</code> represent the same * Two instances of {@code NetworkInterface} represent the same
* NetworkInterface if both name and addrs are the same for both. * NetworkInterface if both name and addrs are the same for both.
* *
* @param obj the object to compare against. * @param obj the object to compare against.
* @return <code>true</code> if the objects are the same; * @return {@code true} if the objects are the same;
* <code>false</code> otherwise. * {@code false} otherwise.
* @see java.net.InetAddress#getAddress() * @see java.net.InetAddress#getAddress()
*/ */
public boolean equals(Object obj) { public boolean equals(Object obj) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -43,11 +43,11 @@ public final class PasswordAuthentication {
private char[] password; private char[] password;
/** /**
* Creates a new <code>PasswordAuthentication</code> object from the given * Creates a new {@code PasswordAuthentication} object from the given
* user name and password. * user name and password.
* *
* <p> Note that the given user password is cloned before it is stored in * <p> Note that the given user password is cloned before it is stored in
* the new <code>PasswordAuthentication</code> object. * the new {@code PasswordAuthentication} object.
* *
* @param userName the user name * @param userName the user name
* @param password the user's password * @param password the user's password

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -36,7 +36,7 @@ public class PortUnreachableException extends SocketException {
private static final long serialVersionUID = 8462541992376507323L; private static final long serialVersionUID = 8462541992376507323L;
/** /**
* Constructs a new <code>PortUnreachableException</code> with a * Constructs a new {@code PortUnreachableException} with a
* detail message. * detail message.
* @param msg the detail message * @param msg the detail message
*/ */
@ -45,7 +45,7 @@ public class PortUnreachableException extends SocketException {
} }
/** /**
* Construct a new <code>PortUnreachableException</code> with no * Construct a new {@code PortUnreachableException} with no
* detailed message. * detailed message.
*/ */
public PortUnreachableException() {} public PortUnreachableException() {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -39,7 +39,7 @@ class ProtocolException extends IOException {
private static final long serialVersionUID = -6098449442062388080L; private static final long serialVersionUID = -6098449442062388080L;
/** /**
* Constructs a new <code>ProtocolException</code> with the * Constructs a new {@code ProtocolException} with the
* specified detail message. * specified detail message.
* *
* @param host the detail message. * @param host the detail message.
@ -49,7 +49,7 @@ class ProtocolException extends IOException {
} }
/** /**
* Constructs a new <code>ProtocolException</code> with no detail message. * Constructs a new {@code ProtocolException} with no detail message.
*/ */
public ProtocolException() { public ProtocolException() {
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ package java.net;
/** /**
* This class represents a proxy setting, typically a type (http, socks) and * This class represents a proxy setting, typically a type (http, socks) and
* a socket address. * a socket address.
* A <code>Proxy</code> is an immutable object. * A {@code Proxy} is an immutable object.
* *
* @see java.net.ProxySelector * @see java.net.ProxySelector
* @author Yingxian Wang * @author Yingxian Wang
@ -61,17 +61,17 @@ public class Proxy {
private SocketAddress sa; private SocketAddress sa;
/** /**
* A proxy setting that represents a <code>DIRECT</code> connection, * A proxy setting that represents a {@code DIRECT} connection,
* basically telling the protocol handler not to use any proxying. * basically telling the protocol handler not to use any proxying.
* Used, for instance, to create sockets bypassing any other global * Used, for instance, to create sockets bypassing any other global
* proxy settings (like SOCKS): * proxy settings (like SOCKS):
* <P> * <P>
* <code>Socket s = new Socket(Proxy.NO_PROXY);</code><br> * {@code Socket s = new Socket(Proxy.NO_PROXY);}<br>
* <P> * <P>
*/ */
public final static Proxy NO_PROXY = new Proxy(); public final static Proxy NO_PROXY = new Proxy();
// Creates the proxy that represents a <code>DIRECT</code> connection. // Creates the proxy that represents a {@code DIRECT} connection.
private Proxy() { private Proxy() {
type = Type.DIRECT; type = Type.DIRECT;
sa = null; sa = null;
@ -82,11 +82,11 @@ public class Proxy {
* Certain combinations are illegal. For instance, for types Http, and * Certain combinations are illegal. For instance, for types Http, and
* Socks, a SocketAddress <b>must</b> be provided. * Socks, a SocketAddress <b>must</b> be provided.
* <P> * <P>
* Use the <code>Proxy.NO_PROXY</code> constant * Use the {@code Proxy.NO_PROXY} constant
* for representing a direct connection. * for representing a direct connection.
* *
* @param type the <code>Type</code> of the proxy * @param type the {@code Type} of the proxy
* @param sa the <code>SocketAddress</code> for that proxy * @param sa the {@code SocketAddress} for that proxy
* @throws IllegalArgumentException when the type and the address are * @throws IllegalArgumentException when the type and the address are
* incompatible * incompatible
*/ */
@ -108,9 +108,9 @@ public class Proxy {
/** /**
* Returns the socket address of the proxy, or * Returns the socket address of the proxy, or
* <code>null</code> if its a direct connection. * {@code null} if its a direct connection.
* *
* @return a <code>SocketAddress</code> representing the socket end * @return a {@code SocketAddress} representing the socket end
* point of the proxy * point of the proxy
*/ */
public SocketAddress address() { public SocketAddress address() {
@ -121,7 +121,7 @@ public class Proxy {
* Constructs a string representation of this Proxy. * Constructs a string representation of this Proxy.
* This String is constructed by calling toString() on its type * This String is constructed by calling toString() on its type
* and concatenating " @ " and the toString() result from its address * and concatenating " @ " and the toString() result from its address
* if its type is not <code>DIRECT</code>. * if its type is not {@code DIRECT}.
* *
* @return a string representation of this object. * @return a string representation of this object.
*/ */
@ -133,16 +133,16 @@ public class Proxy {
/** /**
* Compares this object against the specified object. * Compares this object against the specified object.
* The result is <code>true</code> if and only if the argument is * The result is {@code true} if and only if the argument is
* not <code>null</code> and it represents the same proxy as * not {@code null} and it represents the same proxy as
* this object. * this object.
* <p> * <p>
* Two instances of <code>Proxy</code> represent the same * Two instances of {@code Proxy} represent the same
* address if both the SocketAddresses and type are equal. * address if both the SocketAddresses and type are equal.
* *
* @param obj the object to compare against. * @param obj the object to compare against.
* @return <code>true</code> if the objects are the same; * @return {@code true} if the objects are the same;
* <code>false</code> otherwise. * {@code false} otherwise.
* @see java.net.InetSocketAddress#equals(java.lang.Object) * @see java.net.InetSocketAddress#equals(java.lang.Object)
*/ */
public final boolean equals(Object obj) { public final boolean equals(Object obj) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -83,9 +83,9 @@ public abstract class ProxySelector {
* *
* @throws SecurityException * @throws SecurityException
* If a security manager has been installed and it denies * If a security manager has been installed and it denies
* {@link NetPermission}<tt>("getProxySelector")</tt> * {@link NetPermission}{@code ("getProxySelector")}
* @see #setDefault(ProxySelector) * @see #setDefault(ProxySelector)
* @return the system-wide <code>ProxySelector</code> * @return the system-wide {@code ProxySelector}
* @since 1.5 * @since 1.5
*/ */
public static ProxySelector getDefault() { public static ProxySelector getDefault() {
@ -102,11 +102,11 @@ public abstract class ProxySelector {
* Note: non-standard protocol handlers may ignore this setting. * Note: non-standard protocol handlers may ignore this setting.
* *
* @param ps The HTTP proxy selector, or * @param ps The HTTP proxy selector, or
* <code>null</code> to unset the proxy selector. * {@code null} to unset the proxy selector.
* *
* @throws SecurityException * @throws SecurityException
* If a security manager has been installed and it denies * If a security manager has been installed and it denies
* {@link NetPermission}<tt>("setProxySelector")</tt> * {@link NetPermission}{@code ("setProxySelector")}
* *
* @see #getDefault() * @see #getDefault()
* @since 1.5 * @since 1.5
@ -127,7 +127,7 @@ public abstract class ProxySelector {
* <UL> * <UL>
* <LI>http URI for http connections</LI> * <LI>http URI for http connections</LI>
* <LI>https URI for https connections * <LI>https URI for https connections
* <LI><code>socket://host:port</code><br> * <LI>{@code socket://host:port}<br>
* for tcp client sockets connections</LI> * for tcp client sockets connections</LI>
* </UL> * </UL>
* *

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -74,10 +74,10 @@ public abstract class ResponseCache {
* *
* @throws SecurityException * @throws SecurityException
* If a security manager has been installed and it denies * If a security manager has been installed and it denies
* {@link NetPermission}<tt>("getResponseCache")</tt> * {@link NetPermission}{@code ("getResponseCache")}
* *
* @see #setDefault(ResponseCache) * @see #setDefault(ResponseCache)
* @return the system-wide <code>ResponseCache</code> * @return the system-wide {@code ResponseCache}
* @since 1.5 * @since 1.5
*/ */
public synchronized static ResponseCache getDefault() { public synchronized static ResponseCache getDefault() {
@ -94,11 +94,11 @@ public abstract class ResponseCache {
* Note: non-standard procotol handlers may ignore this setting. * Note: non-standard procotol handlers may ignore this setting.
* *
* @param responseCache The response cache, or * @param responseCache The response cache, or
* <code>null</code> to unset the cache. * {@code null} to unset the cache.
* *
* @throws SecurityException * @throws SecurityException
* If a security manager has been installed and it denies * If a security manager has been installed and it denies
* {@link NetPermission}<tt>("setResponseCache")</tt> * {@link NetPermission}{@code ("setResponseCache")}
* *
* @see #getDefault() * @see #getDefault()
* @since 1.5 * @since 1.5
@ -118,14 +118,14 @@ public abstract class ResponseCache {
* to get the network resource. If a cached response is returned, * to get the network resource. If a cached response is returned,
* that resource is used instead. * that resource is used instead.
* *
* @param uri a <code>URI</code> used to reference the requested * @param uri a {@code URI} used to reference the requested
* network resource * network resource
* @param rqstMethod a <code>String</code> representing the request * @param rqstMethod a {@code String} representing the request
* method * method
* @param rqstHeaders - a Map from request header * @param rqstHeaders - a Map from request header
* field names to lists of field values representing * field names to lists of field values representing
* the current request headers * the current request headers
* @return a <code>CacheResponse</code> instance if available * @return a {@code CacheResponse} instance if available
* from cache, or null otherwise * from cache, or null otherwise
* @throws IOException if an I/O error occurs * @throws IOException if an I/O error occurs
* @throws IllegalArgumentException if any one of the arguments is null * @throws IllegalArgumentException if any one of the arguments is null
@ -148,11 +148,11 @@ public abstract class ResponseCache {
* use to write the resource into the cache. If the resource is * use to write the resource into the cache. If the resource is
* not to be cached, then put must return null. * not to be cached, then put must return null.
* *
* @param uri a <code>URI</code> used to reference the requested * @param uri a {@code URI} used to reference the requested
* network resource * network resource
* @param conn - a URLConnection instance that is used to fetch * @param conn - a URLConnection instance that is used to fetch
* the response to be cached * the response to be cached
* @return a <code>CacheRequest</code> for recording the * @return a {@code CacheRequest} for recording the
* response to be cached. Null return indicates that * response to be cached. Null return indicates that
* the caller does not intend to cache the response. * the caller does not intend to cache the response.
* @throws IOException if an I/O error occurs * @throws IOException if an I/O error occurs

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,7 +37,7 @@ import java.security.PrivilegedExceptionAction;
* based on that request, and then possibly returns a result to the requester. * based on that request, and then possibly returns a result to the requester.
* <p> * <p>
* The actual work of the server socket is performed by an instance * The actual work of the server socket is performed by an instance
* of the <code>SocketImpl</code> class. An application can * of the {@code SocketImpl} class. An application can
* change the socket factory that creates the socket * change the socket factory that creates the socket
* implementation to configure itself to create sockets * implementation to configure itself to create sockets
* appropriate to the local firewall. * appropriate to the local firewall.
@ -89,31 +89,31 @@ class ServerSocket implements java.io.Closeable {
/** /**
* Creates a server socket, bound to the specified port. A port number * Creates a server socket, bound to the specified port. A port number
* of <code>0</code> means that the port number is automatically * of {@code 0} means that the port number is automatically
* allocated, typically from an ephemeral port range. This port * allocated, typically from an ephemeral port range. This port
* number can then be retrieved by calling {@link #getLocalPort getLocalPort}. * number can then be retrieved by calling {@link #getLocalPort getLocalPort}.
* <p> * <p>
* The maximum queue length for incoming connection indications (a * The maximum queue length for incoming connection indications (a
* request to connect) is set to <code>50</code>. If a connection * request to connect) is set to {@code 50}. If a connection
* indication arrives when the queue is full, the connection is refused. * indication arrives when the queue is full, the connection is refused.
* <p> * <p>
* If the application has specified a server socket factory, that * If the application has specified a server socket factory, that
* factory's <code>createSocketImpl</code> method is called to create * factory's {@code createSocketImpl} method is called to create
* the actual socket implementation. Otherwise a "plain" socket is created. * the actual socket implementation. Otherwise a "plain" socket is created.
* <p> * <p>
* If there is a security manager, * If there is a security manager,
* its <code>checkListen</code> method is called * its {@code checkListen} method is called
* with the <code>port</code> argument * with the {@code port} argument
* as its argument to ensure the operation is allowed. * as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
* *
* @param port the port number, or <code>0</code> to use a port * @param port the port number, or {@code 0} to use a port
* number that is automatically allocated. * number that is automatically allocated.
* *
* @exception IOException if an I/O error occurs when opening the socket. * @exception IOException if an I/O error occurs when opening the socket.
* @exception SecurityException * @exception SecurityException
* if a security manager exists and its <code>checkListen</code> * if a security manager exists and its {@code checkListen}
* method doesn't allow the operation. * method doesn't allow the operation.
* @exception IllegalArgumentException if the port parameter is outside * @exception IllegalArgumentException if the port parameter is outside
* the specified range of valid port values, which is between * the specified range of valid port values, which is between
@ -131,42 +131,42 @@ class ServerSocket implements java.io.Closeable {
/** /**
* Creates a server socket and binds it to the specified local port * Creates a server socket and binds it to the specified local port
* number, with the specified backlog. * number, with the specified backlog.
* A port number of <code>0</code> means that the port number is * A port number of {@code 0} means that the port number is
* automatically allocated, typically from an ephemeral port range. * automatically allocated, typically from an ephemeral port range.
* This port number can then be retrieved by calling * This port number can then be retrieved by calling
* {@link #getLocalPort getLocalPort}. * {@link #getLocalPort getLocalPort}.
* <p> * <p>
* The maximum queue length for incoming connection indications (a * The maximum queue length for incoming connection indications (a
* request to connect) is set to the <code>backlog</code> parameter. If * request to connect) is set to the {@code backlog} parameter. If
* a connection indication arrives when the queue is full, the * a connection indication arrives when the queue is full, the
* connection is refused. * connection is refused.
* <p> * <p>
* If the application has specified a server socket factory, that * If the application has specified a server socket factory, that
* factory's <code>createSocketImpl</code> method is called to create * factory's {@code createSocketImpl} method is called to create
* the actual socket implementation. Otherwise a "plain" socket is created. * the actual socket implementation. Otherwise a "plain" socket is created.
* <p> * <p>
* If there is a security manager, * If there is a security manager,
* its <code>checkListen</code> method is called * its {@code checkListen} method is called
* with the <code>port</code> argument * with the {@code port} argument
* as its argument to ensure the operation is allowed. * as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
* The <code>backlog</code> argument is the requested maximum number of * The {@code backlog} argument is the requested maximum number of
* pending connections on the socket. Its exact semantics are implementation * pending connections on the socket. Its exact semantics are implementation
* specific. In particular, an implementation may impose a maximum length * specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided * or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to * should be greater than {@code 0}. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used. * {@code 0}, then an implementation specific default will be used.
* <P> * <P>
* *
* @param port the port number, or <code>0</code> to use a port * @param port the port number, or {@code 0} to use a port
* number that is automatically allocated. * number that is automatically allocated.
* @param backlog requested maximum length of the queue of incoming * @param backlog requested maximum length of the queue of incoming
* connections. * connections.
* *
* @exception IOException if an I/O error occurs when opening the socket. * @exception IOException if an I/O error occurs when opening the socket.
* @exception SecurityException * @exception SecurityException
* if a security manager exists and its <code>checkListen</code> * if a security manager exists and its {@code checkListen}
* method doesn't allow the operation. * method doesn't allow the operation.
* @exception IllegalArgumentException if the port parameter is outside * @exception IllegalArgumentException if the port parameter is outside
* the specified range of valid port values, which is between * the specified range of valid port values, which is between
@ -189,32 +189,32 @@ class ServerSocket implements java.io.Closeable {
* If <i>bindAddr</i> is null, it will default accepting * If <i>bindAddr</i> is null, it will default accepting
* connections on any/all local addresses. * connections on any/all local addresses.
* The port must be between 0 and 65535, inclusive. * The port must be between 0 and 65535, inclusive.
* A port number of <code>0</code> means that the port number is * A port number of {@code 0} means that the port number is
* automatically allocated, typically from an ephemeral port range. * automatically allocated, typically from an ephemeral port range.
* This port number can then be retrieved by calling * This port number can then be retrieved by calling
* {@link #getLocalPort getLocalPort}. * {@link #getLocalPort getLocalPort}.
* *
* <P>If there is a security manager, this method * <P>If there is a security manager, this method
* calls its <code>checkListen</code> method * calls its {@code checkListen} method
* with the <code>port</code> argument * with the {@code port} argument
* as its argument to ensure the operation is allowed. * as its argument to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
* The <code>backlog</code> argument is the requested maximum number of * The {@code backlog} argument is the requested maximum number of
* pending connections on the socket. Its exact semantics are implementation * pending connections on the socket. Its exact semantics are implementation
* specific. In particular, an implementation may impose a maximum length * specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided * or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to * should be greater than {@code 0}. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used. * {@code 0}, then an implementation specific default will be used.
* <P> * <P>
* @param port the port number, or <code>0</code> to use a port * @param port the port number, or {@code 0} to use a port
* number that is automatically allocated. * number that is automatically allocated.
* @param backlog requested maximum length of the queue of incoming * @param backlog requested maximum length of the queue of incoming
* connections. * connections.
* @param bindAddr the local InetAddress the server will bind to * @param bindAddr the local InetAddress the server will bind to
* *
* @throws SecurityException if a security manager exists and * @throws SecurityException if a security manager exists and
* its <code>checkListen</code> method doesn't allow the operation. * its {@code checkListen} method doesn't allow the operation.
* *
* @throws IOException if an I/O error occurs when opening the socket. * @throws IOException if an I/O error occurs when opening the socket.
* @exception IllegalArgumentException if the port parameter is outside * @exception IllegalArgumentException if the port parameter is outside
@ -245,10 +245,10 @@ class ServerSocket implements java.io.Closeable {
} }
/** /**
* Get the <code>SocketImpl</code> attached to this socket, creating * Get the {@code SocketImpl} attached to this socket, creating
* it if necessary. * it if necessary.
* *
* @return the <code>SocketImpl</code> attached to that ServerSocket. * @return the {@code SocketImpl} attached to that ServerSocket.
* @throws SocketException if creation fails. * @throws SocketException if creation fails.
* @since 1.4 * @since 1.4
*/ */
@ -310,17 +310,17 @@ class ServerSocket implements java.io.Closeable {
/** /**
* *
* Binds the <code>ServerSocket</code> to a specific address * Binds the {@code ServerSocket} to a specific address
* (IP address and port number). * (IP address and port number).
* <p> * <p>
* If the address is <code>null</code>, then the system will pick up * If the address is {@code null}, then the system will pick up
* an ephemeral port and a valid local address to bind the socket. * an ephemeral port and a valid local address to bind the socket.
* <p> * <p>
* @param endpoint The IP address and port number to bind to. * @param endpoint The IP address and port number to bind to.
* @throws IOException if the bind operation fails, or if the socket * @throws IOException if the bind operation fails, or if the socket
* is already bound. * is already bound.
* @throws SecurityException if a <code>SecurityManager</code> is present and * @throws SecurityException if a {@code SecurityManager} is present and
* its <code>checkListen</code> method doesn't allow the operation. * its {@code checkListen} method doesn't allow the operation.
* @throws IllegalArgumentException if endpoint is a * @throws IllegalArgumentException if endpoint is a
* SocketAddress subclass not supported by this socket * SocketAddress subclass not supported by this socket
* @since 1.4 * @since 1.4
@ -331,25 +331,25 @@ class ServerSocket implements java.io.Closeable {
/** /**
* *
* Binds the <code>ServerSocket</code> to a specific address * Binds the {@code ServerSocket} to a specific address
* (IP address and port number). * (IP address and port number).
* <p> * <p>
* If the address is <code>null</code>, then the system will pick up * If the address is {@code null}, then the system will pick up
* an ephemeral port and a valid local address to bind the socket. * an ephemeral port and a valid local address to bind the socket.
* <P> * <P>
* The <code>backlog</code> argument is the requested maximum number of * The {@code backlog} argument is the requested maximum number of
* pending connections on the socket. Its exact semantics are implementation * pending connections on the socket. Its exact semantics are implementation
* specific. In particular, an implementation may impose a maximum length * specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided * or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to * should be greater than {@code 0}. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used. * {@code 0}, then an implementation specific default will be used.
* @param endpoint The IP address and port number to bind to. * @param endpoint The IP address and port number to bind to.
* @param backlog requested maximum length of the queue of * @param backlog requested maximum length of the queue of
* incoming connections. * incoming connections.
* @throws IOException if the bind operation fails, or if the socket * @throws IOException if the bind operation fails, or if the socket
* is already bound. * is already bound.
* @throws SecurityException if a <code>SecurityManager</code> is present and * @throws SecurityException if a {@code SecurityManager} is present and
* its <code>checkListen</code> method doesn't allow the operation. * its {@code checkListen} method doesn't allow the operation.
* @throws IllegalArgumentException if endpoint is a * @throws IllegalArgumentException if endpoint is a
* SocketAddress subclass not supported by this socket * SocketAddress subclass not supported by this socket
* @since 1.4 * @since 1.4
@ -480,18 +480,18 @@ class ServerSocket implements java.io.Closeable {
* Listens for a connection to be made to this socket and accepts * Listens for a connection to be made to this socket and accepts
* it. The method blocks until a connection is made. * it. The method blocks until a connection is made.
* *
* <p>A new Socket <code>s</code> is created and, if there * <p>A new Socket {@code s} is created and, if there
* is a security manager, * is a security manager,
* the security manager's <code>checkAccept</code> method is called * the security manager's {@code checkAccept} method is called
* with <code>s.getInetAddress().getHostAddress()</code> and * with {@code s.getInetAddress().getHostAddress()} and
* <code>s.getPort()</code> * {@code s.getPort()}
* as its arguments to ensure the operation is allowed. * as its arguments to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
* @exception IOException if an I/O error occurs when waiting for a * @exception IOException if an I/O error occurs when waiting for a
* connection. * connection.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkAccept</code> method doesn't allow the operation. * {@code checkAccept} method doesn't allow the operation.
* @exception SocketTimeoutException if a timeout was previously set with setSoTimeout and * @exception SocketTimeoutException if a timeout was previously set with setSoTimeout and
* the timeout has been reached. * the timeout has been reached.
* @exception java.nio.channels.IllegalBlockingModeException * @exception java.nio.channels.IllegalBlockingModeException
@ -597,7 +597,7 @@ class ServerSocket implements java.io.Closeable {
* method. * method.
* *
* @return the server-socket channel associated with this socket, * @return the server-socket channel associated with this socket,
* or <tt>null</tt> if this socket was not created * or {@code null} if this socket was not created
* for a channel * for a channel
* *
* @since 1.4 * @since 1.4
@ -678,18 +678,18 @@ class ServerSocket implements java.io.Closeable {
* <p> * <p>
* When a TCP connection is closed the connection may remain * When a TCP connection is closed the connection may remain
* in a timeout state for a period of time after the connection * in a timeout state for a period of time after the connection
* is closed (typically known as the <tt>TIME_WAIT</tt> state * is closed (typically known as the {@code TIME_WAIT} state
* or <tt>2MSL</tt> wait state). * or {@code 2MSL} wait state).
* For applications using a well known socket address or port * For applications using a well known socket address or port
* it may not be possible to bind a socket to the required * it may not be possible to bind a socket to the required
* <tt>SocketAddress</tt> if there is a connection in the * {@code SocketAddress} if there is a connection in the
* timeout state involving the socket address or port. * timeout state involving the socket address or port.
* <p> * <p>
* Enabling {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} prior to * Enabling {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} prior to
* binding the socket using {@link #bind(SocketAddress)} allows the socket * binding the socket using {@link #bind(SocketAddress)} allows the socket
* to be bound even though a previous connection is in a timeout state. * to be bound even though a previous connection is in a timeout state.
* <p> * <p>
* When a <tt>ServerSocket</tt> is created the initial setting * When a {@code ServerSocket} is created the initial setting
* of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is not defined. * of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is not defined.
* Applications can use {@link #getReuseAddress()} to determine the initial * Applications can use {@link #getReuseAddress()} to determine the initial
* setting of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR}. * setting of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR}.
@ -717,7 +717,7 @@ class ServerSocket implements java.io.Closeable {
/** /**
* Tests if {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled. * Tests if {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
* *
* @return a <code>boolean</code> indicating whether or not * @return a {@code boolean} indicating whether or not
* {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled. * {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as a TCP error. * in the underlying protocol, such as a TCP error.
@ -732,7 +732,7 @@ class ServerSocket implements java.io.Closeable {
/** /**
* Returns the implementation address and implementation port of * Returns the implementation address and implementation port of
* this socket as a <code>String</code>. * this socket as a {@code String}.
* <p> * <p>
* If there is a security manager set, its {@code checkConnect} method is * If there is a security manager set, its {@code checkConnect} method is
* called with the local address and {@code -1} as its arguments to see * called with the local address and {@code -1} as its arguments to see
@ -773,14 +773,14 @@ class ServerSocket implements java.io.Closeable {
* application. The factory can be specified only once. * application. The factory can be specified only once.
* <p> * <p>
* When an application creates a new server socket, the socket * When an application creates a new server socket, the socket
* implementation factory's <code>createSocketImpl</code> method is * implementation factory's {@code createSocketImpl} method is
* called to create the actual socket implementation. * called to create the actual socket implementation.
* <p> * <p>
* Passing <code>null</code> to the method is a no-op unless the factory * Passing {@code null} to the method is a no-op unless the factory
* was already set. * was already set.
* <p> * <p>
* If there is a security manager, this method first calls * If there is a security manager, this method first calls
* the security manager's <code>checkSetFactory</code> method * the security manager's {@code checkSetFactory} method
* to ensure the operation is allowed. * to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
@ -789,7 +789,7 @@ class ServerSocket implements java.io.Closeable {
* socket factory. * socket factory.
* @exception SocketException if the factory has already been defined. * @exception SocketException if the factory has already been defined.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkSetFactory</code> method doesn't allow the operation. * {@code checkSetFactory} method doesn't allow the operation.
* @see java.net.SocketImplFactory#createSocketImpl() * @see java.net.SocketImplFactory#createSocketImpl()
* @see SecurityManager#checkSetFactory * @see SecurityManager#checkSetFactory
*/ */
@ -807,7 +807,7 @@ class ServerSocket implements java.io.Closeable {
/** /**
* Sets a default proposed value for the * Sets a default proposed value for the
* {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option for sockets * {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option for sockets
* accepted from this <tt>ServerSocket</tt>. The value actually set * accepted from this {@code ServerSocket}. The value actually set
* in the accepted socket must be determined by calling * in the accepted socket must be determined by calling
* {@link Socket#getReceiveBufferSize()} after the socket * {@link Socket#getReceiveBufferSize()} after the socket
* is returned by {@link #accept()}. * is returned by {@link #accept()}.
@ -851,13 +851,13 @@ class ServerSocket implements java.io.Closeable {
/** /**
* Gets the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option * Gets the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option
* for this <tt>ServerSocket</tt>, that is the proposed buffer size that * for this {@code ServerSocket}, that is the proposed buffer size that
* will be used for Sockets accepted from this <tt>ServerSocket</tt>. * will be used for Sockets accepted from this {@code ServerSocket}.
* *
* <p>Note, the value actually set in the accepted socket is determined by * <p>Note, the value actually set in the accepted socket is determined by
* calling {@link Socket#getReceiveBufferSize()}. * calling {@link Socket#getReceiveBufferSize()}.
* @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} * @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF}
* option for this <tt>Socket</tt>. * option for this {@code Socket}.
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as a TCP error. * in the underlying protocol, such as a TCP error.
* @see #setReceiveBufferSize(int) * @see #setReceiveBufferSize(int)
@ -891,24 +891,24 @@ class ServerSocket implements java.io.Closeable {
* compared, with larger values indicating stronger preferences. If the * compared, with larger values indicating stronger preferences. If the
* application prefers short connection time over both low latency and high * application prefers short connection time over both low latency and high
* bandwidth, for example, then it could invoke this method with the values * bandwidth, for example, then it could invoke this method with the values
* <tt>(1, 0, 0)</tt>. If the application prefers high bandwidth above low * {@code (1, 0, 0)}. If the application prefers high bandwidth above low
* latency, and low latency above short connection time, then it could * latency, and low latency above short connection time, then it could
* invoke this method with the values <tt>(0, 1, 2)</tt>. * invoke this method with the values {@code (0, 1, 2)}.
* *
* <p> Invoking this method after this socket has been bound * <p> Invoking this method after this socket has been bound
* will have no effect. This implies that in order to use this capability * will have no effect. This implies that in order to use this capability
* requires the socket to be created with the no-argument constructor. * requires the socket to be created with the no-argument constructor.
* *
* @param connectionTime * @param connectionTime
* An <tt>int</tt> expressing the relative importance of a short * An {@code int} expressing the relative importance of a short
* connection time * connection time
* *
* @param latency * @param latency
* An <tt>int</tt> expressing the relative importance of low * An {@code int} expressing the relative importance of low
* latency * latency
* *
* @param bandwidth * @param bandwidth
* An <tt>int</tt> expressing the relative importance of high * An {@code int} expressing the relative importance of high
* bandwidth * bandwidth
* *
* @since 1.5 * @since 1.5

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -39,7 +39,7 @@ import java.security.PrivilegedAction;
* between two machines. * between two machines.
* <p> * <p>
* The actual work of the socket is performed by an instance of the * The actual work of the socket is performed by an instance of the
* <code>SocketImpl</code> class. An application, by changing * {@code SocketImpl} class. An application, by changing
* the socket factory that creates the socket implementation, * the socket factory that creates the socket implementation,
* can configure itself to create sockets appropriate to the local * can configure itself to create sockets appropriate to the local
* firewall. * firewall.
@ -88,14 +88,14 @@ class Socket implements java.io.Closeable {
* Creates an unconnected socket, specifying the type of proxy, if any, * Creates an unconnected socket, specifying the type of proxy, if any,
* that should be used regardless of any other settings. * that should be used regardless of any other settings.
* <P> * <P>
* If there is a security manager, its <code>checkConnect</code> method * If there is a security manager, its {@code checkConnect} method
* is called with the proxy host address and port number * is called with the proxy host address and port number
* as its arguments. This could result in a SecurityException. * as its arguments. This could result in a SecurityException.
* <P> * <P>
* Examples: * Examples:
* <UL> <LI><code>Socket s = new Socket(Proxy.NO_PROXY);</code> will create * <UL> <LI>{@code Socket s = new Socket(Proxy.NO_PROXY);} will create
* a plain socket ignoring any other proxy configuration.</LI> * a plain socket ignoring any other proxy configuration.</LI>
* <LI><code>Socket s = new Socket(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("socks.mydom.com", 1080)));</code> * <LI>{@code Socket s = new Socket(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("socks.mydom.com", 1080)));}
* will create a socket connecting through the specified SOCKS proxy * will create a socket connecting through the specified SOCKS proxy
* server.</LI> * server.</LI>
* </UL> * </UL>
@ -103,7 +103,7 @@ class Socket implements java.io.Closeable {
* @param proxy a {@link java.net.Proxy Proxy} object specifying what kind * @param proxy a {@link java.net.Proxy Proxy} object specifying what kind
* of proxying should be used. * of proxying should be used.
* @throws IllegalArgumentException if the proxy is of an invalid type * @throws IllegalArgumentException if the proxy is of an invalid type
* or <code>null</code>. * or {@code null}.
* @throws SecurityException if a security manager is present and * @throws SecurityException if a security manager is present and
* permission to connect to the proxy is * permission to connect to the proxy is
* denied. * denied.
@ -173,21 +173,22 @@ class Socket implements java.io.Closeable {
* Creates a stream socket and connects it to the specified port * Creates a stream socket and connects it to the specified port
* number on the named host. * number on the named host.
* <p> * <p>
* If the specified host is <tt>null</tt> it is the equivalent of * If the specified host is {@code null} it is the equivalent of
* specifying the address as <tt>{@link java.net.InetAddress#getByName InetAddress.getByName}(null)</tt>. * specifying the address as
* {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}.
* In other words, it is equivalent to specifying an address of the * In other words, it is equivalent to specifying an address of the
* loopback interface. </p> * loopback interface. </p>
* <p> * <p>
* If the application has specified a server socket factory, that * If the application has specified a server socket factory, that
* factory's <code>createSocketImpl</code> method is called to create * factory's {@code createSocketImpl} method is called to create
* the actual socket implementation. Otherwise a "plain" socket is created. * the actual socket implementation. Otherwise a "plain" socket is created.
* <p> * <p>
* If there is a security manager, its * If there is a security manager, its
* <code>checkConnect</code> method is called * {@code checkConnect} method is called
* with the host address and <code>port</code> * with the host address and {@code port}
* as its arguments. This could result in a SecurityException. * as its arguments. This could result in a SecurityException.
* *
* @param host the host name, or <code>null</code> for the loopback address. * @param host the host name, or {@code null} for the loopback address.
* @param port the port number. * @param port the port number.
* *
* @exception UnknownHostException if the IP address of * @exception UnknownHostException if the IP address of
@ -195,7 +196,7 @@ class Socket implements java.io.Closeable {
* *
* @exception IOException if an I/O error occurs when creating the socket. * @exception IOException if an I/O error occurs when creating the socket.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkConnect</code> method doesn't allow the operation. * {@code checkConnect} method doesn't allow the operation.
* @exception IllegalArgumentException if the port parameter is outside * @exception IllegalArgumentException if the port parameter is outside
* the specified range of valid port values, which is between * the specified range of valid port values, which is between
* 0 and 65535, inclusive. * 0 and 65535, inclusive.
@ -217,23 +218,23 @@ class Socket implements java.io.Closeable {
* number at the specified IP address. * number at the specified IP address.
* <p> * <p>
* If the application has specified a socket factory, that factory's * If the application has specified a socket factory, that factory's
* <code>createSocketImpl</code> method is called to create the * {@code createSocketImpl} method is called to create the
* actual socket implementation. Otherwise a "plain" socket is created. * actual socket implementation. Otherwise a "plain" socket is created.
* <p> * <p>
* If there is a security manager, its * If there is a security manager, its
* <code>checkConnect</code> method is called * {@code checkConnect} method is called
* with the host address and <code>port</code> * with the host address and {@code port}
* as its arguments. This could result in a SecurityException. * as its arguments. This could result in a SecurityException.
* *
* @param address the IP address. * @param address the IP address.
* @param port the port number. * @param port the port number.
* @exception IOException if an I/O error occurs when creating the socket. * @exception IOException if an I/O error occurs when creating the socket.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkConnect</code> method doesn't allow the operation. * {@code checkConnect} method doesn't allow the operation.
* @exception IllegalArgumentException if the port parameter is outside * @exception IllegalArgumentException if the port parameter is outside
* the specified range of valid port values, which is between * the specified range of valid port values, which is between
* 0 and 65535, inclusive. * 0 and 65535, inclusive.
* @exception NullPointerException if <code>address</code> is null. * @exception NullPointerException if {@code address} is null.
* @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory) * @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
* @see java.net.SocketImpl * @see java.net.SocketImpl
* @see java.net.SocketImplFactory#createSocketImpl() * @see java.net.SocketImplFactory#createSocketImpl()
@ -249,28 +250,29 @@ class Socket implements java.io.Closeable {
* the specified remote port. The Socket will also bind() to the local * the specified remote port. The Socket will also bind() to the local
* address and port supplied. * address and port supplied.
* <p> * <p>
* If the specified host is <tt>null</tt> it is the equivalent of * If the specified host is {@code null} it is the equivalent of
* specifying the address as <tt>{@link java.net.InetAddress#getByName InetAddress.getByName}(null)</tt>. * specifying the address as
* {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}.
* In other words, it is equivalent to specifying an address of the * In other words, it is equivalent to specifying an address of the
* loopback interface. </p> * loopback interface. </p>
* <p> * <p>
* A local port number of <code>zero</code> will let the system pick up a * A local port number of {@code zero} will let the system pick up a
* free port in the <code>bind</code> operation.</p> * free port in the {@code bind} operation.</p>
* <p> * <p>
* If there is a security manager, its * If there is a security manager, its
* <code>checkConnect</code> method is called * {@code checkConnect} method is called
* with the host address and <code>port</code> * with the host address and {@code port}
* as its arguments. This could result in a SecurityException. * as its arguments. This could result in a SecurityException.
* *
* @param host the name of the remote host, or <code>null</code> for the loopback address. * @param host the name of the remote host, or {@code null} for the loopback address.
* @param port the remote port * @param port the remote port
* @param localAddr the local address the socket is bound to, or * @param localAddr the local address the socket is bound to, or
* <code>null</code> for the <code>anyLocal</code> address. * {@code null} for the {@code anyLocal} address.
* @param localPort the local port the socket is bound to, or * @param localPort the local port the socket is bound to, or
* <code>zero</code> for a system selected free port. * {@code zero} for a system selected free port.
* @exception IOException if an I/O error occurs when creating the socket. * @exception IOException if an I/O error occurs when creating the socket.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkConnect</code> method doesn't allow the operation. * {@code checkConnect} method doesn't allow the operation.
* @exception IllegalArgumentException if the port parameter or localPort * @exception IllegalArgumentException if the port parameter or localPort
* parameter is outside the specified range of valid port values, * parameter is outside the specified range of valid port values,
* which is between 0 and 65535, inclusive. * which is between 0 and 65535, inclusive.
@ -289,30 +291,31 @@ class Socket implements java.io.Closeable {
* the specified remote port. The Socket will also bind() to the local * the specified remote port. The Socket will also bind() to the local
* address and port supplied. * address and port supplied.
* <p> * <p>
* If the specified local address is <tt>null</tt> it is the equivalent of * If the specified local address is {@code null} it is the equivalent of
* specifying the address as the AnyLocal address (see <tt>{@link java.net.InetAddress#isAnyLocalAddress InetAddress.isAnyLocalAddress}()</tt>). * specifying the address as the AnyLocal address
* (see {@link java.net.InetAddress#isAnyLocalAddress InetAddress.isAnyLocalAddress}{@code ()}).
* <p> * <p>
* A local port number of <code>zero</code> will let the system pick up a * A local port number of {@code zero} will let the system pick up a
* free port in the <code>bind</code> operation.</p> * free port in the {@code bind} operation.</p>
* <p> * <p>
* If there is a security manager, its * If there is a security manager, its
* <code>checkConnect</code> method is called * {@code checkConnect} method is called
* with the host address and <code>port</code> * with the host address and {@code port}
* as its arguments. This could result in a SecurityException. * as its arguments. This could result in a SecurityException.
* *
* @param address the remote address * @param address the remote address
* @param port the remote port * @param port the remote port
* @param localAddr the local address the socket is bound to, or * @param localAddr the local address the socket is bound to, or
* <code>null</code> for the <code>anyLocal</code> address. * {@code null} for the {@code anyLocal} address.
* @param localPort the local port the socket is bound to or * @param localPort the local port the socket is bound to or
* <code>zero</code> for a system selected free port. * {@code zero} for a system selected free port.
* @exception IOException if an I/O error occurs when creating the socket. * @exception IOException if an I/O error occurs when creating the socket.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkConnect</code> method doesn't allow the operation. * {@code checkConnect} method doesn't allow the operation.
* @exception IllegalArgumentException if the port parameter or localPort * @exception IllegalArgumentException if the port parameter or localPort
* parameter is outside the specified range of valid port values, * parameter is outside the specified range of valid port values,
* which is between 0 and 65535, inclusive. * which is between 0 and 65535, inclusive.
* @exception NullPointerException if <code>address</code> is null. * @exception NullPointerException if {@code address} is null.
* @see SecurityManager#checkConnect * @see SecurityManager#checkConnect
* @since JDK1.1 * @since JDK1.1
*/ */
@ -326,33 +329,34 @@ class Socket implements java.io.Closeable {
* Creates a stream socket and connects it to the specified port * Creates a stream socket and connects it to the specified port
* number on the named host. * number on the named host.
* <p> * <p>
* If the specified host is <tt>null</tt> it is the equivalent of * If the specified host is {@code null} it is the equivalent of
* specifying the address as <tt>{@link java.net.InetAddress#getByName InetAddress.getByName}(null)</tt>. * specifying the address as
* {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}.
* In other words, it is equivalent to specifying an address of the * In other words, it is equivalent to specifying an address of the
* loopback interface. </p> * loopback interface. </p>
* <p> * <p>
* If the stream argument is <code>true</code>, this creates a * If the stream argument is {@code true}, this creates a
* stream socket. If the stream argument is <code>false</code>, it * stream socket. If the stream argument is {@code false}, it
* creates a datagram socket. * creates a datagram socket.
* <p> * <p>
* If the application has specified a server socket factory, that * If the application has specified a server socket factory, that
* factory's <code>createSocketImpl</code> method is called to create * factory's {@code createSocketImpl} method is called to create
* the actual socket implementation. Otherwise a "plain" socket is created. * the actual socket implementation. Otherwise a "plain" socket is created.
* <p> * <p>
* If there is a security manager, its * If there is a security manager, its
* <code>checkConnect</code> method is called * {@code checkConnect} method is called
* with the host address and <code>port</code> * with the host address and {@code port}
* as its arguments. This could result in a SecurityException. * as its arguments. This could result in a SecurityException.
* <p> * <p>
* If a UDP socket is used, TCP/IP related socket options will not apply. * If a UDP socket is used, TCP/IP related socket options will not apply.
* *
* @param host the host name, or <code>null</code> for the loopback address. * @param host the host name, or {@code null} for the loopback address.
* @param port the port number. * @param port the port number.
* @param stream a <code>boolean</code> indicating whether this is * @param stream a {@code boolean} indicating whether this is
* a stream socket or a datagram socket. * a stream socket or a datagram socket.
* @exception IOException if an I/O error occurs when creating the socket. * @exception IOException if an I/O error occurs when creating the socket.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkConnect</code> method doesn't allow the operation. * {@code checkConnect} method doesn't allow the operation.
* @exception IllegalArgumentException if the port parameter is outside * @exception IllegalArgumentException if the port parameter is outside
* the specified range of valid port values, which is between * the specified range of valid port values, which is between
* 0 and 65535, inclusive. * 0 and 65535, inclusive.
@ -373,32 +377,32 @@ class Socket implements java.io.Closeable {
* Creates a socket and connects it to the specified port number at * Creates a socket and connects it to the specified port number at
* the specified IP address. * the specified IP address.
* <p> * <p>
* If the stream argument is <code>true</code>, this creates a * If the stream argument is {@code true}, this creates a
* stream socket. If the stream argument is <code>false</code>, it * stream socket. If the stream argument is {@code false}, it
* creates a datagram socket. * creates a datagram socket.
* <p> * <p>
* If the application has specified a server socket factory, that * If the application has specified a server socket factory, that
* factory's <code>createSocketImpl</code> method is called to create * factory's {@code createSocketImpl} method is called to create
* the actual socket implementation. Otherwise a "plain" socket is created. * the actual socket implementation. Otherwise a "plain" socket is created.
* *
* <p>If there is a security manager, its * <p>If there is a security manager, its
* <code>checkConnect</code> method is called * {@code checkConnect} method is called
* with <code>host.getHostAddress()</code> and <code>port</code> * with {@code host.getHostAddress()} and {@code port}
* as its arguments. This could result in a SecurityException. * as its arguments. This could result in a SecurityException.
* <p> * <p>
* If UDP socket is used, TCP/IP related socket options will not apply. * If UDP socket is used, TCP/IP related socket options will not apply.
* *
* @param host the IP address. * @param host the IP address.
* @param port the port number. * @param port the port number.
* @param stream if <code>true</code>, create a stream socket; * @param stream if {@code true}, create a stream socket;
* otherwise, create a datagram socket. * otherwise, create a datagram socket.
* @exception IOException if an I/O error occurs when creating the socket. * @exception IOException if an I/O error occurs when creating the socket.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkConnect</code> method doesn't allow the operation. * {@code checkConnect} method doesn't allow the operation.
* @exception IllegalArgumentException if the port parameter is outside * @exception IllegalArgumentException if the port parameter is outside
* the specified range of valid port values, which is between * the specified range of valid port values, which is between
* 0 and 65535, inclusive. * 0 and 65535, inclusive.
* @exception NullPointerException if <code>host</code> is null. * @exception NullPointerException if {@code host} is null.
* @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory) * @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
* @see java.net.SocketImpl * @see java.net.SocketImpl
* @see java.net.SocketImplFactory#createSocketImpl() * @see java.net.SocketImplFactory#createSocketImpl()
@ -437,8 +441,8 @@ class Socket implements java.io.Closeable {
/** /**
* Creates the socket implementation. * Creates the socket implementation.
* *
* @param stream a <code>boolean</code> value : <code>true</code> for a TCP socket, * @param stream a {@code boolean} value : {@code true} for a TCP socket,
* <code>false</code> for UDP. * {@code false} for UDP.
* @throws IOException if creation fails * @throws IOException if creation fails
* @since 1.4 * @since 1.4
*/ */
@ -500,10 +504,10 @@ class Socket implements java.io.Closeable {
/** /**
* Get the <code>SocketImpl</code> attached to this socket, creating * Get the {@code SocketImpl} attached to this socket, creating
* it if necessary. * it if necessary.
* *
* @return the <code>SocketImpl</code> attached to that ServerSocket. * @return the {@code SocketImpl} attached to that ServerSocket.
* @throws SocketException if creation fails * @throws SocketException if creation fails
* @since 1.4 * @since 1.4
*/ */
@ -516,7 +520,7 @@ class Socket implements java.io.Closeable {
/** /**
* Connects this socket to the server. * Connects this socket to the server.
* *
* @param endpoint the <code>SocketAddress</code> * @param endpoint the {@code SocketAddress}
* @throws IOException if an error occurs during the connection * @throws IOException if an error occurs during the connection
* @throws java.nio.channels.IllegalBlockingModeException * @throws java.nio.channels.IllegalBlockingModeException
* if this socket has an associated channel, * if this socket has an associated channel,
@ -535,7 +539,7 @@ class Socket implements java.io.Closeable {
* A timeout of zero is interpreted as an infinite timeout. The connection * A timeout of zero is interpreted as an infinite timeout. The connection
* will then block until established or an error occurs. * will then block until established or an error occurs.
* *
* @param endpoint the <code>SocketAddress</code> * @param endpoint the {@code SocketAddress}
* @param timeout the timeout value to be used in milliseconds. * @param timeout the timeout value to be used in milliseconds.
* @throws IOException if an error occurs during the connection * @throws IOException if an error occurs during the connection
* @throws SocketTimeoutException if timeout expires before connecting * @throws SocketTimeoutException if timeout expires before connecting
@ -597,10 +601,10 @@ class Socket implements java.io.Closeable {
/** /**
* Binds the socket to a local address. * Binds the socket to a local address.
* <P> * <P>
* If the address is <code>null</code>, then the system will pick up * If the address is {@code null}, then the system will pick up
* an ephemeral port and a valid local address to bind the socket. * an ephemeral port and a valid local address to bind the socket.
* *
* @param bindpoint the <code>SocketAddress</code> to bind to * @param bindpoint the {@code SocketAddress} to bind to
* @throws IOException if the bind operation fails, or if the socket * @throws IOException if the bind operation fails, or if the socket
* is already bound. * is already bound.
* @throws IllegalArgumentException if bindpoint is a * @throws IllegalArgumentException if bindpoint is a
@ -668,7 +672,7 @@ class Socket implements java.io.Closeable {
* after the socket is closed. * after the socket is closed.
* *
* @return the remote IP address to which this socket is connected, * @return the remote IP address to which this socket is connected,
* or <code>null</code> if the socket is not connected. * or {@code null} if the socket is not connected.
*/ */
public InetAddress getInetAddress() { public InetAddress getInetAddress() {
if (!isConnected()) if (!isConnected())
@ -760,15 +764,15 @@ class Socket implements java.io.Closeable {
/** /**
* Returns the address of the endpoint this socket is connected to, or * Returns the address of the endpoint this socket is connected to, or
* <code>null</code> if it is unconnected. * {@code null} if it is unconnected.
* <p> * <p>
* If the socket was connected prior to being {@link #close closed}, * If the socket was connected prior to being {@link #close closed},
* then this method will continue to return the connected address * then this method will continue to return the connected address
* after the socket is closed. * after the socket is closed.
* *
* @return a <code>SocketAddress</code> representing the remote endpoint of this * @return a {@code SocketAddress} representing the remote endpoint of this
* socket, or <code>null</code> if it is not connected yet. * socket, or {@code null} if it is not connected yet.
* @see #getInetAddress() * @see #getInetAddress()
* @see #getPort() * @see #getPort()
* @see #connect(SocketAddress, int) * @see #connect(SocketAddress, int)
@ -785,10 +789,10 @@ class Socket implements java.io.Closeable {
* Returns the address of the endpoint this socket is bound to. * Returns the address of the endpoint this socket is bound to.
* <p> * <p>
* If a socket bound to an endpoint represented by an * If a socket bound to an endpoint represented by an
* <code>InetSocketAddress </code> is {@link #close closed}, * {@code InetSocketAddress } is {@link #close closed},
* then this method will continue to return an <code>InetSocketAddress</code> * then this method will continue to return an {@code InetSocketAddress}
* after the socket is closed. In that case the returned * after the socket is closed. In that case the returned
* <code>InetSocketAddress</code>'s address is the * {@code InetSocketAddress}'s address is the
* {@link InetAddress#isAnyLocalAddress wildcard} address * {@link InetAddress#isAnyLocalAddress wildcard} address
* and its port is the local port that it was bound to. * and its port is the local port that it was bound to.
* <p> * <p>
@ -828,7 +832,7 @@ class Socket implements java.io.Closeable {
* methods. * methods.
* *
* @return the socket channel associated with this socket, * @return the socket channel associated with this socket,
* or <tt>null</tt> if this socket was not created * or {@code null} if this socket was not created
* for a channel * for a channel
* *
* @since 1.4 * @since 1.4
@ -843,7 +847,7 @@ class Socket implements java.io.Closeable {
* *
* <p> If this socket has an associated channel then the resulting input * <p> If this socket has an associated channel then the resulting input
* stream delegates all of its operations to the channel. If the channel * stream delegates all of its operations to the channel. If the channel
* is in non-blocking mode then the input stream's <tt>read</tt> operations * is in non-blocking mode then the input stream's {@code read} operations
* will throw an {@link java.nio.channels.IllegalBlockingModeException}. * will throw an {@link java.nio.channels.IllegalBlockingModeException}.
* *
* <p>Under abnormal conditions the underlying connection may be * <p>Under abnormal conditions the underlying connection may be
@ -867,7 +871,7 @@ class Socket implements java.io.Closeable {
* <li><p>If there are no bytes buffered on the socket, and the * <li><p>If there are no bytes buffered on the socket, and the
* socket has not been closed using {@link #close close}, then * socket has not been closed using {@link #close close}, then
* {@link java.io.InputStream#available available} will * {@link java.io.InputStream#available available} will
* return <code>0</code>. * return {@code 0}.
* *
* </ul> * </ul>
* *
@ -910,7 +914,7 @@ class Socket implements java.io.Closeable {
* *
* <p> If this socket has an associated channel then the resulting output * <p> If this socket has an associated channel then the resulting output
* stream delegates all of its operations to the channel. If the channel * stream delegates all of its operations to the channel. If the channel
* is in non-blocking mode then the output stream's <tt>write</tt> * is in non-blocking mode then the output stream's {@code write}
* operations will throw an {@link * operations will throw an {@link
* java.nio.channels.IllegalBlockingModeException}. * java.nio.channels.IllegalBlockingModeException}.
* *
@ -949,8 +953,8 @@ class Socket implements java.io.Closeable {
* Enable/disable {@link SocketOptions#TCP_NODELAY TCP_NODELAY} * Enable/disable {@link SocketOptions#TCP_NODELAY TCP_NODELAY}
* (disable/enable Nagle's algorithm). * (disable/enable Nagle's algorithm).
* *
* @param on <code>true</code> to enable TCP_NODELAY, * @param on {@code true} to enable TCP_NODELAY,
* <code>false</code> to disable. * {@code false} to disable.
* *
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as a TCP error. * in the underlying protocol, such as a TCP error.
@ -968,7 +972,7 @@ class Socket implements java.io.Closeable {
/** /**
* Tests if {@link SocketOptions#TCP_NODELAY TCP_NODELAY} is enabled. * Tests if {@link SocketOptions#TCP_NODELAY TCP_NODELAY} is enabled.
* *
* @return a <code>boolean</code> indicating whether or not * @return a {@code boolean} indicating whether or not
* {@link SocketOptions#TCP_NODELAY TCP_NODELAY} is enabled. * {@link SocketOptions#TCP_NODELAY TCP_NODELAY} is enabled.
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as a TCP error. * in the underlying protocol, such as a TCP error.
@ -1066,9 +1070,9 @@ class Socket implements java.io.Closeable {
* and there is no capability to distinguish between normal data and urgent * and there is no capability to distinguish between normal data and urgent
* data unless provided by a higher level protocol. * data unless provided by a higher level protocol.
* *
* @param on <code>true</code> to enable * @param on {@code true} to enable
* {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE}, * {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE},
* <code>false</code> to disable. * {@code false} to disable.
* *
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as a TCP error. * in the underlying protocol, such as a TCP error.
@ -1086,7 +1090,7 @@ class Socket implements java.io.Closeable {
/** /**
* Tests if {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE} is enabled. * Tests if {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE} is enabled.
* *
* @return a <code>boolean</code> indicating whether or not * @return a {@code boolean} indicating whether or not
* {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE}is enabled. * {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE}is enabled.
* *
* @exception SocketException if there is an error * @exception SocketException if there is an error
@ -1151,7 +1155,7 @@ class Socket implements java.io.Closeable {
/** /**
* Sets the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option to the * Sets the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option to the
* specified value for this <tt>Socket</tt>. * specified value for this {@code Socket}.
* The {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option is used by the * The {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option is used by the
* platform's networking code as a hint for the size to set the underlying * platform's networking code as a hint for the size to set the underlying
* network I/O buffers. * network I/O buffers.
@ -1184,10 +1188,10 @@ class Socket implements java.io.Closeable {
/** /**
* Get value of the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option * Get value of the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option
* for this <tt>Socket</tt>, that is the buffer size used by the platform * for this {@code Socket}, that is the buffer size used by the platform
* for output on this <tt>Socket</tt>. * for output on this {@code Socket}.
* @return the value of the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} * @return the value of the {@link SocketOptions#SO_SNDBUF SO_SNDBUF}
* option for this <tt>Socket</tt>. * option for this {@code Socket}.
* *
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as a TCP error. * in the underlying protocol, such as a TCP error.
@ -1208,7 +1212,7 @@ class Socket implements java.io.Closeable {
/** /**
* Sets the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option to the * Sets the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option to the
* specified value for this <tt>Socket</tt>. The * specified value for this {@code Socket}. The
* {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option is * {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option is
* used by the platform's networking code as a hint for the size to set * used by the platform's networking code as a hint for the size to set
* the underlying network I/O buffers. * the underlying network I/O buffers.
@ -1258,11 +1262,11 @@ class Socket implements java.io.Closeable {
/** /**
* Gets the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option * Gets the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option
* for this <tt>Socket</tt>, that is the buffer size used by the platform * for this {@code Socket}, that is the buffer size used by the platform
* for input on this <tt>Socket</tt>. * for input on this {@code Socket}.
* *
* @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} * @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF}
* option for this <tt>Socket</tt>. * option for this {@code Socket}.
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as a TCP error. * in the underlying protocol, such as a TCP error.
* @see #setReceiveBufferSize(int) * @see #setReceiveBufferSize(int)
@ -1298,7 +1302,7 @@ class Socket implements java.io.Closeable {
/** /**
* Tests if {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE} is enabled. * Tests if {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE} is enabled.
* *
* @return a <code>boolean</code> indicating whether or not * @return a {@code boolean} indicating whether or not
* {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE} is enabled. * {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE} is enabled.
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as a TCP error. * in the underlying protocol, such as a TCP error.
@ -1321,7 +1325,7 @@ class Socket implements java.io.Closeable {
* 255} or an IllegalArgumentException will be thrown. * 255} or an IllegalArgumentException will be thrown.
* <p>Notes: * <p>Notes:
* <p>For Internet Protocol v4 the value consists of an * <p>For Internet Protocol v4 the value consists of an
* <code>integer</code>, the least significant 8 bits of which * {@code integer}, the least significant 8 bits of which
* represent the value of the TOS octet in IP packets sent by * represent the value of the TOS octet in IP packets sent by
* the socket. * the socket.
* RFC 1349 defines the TOS values as follows: * RFC 1349 defines the TOS values as follows:
@ -1347,10 +1351,10 @@ class Socket implements java.io.Closeable {
* in the underlying platform. Applications should not assume that * in the underlying platform. Applications should not assume that
* they can change the TOS field after the connection. * they can change the TOS field after the connection.
* <p> * <p>
* For Internet Protocol v6 <code>tc</code> is the value that * For Internet Protocol v6 {@code tc} is the value that
* would be placed into the sin6_flowinfo field of the IP header. * would be placed into the sin6_flowinfo field of the IP header.
* *
* @param tc an <code>int</code> value for the bitset. * @param tc an {@code int} value for the bitset.
* @throws SocketException if there is an error setting the * @throws SocketException if there is an error setting the
* traffic class or type-of-service * traffic class or type-of-service
* @since 1.4 * @since 1.4
@ -1392,11 +1396,11 @@ class Socket implements java.io.Closeable {
* <p> * <p>
* When a TCP connection is closed the connection may remain * When a TCP connection is closed the connection may remain
* in a timeout state for a period of time after the connection * in a timeout state for a period of time after the connection
* is closed (typically known as the <tt>TIME_WAIT</tt> state * is closed (typically known as the {@code TIME_WAIT} state
* or <tt>2MSL</tt> wait state). * or {@code 2MSL} wait state).
* For applications using a well known socket address or port * For applications using a well known socket address or port
* it may not be possible to bind a socket to the required * it may not be possible to bind a socket to the required
* <tt>SocketAddress</tt> if there is a connection in the * {@code SocketAddress} if there is a connection in the
* timeout state involving the socket address or port. * timeout state involving the socket address or port.
* <p> * <p>
* Enabling {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} * Enabling {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR}
@ -1404,7 +1408,7 @@ class Socket implements java.io.Closeable {
* the socket to be bound even though a previous connection is in a timeout * the socket to be bound even though a previous connection is in a timeout
* state. * state.
* <p> * <p>
* When a <tt>Socket</tt> is created the initial setting * When a {@code Socket} is created the initial setting
* of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is disabled. * of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is disabled.
* <p> * <p>
* The behaviour when {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is * The behaviour when {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is
@ -1430,7 +1434,7 @@ class Socket implements java.io.Closeable {
/** /**
* Tests if {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled. * Tests if {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
* *
* @return a <code>boolean</code> indicating whether or not * @return a {@code boolean} indicating whether or not
* {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled. * {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
* @exception SocketException if there is an error * @exception SocketException if there is an error
* in the underlying protocol, such as a TCP error. * in the underlying protocol, such as a TCP error.
@ -1536,7 +1540,7 @@ class Socket implements java.io.Closeable {
} }
/** /**
* Converts this socket to a <code>String</code>. * Converts this socket to a {@code String}.
* *
* @return a string representation of this socket. * @return a string representation of this socket.
*/ */
@ -1555,7 +1559,7 @@ class Socket implements java.io.Closeable {
* Returns the connection state of the socket. * Returns the connection state of the socket.
* <p> * <p>
* Note: Closing a socket doesn't clear its connection state, which means * Note: Closing a socket doesn't clear its connection state, which means
* this method will return <code>true</code> for a closed socket * this method will return {@code true} for a closed socket
* (see {@link #isClosed()}) if it was successfuly connected prior * (see {@link #isClosed()}) if it was successfuly connected prior
* to being closed. * to being closed.
* *
@ -1571,7 +1575,7 @@ class Socket implements java.io.Closeable {
* Returns the binding state of the socket. * Returns the binding state of the socket.
* <p> * <p>
* Note: Closing a socket doesn't clear its binding state, which means * Note: Closing a socket doesn't clear its binding state, which means
* this method will return <code>true</code> for a closed socket * this method will return {@code true} for a closed socket
* (see {@link #isClosed()}) if it was successfuly bound prior * (see {@link #isClosed()}) if it was successfuly bound prior
* to being closed. * to being closed.
* *
@ -1629,13 +1633,13 @@ class Socket implements java.io.Closeable {
* application. The factory can be specified only once. * application. The factory can be specified only once.
* <p> * <p>
* When an application creates a new client socket, the socket * When an application creates a new client socket, the socket
* implementation factory's <code>createSocketImpl</code> method is * implementation factory's {@code createSocketImpl} method is
* called to create the actual socket implementation. * called to create the actual socket implementation.
* <p> * <p>
* Passing <code>null</code> to the method is a no-op unless the factory * Passing {@code null} to the method is a no-op unless the factory
* was already set. * was already set.
* <p>If there is a security manager, this method first calls * <p>If there is a security manager, this method first calls
* the security manager's <code>checkSetFactory</code> method * the security manager's {@code checkSetFactory} method
* to ensure the operation is allowed. * to ensure the operation is allowed.
* This could result in a SecurityException. * This could result in a SecurityException.
* *
@ -1644,7 +1648,7 @@ class Socket implements java.io.Closeable {
* socket factory. * socket factory.
* @exception SocketException if the factory is already defined. * @exception SocketException if the factory is already defined.
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* <code>checkSetFactory</code> method doesn't allow the operation. * {@code checkSetFactory} method doesn't allow the operation.
* @see java.net.SocketImplFactory#createSocketImpl() * @see java.net.SocketImplFactory#createSocketImpl()
* @see SecurityManager#checkSetFactory * @see SecurityManager#checkSetFactory
*/ */
@ -1678,23 +1682,23 @@ class Socket implements java.io.Closeable {
* values represent a lower priority than positive values. If the * values represent a lower priority than positive values. If the
* application prefers short connection time over both low latency and high * application prefers short connection time over both low latency and high
* bandwidth, for example, then it could invoke this method with the values * bandwidth, for example, then it could invoke this method with the values
* <tt>(1, 0, 0)</tt>. If the application prefers high bandwidth above low * {@code (1, 0, 0)}. If the application prefers high bandwidth above low
* latency, and low latency above short connection time, then it could * latency, and low latency above short connection time, then it could
* invoke this method with the values <tt>(0, 1, 2)</tt>. * invoke this method with the values {@code (0, 1, 2)}.
* *
* <p> Invoking this method after this socket has been connected * <p> Invoking this method after this socket has been connected
* will have no effect. * will have no effect.
* *
* @param connectionTime * @param connectionTime
* An <tt>int</tt> expressing the relative importance of a short * An {@code int} expressing the relative importance of a short
* connection time * connection time
* *
* @param latency * @param latency
* An <tt>int</tt> expressing the relative importance of low * An {@code int} expressing the relative importance of low
* latency * latency
* *
* @param bandwidth * @param bandwidth
* An <tt>int</tt> expressing the relative importance of high * An {@code int} expressing the relative importance of high
* bandwidth * bandwidth
* *
* @since 1.5 * @since 1.5

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,7 @@ class SocketException extends IOException {
private static final long serialVersionUID = -5935874303556886934L; private static final long serialVersionUID = -5935874303556886934L;
/** /**
* Constructs a new <code>SocketException</code> with the * Constructs a new {@code SocketException} with the
* specified detail message. * specified detail message.
* *
* @param msg the detail message. * @param msg the detail message.
@ -48,7 +48,7 @@ class SocketException extends IOException {
} }
/** /**
* Constructs a new <code>SocketException</code> with no detail message. * Constructs a new {@code SocketException} with no detail message.
*/ */
public SocketException() { public SocketException() {
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ import java.io.OutputStream;
import java.io.FileDescriptor; import java.io.FileDescriptor;
/** /**
* The abstract class <code>SocketImpl</code> is a common superclass * The abstract class {@code SocketImpl} is a common superclass
* of all classes that actually implement sockets. It is used to * of all classes that actually implement sockets. It is used to
* create both client and server sockets. * create both client and server sockets.
* <p> * <p>
@ -71,7 +71,7 @@ public abstract class SocketImpl implements SocketOptions {
/** /**
* Creates either a stream or a datagram socket. * Creates either a stream or a datagram socket.
* *
* @param stream if <code>true</code>, create a stream socket; * @param stream if {@code true}, create a stream socket;
* otherwise, create a datagram socket. * otherwise, create a datagram socket.
* @exception IOException if an I/O error occurs while creating the * @exception IOException if an I/O error occurs while creating the
* socket. * socket.
@ -122,7 +122,7 @@ public abstract class SocketImpl implements SocketOptions {
/** /**
* Sets the maximum queue length for incoming connection indications * Sets the maximum queue length for incoming connection indications
* (a request to connect) to the <code>count</code> argument. If a * (a request to connect) to the {@code count} argument. If a
* connection indication arrives when the queue is full, the * connection indication arrives when the queue is full, the
* connection is refused. * connection is refused.
* *
@ -217,9 +217,9 @@ public abstract class SocketImpl implements SocketOptions {
} }
/** /**
* Returns the value of this socket's <code>fd</code> field. * Returns the value of this socket's {@code fd} field.
* *
* @return the value of this socket's <code>fd</code> field. * @return the value of this socket's {@code fd} field.
* @see java.net.SocketImpl#fd * @see java.net.SocketImpl#fd
*/ */
protected FileDescriptor getFileDescriptor() { protected FileDescriptor getFileDescriptor() {
@ -227,9 +227,9 @@ public abstract class SocketImpl implements SocketOptions {
} }
/** /**
* Returns the value of this socket's <code>address</code> field. * Returns the value of this socket's {@code address} field.
* *
* @return the value of this socket's <code>address</code> field. * @return the value of this socket's {@code address} field.
* @see java.net.SocketImpl#address * @see java.net.SocketImpl#address
*/ */
protected InetAddress getInetAddress() { protected InetAddress getInetAddress() {
@ -237,9 +237,9 @@ public abstract class SocketImpl implements SocketOptions {
} }
/** /**
* Returns the value of this socket's <code>port</code> field. * Returns the value of this socket's {@code port} field.
* *
* @return the value of this socket's <code>port</code> field. * @return the value of this socket's {@code port} field.
* @see java.net.SocketImpl#port * @see java.net.SocketImpl#port
*/ */
protected int getPort() { protected int getPort() {
@ -270,9 +270,9 @@ public abstract class SocketImpl implements SocketOptions {
protected abstract void sendUrgentData (int data) throws IOException; protected abstract void sendUrgentData (int data) throws IOException;
/** /**
* Returns the value of this socket's <code>localport</code> field. * Returns the value of this socket's {@code localport} field.
* *
* @return the value of this socket's <code>localport</code> field. * @return the value of this socket's {@code localport} field.
* @see java.net.SocketImpl#localport * @see java.net.SocketImpl#localport
*/ */
protected int getLocalPort() { protected int getLocalPort() {
@ -296,7 +296,7 @@ public abstract class SocketImpl implements SocketOptions {
} }
/** /**
* Returns the address and port of this socket as a <code>String</code>. * Returns the address and port of this socket as a {@code String}.
* *
* @return a string representation of this socket. * @return a string representation of this socket.
*/ */
@ -328,23 +328,23 @@ public abstract class SocketImpl implements SocketOptions {
* values represent a lower priority than positive values. If the * values represent a lower priority than positive values. If the
* application prefers short connection time over both low latency and high * application prefers short connection time over both low latency and high
* bandwidth, for example, then it could invoke this method with the values * bandwidth, for example, then it could invoke this method with the values
* <tt>(1, 0, 0)</tt>. If the application prefers high bandwidth above low * {@code (1, 0, 0)}. If the application prefers high bandwidth above low
* latency, and low latency above short connection time, then it could * latency, and low latency above short connection time, then it could
* invoke this method with the values <tt>(0, 1, 2)</tt>. * invoke this method with the values {@code (0, 1, 2)}.
* *
* By default, this method does nothing, unless it is overridden in a * By default, this method does nothing, unless it is overridden in a
* a sub-class. * a sub-class.
* *
* @param connectionTime * @param connectionTime
* An <tt>int</tt> expressing the relative importance of a short * An {@code int} expressing the relative importance of a short
* connection time * connection time
* *
* @param latency * @param latency
* An <tt>int</tt> expressing the relative importance of low * An {@code int} expressing the relative importance of low
* latency * latency
* *
* @param bandwidth * @param bandwidth
* An <tt>int</tt> expressing the relative importance of high * An {@code int} expressing the relative importance of high
* bandwidth * bandwidth
* *
* @since 1.5 * @since 1.5

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ package java.net;
/** /**
* This interface defines a factory for socket implementations. It * This interface defines a factory for socket implementations. It
* is used by the classes <code>Socket</code> and * is used by the classes {@code Socket} and
* <code>ServerSocket</code> to create actual socket * {@code ServerSocket} to create actual socket
* implementations. * implementations.
* *
* @author Arthur van Hoff * @author Arthur van Hoff
@ -39,9 +39,9 @@ package java.net;
public public
interface SocketImplFactory { interface SocketImplFactory {
/** /**
* Creates a new <code>SocketImpl</code> instance. * Creates a new {@code SocketImpl} instance.
* *
* @return a new instance of <code>SocketImpl</code>. * @return a new instance of {@code SocketImpl}.
* @see java.net.SocketImpl * @see java.net.SocketImpl
*/ */
SocketImpl createSocketImpl(); SocketImpl createSocketImpl();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -67,8 +67,8 @@ class SocketInputStream extends FileInputStream
* Returns the unique {@link java.nio.channels.FileChannel FileChannel} * Returns the unique {@link java.nio.channels.FileChannel FileChannel}
* object associated with this file input stream.</p> * object associated with this file input stream.</p>
* *
* The <code>getChannel</code> method of <code>SocketInputStream</code> * The {@code getChannel} method of {@code SocketInputStream}
* returns <code>null</code> since it is a socket based stream.</p> * returns {@code null} since it is a socket based stream.</p>
* *
* @return the file channel associated with this file input stream * @return the file channel associated with this file input stream
* *

Some files were not shown because too many files have changed in this diff Show More