question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with " " (white space) for adding user hotspot

See original GitHub issue

Relates to https://github.com/GideonLeGrange/mikrotik-java/issues/3

Environment:

<dependency>
    <groupId>me.legrange</groupId>
    <artifactId>mikrotik</artifactId>
    <version>3.0.1</version>
</dependency>

Router OS 6.35.4

hAP lite RB941-2nD-TC

The code WITH With Space:

connection.execute(String.format("/ip/hotspot/user/add name=%s password=%s profile=%s", "rudi wijaya", "rudi wijaya", "default"));

and I got error:

me.legrange.mikrotik.MikrotikApiException: unknown parameter
    at me.legrange.mikrotik.impl.ApiConnectionImpl$SyncListener.getResults(ApiConnectionImpl.java:471)
    at me.legrange.mikrotik.impl.ApiConnectionImpl$SyncListener.access$100(ApiConnectionImpl.java:425)
    at me.legrange.mikrotik.impl.ApiConnectionImpl.execute(ApiConnectionImpl.java:110)
    at me.legrange.mikrotik.impl.ApiConnectionImpl.execute(ApiConnectionImpl.java:68)
    at com.rudiwijaya.payment.dao.MikroTikManagerImpl.createUserHotspot(MikroTikManagerImpl.java:78)
    at com.rudiwijaya.payment.dao.MikroTikManagerTest.addUserHotspot(MikroTikManagerTest.java:50)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: me.legrange.mikrotik.impl.ApiCommandException: unknown parameter
    at me.legrange.mikrotik.impl.ApiConnectionImpl$Processor.run(ApiConnectionImpl.java:257)

If mycode (with NO White Space):

connection.execute(String.format("/ip/hotspot/user/add name=%s password=%s profile=%s","rudiwijaya", "rudiwijaya", "default"));

There was no problem…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
GideonLeGrangecommented, Jun 23, 2016

Both of these work for me.

       con.execute("/ip/hotspot/user/add name=\"rudi wijaya\" password=\"rudi wijaya\" profile=default");

       con.execute(String.format("/ip/hotspot/user/add name=\"%s\" password=\"%s\" profile=default", "rudi wijaya", "rudi wijaya"));
2reactions
GideonLeGrangecommented, Jun 23, 2016

I don’t think this is related to #3, I think it is the same as #33 , which wasn’t a bug.

You need to handle string quoting, like so:

connection.execute(String.format("/ip/hotspot/user/add name=\"%s\" password=\"%s\" profile=%s", "rudi wijaya", "rudi wijaya", "default")); 

The command that will then be generated will be:

/ip/hotspot/user/add name="rudi wijaya" password="rudi wijaya" profile=default

Let me know if that solves it please.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reduce unnecessary white space on some androids #353
Screenshots are from a community member in discord: On an android, it appears that there is too much white space all around (or...
Read more >
Dynamic Hotspot Clustering Using White Space - JMEST
Abstract—The proliferation of smart phones is growing demand anywhere wireless access to data in our daily life. This issue of the increasing.
Read more >
whitespace problem - Microsoft Community
This users potation contain users name such as "Mahabir Das". This name should be contain whitespace. How to remove this white space? Image....
Read more >
(PDF) Clustering over TV White Space in Dense Wireless Areas
This paper, presents a novel technique to solve the problem of lack spectrum in dense areas using a clustering approach.
Read more >
(PDF) Clustering over TV White Space in Dense Wireless Areas
In addition, it enables frequency reuse without causing interference, ... The TV mentioned problem using a clustering white-space (TVWS) are present on the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found