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.

View | Details | Raw Unified | Return to bug 217874
Collapse All | Expand All

(-)a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/NativeProcessBuilder.java (-2 / +22 lines)
Lines 58-63 Link Here
58
import org.netbeans.modules.nativeexecution.TerminalLocalNativeProcess;
58
import org.netbeans.modules.nativeexecution.TerminalLocalNativeProcess;
59
import org.netbeans.modules.nativeexecution.api.pty.PtySupport;
59
import org.netbeans.modules.nativeexecution.api.pty.PtySupport;
60
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
60
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
61
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager.CancellationException;
61
import org.netbeans.modules.nativeexecution.api.util.ExternalTerminal;
62
import org.netbeans.modules.nativeexecution.api.util.ExternalTerminal;
62
import org.netbeans.modules.nativeexecution.api.util.ExternalTerminalProvider;
63
import org.netbeans.modules.nativeexecution.api.util.ExternalTerminalProvider;
63
import org.netbeans.modules.nativeexecution.api.util.MacroMap;
64
import org.netbeans.modules.nativeexecution.api.util.MacroMap;
Lines 65-70 Link Here
65
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport;
66
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport;
66
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport.ShellValidationStatus;
67
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport.ShellValidationStatus;
67
import org.netbeans.modules.nativeexecution.api.util.WindowsSupport;
68
import org.netbeans.modules.nativeexecution.api.util.WindowsSupport;
69
import org.openide.util.Exceptions;
70
import org.openide.util.UserQuestionException;
68
71
69
/**
72
/**
70
 * Utility class for the {@link NativeProcess external native process} creation.
73
 * Utility class for the {@link NativeProcess external native process} creation.
Lines 160-177 Link Here
160
     *             in this builder
163
     *             in this builder
161
     * @throws IOException if the process could not be created
164
     * @throws IOException if the process could not be created
162
     */
165
     */
166
    @NbBundle.Messages({
167
        "#{0} - display name of execution environment",
168
        "EXC_NotConnectedQuestion=No connection to {0}. Connect now?"
169
    })
163
    @Override
170
    @Override
