Questions tagged [java]

Java (not to be confused with JavaScript or JScript or JS) is a general-purpose object-oriented programming language designed to be used in conjunction with the Java Virtual Machine (JVM). "Java platform" is the name for a computing system that has installed tools for developing and running Java ...

1
vote
0answers
10 views

Same string representation results in different outcome

I am currently facing an issue which is driving me nuts: The following code snippet is the wrapping part to send a request to Facebook to create a new post. This works fine for directly posted and ...
0
votes
0answers
2 views

Submit a post xml request to webservice hosted on weblogic and get a response xml from client request

I am trying to send post requests to a webservice that is in weblogic. I am using soapui to make the requests, this tool structures me the object that I have to send to XML format, but when I send the ...
1
vote
1answer
10 views

Java Servlet doPost() returning null from Postman

I am doing a simple Java Servlet POST request without using any HTML and only using Postman. And the response from getParameter() is always null. Here is the servlet: @WebServlet("/api/form") public ...
0
votes
0answers
4 views

AIDL implementation for Protobuf genarated object

I have use case as follows, my custom object is generated from Protobuf. I would like to use these protobuf generated class as parameter for AIDL implementations. Since protobuf doesn't use ...
-1
votes
0answers
5 views

Map backend messages to frontend ones

I am trying to understand how to implement a mapping between backend messages and frontend displayed ones. The backend is build with Java 1.8 and Spring Boot 2.0. The frontend is build with Angular 5. ...
1
vote
0answers
9 views

How to add header and footer on itext pdf page

I want to add Header and page number in itext pdf page when creating multiple copy of existing pdf. Code example Document document = new Document(PageSize.A4,30,30,40,40); PdfCopy ...
2
votes
0answers
15 views

Java 8 - throw multiple generic checked exceptions in lambda

