Maven transitiive dependecy downloading multiple jars version with same group id and artifact id

I am facing some weired behavior with maven transitive dependencies for multi module project.

I have 3 modules in all three modules httpclient is transitive dependency coming from some common jar.This common jar is used as parent across the platform.If we want to change version ,group id ,artifact id etc then we will change in common jar so that all modules referenced from this common jar will have latest changes.If we do dependency tree for httpclient on common jar also it is showing 4.5.3 dependency only.

mvn dependency:tree -Dverbose -Dincludes=org.apache.httpcomponents:httpclient

Now my issue is module 1 and module 2 is downloading latest httpclient
jar[4.5.3] but module 3 is downloading older httpclient [4.5.2] jar
from common jar.Since the 4.5.3 and 4.5.2 is having common artifact
and group id how can we figure out which jar from common is causing
4.5.2 to download.

I have posted another question in followng link which can be a reference link.

How to get mvn dependecy tree to filter dependencies with specific version

All modules have common transitive parent.

Any one came across this kind of issue can help me to figure out.
TIA

Spring data rest pagination working only for some repositories

I have a Spring boot application exposing various entities via REST and I am trying to integrate the built in pagination with my client application. I am using Spring Data Rest to generate my REST interface, but it seems that the pagination works only for some repositories.

The following request works fine and returns the page information:

/users?page=0&size=5:

{
  "_embedded" : {
    ...
  },
  "_links" : {
    ...
  },
  "page" : {
    "size" : 5,
    "totalElements" : 12,
    "totalPages" : 3,
    "number" : 0
  }
}

with the following repository:

@Repository
public interface UserRepository extends JpaRepository<User, Long> {

  @Override
  Page<User> findAll(Pageable pageable);

}

But when trying the same request (/users/1/devices), it does not return the page information in the request (it returns the entities in HAL/JSON format but does not contain page information).

The repository is identical:

@Repository
public interface DeviceRepository extends JpaRepository<Device, Long> {

  @Override
  Page<Device> findAll(Pageable pageable);
}

Does anyone have an idea what is going on?

Import module when run pyhon script in java

I’m trying to run python script with java ,the script have library but java can’t find it ,the script works with no problems with pycharm ide.

Java code

ProcessBuilder pb = new ProcessBuilder("/home/user/Python-3.6.3/python", "/home/user/PycharmProjects/myproject/App.py");
       pb.redirectErrorStream(true);
       Process proc = pb.start();

       Reader reader = new InputStreamReader(proc.getInputStream());
       int ch;
       while ((ch = reader.read()) != -1) {
           System.out.print((char) ch);
       }
       reader.close();

error in eclipse console

  File "/home/user/PycharmProjects/myproject/App.py", line 5, in <module>
import pypff
ModuleNotFoundError: No module named 'pypff'

Check array if unique element

