...
Code Block | ||
---|---|---|
| ||
public boolean sendPage(Socket socket, String pageName) { // No synchronization Page targetPage = getPage(pageName); if (targetPage == null) return false; return deliverPage(socket, targetPage); } private synchronized Page getPage(String pageName) { // Requires synchronization Page targetPage = null; for (Page p : pageBuff) { if (p.getName().equals(pageName)) { targetPage = p; } } return targetPage; } // Return false if an error occurs, true if successful public boolean deliverPage(Socket socket, Page page) { ObjectOutputStream out = null; boolean result = true; try { // Get the output stream to write the Page to out = new ObjectOutputStream(socket.getOutputStream()); // Send the Page to the client out.writeObject(page); } catch (IOException io) { result = false; } finally { if (out != null) { try { out.flush(); out.close(); } catch (IOException e) { result = false; } } } return result; } |
Exceptions
LCK09-EX1EX0: Classes that provide an appropriate termination mechanism to callers are permitted to violate this rule. See rule THI06-J. Ensure that threads performing blocking operations can be terminated.
LCK09-EX2EX1: Method that require multiple locks may hold several locks while waiting for the remaining locks to become available. This constitutes a valid exception, although the programmer must follow other applicable rules to avoid deadlock. See rule LCK07-J. Avoid deadlock by requesting and releasing locks in the same order for more information.
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
LCK09-J | low | probable | high | P2 | L3 |
Related Vulnerabilities
...
Related Guidelines
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="37bd8142605903a0-c4a417e4-4fd74191-9c4d92d5-146931fe052946d91d05a56d"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. Bibliography#API 06]] | Class | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c0a83fb652e13b05-a0e6bfcd-44494a27-afaebd8e-3269cfb07c5da161a8df7ca7"><ac:plain-text-body><![CDATA[ | [[Grosso 2001 | AA. Bibliography#Grosso 01]] | [Chapter 10: Serialization | http://oreilly.com/catalog/javarmi/chapter/ch10.html] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="efd856bfc7553aa0-66900897-49ff4e03-b5c2b9af-73f60bb77834f1ee86dc5d14"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. Bibliography#JLS 05]] | [Chapter 17, Threads and Locks | http://java.sun.com/docs/books/jls/third_edition/html/memory.html] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="9d34c363442a6cb1-a2aab50d-4e004397-abc7a0a2-2ad8bdc86d03725882088a0d"><ac:plain-text-body><![CDATA[ | [[Rotem 2008 | AA. Bibliography#Rotem 08]] | [Falacies of Distributed Computing Explained | http://www.rgoarchitects.com/Files/fallacies.pdf] | ]]></ac:plain-text-body></ac:structured-macro> |
...