mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-24 05:39:44 +00:00
[AB-246] fixing new lines being removed from parameters
creating javadoc profile to only build javadoc on release builds
This commit is contained in:
@@ -35,7 +35,7 @@ public class AChannelParameterHandlerImpl implements AChannelParameterHandler {
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
TextChannel textChannel = (TextChannel) textChannelParameterHandler.handle(input, iterators, param, context, command);
|
||||
if(textChannel == null) {
|
||||
Long channelId = Long.parseLong((String) input.getValue());
|
||||
Long channelId = Long.parseLong(((String) input.getValue()).trim());
|
||||
AChannel actualInstance = channelManagementService.loadChannel(channelId);
|
||||
return AChannel.builder().fake(true).id(actualInstance.getId()).build();
|
||||
} else {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class AUserInAServerParameterHandlerImpl implements AUserInAServerParamet
|
||||
Member member = (Member) o;
|
||||
actualInstance = userInServerManagementService.loadOrCreateUser(member);
|
||||
} else {
|
||||
Long userId = Long.parseLong((String) input.getValue());
|
||||
Long userId = Long.parseLong(((String) input.getValue()).trim());
|
||||
actualInstance = userInServerManagementService.loadAUserInAServerOptional(context.getGuild().getIdLong(), userId).orElseThrow(() -> new UserInServerNotFoundException(0L));
|
||||
}
|
||||
future.complete(AUserInAServer.builder().userInServerId(actualInstance.getUserInServerId()).build());
|
||||
|
||||
@@ -18,7 +18,7 @@ public class BooleanParameterHandlerImpl implements BooleanParameterHandler {
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
return Boolean.valueOf((String) input.getValue());
|
||||
return Boolean.valueOf(((String) input.getValue()).trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ChannelGroupParameterHandlerImpl implements ChannelGroupParameterHa
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
AServer server = serverManagementService.loadServer(context.getGuild().getIdLong());
|
||||
String inputString = (String) input.getValue();
|
||||
String inputString = ((String) input.getValue()).trim();
|
||||
AChannelGroup actualInstance = channelGroupManagementService.findByNameAndServerOptional(inputString, server)
|
||||
.orElseThrow(() -> new ChannelGroupNotFoundException(inputString, channelGroupManagementService.getAllAvailableAsString(server)));
|
||||
ChannelGroupType channelGroupType = ChannelGroupType
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ChannelGroupTypeParameterHandlerImpl implements ChannelGroupTypePar
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
ChannelGroupType actualGroupType = channelGroupTypeManagementService.findChannelGroupTypeByKey((String) input.getValue());
|
||||
ChannelGroupType actualGroupType = channelGroupTypeManagementService.findChannelGroupTypeByKey(((String) input.getValue()).trim());
|
||||
return ChannelGroupType
|
||||
.builder()
|
||||
.groupTypeKey(actualGroupType.getGroupTypeKey())
|
||||
|
||||
@@ -20,7 +20,7 @@ public class CommandKeyParameterHandlerImpl implements CommandKeyParameterHandle
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
return CommandParameterKey.getEnumFromKey(param.getType(), (String) input.getValue());
|
||||
return CommandParameterKey.getEnumFromKey(param.getType(), ((String) input.getValue()).trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,7 @@ public class DoubleParameterHandlerImpl implements DoubleParameterHandler {
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
return Double.parseDouble((String) input.getValue());
|
||||
return Double.parseDouble(((String) input.getValue()).trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ public class DurationParameterHandlerImpl implements DurationParameterHandler {
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
return ParseUtils.parseDuration((String) input.getValue());
|
||||
return ParseUtils.parseDuration(((String) input.getValue()).trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,7 @@ public class EmoteParameterHandlerImpl implements EmoteParameterHandler {
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
String inputString = (String) input.getValue();
|
||||
String inputString = ((String) input.getValue()).trim();
|
||||
Matcher matcher = Message.MentionType.EMOTE.getPattern().matcher(inputString);
|
||||
if(matcher.matches() && iterators.getEmoteIterator().hasNext()) {
|
||||
return iterators.getEmoteIterator().next();
|
||||
|
||||
@@ -19,7 +19,7 @@ public class IntegerParameterHandlerImpl implements IntegerParameterHandler {
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
return Integer.parseInt((String) input.getValue());
|
||||
return Integer.parseInt(((String) input.getValue()).trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@ public class LongParameterHandlerImpl implements LongParameterHandler {
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
return Long.parseLong((String) input.getValue());
|
||||
return Long.parseLong(((String) input.getValue()).trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ public class MemberParameterHandlerImpl implements MemberParameterHandler {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Object> handleAsync(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
String inputString = (String) input.getValue();
|
||||
String inputString = ((String) input.getValue()).trim();
|
||||
Matcher matcher = Message.MentionType.USER.getPattern().matcher(inputString);
|
||||
if(matcher.matches() && iterators.getMemberIterator().hasNext()) {
|
||||
return CompletableFuture.completedFuture(iterators.getMemberIterator().next());
|
||||
|
||||
@@ -24,7 +24,7 @@ public class RoleParameterHandlerImpl implements RoleParameterHandler {
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
String inputString = (String) input.getValue();
|
||||
String inputString = ((String) input.getValue()).trim();
|
||||
Matcher matcher = Message.MentionType.ROLE.getPattern().matcher(inputString);
|
||||
if(matcher.matches() && iterators.getRoleIterator().hasNext()) {
|
||||
return iterators.getRoleIterator().next();
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TextChannelParameterHandlerImpl implements TextChannelParameterHand
|
||||
|
||||
@Override
|
||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||
String inputString = (String) input.getValue();
|
||||
String inputString = ((String) input.getValue()).trim();
|
||||
Matcher matcher = Message.MentionType.CHANNEL.getPattern().matcher(inputString);
|
||||
if(matcher.matches() && iterators.getChannelIterator().hasNext()) {
|
||||
return iterators.getChannelIterator().next();
|
||||
|
||||
@@ -51,12 +51,6 @@ public class BooleanParameterHandlerImplTest extends AbstractParameterHandlerTes
|
||||
Assert.assertFalse((Boolean)testUnit.handle(piece, null, parameter, null, command));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullInput() {
|
||||
UnparsedCommandParameterPiece piece = getPieceWithValue(null);
|
||||
Assert.assertFalse((Boolean)testUnit.handle(piece, null, parameter, null, command));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyStringAsInput() {
|
||||
UnparsedCommandParameterPiece piece = getPieceWithValue("");
|
||||
|
||||
@@ -54,11 +54,6 @@ public class DurationParameterHandlerImplTest extends AbstractParameterHandlerTe
|
||||
Assert.assertEquals(targetDuration, testUnit.handle(getPieceWithValue("5h5m4d"), null, parameter, null, command));
|
||||
}
|
||||
|
||||
@Test(expected = DurationFormatException.class)
|
||||
public void testNullInput() {
|
||||
testUnit.handle(getPieceWithValue(null), null, parameter, null, command);
|
||||
}
|
||||
|
||||
@Test(expected = DurationFormatException.class)
|
||||
public void testEmptyStringAsInput() {
|
||||
testUnit.handle(getPieceWithValue(""), null, parameter, null, command);
|
||||
|
||||
@@ -60,11 +60,6 @@ public class IntegerParameterHandlerImplTest extends AbstractParameterHandlerTes
|
||||
testUnit.handle(getPieceWithValue("someText"), null, parameter, null, command);
|
||||
}
|
||||
|
||||
@Test(expected = NumberFormatException.class)
|
||||
public void testNullInput() {
|
||||
testUnit.handle(getPieceWithValue(null), null, parameter, null, command);
|
||||
}
|
||||
|
||||
@Test(expected = NumberFormatException.class)
|
||||
public void testEmptyStringAsInput() {
|
||||
testUnit.handle(getPieceWithValue(""), null, parameter, null, command);
|
||||
|
||||
@@ -59,11 +59,6 @@ public class LongParameterHandlerImplTest extends AbstractParameterHandlerTest {
|
||||
testUnit.handle(getPieceWithValue("someText"), null, parameter, null, command);
|
||||
}
|
||||
|
||||
@Test(expected = NumberFormatException.class)
|
||||
public void testNullInput() {
|
||||
testUnit.handle(getPieceWithValue(null), null, parameter, null, command);
|
||||
}
|
||||
|
||||
@Test(expected = NumberFormatException.class)
|
||||
public void testEmptyStringAsInput() {
|
||||
testUnit.handle(getPieceWithValue(""), null, parameter, null, command);
|
||||
|
||||
Reference in New Issue
Block a user