Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0BCFA200D20 for ; Tue, 12 Sep 2017 03:16:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0A77F1609C4; Tue, 12 Sep 2017 01:16:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 56D131609C5 for ; Tue, 12 Sep 2017 03:16:05 +0200 (CEST) Received: (qmail 6219 invoked by uid 500); 12 Sep 2017 01:16:04 -0000 Mailing-List: contact issues-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list issues@karaf.apache.org Received: (qmail 6201 invoked by uid 99); 12 Sep 2017 01:16:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Sep 2017 01:16:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id DC5B5183B03 for ; Tue, 12 Sep 2017 01:16:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id lNi_Vq68YEF7 for ; Tue, 12 Sep 2017 01:16:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id C5F575FCB9 for ; Tue, 12 Sep 2017 01:16:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 99AF7E0663 for ; Tue, 12 Sep 2017 01:16:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 25B4124137 for ; Tue, 12 Sep 2017 01:16:00 +0000 (UTC) Date: Tue, 12 Sep 2017 01:16:00 +0000 (UTC) From: "Emily Berk (JIRA)" To: issues@karaf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (KARAF-5362) NPE creating session with a null "in" parameter from a SessionFactory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 12 Sep 2017 01:16:06 -0000 [ https://issues.apache.org/jira/browse/KARAF-5362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Emily Berk updated KARAF-5362: ------------------------------ Summary: NPE creating session with a null "in" parameter from a SessionFactory (was: NPE Creating Session with a null "in" parameter from a SessionFactory) > NPE creating session with a null "in" parameter from a SessionFactory > --------------------------------------------------------------------- > > Key: KARAF-5362 > URL: https://issues.apache.org/jira/browse/KARAF-5362 > Project: Karaf > Issue Type: Bug > Components: karaf-shell > Affects Versions: 4.1.2 > Reporter: Emily Berk > Priority: Trivial > > The javadoc for {{SessionFactory#create(InputStream, PrintStream, PrintStream)}} says > {code:java} > @param in the input stream, can be null if the session is only used to execute a command using {@link Session#execute(CharSequence)} > {code} > When I try > {code:java} > package org.apache.karaf.shell.impl.console; > import static org.easymock.EasyMock.createMock; > import java.io.PrintStream; > import java.io.UnsupportedEncodingException; > import org.apache.felix.service.threadio.ThreadIO; > import org.apache.karaf.shell.api.console.SessionFactory; > import org.junit.Test; > public class SessionFactoryImplTest { > > @Test > public void createWithNullInputStream() throws UnsupportedEncodingException { > final SessionFactory sessionFactory = new SessionFactoryImpl(createMock(ThreadIO.class)); > sessionFactory.create(null, createMock(PrintStream.class), createMock(PrintStream.class)); > } > } > {code} > I get > {code} > java.lang.NullPointerException: "in" is null! > at java.nio.channels.Channels.checkNotNull(Channels.java:67) > at java.nio.channels.Channels.newChannel(Channels.java:347) > at org.apache.felix.gogo.runtime.CommandSessionImpl.(CommandSessionImpl.java:108) > at org.apache.felix.gogo.runtime.CommandProcessorImpl.createSession(CommandProcessorImpl.java:82) > at org.apache.felix.gogo.runtime.CommandProcessorImpl.createSession(CommandProcessorImpl.java:38) > at org.apache.karaf.shell.impl.console.HeadlessSessionImpl.(HeadlessSessionImpl.java:67) > at org.apache.karaf.shell.impl.console.SessionFactoryImpl.create(SessionFactoryImpl.java:155) > at org.apache.karaf.shell.impl.console.SessionFactoryImpl.create(SessionFactoryImpl.java:146) > at org.apache.karaf.shell.impl.console.SessionFactoryImplTest.createWithNullInputStream(SessionFactoryImplTest.java:41) > {code} > A work-around is to pass a non-null {{InputStream}} that should never be called if the {{Session}} is only used to execute a command using {{Session#execute(CharSequence)}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)