JitPack + ProGuard with Gradle

I want the Jar made available by JitPack to be compiled by Proguard.

I have set the Proguard Task to be generated as a dependency of the jar.

task myProguardTask(type: proguard.gradle.ProGuardTask) {
    configuration 'proguard.conf'

    // make all runtime-dependencies available while obfruscating
    configurations.runtime.resolve().each {
        libraryjars file(it.getAbsolutePath())

    injars 'build/libs/shadow-' + project.version.toString() + '.jar'
    outjars 'build/libs/proak-integration-' + project.version.toString() + '.Final.jar'

jar.dependsOn shadowJar
jar.dependsOn myProguardTask

myProguardTask.mustRunAfter shadowJar

The log from JitPack shows the tasks being called:

Getting a list of gradle tasks
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all
Found javadoc task
Running: gradle clean -Pgroup=com.github.mataide -Pversion=0.9.2 -xtest install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all
:clean UP-TO-DATE
Note: there were 2049 duplicate class definitions.


But the JitPack don’t provide the Jar compiled by Proguard.

How do I start a job after guice application starts

I am writing a REST application, that uses guice for DI. I have a method that I need to call as soon as the application is started and initialized.

From what Ive read, seems like the object is instantiated only when it is requested (like an http call made). However, I want an object instantiated and one of its method called, even before I can serve any http requests. This method basically starts a thread and does some work in the background.

I tried marking it as eager singleton, but still the dependencies inside the method are null.

I am not sure how do I achieve this. Any pointers?

JDateChooser make action when you select date automatically only one time

the thing is that i’m using in Customize Code the next code:

DachBuscar.getDateEditor().addPropertyChangeListener(new java.beans.PropertyChangeListener(){
    public void propertyChange(java.beans.PropertyChangeEvent evt){
        System.out.println("Hello World");

but when i do click on the JDateChooser and i select the date, it make the action 5 times and of corse that is slower because i’m using an sql consult and that method is used 5 times, i only want to make that code 1 time, and also i thing the number of times that the method execute its more and more because i try to patch this with if and a int variable increasing each time that the method execute to use it only one time but it doesn’t make effect

How to read from this IntStream object?

I understand the exception. I don’t know if I am on the right track at all. I want to use the Scanner object to read from the IntStream object.

This code:

package foo;

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class bar {

    public static void main(String[] args) {
        int[] input = {1,2,3,4,5,6,7,8,9,10};       
        IntStream intStream = Arrays.stream(input);
        Scanner scanner = new Scanner((Readable) intStream); // crashes here        

Yields this runtime error:

Exception in thread "main" java.lang.ClassCastException: java.util.stream.IntPipeline$Head cannot be cast to java.lang.Readable
    at gorp.bar.main(bar.java:12)

Should functional interfaces be called directly?

I built a few classes that implement functional interfaces so that they can be reused, these include Predicates, Functions, etc.

These work great when I pass a new instance into a collection stream, for example:

myList.stream().filter(new PrimeNumberPredicate())...

Today I found an engineer on my team trying to reuse a predicate by creating and calling a predicate directly:

boolean result = new PrimeNumberPredicate().test(myData);

I find this code a bit verbose, and I’d like to ask if there is another way to write this so that I could do the test without explicitly calling test() on a single object.

Android custom app bar underneath system default

My MainActivity.xml is as below:

<?xml version="1.0" encoding="utf-8"?>

    android:layout_height="match_parent" />

    app:menu="@menu/activity_appbar_drawer" />






                android:text="@string/tab_text_1" />

                android:text="@string/tab_text_2" />

                android:text="@string/tab_text_3" />



        app:layout_behavior="@string/appbar_scrolling_view_behavior" >



My intention is to have an appbar with navigation drawer (icon on left), and options menu (icon on right). However, it appears to be stuck underneath the system default. Here is an image showing its preview:

Android Studio Preview

Additionally, my styles.xml is:


<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

<style name="AppTheme.NoActionBar" parent="AppTheme">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />


Changing AppCompat.Light.DarkActionBar to NoActionBar has no effect. The appbar with “AppName” just remains above the other appbar (which should show “BEEP” as text, in addition to the two icons for navbar and options menu) – NoActionBar is also defined in the manifest for the activity:

            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

Here is the relevant part of the MainActivity.java, if needed:

protected void onCreate(Bundle savedInstanceState) {


    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);

    mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
    tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
   ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);

So, how can I get the toolbar (ID is “toolbar”) to display instead of the default appbar that currently contains the text “AppName” in the above image? I also followed https://developer.android.com/training/appbar/setting-up.html however there is no change in the result.

VMware vCenter API exception:The request refers to an unexpected or unknown type?

The console shows exception:”The request refers to an unexpected or unknown type” when I create a cluster.please help me. code shows the following:

 ManagedObjectReference data = getDatacenterByName2("Datacenter");
 String name = "cluster_hi";
 ClusterConfigSpec spec = new ClusterConfigSpec(); 
 ClusterDasConfigInfo value = new ClusterDasConfigInfo(); 
 vimPort.createCluster(data, name, spec); 

Exception in thread “main” javax.xml.ws.soap.SOAPFaultException:
The request refers to an unexpected or unknown type.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)

at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:119)

at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)

at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)

at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)
at com.sun.proxy.$Proxy35.createCluster(Unknown Source)

at com.huawei.robo.common.vcenterclient.VcenterClientImpl.main(VcenterClientImpl.java:162)

Java eventbus that works on Android and GWT?

My application uses native java for android development and GWT for web (and MOE for ios). I need an EventBus for communication within the core code that gets compiled to each of these platforms.

I’ve tried guava’s and greenrobot’s event bus, but they don’t work for GWT. I’ve tried GWT’s event bus, but I can’t seem to use it in the core module that is used as a library for the various platforms (not sure if it wont work, or if I just can’t figure out how to set it up correctly with gradle).

I’m wondering if there are any other good libraries for this, or even just sample code if I have to roll my own. The main features I need are (1) be able to define custom event classes that can have their own data, and (2) be able to register generic event handlers (for example, guava and greenrobot allow listeners to register on a base event class and be notified for events of child types).

SAML authentication in Azure AD via Java struts web application

In one of the java struts based web projects, I have implemented SSO (Single-sign-on) using SAML authentication, using picketlink library, deployed on Jboss AS 7.1. Its working without any issues.

I need to implement the SSO in another Struts based web project, running on Tomcat 7. The IDP in this case is Azure AD. I have followed the steps given in the article SAML with Tomcat and PicketLink. I have also configured the application in Azure AD. The IDP and SP URLs are mentioned in the picketlink conif file as follows:

<PicketLink xmlns="urn:picketlink:identity-federation:config:2.1">
<PicketLinkSP xmlns="urn:picketlink:identity-federation:config:2.1" BindingType="POST">
<Handlers xmlns="urn:picketlink:identity-federation:handler:config:2.1">
    <Handler class="org.picketlink.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler" />
    <Handler class="org.picketlink.identity.federation.web.handlers.saml2.SAML2LogOutHandler" />
    <Handler class="org.picketlink.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler">
        <Option Key="ROLE_KEY" Value="http://schemas.microsoft.com/ws/2008/06/identity/claims/role"/>
    <Handler class="org.picketlink.identity.federation.web.handlers.saml2.RolesGenerationHandler" />

I have mentioned the SAML-P endpoint that I got from Azure AD against the configured application in the above file.


Its not working after making all these changes. It looks like I need to get the certificate from the federation-metadata file and follow some steps to enable SSL and to make it ready for SAML to understand. I could not do this.
I do not know if my path is correct. Can you please give me a sample program or steps to complete this task.