Security Review Notes
Java strings and threads
String.length() returns the number of UTF-16 code units. yield() tells the scheduler that the current thread is willing to give up the processor. The scheduler decides when to run the thread again.
Waiting, notifying, and sleeping
| Method | Behavior |
|---|---|
| wait() | A thread holding an object's monitor enters its wait set, releases the monitor, and reacquires it before returning. |
| notify() | Wakes one waiter. That thread must acquire the monitor before it can continue. |
| sleep() | Pauses the current thread for a time while it keeps any monitors it already holds. |
HTTP and mobile apps
HTTP 301 indicates a permanent move, and Location can identify the new address. Android broadcast receivers can be declared in the manifest or registered dynamically for a component lifecycle. When shrinking and obfuscating a release build, inspect package size and preserve its mapping file.
Shell parameters
In a shell script, $0 is the script name, $1 is the first argument, $# is the number of arguments, and $? is the previous command's exit status. Use "$@" to preserve the boundaries between arguments.
Service permissions and request freshness
Constrain the network exposure, caller identity, and account privileges of database and cache services. For one-time operations, check expiry and a unique request identifier to avoid accepting a previously valid request again.