• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 22317391561

23 Feb 2026 05:30PM UTC coverage: 70.257% (-0.2%) from 70.474%
22317391561

Pull #1714

github

web-flow
Merge 5be048514 into 379acdc9d
Pull Request #1714: #404: #1713: advanced logging

4066 of 6384 branches covered (63.69%)

Branch coverage included in aggregate %.

10598 of 14488 relevant lines covered (73.15%)

3.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
cli/src/main/java/com/devonfw/tools/ide/context/IdeContextConsole.java
1
package com.devonfw.tools.ide.context;
2

3
import java.util.Scanner;
4

5
import org.slf4j.Logger;
6
import org.slf4j.LoggerFactory;
7

8
import com.devonfw.tools.ide.io.IdeProgressBar;
9
import com.devonfw.tools.ide.io.IdeProgressBarConsole;
10
import com.devonfw.tools.ide.log.IdeLogLevel;
11
import com.devonfw.tools.ide.log.IdeLogListenerNone;
12

13
/**
14
 * Default implementation of {@link IdeContext} using the console.
15
 */
16
public class IdeContextConsole extends AbstractIdeContext {
17

18
  private static final Logger LOG = LoggerFactory.getLogger(IdeContextConsole.class);
×
19

20
  private final Scanner scanner;
21

22
  /**
23
   * The constructor.
24
   */
25
  public IdeContextConsole() {
26
    this(new IdeStartContextImpl(IdeLogLevel.INFO, IdeLogListenerNone.INSTANCE));
×
27
  }
×
28

29
  /**
30
   * The constructor.
31
   *
32
   * @param startContext the {@link IdeStartContextImpl}.
33
   */
34
  public IdeContextConsole(IdeStartContextImpl startContext) {
35

36
    super(startContext, null);
×
37
    if (System.console() == null) {
×
38
      LOG.debug("System console not available - using System.in as fallback");
×
39
      this.scanner = new Scanner(System.in);
×
40
    } else {
41
      this.scanner = null;
×
42
    }
43
  }
×
44

45
  @Override
46
  protected String readLine() {
47

48
    if (this.scanner == null) {
×
49
      return System.console().readLine();
×
50
    } else {
51
      return this.scanner.nextLine();
×
52
    }
53
  }
54

55
  @Override
56
  public IdeProgressBar newProgressBar(String title, long size, String unitName, long unitSize) {
57

58
    return new IdeProgressBarConsole(getSystemInfo(), title, size, unitName, unitSize);
×
59
  }
60

61
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc