java.lang.IllegalArgumentException: No line matching interface Clip is supported - java

Nearly 1 month my program worked fine, but today im getting the error above when starting it.
The error comes up in this line:
sounds.put(key, (Clip)AudioSystem.getLine(new Line.Info(Clip.class)));
I have no idea why.
After i read the accepted answer here, i reinstalled eclipse, deleted metadata and so on, but the error still comes up.
The code is to 100% right, but any way ill post the code near the error:
protected SoundArchive(String soundArchive, boolean debugFrame){
f = new File(this.getClass().getResource("../" + soundArchive).toString().substring(5)).listFiles();
sounds = new HashMap<String, Clip>();
try{
for(int i = 0; i < f.length; i++){
String key = f[i].toString().split("\\\\")[f[i].toString().split("\\\\").length - 1].split("\\.")[0];
sounds.put(key, (Clip)AudioSystem.getLine(new Line.Info(Clip.class)));
sounds.get(key).open(AudioSystem.getAudioInputStream(f[i]));
}
}
catch(Exception e){
e.printStackTrace(System.out);
}
if(debugFrame) debugFrame();
}
So, does anyone know what i have to do now? I've my back to the wall....

Related

Assertion failure in NSEvent?

thanks for taking the time to read this. I'm fairly new to JavaFX and have a weird error in my compiler that I would like some insight on.
Here's the error:
2018-09-13 19:09:36.387 java[8040:660455] unrecognized type is 4294967295
2018-09-13 19:09:36.387 java[8040:660455] *** Assertion failure in -[NSEvent _initWithCGEvent:eventRef:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1652/AppKit.subproj/NSEvent.m:1969
Here is the code I am working with:
This is in a .java file named applicationSettings
public static double lookupUser(String name, String password) throws IOException {
InputStream inputStream = applicationSettings.class.getResourceAsStream("/files/users.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
Integer lastRow = sheet.getPhysicalNumberOfRows();
int currentRow = 1;
while(currentRow < lastRow) {
if(sheet.getRow(currentRow).getCell(0).getStringCellValue().toLowerCase().equals(name.toLowerCase())) {
if(sheet.getRow(currentRow).getCell(1).getStringCellValue().toLowerCase().equals(password.toLowerCase())) {
double accessLevel = sheet.getRow(currentRow).getCell(2).getNumericCellValue();
System.out.println(accessLevel);
return accessLevel;
}
}
currentRow++;
}
return 4.0;
}
}
This is in a .java file named loginScreen
EventHandler<ActionEvent> loginClicked = new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
double userFound = 0.0;
try {
userFound = applicationSettings.lookupUser(usernameField.getText(), passwordField.getText());
} catch (IOException e) {
e.printStackTrace();
}//END of Try/Catch
if(userFound == 1.0) { //1 is Admin Access
//TODO: Implement Login
System.out.println("Admin Login");
errorLabel.setVisible(false);
}else if(userFound == 2.0){ //2 is Elevated Access
//TODO: Elevated Access
System.out.println("Elevated Login");
errorLabel.setVisible(false);
}else if(userFound == 3.0){
//TODO: Basic Access
System.out.println("Basic Login");
errorLabel.setVisible(false);
}else{//Show Error
errorLabel.setVisible(true);
//TODO: Show Error
}//End If Statement
}
};
My Excel File is basically structured like this:
NAME PASSWORD ACCESS LEVEL
So for my login it would be like:
Trey Carey March3199; 1
This isn't going anywhere besides by church where it's not really doing anything besides automating some tedious tasks, so security isn't an issue.
Also, if there's anyway I can clean up some of these if statements and my code in general I would appreciate any tips or help!
Edit 2 13.11.2018:
This bug has been officially fixed now in JavaFX 12, was backported to JDK8 and approved to be backported to JFX 11. You can have a look at the bug report to find more information about it.JDK-8211304 Here is a link to the changes they've made. openjfx I'm personally not sure about the current license situation of JDK8 so I would advise to switch to the newest OpenJDK and OpenJFX if possible.
Hey there I'm experiencing the same issue you have and I can constantly reproduce it. The issue appears for me on JavaFX on macOS 10.14. You can simply create an application with a button that opens a second stage. If you invoke stage.showAndWait() (could be related to anything that holds the thread) on the second stage and then switch focus between different applications (I just alt-tab between my JavaFX app and Safari), the JavaFX Application crashes. Also reproducible in any IDE.
I actually found a bug report on the OpenJDK/OpenJFX bug tracker but there isn't much going on at the moment. JDK-8211137 Mac: JVM Crash due to uncaught exception
I don't have a solution yet as I'm having troubles pinning down the exact problem but I found a workaround that works in my specific case.
Edit:
If I'm using "stage.show()" I'm only getting the error but when using stage.showAndWait() or anything that does some kind of waiting loop, the application completely crashes.

Java show me long error but missing in my log file

Hi all I know its a stupid question but I'm trying everything.
My game server show me a very long error which is too long for console and can see the top of it, but it is missing from my log and I can't see the details of this error.
Can somebody help me on how can I capture that error:
private void fix(L2PcInstance pl, int playerPoints)
{
try
{
IAchievement arc = Achievements.getInstance().GetAchivment(_id, pl.getAchivmentLevelbyId(_id) + 1);
if ((arc != null) && (playerPoints > arc.getNeedPoints()))
{
Achievements.getInstance().reward(pl, arc);
fix(pl, playerPoints);
}
}
catch (Exception e)
{
_log.error(getClass().getSimpleName() + ": Error in fix: " + e);
}
}
the error
the line 96 is
fix(pl, playerPoints);
but the error is missing from my log im try to capture the console to txt file from command
java myserver.jar > capturemyconsole.txt but again it's showing error in console that the txt is missing. How is this possible ? Thanks for your time and help :)
and sorry for my bad english :(
You method fix calls itself, with the same arguments, causing stack overflow...
Should add some modification to the arguments, or some more condition to the recursion...
You can catch "Error" instead of "Exception" and then log
[...] catch (Error e)
{
_log.error(getClass().getSimpleName() + ": Error in fix: " + e, e);
}
In Your current code StackOverflowException (which is not a child of Exception) is propagated without going into catch block. Remember to put additional "e" parameter to log full stacktrace.
It's not a good practice to catch Error, but it'll answer Your question.
More info: try/catch on stack overflows in java?

Parsing Google ignoring the Error using JSOUP

I am working on a simple crawler. I can parse google using jsoup, no problem. But sometimes crawling some word gives error.I like the jsoup not to stop but ignore the error and keep giving me the output. I tried like following but it gives the same result as the google result is always same. Please give me a solution.
String GOOGLE_SEARCH_URL = "https://www.google.com/search";
String searchURL = GOOGLE_SEARCH_URL + "?q=" + word + "&num=" + 4;
for(int m =0; m <4;m++){
try {
Document doc = Jsoup.connect(searchURL).userAgent("Mozilla/5.0").get();
Elements results = doc.select("h3.r > a");
..........
.........
}
catch (HttpStatusException e) {
continue;
}
}
Result:
conn built
Success
Enter a word
far
http://www.merriam-webster.com/dictionary/far
Count of [far] is : 71
http://www.farmanager.com/
Count of [far] is : 7
.....repeat
If I don't use try catch the error is:
http://www.thefreedictionary.com/far
Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=403, URL=http://www.thefreedictionary.com/_/403.aspx?p
..........
to be honest, I don't like to use for loop but is there any way just ignore some site and keep giving me the results?

Java ProgramCall.run hangs

Busy trying to Call RPG function from Java and got this example from JamesA. But now I am having trouble, here is my code:
AS400 system = new AS400("MachineName");
ProgramCall program = new ProgramCall(system);
try
{
// Initialise the name of the program to run.
String programName = "/QSYS.LIB/LIBNAME.LIB/FUNNAME.PGM";
// Set up the 3 parameters.
ProgramParameter[] parameterList = new ProgramParameter[2];
// First parameter is to input a name.
AS400Text OperationsItemId = new AS400Text(20);
parameterList[0] = new ProgramParameter(OperationsItemId.toBytes("TestID"));
AS400Text CaseMarkingValue = new AS400Text(20);
parameterList[1] = new ProgramParameter(CaseMarkingValue.toBytes("TestData"));
// Set the program name and parameter list.
program.setProgram(programName, parameterList);
// Run the program.
if (program.run() != true)
{
// Report failure.
System.out.println("Program failed!");
// Show the messages.
AS400Message[] messagelist = program.getMessageList();
for (int i = 0; i < messagelist.length; ++i)
{
// Show each message.
System.out.println(messagelist[i]);
}
}
// Else no error, get output data.
else
{
AS400Text text = new AS400Text(50);
System.out.println(text.toObject(parameterList[1].getOutputData()));
System.out.println(text.toObject(parameterList[2].getOutputData()));
}
}
catch (Exception e)
{
//System.out.println("Program " + program.getProgram() + " issued an exception!");
e.printStackTrace();
}
// Done with the system.
system.disconnectAllServices();
The application Hangs at this lineif (program.run() != true), and I wait for about 10 minutes and then I terminate the application.
Any idea what I am doing wrong?
Edit
Here is the message on the job log:
Client request - run program QSYS/QWCRTVCA.
Client request - run program LIBNAME/FUNNAME.
File P6CASEL2 in library *LIBL not found or inline data file missing.
Error message CPF4101 appeared during OPEN.
Cannot resolve to object YOBPSSR. Type and Subtype X'0201' Authority
FUNNAME insert a row into table P6CASEPF through a view called P6CASEL2. P6CASEL2 is in a different library lets say LIBNAME2. Is there away to maybe set the JobDescription?
Are you sure FUNNAME.PGM is terminating and not hung with a MSGW? Check QSYSOPR for any messages.
Class ProgramCall:
NOTE: When the program runs within the host server job, the library list will be the initial library list specified in the job description in the user profile.
So I saw that my problem is that my library list is not setup, and for some reason, the user we are using, does not have a Job Description. So to over come this I added the following code before calling the program.run()
CommandCall command = new CommandCall(system);
command.run("ADDLIBLE LIB(LIBNAME)");
command.run("ADDLIBLE LIB(LIBNAME2)");
This simply add this LIBNAME, and LIBNAME2 to the user's library list.
Oh yes, the problem is Library list not set ... take a look at this discussion on Midrange.com, there are different work-around ...
http://archive.midrange.com/java400-l/200909/msg00032.html
...
Depe

Android / Java : GC_CONCURENT when creating many String's

I'm blocking with a problem from a few days. I've found some similar posts but still didn't understanding the problem of my code.
In fact, I'm reading a file (18,4Kbytes) which is containing SQL queries. So the only thing I want to do is read the file and execute the queries.
I've no problem reading the file, the problem occurs when after having executed all the queries (if I don't execute it, it works but it's not the deal!)
So here's my code (between try / catch for IO Exception):
InputStream in = ctx.getAssets().open("file.sql");
ByteArrayBuffer queryBuff = new ByteArrayBuffer(in.available());
String query = null;
int curent;
while (-1 != (curent = in.read())) {
queryBuff.append((char) curent);
if (((char) curent) == ';') {
query = new String(queryBuff.toByteArray());
db.execSQL(query);
queryBuff.clear();
query = null;
}
}
in.close();
queryBuff.clear();
And my GC_CONCURENT occurs when there is "new String" in the loop, after the end of the loop.
Thanks !
EDIT :
I'm a little annoyed, because my memory-leak didn't occurs in this part of code but in a part of code executed laterly (don't know what for now) but my problem wasn't a problem, app worked properly in fact...
Sorry !

Categories