src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java

Print this page
rev 10199 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz, prappo
Contributed-by: Otavio Santana <otaviojava@java.net>


 125         }
 126     }
 127 
 128     @Override
 129     String errorMessageFor(Exception e) {
 130         if (e instanceof AmbiguousMethodException) {
 131             return (MessageOutput.format("Method is overloaded; specify arguments",
 132                                          methodName()));
 133             /*
 134              * TO DO: list the methods here
 135              */
 136         } else if (e instanceof NoSuchMethodException) {
 137             return (MessageOutput.format("No method in",
 138                                          new Object [] {methodName(),
 139                                                         refSpec.toString()}));
 140         } else if (e instanceof AbsentInformationException) {
 141             return (MessageOutput.format("No linenumber information for",
 142                                          refSpec.toString()));
 143         } else if (e instanceof LineNotFoundException) {
 144             return (MessageOutput.format("No code at line",
 145                                          new Object [] {new Long (lineNumber()),
 146                                                         refSpec.toString()}));
 147         } else if (e instanceof InvalidTypeException) {
 148             return (MessageOutput.format("Breakpoints can be located only in classes.",
 149                                          refSpec.toString()));
 150         } else {
 151             return super.errorMessageFor( e);
 152         }
 153     }
 154 
 155     @Override
 156     public String toString() {
 157         StringBuilder sb = new StringBuilder(refSpec.toString());
 158         if (isMethodBreakpoint()) {
 159             sb.append('.');
 160             sb.append(methodId);
 161             if (methodArgs != null) {
 162                 boolean first = true;
 163                 sb.append('(');
 164                 for (String arg : methodArgs) {
 165                     if (!first) {




 125         }
 126     }
 127 
 128     @Override
 129     String errorMessageFor(Exception e) {
 130         if (e instanceof AmbiguousMethodException) {
 131             return (MessageOutput.format("Method is overloaded; specify arguments",
 132                                          methodName()));
 133             /*
 134              * TO DO: list the methods here
 135              */
 136         } else if (e instanceof NoSuchMethodException) {
 137             return (MessageOutput.format("No method in",
 138                                          new Object [] {methodName(),
 139                                                         refSpec.toString()}));
 140         } else if (e instanceof AbsentInformationException) {
 141             return (MessageOutput.format("No linenumber information for",
 142                                          refSpec.toString()));
 143         } else if (e instanceof LineNotFoundException) {
 144             return (MessageOutput.format("No code at line",
 145                                          new Object [] {Long.valueOf(lineNumber()),
 146                                                  refSpec.toString()}));
 147         } else if (e instanceof InvalidTypeException) {
 148             return (MessageOutput.format("Breakpoints can be located only in classes.",
 149                                          refSpec.toString()));
 150         } else {
 151             return super.errorMessageFor( e);
 152         }
 153     }
 154 
 155     @Override
 156     public String toString() {
 157         StringBuilder sb = new StringBuilder(refSpec.toString());
 158         if (isMethodBreakpoint()) {
 159             sb.append('.');
 160             sb.append(methodId);
 161             if (methodArgs != null) {
 162                 boolean first = true;
 163                 sb.append('(');
 164                 for (String arg : methodArgs) {
 165                     if (!first) {