This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 183574 - java.lang.NumberFormatException: For input string: ""
Summary: java.lang.NumberFormatException: For input string: ""
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Terminalemulator (show other bugs)
Version: 6.x
Hardware: PC Solaris
: P2 normal (vote)
Assignee: ivan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-06 14:51 UTC by Alexey Vladykin
Modified: 2010-06-17 10:42 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Vladykin 2010-04-06 14:51:32 UTC
I see the following exception in NetBeans log if I connect to bluebox.russia (Solaris x86) and type "nano". Terminal stops working after this.

java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(EventQueue.java:997)
	at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1320)
	at org.netbeans.lib.terminalemulator.StreamTerm$OutputMonitor.run(StreamTerm.java:251)
Caused by: java.lang.NumberFormatException: For input string: ""
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
	at java.lang.Integer.parseInt(Integer.java:470)
	at java.lang.Integer.parseInt(Integer.java:499)
	at org.netbeans.lib.terminalemulator.AbstractInterp.numberAt(AbstractInterp.java:155)
	at org.netbeans.lib.terminalemulator.InterpANSI$InterpTypeANSI$ACT_ATTR.action(InterpANSI.java:342)
	at org.netbeans.lib.terminalemulator.InterpDumb.processChar(InterpDumb.java:241)
	at org.netbeans.lib.terminalemulator.Term.putc_work(Term.java:3897)
	at org.netbeans.lib.terminalemulator.Term.access$400(Term.java:247)
	at org.netbeans.lib.terminalemulator.Term$BaseTermStream.putChars(Term.java:404)
	at org.netbeans.lib.terminalemulator.Term.putChars(Term.java:3157)
	at org.netbeans.lib.terminalemulator.StreamTerm$OutputMonitor$Trampoline.run(StreamTerm.java:200)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:133)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Comment 1 ivan 2010-04-06 19:02:45 UTC
This seems to be because of poor handling of malformed escape
sequences, but it would help to know what the malformed sequence is.
It has to be something of the form
    <esc> [ <n1> ; m
    <esc> [ <n1> ; <n1> ; m
    <esc> [ <n1> ; <n2> ; <n3 ; m
and so on.

Just typing 'nano' won't do it.
what shell are you using?
Is emacs or vi cmdline editing turned on?

Terminal can echo debugging stuff but there is no trivial way to turn
it on from the user level. We might have to add that before we
know what the bad sequence is.

I can also try a blind fix and see where we go from that.
Comment 2 ivan 2010-04-06 19:14:58 UTC
One other thing ... you might be emitting some terminal
control characters with your prompt. For example
in bash this is done by setting $PROMPT_COMMAND to some
shell function or command.
Comment 3 Alexey Vladykin 2010-04-08 20:30:56 UTC
The control sequence is "[7;m"
Exception occurs when InterpANSI.ACT_ATTR.action() loops over ai numbers:
341:		    for (int n = 0; n <= ai.nNumbers(); n++)
342:			ai.ops.op_attr(ai.numberAt(n));

Here ai.nNumbers() == 1, but ai.number[1] == "".
Probably the loop should be
for (int n = 0; n < ai.nNumbers(); n++)
Comment 4 ivan 2010-04-09 02:21:04 UTC
    16d4fdb3d65f - preparatory cleanup of annotations

    aeca8fa932ae - convenient way to turn on Term debugging.
    Pass the following to the IDE at startup:
        -J-DTerm.debug=ops,keys,input,output,wrap,margins
    Or in nbproject/private/private.properties put
        run.args.extra=-J-DTerm.debug=ops,keys,input,output,wrap,margins

    e8fd486b529 - actual fix
    The <= in the loop is correct. The actual syntax for ESC m is this:
            <esc> [ <n1> m
            <esc> [ <n1> ; <n2> m
            <esc> [ <n1> ; <n2> ; <n3> m
            ...
    I either misquoted or quoted from a bad source earlier.

    This means that the sequence being sent, "<esc> [ 7 ; m" is "poorly formed".
    There should be no ';' or a number after the ';'.

    And Term should not throw an exception on this but treat the missing
    number after the ';' as some default number.
    For now fixing in AbstractInterp.numberAt() such that it returns a
    default of 0 in case of trouble.
Comment 5 Quality Engineering 2010-04-11 04:21:04 UTC
Integrated into 'main-golden', will be available in build *201004110201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/16d4fdb3d65f
User: ivan@netbeans.org
Log: bug #183574 - preparatory cleanup of annotations