[hg] main-silver: Brackets added, etc. to prevent from a lot of ...

  • From:
  • To:
  • Subject: [hg] main-silver: Brackets added, etc. to prevent from a lot of ...
  • Date: Thu, 21 Feb 2013 19:37:58 -0800

changeset d86a5e4e1ac5 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/d86a5e4e1ac5
description:
        Brackets added, etc. to prevent from a lot of warnings.

diffstat:

 debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java | 
 179 ++++++---
 1 files changed, 123 insertions(+), 56 deletions(-)

diffs (470 lines):

diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
--- 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
+++ 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
@@ -221,12 +221,15 @@
         pcs = new PropertyChangeSupport (this);
         List l = lookupProvider.lookup (null, DebuggerEngineProvider.class);
         int i, k = l.size ();
-        for (i = 0; i < k; i++)
-            if (l.get (i) instanceof JavaEngineProvider)
+        for (i = 0; i < k; i++) {
+            if (l.get (i) instanceof JavaEngineProvider) {
                 javaEngineProvider = (JavaEngineProvider) l.get (i);
-        if (javaEngineProvider == null)
+            }
+        }
+        if (javaEngineProvider == null) {
             throw new IllegalArgumentException
                 ("JavaEngineProvider have to be used to start 
JPDADebugger!");
+        }
         languages = new HashSet<String>();
         languages.add ("Java");
         threadsTranslation = ObjectTranslation.createThreadTranslation(this);
@@ -274,7 +277,9 @@
     public void setSuspend (int s) {
         int old;
         synchronized (stateLock) {
-            if (s == suspend) return;
+            if (s == suspend) {
+                return;
+            }
             old = suspend;
             suspend = s;
         }
@@ -381,16 +386,17 @@
         synchronized (LOCK2) {
             int state = getState();
             if (state == STATE_DISCONNECTED) {
-                if (throwable != null)
+                if (throwable != null) {
                     throw new DebuggerStartException (throwable);
-                else
+                } else {
                     return true;
             }
+            }
             if (!starting && state != STATE_STARTING || throwable != null) {
                 return true; // We're already running
             }
             try {
-                logger.fine("JPDADebuggerImpl.waitRunning(): starting = 
"+starting+", state = "+state+", exception = "+throwable);
+                logger.log(Level.FINE, "JPDADebuggerImpl.waitRunning(): 
starting = {0}, state = {1}, exception = {2}", new Object[]{starting, state, 
throwable});
                 LOCK2.wait (timeout);
                 if ((starting || state == STATE_STARTING) && throwable == 
null) {
                     return false; // We're still not running and the time 
expired
@@ -399,12 +405,13 @@
                  throw new DebuggerStartException (e);
             }
 
-            if (throwable != null)
+            if (throwable != null) {
                 throw new DebuggerStartException (throwable);
-            else
+            } else {
                 return true;
         }
     }
+    }
     
     public void setIO(InputOutput io) {
         this.io = io;
@@ -422,7 +429,9 @@
     @Override
     public boolean canPopFrames () {
         VirtualMachine vm = getVirtualMachine ();
-        if (vm == null) return false;
+        if (vm == null) {
+            return false;
+        }
         return VirtualMachineWrapper.canPopFrames0(vm);
     }
 
@@ -435,7 +444,9 @@
     @Override
     public boolean canFixClasses () {
         VirtualMachine vm = getVirtualMachine ();
-        if (vm == null) return false;
+        if (vm == null) {
+            return false;
+        }
         return VirtualMachineWrapper.canRedefineClasses0(vm);
     }
 
@@ -464,12 +475,13 @@
                     byte[] bytes = classEntry.getValue();
                     List<ReferenceType> classRefs = 
VirtualMachineWrapper.classesByName (vm, className);
                     int j, jj = classRefs.size ();
-                    for (j = 0; j < jj; j++)
+                    for (j = 0; j < jj; j++) {
                         map.put (
                             classRefs.get (j),
                             bytes
                         );
                 }
+                }
                 VirtualMachineWrapper.redefineClasses (vm, map);
             } catch (InternalExceptionWrapper ex) {
             } catch (VMDisconnectedExceptionWrapper ex) {
@@ -484,11 +496,15 @@
             JPDAThread t = getCurrentThread ();
             if (t != null && t.isSuspended()) {
                 try {
-                    if (t.getStackDepth () < 2) return;
+                    if (t.getStackDepth () < 2) {
+                        return;
+                    }
                     CallStackFrame frame;
                     try {
                         CallStackFrame[] frames = t.getCallStack(0, 1);
-                        if (frames.length == 0) return ;
+                        if (frames.length == 0) {
+                            return ;
+                        }
                         frame = frames[0]; // Retrieve the new, possibly 
obsoleted frame and check it.
                     } catch (AbsentInformationException ex) {
                         return;
@@ -532,7 +548,9 @@
                     break;
                 }
             }
-            if (bel != null) bel.fixBreakpointImpls ();
+            if (bel != null) {
+                bel.fixBreakpointImpls ();
+            }
         }
     }
 
@@ -550,7 +568,9 @@
     @Override
     public boolean canBeModified() {
         VirtualMachine vm = getVirtualMachine ();
-        if (vm == null) return false;
+        if (vm == null) {
+            return false;
+        }
         synchronized (canBeModifiedLock) {
             if (canBeModified == null) {
                 canBeModified = vm.canBeModified();
@@ -577,8 +597,9 @@
     CompoundSmartSteppingListener compoundSmartSteppingListener;
 
     private CompoundSmartSteppingListener getCompoundSmartSteppingListener 
() {
-        if (compoundSmartSteppingListener == null)
+        if (compoundSmartSteppingListener == null) {
             compoundSmartSteppingListener = lookupProvider.lookupFirst(null, 
CompoundSmartSteppingListener.class);
+        }
         return compoundSmartSteppingListener;
     }
 
@@ -716,14 +737,19 @@
         if (thread != oldT) {
             evt = new PropertyChangeEvent(this, PROP_CURRENT_THREAD, oldT, 
thread);
         }
-        if (evt == null) evt = evt2;
-        else if (evt2 != null) evt.setPropagationId(evt2);
+        if (evt == null) {
+            evt = evt2;
+        } else if (evt2 != null) {
+            evt.setPropagationId(evt2);
+        }
         return evt;
     }
 
     public void setCurrentCallStackFrame (CallStackFrame callStackFrame) {
         CallStackFrame old = setCurrentCallStackFrameNoFire(callStackFrame);
-        if (old == callStackFrame) return ;
+        if (old == callStackFrame) {
+            return ;
+        }
         firePropertyChange (
             PROP_CURRENT_CALL_STACK_FRAME,
             old,
@@ -734,7 +760,9 @@
     private CallStackFrame setCurrentCallStackFrameNoFire (CallStackFrame 
callStackFrame) {
         CallStackFrame old;
         synchronized (currentThreadAndFrameLock) {
-            if (callStackFrame == currentCallStackFrame) return 
callStackFrame;
+            if (callStackFrame == currentCallStackFrame) {
+                return callStackFrame;
+            }
             old = currentCallStackFrame;
             currentCallStackFrame = callStackFrame;
         }
@@ -803,7 +831,7 @@
 
         Session s = getSession();
         Evaluator e = s.lookupFirst(s.getCurrentLanguage(), Evaluator.class);
-        logger.fine("Have evaluator "+e+" for language 
"+s.getCurrentLanguage());   // NOI18N
+        logger.log(Level.FINE, "Have evaluator {0} for language {1}", new 
Object[]{e, s.getCurrentLanguage()});   // NOI18N
 
         if (e == null) {
             e = new JavaEvaluator(s);
@@ -970,9 +998,10 @@
         int maxLength
     ) throws InvalidExpressionException {
         synchronized (currentThreadAndFrameLock) {
-            if (thread == null && currentThread == null)
+            if (thread == null && currentThread == null) {
                 throw new InvalidExpressionException
                         (NbBundle.getMessage(JPDADebuggerImpl.class, 
"MSG_NoCurrentContext"));
+            }
             if (thread == null) {
                 thread = currentThread;
             }
@@ -1024,9 +1053,7 @@
                     }
                     return v;
                 } catch (InternalException e) {
-                    InvalidExpressionException ieex = new 
InvalidExpressionException (e.getLocalizedMessage());
-                    ieex.initCause(e);
-                    throw ieex;
+                    throw new InvalidExpressionException(e);
                 }
             } catch (InvalidExpressionException ieex) {
                 if (ieex.getTargetException() instanceof 
UnsupportedOperationException) {
@@ -1037,7 +1064,7 @@
                 if (threadSuspended) {
                     thread.notifyMethodInvokeDone();
                 }
-                if (frameThread != null) {
+                if (frameThread != null && csf != null) {
                     try {
                         csf.getThread();
                     } catch (InvalidStackFrameException isfex) {
@@ -1095,7 +1122,9 @@
     }
 
     public static String getGenericSignature (TypeComponent component) {
-        if (tcGenericSignatureMethod == null) return null;
+        if (tcGenericSignatureMethod == null) {
+            return null;
+        }
         try {
             return (String) tcGenericSignatureMethod.invoke
                 (component, new Object[0]);
@@ -1109,7 +1138,9 @@
     }
 
     public static String getGenericSignature (LocalVariable component) {
-        if (lvGenericSignatureMethod == null) return null;
+        if (lvGenericSignatureMethod == null) {
+            return null;
+        }
         try {
             return (String) lvGenericSignatureMethod.invoke(component, new 
Object[0]);
         } catch (IllegalAccessException e) {
@@ -1232,10 +1263,13 @@
             evt = setCurrentThreadNoFire(t);
             PropertyChangeEvent evt2 = setStateNoFire(STATE_STOPPED);
 
-            if (evt == null) evt = evt2;
-            else if (evt2 != null) {
+            if (evt == null) {
+                evt = evt2;
+            } else if (evt2 != null) {
                 PropertyChangeEvent evt3 = evt;
-                while(evt3.getPropagationId() != null) evt3 = 
(PropertyChangeEvent) evt3.getPropagationId();
+                while(evt3.getPropagationId() != null) {
+                    evt3 = (PropertyChangeEvent) evt3.getPropagationId();
+                }
                 evt3.setPropagationId(evt2);
             }
         } finally {
@@ -1270,15 +1304,21 @@
             checkJSR45Languages (t);
             PropertyChangeEvent evt2 = setCurrentThreadNoFire(t);
 
-            if (evt == null) evt = evt2;
-            else if (evt2 != null) evt.setPropagationId(evt2);
+            if (evt == null) {
+                evt = evt2;
+            } else if (evt2 != null) {
+                evt.setPropagationId(evt2);
+            }
 
             evt2 = setStateNoFire(STATE_STOPPED);
 
-            if (evt == null) evt = evt2;
-            else if (evt2 != null) {
+            if (evt == null) {
+                evt = evt2;
+            } else if (evt2 != null) {
                 PropertyChangeEvent evt3 = evt;
-                while(evt3.getPropagationId() != null) evt3 = 
(PropertyChangeEvent) evt3.getPropagationId();
+                while(evt3.getPropagationId() != null) {
+                    evt3 = (PropertyChangeEvent) evt3.getPropagationId();
+                }
                 evt3.setPropagationId(evt2);
             }
 
@@ -1310,10 +1350,14 @@
                 finishing = true;
             }
             logger.fine("StartActionProvider.finish ()");
-            if (getState () == STATE_DISCONNECTED) return;
+            if (getState () == STATE_DISCONNECTED) {
+                return;
+            }
             AbstractDICookie di = lookupProvider.lookupFirst(null, 
AbstractDICookie.class);
             Operator o = getOperator();
-            if (o != null) o.stop();
+            if (o != null) {
+                o.stop();
+            }
             stopAttachListening();
             try {
                 boolean startedUp;
@@ -1366,9 +1410,9 @@
                         VirtualMachineWrapper.exit (vm, 0);
                     }
                 } catch (InternalExceptionWrapper e) {
-                    logger.fine(" StartActionProvider.finish() VM exception 
" + e);
+                    logger.log(Level.FINE, " StartActionProvider.finish() VM 
exception {0}", e);
                 } catch (VMDisconnectedExceptionWrapper e) {
-                    logger.fine(" StartActionProvider.finish() VM exception 
" + e);
+                    logger.log(Level.FINE, " StartActionProvider.finish() VM 
exception {0}", e);
                     // debugee VM is already disconnected (it finished 
normally)
                 }
             }
@@ -1922,7 +1966,9 @@
             synchronized (virtualMachineLock) {
                 vm = virtualMachine;
             }
-            if (vm == null) return ;
+            if (vm == null) {
+                return ;
+            }
             try {
                 java.util.regex.Matcher m = 
jvmVersionPattern.matcher(VirtualMachineWrapper.version(vm));
                 if (m.matches ()) {
@@ -1947,7 +1993,9 @@
     private PropertyChangeEvent setStateNoFire (int state) {
         int o;
         synchronized (stateLock) {
-            if (state == this.state) return null;
+            if (state == this.state) {
+                return null;
+            }
             o = this.state;
             this.state = state;
         }
@@ -1996,28 +2044,34 @@
 
     private SourcePath engineContext;
     public synchronized SourcePath getEngineContext () {
-        if (engineContext == null)
+        if (engineContext == null) {
             engineContext = lookupProvider.lookupFirst(null, 
SourcePath.class);
+        }
         return engineContext;
     }
 
     private LocalsTreeModel localsTreeModel;
     private LocalsTreeModel getLocalsTreeModel () {
-        if (localsTreeModel == null)
+        if (localsTreeModel == null) {
             localsTreeModel = (LocalsTreeModel) lookupProvider.
                 lookupFirst ("LocalsView", TreeModel.class);
+        }
         return localsTreeModel;
     }
 
     private ThreadReference getEvaluationThread () {
         synchronized (currentThreadAndFrameLock) {
-            if (currentThread != null) return 
currentThread.getThreadReference ();
+            if (currentThread != null) {
+                return currentThread.getThreadReference ();
+            }
         }
         VirtualMachine vm;
         synchronized (virtualMachineLock) {
             vm = virtualMachine;
         }
-        if (vm == null) return null;
+        if (vm == null) {
+            return null;
+        }
         List l;
         try {
             l = VirtualMachineWrapper.allThreads(vm);
@@ -2026,7 +2080,9 @@
         } catch (VMDisconnectedExceptionWrapper ex) {
             return null;
         }
-        if (l.size () < 1) return null;
+        if (l.size () < 1) {
+            return null;
+        }
         int i, k = l.size ();
         ThreadReference thread = null;
         for (i = 0; i < k; i++) {
@@ -2034,9 +2090,10 @@
             try {
                 if (ThreadReferenceWrapper.isSuspended (t)) {
                     thread = t;
-                    if (ThreadReferenceWrapper.name (t).equals ("Finalizer"))
+                    if (ThreadReferenceWrapper.name (t).equals 
("Finalizer")) {
                         return t;
                 }
+                }
             } catch (InternalExceptionWrapper ex) {
             } catch (IllegalThreadStateExceptionWrapper ex) {
             } catch (ObjectCollectedExceptionWrapper ex) {
@@ -2064,10 +2121,13 @@
             }
         }
         oldSF = setCurrentCallStackFrameNoFire(newSF);
-        if (oldSF == newSF) return null;
-        else return new PropertyChangeEvent(this, 
PROP_CURRENT_CALL_STACK_FRAME,
+        if (oldSF == newSF) {
+            return null;
+        } else {
+            return new PropertyChangeEvent(this, 
PROP_CURRENT_CALL_STACK_FRAME,
                                             oldSF, newSF);
     }
+    }
     
     private CallStackFrame preferredTopFrame;
     
@@ -2106,16 +2166,21 @@
     private PropertyChangeEvent 
updateCurrentCallStackFrameNoFire(CallStackFrame callStackFrame) {
         CallStackFrame old;
         old = setCurrentCallStackFrameNoFire(callStackFrame);
-        if (old == callStackFrame) return null;
-        else return new PropertyChangeEvent(this, 
PROP_CURRENT_CALL_STACK_FRAME,
+        if (old == callStackFrame) {
+            return null;
+        } else {
+            return new PropertyChangeEvent(this, 
PROP_CURRENT_CALL_STACK_FRAME,
                                             old, callStackFrame);
     }
+    }
 
     private void checkJSR45Languages (JPDAThread t) {
-        if (t.getStackDepth () > 0)
+        if (t.getStackDepth () > 0) {
             try {
                 CallStackFrame[] frames = t.getCallStack (0, 1);
-                if (frames.length < 1) return ; // Internal error or 
disconnected
+                if (frames.length < 1) {
+                    return ; // Internal error or disconnected
+                }
                 CallStackFrame f = frames [0];
                 List<String> l = f.getAvailableStrata ();
                 String stratum = f.getDefaultStratum ();
@@ -2146,12 +2211,14 @@
                 } // for
                 if ( (stratum != null) &&
                      (!stratum.equals (lastStratumn))
-                )
+                ) {
                     javaEngineProvider.getSession ().setCurrentLanguage 
(stratum);
+                }
                 lastStratumn = stratum;
             } catch (AbsentInformationException e) {
             }
     }
+    }
 
     private Set<JSR45DebuggerEngineProvider> jsr45EngineProviders;
 

[hg] main-silver: Brackets added, etc. to prevent from a lot of ...

mentlicher 02/22/2013

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 29 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close