I have an array which contains the numbers Wish[] list = {1,2,2}; and now I wanna check if it has a unique element..
I figured out a for loop but it does not work :
`

    public Wunsch nextUniqueWish() {

       Wish isUnique = null;
       for (int j = 0; j < list.length; j++) {
           for (int k = j+1;k<list.length;k++) {
               if (list[k]==list[j]) {
                   isUnique = list[j];

            }

    }

Add additional xpath line to an initialized object

I have an initialized objects already in class. I need to add another line for those. So example I have public static By username = By.xpath("//*[@id='username']");

I need to add another line in that object: /following-sibling::*[contains(text(),'"+message+"')] where message can be different every time.

NOTE: It should be in object. NNOT in webElement.

Height and width must be greater than 0?

I am trying to create whiteboard type application using fragments. But, I am having problem in height whenever fragments called height is always zero but this code is working perfect in activities. When onSizeChanged function called height is always 0. Please see the code and error below

getting this error

FATAL EXCEPTION: main
          Process: com.example.ebmacs.vickyy.kids, PID: 5781
          java.lang.IllegalArgumentException: width and height must be > 0
              at android.graphics.Bitmap.createBitmap(Bitmap.java:829)
              at android.graphics.Bitmap.createBitmap(Bitmap.java:808)
              at android.graphics.Bitmap.createBitmap(Bitmap.java:775)
              at com.example.ebmacs.vickyy.kids.Classes.PaintView.onSizeChanged(PaintView.java:82)
              at android.view.View.sizeChange(View.java:16748)
              at android.view.View.setFrame(View.java:16710)
              at android.view.View.layout(View.java:16627)
              at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
              at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
              at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
              at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
              at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
              at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
              at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
              at android.widget.ScrollView.onLayout(ScrollView.java:1525)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
              at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1732)
              at android.widget.LinearLayout.onLayout(LinearLayout.java:1497)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
              at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
              at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
              at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
              at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
              at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
              at android.view.View.layout(View.java:16630)
              at android.view.ViewGroup.layout(ViewGroup.java:5437)
              at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2171)
              at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1931)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1

this is code where i get error

 @Override
public void onSizeChanged(int widthContentView, int heightContentView, int oldWidth, int oldHeight) {
    super.onSizeChanged(widthContentView, heightContentView, oldWidth, oldHeight);
    this.bitmap = Bitmap.createBitmap(widthContentView,heightContentView, Bitmap.Config.ARGB_8888);
    this.canvas = new Canvas(bitmap);
}

How to register a servlet filter in Spring MVC application without Initializer

I made a simple servlet filter to slow the responses of my app down:

import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class DelayFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {}

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
        Integer seconds = 10;
        try {
            Thread.sleep(seconds * 1000);
        } catch (InterruptedException e) {
            throw new ServletException("Interrupted!");
        }
        HttpServletResponse response = (HttpServletResponse) resp;
        response.setHeader("Cache-Control", "no-cache, must-revalidate");
        chain.doFilter(req, resp);
    }

    @Override
    public void destroy() {}
}

I read a bunch of articles to register it for the app like this: enter link description here
Usually there are two methods of registering, one for using web.xml and one for programmatic configuration. The Application I have to work with doesn’t use the XML, but neither have any initializer class. Configuration ist done with a Config Class strating like this:

@Configuration
@EnableWebMvc
@EnableAsync
@EnableTransactionManagement
@EnableSpringConfigured
@PropertySource("classpath:config/application.properties")
public class ApplicationConfiguration extends WebMvcConfigurerAdapter {

So I made a initializer

import javax.servlet.Filter;

public class arachneInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses () {
        return null;
    }

    @Override
    protected Class<?>[] getServletConfigClasses () {
        return new Class<?>[]{ApplicationConfiguration.class};
    }

    @Override
    protected String[] getServletMappings () {
        return new String[]{"/"};
    }

    @Override
    protected Filter[] getServletFilters() {
        return new Filter[] {
            new DelayFilter()
        };
    }
}

I am not sure, if this is correct or will it change they way my Application acts? Everything seems to be normal at a first glance though.
But the filter does not kick in! Any ideas what I did wrong or suggestion how I can add the filter maybe without an Initializer?

@NotNull for Double in XML Parsing

I need to validate the structure of an XML in input using JSR-303 annotations. So I want my XML to contain all the required tags, and I accept if the XML tags contain no value at all.
So there must be all the tags and they can be empty.

The problem is that if @NotNull annotation works well for Strings (so I can have the xml tag without value in it), for Double variables I cannot use it, because if I empty the tag, it returns me the error like I delete the tag also.

For istance:

<extTag>
  <myString>Hello</myString>   -> @NotNull String myString; -> OK!
</extTag>

<extTag>
  <myString></myString>        -> @NotNull String myString; -> OK!
</extTag>

<extTag>
                               -> @NotNull String myString; -> ERROR!
</extTag>

For Double I would like to have the same control, but when the value is null I get the error!

<extTag>
  <myDouble>12.00</myDouble>   -> @NotNull Double myDouble; -> OK!
</extTag>

<extTag>
  <myDouble></myDouble>        -> @NotNull Double myDouble; -> ERROR!
</extTag>

<extTag>
                               -> @NotNull Double myDouble; -> ERROR!
</extTag>

I can I get the same behaviour od strings for Double variables using annotations?