Re: How to restrict access to sun.misc.Unsafe when using PaxExam ?

2017-11-23 Thread Christian Schneider
Do you maybe use boot delegation?

Christian

2017-11-23 11:06 GMT+01:00 'Norman Maurer' via OPS4J :

> Hmm I do not export it... Can I somehow see "who" export it ?
> I only run the unit test and add my bundle to the config thats it.
>
>
> Am Donnerstag, 23. November 2017 11:00:02 UTC+1 schrieb Achim Nierbeck:
>>
>> Hi,
>>
>> first of all, if you don't have a bundle or system-fragment-bundle
>> exporting sun.misc* it won't be available at all.
>> As per default the framework itself only provides following packages
>> (defined per spec):
>> java.*
>> As you can see here[1]
>> some more are per default exported. But sun.misc isn't one of them.
>> So unless you don't have any special setup sun.misc shouldn't be
>> available to your setup :)
>>
>> regards, Achim
>>
>> [1] - https://github.com/apache/felix/blob/trunk/framework/src/
>> main/resources/default.properties#L711-L865
>>
>> 2017-11-23 10:54 GMT+01:00 'Norman Maurer' via OPS4J <
>> op...@googlegroups.com>:
>>
>>> Hi all,
>>>
>>> I am trying to use @RunWith(PaxExam.class) and restrict the access to
>>> sun.misc.Unsafe while doing this. I want to do this to write a unit that
>>> ensure we are still able to init a class when sun.misc.Unsafe is not
>>> present. Any idea how to do this ? So far I could not find any way to do so.
>>>
>>> This is the issue I want to write a unit test for:
>>>
>>> https://github.com/netty/netty/pull/7432
>>>
>>> Thanks
>>>
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - op...@googlegroups.com
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OPS4J" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ops4j+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Apache Member
>> Apache Karaf  Committer & PMC
>> OPS4J Pax Web  Committer
>> & Project Lead
>> blog 
>> Co-Author of Apache Karaf Cookbook 
>>
>> Software Architect / Project Manager / Scrum Master
>>
>> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-- 
Christian Schneider
http://www.liquid-reality.de


Computer Scientist
http://www.adobe.com

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to restrict access to sun.misc.Unsafe when using PaxExam ?

2017-11-23 Thread 'Achim Nierbeck' via OPS4J
Hi,

you could write a little test and do look for which bundle actually exports
that package.

for example with the following code you'll find all exports of all bundles
;)


List bundleWirings = Arrays.stream(bundleContext.getBundles())
.map(bundle ->
bundle.adapt(BundleWiring.class)).collect(Collectors.toList());

List exportedPackages = (List) bundleWirings.stream()
.map(bundleWiring ->
bundleWiring.getCapabilities("osgi.wiring.package"))
.flatMap(bundleCapabilities -> bundleCapabilities.stream())
.map(bundleCapability ->
bundleCapability.getAttributes().get("osgi.wiring.package"))
.map(o -> ((String) o))
.distinct()
.collect(Collectors.toList());


It should be straight forward to have a filter and a print out for the
bundle that does it ;)

regards, Achim

2017-11-23 11:06 GMT+01:00 'Norman Maurer' via OPS4J :

> Hmm I do not export it... Can I somehow see "who" export it ?
> I only run the unit test and add my bundle to the config thats it.
>
>
> Am Donnerstag, 23. November 2017 11:00:02 UTC+1 schrieb Achim Nierbeck:
>>
>> Hi,
>>
>> first of all, if you don't have a bundle or system-fragment-bundle
>> exporting sun.misc* it won't be available at all.
>> As per default the framework itself only provides following packages
>> (defined per spec):
>> java.*
>> As you can see here[1]
>> some more are per default exported. But sun.misc isn't one of them.
>> So unless you don't have any special setup sun.misc shouldn't be
>> available to your setup :)
>>
>> regards, Achim
>>
>> [1] - https://github.com/apache/felix/blob/trunk/framework/src/
>> main/resources/default.properties#L711-L865
>>
>> 2017-11-23 10:54 GMT+01:00 'Norman Maurer' via OPS4J <
>> op...@googlegroups.com>:
>>
>>> Hi all,
>>>
>>> I am trying to use @RunWith(PaxExam.class) and restrict the access to
>>> sun.misc.Unsafe while doing this. I want to do this to write a unit that
>>> ensure we are still able to init a class when sun.misc.Unsafe is not
>>> present. Any idea how to do this ? So far I could not find any way to do so.
>>>
>>> This is the issue I want to write a unit test for:
>>>
>>> https://github.com/netty/netty/pull/7432
>>>
>>> Thanks
>>>
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - op...@googlegroups.com
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OPS4J" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ops4j+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Apache Member
>> Apache Karaf  Committer & PMC
>> OPS4J Pax Web  Committer
>> & Project Lead
>> blog 
>> Co-Author of Apache Karaf Cookbook 
>>
>> Software Architect / Project Manager / Scrum Master
>>
>> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Apache Member
Apache Karaf  Committer & PMC
OPS4J Pax Web  Committer &
Project Lead
blog 
Co-Author of Apache Karaf Cookbook 

Software Architect / Project Manager / Scrum Master

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to restrict access to sun.misc.Unsafe when using PaxExam ?

2017-11-23 Thread 'Norman Maurer' via OPS4J
Hmm I do not export it... Can I somehow see "who" export it ?
I only run the unit test and add my bundle to the config thats it.


Am Donnerstag, 23. November 2017 11:00:02 UTC+1 schrieb Achim Nierbeck:
>
> Hi, 
>
> first of all, if you don't have a bundle or system-fragment-bundle 
> exporting sun.misc* it won't be available at all. 
> As per default the framework itself only provides following packages 
> (defined per spec): 
> java.* 
> As you can see here[1]
> some more are per default exported. But sun.misc isn't one of them.
> So unless you don't have any special setup sun.misc shouldn't be available 
> to your setup :) 
>
> regards, Achim
>
> [1] - 
> https://github.com/apache/felix/blob/trunk/framework/src/main/resources/default.properties#L711-L865
>
> 2017-11-23 10:54 GMT+01:00 'Norman Maurer' via OPS4J <
> op...@googlegroups.com >:
>
>> Hi all,
>>
>> I am trying to use @RunWith(PaxExam.class) and restrict the access to 
>> sun.misc.Unsafe while doing this. I want to do this to write a unit that 
>> ensure we are still able to init a class when sun.misc.Unsafe is not 
>> present. Any idea how to do this ? So far I could not find any way to do so.
>>
>> This is the issue I want to write a unit test for:
>>
>> https://github.com/netty/netty/pull/7432
>>
>> Thanks
>>
>> -- 
>> -- 
>> --
>> OPS4J - http://www.ops4j.org - op...@googlegroups.com 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ops4j+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Apache Member
> Apache Karaf  Committer & PMC
> OPS4J Pax Web  Committer & 
> Project Lead
> blog 
> Co-Author of Apache Karaf Cookbook 
>
> Software Architect / Project Manager / Scrum Master 
>
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to restrict access to sun.misc.Unsafe when using PaxExam ?

2017-11-23 Thread 'Norman Maurer' via OPS4J
Hi all,

I am trying to use @RunWith(PaxExam.class) and restrict the access to 
sun.misc.Unsafe while doing this. I want to do this to write a unit that 
ensure we are still able to init a class when sun.misc.Unsafe is not 
present. Any idea how to do this ? So far I could not find any way to do so.

This is the issue I want to write a unit test for:

https://github.com/netty/netty/pull/7432

Thanks

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.