src/java.base/share/classes/java/lang/Thread.java

Print this page

        

*** 143,153 **** private static native void registerNatives(); static { registerNatives(); } ! private volatile char name[]; private int priority; private Thread threadQ; private long eetop; /* Whether or not to single_step this thread. */ --- 143,153 ---- private static native void registerNatives(); static { registerNatives(); } ! private volatile String name; private int priority; private Thread threadQ; private long eetop; /* Whether or not to single_step this thread. */
*** 364,374 **** long stackSize, AccessControlContext acc) { if (name == null) { throw new NullPointerException("name cannot be null"); } ! this.name = name.toCharArray(); Thread parent = currentThread(); SecurityManager security = System.getSecurityManager(); if (g == null) { /* Determine if it's an applet or not */ --- 364,374 ---- long stackSize, AccessControlContext acc) { if (name == null) { throw new NullPointerException("name cannot be null"); } ! this.name = name; Thread parent = currentThread(); SecurityManager security = System.getSecurityManager(); if (g == null) { /* Determine if it's an applet or not */
*** 1117,1127 **** * @see #getName * @see #checkAccess() */ public final synchronized void setName(String name) { checkAccess(); ! this.name = name.toCharArray(); if (threadStatus != 0) { setNativeName(name); } } --- 1117,1131 ---- * @see #getName * @see #checkAccess() */ public final synchronized void setName(String name) { checkAccess(); ! if (name == null) { ! throw new NullPointerException("name cannot be null"); ! } ! ! this.name = name; if (threadStatus != 0) { setNativeName(name); } }
*** 1130,1140 **** * * @return this thread's name. * @see #setName(String) */ public final String getName() { ! return new String(name, true); } /** * Returns the thread group to which this thread belongs. * This method returns null if this thread has died --- 1134,1144 ---- * * @return this thread's name. * @see #setName(String) */ public final String getName() { ! return name; } /** * Returns the thread group to which this thread belongs. * This method returns null if this thread has died