In a project I am working at, I have found a class which wraps all methods of its super-class in some elaborate exception handling. It looks similar to that: public void method1() throws ExceptionA { ...
0
votes
0answers
11 views

Change ImageView as per user input

I'm using Numberpicker in which I'm taking input of String. public final String Branch[] = {"Branch","Comp", "Civil", "Mech", "Chem", "EnTC"}; I'm sending this data in Firebase. In other ...
0
votes
0answers
2 views

Unable to load component class org.sonar.batch.bootstrap.BatchPluginInstaller

I'm running Jenkins ver 2.89.2 with SonarQube Scanner plugin ver 2.4 When running the scanner for MSBuild, it appears to be working, I see lines such as this in my logs: Downloading from http://...
0
votes
0answers
9 views

GridView not showing correct height when parent item resized

Why is it that whenever my GridView height inside a CardView is stretched to beyond its contents? Even though none of the android:layout_height instances are set to match_parent. XML <?xml ...
-1
votes
1answer
14 views

Do not throw IllegalArgument Exception when canceling dialog box

I am working on a game involving betting which will not allow the user to input negative numbers, or a number more than their balance: code: int bet = 0; boolean cont = true; int userBalance ...
0
votes
1answer
12 views

Mockito verify constructor calls method

I'm trying to test when the Game class is instantiated, that the start method is called. However I get the following error: Wanted but not invoked: game.start(); Actually, there were zero ...
0
votes
1answer
14 views

Copy Database table data to text file without looping recordset

Is it possible to get the result set data to single string (for writing to notepad)? Using record set we need to loop through each fields. Is there any other way we can get to a single string without ...
-1
votes
0answers
13 views

a for loop that add's to a Long[] and uses Long[i--] as a variable [duplicate]

public static void main(String[] args) { Long initialTime = System.currentTimeMillis(); Long[] longList = {}; for (int i = 0; i <= 150; i++) { if (i == 0) { longList[...
0
votes
0answers
10 views

What happens with transaction when repository is called from completable future supply method?

My question is: how will transaction behave in a code like this? @Transactional(propagation = Propagation.REQUIRES_NEW) public void test(List<Long> ids) { List<CompletableFuture> list ...
0
votes
0answers
6 views

Is there a way to specify a JsonView to a final class in Java?

Basically, I need to be able to specify a JsonView annotation on a class that has been declared final and of which I cannot change. If the class were not final, I could just extend it and add the ...
0
votes
0answers
8 views

Disable Maximum Inheritance Depth in sonar

I have a problem with disabling the issue "Maximum Inheritance Depth". In the sonar rule description it is written that its squid is: "squid:MaximumInheritanceDepth". So, in my POM i have: <sonar....
0
votes
0answers
9 views

Attempt to invoke virtual method 'void android.media.MediaPlayer.start()

I'm Making and Audio Player and Have Fetched All Audio files with their paths but on starting Media Player It gives me Null Pointer Exception. here is My Code. where mSongs is Array list Which ...
-1
votes
2answers
22 views

Reading and Writing to a file in java

So i'm currently working on a challenge program for fun. the challenge is to read an array from a file located in the working directory, reversing the array, and writing it back to an output file. Can ...
-1
votes
1answer
22 views

How to filter out empty or null values using java 8? [duplicate]

I have a parameter map and I am trying to build the complete url by appending the request parameters to the url. Following code is what I have done so far to extract key values from the parameter ...
0
votes
0answers
5 views

Software connection abort: socket write error Tomcat8

So i'm trying to deploy my war to tomcat8 server, first i start tomcat by startup.bat at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager....
1
vote
0answers
7 views

Spring HATEOAS error handling with VndErrors

I am struggling to find a clean way of handling errors produced by an HATEOAS enabled api. Basically our backend service is a spring application that in case of exceptions uses @ControllerAdvice to ...
0
votes
2answers
51 views

Don't duplicate character - Java

I'm trying to have the program print out an error if the character inputted has already been used. If you check the else If statement, it technically runs but I don't want it to print each time. Only ...
-9
votes
0answers
13 views

How to extract English words from Wiktionary using its apis [on hold]

Please I need thousands of English words for an Android app I'm working on. I found Wiktionary to be a good source for my app, but I don't know how to go about it
0
votes
0answers
11 views

Java Jackson XML Deserialize

I get this XML response from an external service and I want to deserialize it to a pojo. <?xml version="1.0" encoding="utf-8"?> <string xmlns="">67890</string> I am trying to use ...
0
votes
1answer
13 views

Angular 1.7.2/Spring Boot - Infinite template loading when include navbar and footer

My project was migrated from Thymeleaf to Angular. Navbar and footer is being included from another files on all pages. What is interesting - navbar/footer works on most of pages, without Home Page, ...
-2
votes
0answers
27 views

Java: scanning hasNextLine and iterate field

This code works so far, but the problem is that after entering the age, the field stops to iterate and nothing is showing up, till the moment when I am finally entering the lastname (it shows "id"). I ...
-7
votes
0answers
45 views

Cannot evaluate method toString() - throws NPE [duplicate]

I am trying to figure out what is wrong? this is my Map class: private Tile[][] tiles; private int time; public Map(int width, int height){ tiles = new Tile[height][width]; time = 0; ...
0
votes
0answers
5 views

Hangout chat to a bot doesn't post the message to pub/sub

I followed the steps in https://developers.google.com/hangouts/chat/how-tos/bots-publish If I post to a topic through google console https://console.cloud.google.com/cloudpubsub/topics/ But chatting ...
1
vote
0answers
9 views

TestNG instance initialization doesn't work when application is deployed as jar file.

I have looked through every blog/forum but unable to solve this. A simple project, On button click declare testNG instance and run it. This works when project is run in eclipse. But after exporting ...
0
votes
2answers
18 views

Gradle: Task with path not found in project

I have a gradle project with the following structure: rootDir |--agent-v1.0.0 |--agent.jar |--proj1 |-- // other project files |--build.gradle |--proj2 |-- // other project files |--...
0
votes
0answers
18 views

No recipient addresses javax.mail

I'm trying to send an E-Mail using Java (Java 10), but i have this error: javax.mail.SendFailedException: No recipient addresses at javax.mail.Transport.send0(Transport.java:154) at javax.mail....
0
votes
0answers
11 views

ElasticSearch - How to group by date and get most relevant document

I have following structure of a document: id url text summary publish_date I would like to group by publish_date (daily) and then rank the ones that are on the same date based on term relevancy (in ...
0
votes
0answers
7 views

Getting error under webpack execution for the frontend maven plugin

I am following this tutorial on how to create a Spring Boot app with ReactJS. <plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</...
-7
votes
2answers
52 views

Why do some objects initilize themselves? [on hold]

FileSearchApp.java package com.example.filesearch; public class FileSearchApp { String path; String regex; public static void main(String[] args) { FileSearchApp app = new ...
1
vote
1answer
34 views

How to convert spring-boot request parameter [duplicate]

Currently a request method receives a encoded token as parameter (this token is a String but not JSON or anything like that). This token then gets decoded to a data class. @GetMapping(value = "/api/...
-3
votes
0answers
24 views

I have a list view in android on the click of item from a list how do i display its content from sqllite? [on hold]

I'm a Beginner in Android I have created a list view and I need to take the data (it can be 200 to 400 lines) from an SQLite database and display it in its fragments.
0
votes
0answers
13 views

JPA @JoinColumns should still join rows when one column is null

I have 2 tables: First one has id, column1, column2, column3. Second one has id, column1, column2, column4. Respective entity for the first one: @Entity public class FirstEntity { @Id ...
-3
votes
1answer
32 views

Generate Unique Random Number in Java help of ArrayList

I am trying to generate unique random number every time. For checking it, `ArrayList<Integer> randomNumbers = new ArrayList<>(); int letterIndex; do { Random ...
0
votes
2answers
43 views

Converting JSON string to object returns “Expected BEGIN_ARRAY but was STRING”

I have a JSON response coming back from my server in the format: [ { "id": "one", "values": { "name": "John", } }, { "id": "two", "...
0
votes
1answer
9 views

switching to loader using locationListener

I'm doing a Udacity Android Basics course and am trying to change my app to use a Loader rather than AsyncTask. My app uses a locationListener to generate a custom URL that is then passed to the ...
0
votes
1answer
8 views

Unable to load rJava.dll - not a valid Win32 application - while installing ReporteRsjars

I am having problems installing ReporteRsjars package on my 64 bit R, 64 bit Windows 10 machine. The ReporteRsjars package was downloaded from the CRAN archive (tar.gz file) and installed from a local ...
1
vote
1answer
20 views

Running Tomcat 9 with SpringBoot-App as a service with Ubuntu 18.04

actually I'm not able to run a Tomcat9-WebApp properly. I'd be thankful for any help pointing me in the right direction. Setup: OS: Ubuntu 18.04 App-Server: Tomcat 9.0.12 (also tested with 8.5.34) ...
-4
votes
0answers
37 views

java regular expression for cellphone

public String makePhoneNumber(String phoneNum) { String regEx = "^[0-9]-*[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$"; if(!phoneNum.matches(regEx)){ phoneNum = phoneNum....
1
vote
0answers
15 views

When generating JavaDocs during a Maven Site Deploy, a MalformedInputException error is thrown

The organization I work in uses a RAML tool as a way of building API documentation. This documentation is included with the JavaDocs as an additional resource that makes up a full Maven site for our ...
1
vote
2answers
32 views

adding fragment to xml crashes my app - how to fix that?

it's my first time dealing with fragments in android. and for some reason my app crashes when i try to add fragment tag to my main activity. i know there is a lot of questions similar to mine but i ...
-4
votes
0answers
23 views

Login not working after upgrade to java 1.8.181 [duplicate]

We have an application where we have external and internal users.Internal users use Company credentials to login and external users have their own. After Java 1.8.181 update internal users are not ...
1
vote
0answers
19 views

Swagger code generation java, XML attributes

I'm fairly new to swagger and struggling for a while now. I'm using the maven swagger codegen plugin (groupId: io.swagger.codegen.v3, artifactId: swagger-codegen-maven-plugin, version: 3.0.0): <...
2
votes
1answer
24 views

Replace a specific symbol in the end of yyyy-MM-dd pattern using regex in Java

I have a string, which contains dates in yyyy-MM-dd format along with other symbols. Some of these dates contains the 'Z' symbol at the end. For example: control1970-04-26Z_shifted1982-02-...
2
votes
1answer
45 views

Map C++ structure to Java Structure

I am trying to call C++ function present within a dll file,C++ function takes structure object as parameter and function will assign values to it. I am making use this through Java native calls and my ...