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 2C354200D09 for ; Tue, 12 Sep 2017 13:47:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2AE4F1609C9; Tue, 12 Sep 2017 11:47:04 +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 6BF2B1609C6 for ; Tue, 12 Sep 2017 13:47:03 +0200 (CEST) Received: (qmail 16591 invoked by uid 500); 12 Sep 2017 11:47:02 -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 16580 invoked by uid 99); 12 Sep 2017 11:47:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Sep 2017 11:47:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id E963DD3117 for ; Tue, 12 Sep 2017 11:47:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-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-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ftReNRSWmtLT for ; Tue, 12 Sep 2017 11:47:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id E579A5F6BE for ; Tue, 12 Sep 2017 11:47:00 +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 7A144E010F for ; Tue, 12 Sep 2017 11:47: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 3893124147 for ; Tue, 12 Sep 2017 11:47:00 +0000 (UTC) Date: Tue, 12 Sep 2017 11:47:00 +0000 (UTC) From: =?utf-8?Q?Jean-Baptiste_Onofr=C3=A9_=28JIRA=29?= 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: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 12 Sep 2017 11:47:04 -0000 [ https://issues.apache.org/jira/browse/KARAF-5362?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Jean-Baptiste Onofr=C3=A9 updated KARAF-5362: ---------------------------------------- Component/s: karaf-documentation > 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-documentation, karaf-shell > Affects Versions: 4.1.2 > Reporter: Emily Berk > Assignee: Jean-Baptiste Onofr=C3=A9 > Priority: Trivial > > The javadoc for {{SessionFactory#create(InputStream, PrintStream, PrintSt= ream)}} says > {code:java} > @param in the input stream, can be null if the session is on= ly 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 { > =20 > @Test > public void createWithNullInputStream() throws UnsupportedEncodingExc= eption { > final SessionFactory sessionFactory =3D new SessionFactoryImpl(cr= eateMock(ThreadIO.class)); > sessionFactory.create(null, createMock(PrintStream.class), create= Mock(PrintStream.class)); > } > } > {code} > I get > {code} > java.lang.NullPointerException: "in" is null! > =09at java.nio.channels.Channels.checkNotNull(Channels.java:67) > =09at java.nio.channels.Channels.newChannel(Channels.java:347) > =09at org.apache.felix.gogo.runtime.CommandSessionImpl.(CommandSess= ionImpl.java:108) > =09at org.apache.felix.gogo.runtime.CommandProcessorImpl.createSession(Co= mmandProcessorImpl.java:82) > =09at org.apache.felix.gogo.runtime.CommandProcessorImpl.createSession(Co= mmandProcessorImpl.java:38) > =09at org.apache.karaf.shell.impl.console.HeadlessSessionImpl.(Head= lessSessionImpl.java:67) > =09at org.apache.karaf.shell.impl.console.SessionFactoryImpl.create(Sessi= onFactoryImpl.java:155) > =09at org.apache.karaf.shell.impl.console.SessionFactoryImpl.create(Sessi= onFactoryImpl.java:146) > =09at org.apache.karaf.shell.impl.console.SessionFactoryImplTest.createWi= thNullInputStream(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)