Skip to content

Commit

Permalink
Fixed OSGI Shell broken in 00bbae0
Browse files Browse the repository at this point in the history
- optional packages, not provided - they serve as an alternative
- cleanup
- without previous commit it was impossible to find the bug - in fact there
  were two:
  - enhanceForTarget originally returned it's parameter, not null
  - inaccessible imports

Signed-off-by: David Matějček <dmatej@seznam.cz>
  • Loading branch information
dmatej committed Apr 13, 2022
1 parent b865744 commit 9742548
Show file tree
Hide file tree
Showing 12 changed files with 678 additions and 386 deletions.
5 changes: 3 additions & 2 deletions nucleus/common/common-util/osgi.bundle
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ Bundle-Activator: org.glassfish.common.util.CommonUtilsActivator
com.sun.enterprise.util.zip; \
com.sun.logging; \
org.glassfish.admin.payload; \
org.glassfish.common.util.admin; \
org.glassfish.common.util; \
org.glassfish.quality; \
org.glassfish.common.util.admin; \
org.glassfish.common.util.io; \
org.glassfish.common.util.timer; \
org.glassfish.quality; \
org.glassfish.security.common; \
com.sun.logging.enterprise.system.core; \
org.glassfish.server; version=${project.osgi.version}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.glassfish.common.util.io;

import java.io.IOException;
import java.io.InputStream;

/**
* Input stream which doesn't contain anything.
*
* @author David Matejcek
*/
public class EmptyInputStream extends InputStream {

@Override
public int read() throws IOException {
return -1;
}


@Override
public int available() throws IOException {
return 0;
}


@Override
public int read(final byte[] b) throws IOException {
return -1;
}


@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
return -1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.glassfish.common.util.io;

import java.io.IOException;
import java.io.OutputStream;


/**
* Ignores all input, so is always empty.
*
* @author David Matejcek
*/
public class EmptyOutputStream extends OutputStream {

@Override
public void write(int b) throws IOException {
return;
}


@Override
public void write(byte[] b) throws IOException {
return;
}


@Override
public void write(byte[] b, int off, int len) throws IOException {
return;
}
}

0 comments on commit 9742548

Please sign in to comment.