164
    public NativeProcess call() throws IOException {
171
    public NativeProcess call() throws IOException {
165
        AbstractNativeProcess process = null;
172
        AbstractNativeProcess process = null;
166
173
167
        ExecutionEnvironment execEnv = info.getExecutionEnvironment();
174
        final ExecutionEnvironment execEnv = info.getExecutionEnvironment();
168
175
169
        if (info.getCommand() == null) {
176
        if (info.getCommand() == null) {
170
            throw new IllegalStateException("No executable nor command line is specified"); // NOI18N
177
            throw new IllegalStateException("No executable nor command line is specified"); // NOI18N
171
        }
178
        }
172
179
173
        if (!ConnectionManager.getInstance().isConnectedTo(execEnv)) {
180
        if (!ConnectionManager.getInstance().isConnectedTo(execEnv)) {
174
            throw new IOException("No connection to " + execEnv.getDisplayName()); // NOI18N
181
            throw new UserQuestionException("No connection to " + execEnv.getDisplayName()) {
182
                @Override
183
                public void confirmed() throws IOException {
184
                    try {
185
                        ConnectionManager.getInstance().connectTo(execEnv);
186
                    } catch (CancellationException ex) {
187
                        throw new IOException(ex);
188
                    }
189
                }
190
                @Override
191
                public String getLocalizedMessage() {
192
                    return Bundle.EXC_NotConnectedQuestion(execEnv.getDisplayName());
193
                }
194
            };
175
        }
195
        }
176
196
177
        if (info.isPtyMode() && PtySupport.isSupportedFor(info.getExecutionEnvironment())) {
197
        if (info.isPtyMode() && PtySupport.isSupportedFor(info.getExecutionEnvironment())) {
(-)a/dlight.nativeexecution/test/unit/src/org/netbeans/modules/nativeexecution/api/NativeProcessBuilderTest.java (+22 lines)
Lines 64-69 Link Here
64
import org.netbeans.modules.nativeexecution.test.NativeExecutionBaseTestSuite;
64
import org.netbeans.modules.nativeexecution.test.NativeExecutionBaseTestSuite;
65
import org.openide.util.Exceptions;
65
import org.openide.util.Exceptions;
66
import org.openide.util.RequestProcessor;
66
import org.openide.util.RequestProcessor;
67
import org.openide.util.UserQuestionException;
67
68
68
public class NativeProcessBuilderTest extends NativeExecutionBaseTestCase {
69
public class NativeProcessBuilderTest extends NativeExecutionBaseTestCase {
69
70
Lines 203-208 Link Here
203
    public void testSetCommandLine() throws Exception {
204
    public void testSetCommandLine() throws Exception {
204
        doTestSetCommandLine(getTestExecutionEnvironment());
205
        doTestSetCommandLine(getTestExecutionEnvironment());
205
    }
206
    }
207
    
208
    public void testAsksForconnection() {
209
        ExecutionEnvironment ee = ExecutionEnvironmentFactory.createNew("never", "existed.com");
210
        NativeProcessBuilder b = NativeProcessBuilder.newProcessBuilder(ee);
211
        b.setExecutable("ade");
212
        b.setArguments("lsviews");
213
        try {
214
            b.call();
215
            fail("The previous call should thrown an exception");
216
        } catch (UserQuestionException ex) {
217
            // OK, expected
218
            assertEquals(
219
                "Localized message as expected",
220
                Bundle.EXC_NotConnectedQuestion(ee.getDisplayName()), 
221
                ex.getLocalizedMessage()
222
            );
223
            assertEquals("No connection to never@existed.com", ex.getMessage());
224
        } catch (IOException ex) {
225
            fail("we should not get IOException: " + ex);
226
        }
227
    }
206
228
207
    private void doTestSetCommandLine(ExecutionEnvironment execEnv) throws Exception {
229
    private void doTestSetCommandLine(ExecutionEnvironment execEnv) throws Exception {
208
        HostInfo hostinfo = HostInfoUtils.getHostInfo(execEnv);
230
        HostInfo hostinfo = HostInfoUtils.getHostInfo(execEnv);
(-)a/dlight.remote.impl/nbproject/project.properties (-1 / +1 lines)
Lines 1-7 Link Here
1
is.autoload=true
1
is.autoload=true
2
javac.source=1.6
2
javac.source=1.6
3
javac.compilerargs=-Xlint -Xlint:-serial
3
javac.compilerargs=-Xlint -Xlint:-serial
4
spec.version.base=1.14.0
4
spec.version.base=1.15.0
5
5
6
test.config.stableBTD.includes=**/*Test.class
6
test.config.stableBTD.includes=**/*Test.class
7
test.config.stableBTD.excludes=**/RemoteFSTCKTest.class
7
test.config.stableBTD.excludes=**/RemoteFSTCKTest.class
(-)a/dlight.remote.impl/nbproject/project.xml (-1 / +1 lines)
Lines 44-50 Link Here
44
                    <build-prerequisite/>
44
                    <build-prerequisite/>
45
                    <compile-dependency/>
45
                    <compile-dependency/>
46
                    <run-dependency>
46
                    <run-dependency>
47
                        <specification-version>1.9.4</specification-version>
47
                        <specification-version>1.15</specification-version>
48
                    </run-dependency>
48
                    </run-dependency>
49
                </dependency>
49
                </dependency>
50
                <dependency>
50
                <dependency>
(-)a/dlight.remote/nbproject/project.properties (-1 / +1 lines)
Lines 1-5 Link Here
1
is.autoload=true
1
is.autoload=true
2
javac.source=1.6
2
javac.source=1.6
3
javac.compilerargs=-Xlint -Xlint:-serial
3
javac.compilerargs=-Xlint -Xlint:-serial
4
spec.version.base=1.14.0
4
spec.version.base=1.15.0
5
5

Return to bug 217874