auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void checkLiteralEvaluatedButNotUsed(@NotNull AnnotationHolder holder, @NotNull PsiElement element, String message) { PsiElement parent = element.getParent(); if (element instanceof GoFunctionLit) { if (parent instanceof GoCallExpr) return; } else if (element instanceof GoStringLiteral || element instanceof GoLiteral) { if (parent instanceof GoIndexOrSliceExpr || parent instanceof GoConditionalExpr) { return; } } parent = PsiTreeUtil.getParentOfType(element, GoLeftHandExprList.class, GoArgumentList.class); if (parent == null) return; if (parent instanceof GoArgumentList) return; if (parent instanceof GoLeftHandExprList && ((GoLeftHandExprList)parent).getExpressionList().size() != 1) { return; } if (element instanceof GoFunctionLit) { element = ((GoFunctionLit)element).getFunc(); } else { if (parent.getParent().getParent() instanceof GoSwitchStatement) return; } holder.createErrorAnnotation(element, message + " literal evaluated but not used"); }

Target:
private static void checkLiteralEvaluatedButNotUsed(@NotNull AnnotationHolder holder, @NotNull PsiElement element, String message) { PsiElement parent = element.getParent(); if (element instanceof GoFunctionLit) { if (parent instanceof GoCallExpr) return; } else if (element instanceof GoStringLiteral || element instanceof GoLiteral) { if (parent instanceof GoIndexOrSliceExpr || parent instanceof GoConditionalExpr) { return; } } parent = PsiTreeUtil.getParentOfType(element, GoLeftHandExprList.class, GoArgumentList.class); if (parent == null) return; if (parent instanceof GoArgumentList) return; if (parent instanceof GoLeftHandExprList && ((GoLeftHandExprList)parent).getExpressionList().size() != 1) { return; } if (element instanceof GoFunctionLit) { element = ((GoFunctionLit)element).getFunc(); } else if (parent.getParent().getParent() instanceof GoSwitchStatement) { return; } holder.createErrorAnnotation(element, message + " literal evaluated but not used"); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((registry == null) ? 0 : registry.hashCode()); result = prime * result + ((version == null) ? 0 : version.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hash(getRegistry(), getId(), getVersion()); }
Source:
private <R extends Row,T> ListenableFuture<Object> issueRowRequest( final Row row, final Batch.Callback<T> callback, final Object[] results, final int index) { LOG.trace("issueRowRequest(Row, Batch.Callback, Object[], index"); SettableFuture<Object> resultFuture = SettableFuture.create(); results[index] = null; ListenableFuture<? extends GeneratedMessage> future = null; try { future = issueRequest(row); } catch (InterruptedException e) { future = Futures.immediateFailedFuture(e); } Futures.addCallback(future, new RpcResultFutureCallback<T, GeneratedMessage>( row, callback, index, results, resultFuture, ROW_RESULT_CONVERTER), service); return resultFuture; }

Target:
private <R extends Row, T> ListenableFuture<Object> issueRowRequest(final Row row, final Batch.Callback<T> callback, final Object[] results, final int index) throws InterruptedException { LOG.trace("issueRowRequest(Row, Batch.Callback, Object[], index"); SettableFuture<Object> resultFuture = SettableFuture.create(); results[index] = null; ListenableFuture<? extends GeneratedMessage> future = issueRequest(row); Futures.addCallback(future, new RpcResultFutureCallback<T, GeneratedMessage>( row, callback, index, results, resultFuture, ROW_RESULT_CONVERTER), service); return resultFuture; }
Source:
public void sendAdvertisedRefs(RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { if (advertiseError != null) { adv.writeOne("ERR " + advertiseError); return; } try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(CAPABILITY_SIDE_BAND_64K); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); if (allowQuiet) adv.advertiseCapability(CAPABILITY_QUIET); String nonce = getPushCertificateParser().getAdvertiseNonce(); if (nonce != null) { adv.advertiseCapability(nonce); } if (db.getRefDatabase().performsAtomicTransactions()) adv.advertiseCapability(CAPABILITY_ATOMIC); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); if (allowPushOptions) { adv.advertiseCapability(CAPABILITY_PUSH_OPTIONS); } adv.advertiseCapability(OPTION_AGENT, UserAgent.get()); Map<String, Ref> advertisedOrDefaultRefs = getAdvertisedOrDefaultRefs(); if (advertisedOrDefaultRefs != null) { adv.send(advertisedOrDefaultRefs.values()); } for (ObjectId obj : advertisedHaves) adv.advertiseHave(obj); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }

Target:
public void sendAdvertisedRefs(RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { if (advertiseError != null) { adv.writeOne("ERR " + advertiseError); return; } try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(CAPABILITY_SIDE_BAND_64K); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); if (allowQuiet) adv.advertiseCapability(CAPABILITY_QUIET); String nonce = getPushCertificateParser().getAdvertiseNonce(); if (nonce != null) { adv.advertiseCapability(nonce); } if (db.getRefDatabase().performsAtomicTransactions()) adv.advertiseCapability(CAPABILITY_ATOMIC); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); if (allowPushOptions) { adv.advertiseCapability(CAPABILITY_PUSH_OPTIONS); } adv.advertiseCapability(OPTION_AGENT, UserAgent.get()); adv.send(getAdvertisedOrDefaultRefs().values()); for (ObjectId obj : advertisedHaves) adv.advertiseHave(obj); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }
Source:
private static @Nullable Long nullableNumberToLong(@Nullable Number number) { if (number == null) { return null; } return Long.valueOf(number.longValue()); }

Target:
private static @Nullable Long nullableNumberToLong(@Nullable Number number) { return number == null ? null : Long.valueOf(number.longValue()); }
Source:
private boolean hasEditableFields() { Stack<Control> stack = new Stack<>(); stack.push(this); while (!stack.isEmpty()) { Control currentCtrl = stack.pop(); if ((currentCtrl.style & SWT.READ_ONLY) != 0) { return false; } if (currentCtrl instanceof Composite) { for (Control child : ((Composite) currentCtrl).getChildren()) { stack.push(child); } } } return true; }

Target:
private boolean hasEditableFields() { Stack<Control> stack = new Stack<>(); stack.push(this); while (!stack.isEmpty()) { Control currentCtrl = stack.pop(); if ((currentCtrl instanceof StyledText || currentCtrl instanceof Text || currentCtrl instanceof Combo) && (currentCtrl.style & SWT.READ_ONLY) == 0) { return true; } if (currentCtrl instanceof Composite) { for (Control child : ((Composite) currentCtrl).getChildren()) { stack.push(child); } } } return false; }
Source:
private Consumer<Future<String>> assertAllLocksAcquiredCorrectly() { return result -> { try { String assertionError = result.get( SECONDS_TO_RUN * 100, TimeUnit.SECONDS ); if ( assertionError != null ) { fail( assertionError ); } } catch ( InterruptedException | ExecutionException | TimeoutException e ) { throw Exceptions.launderedException( e ); } }; }

Target:
private Consumer<Future<String>> assertAllLocksAcquiredCorrectly() { return result -> { try { String assertionError = result.get( SECONDS_TO_RUN * 100, TimeUnit.SECONDS ); if ( assertionError != null ) { fail( assertionError ); } } catch ( InterruptedException | ExecutionException | TimeoutException e ) { throw new RuntimeException( e ); } }; }
Source:
public synchronized Set<LongRange> getRangeSet(final String evalId, final String dataType) { if (!mapIdDatatypeRange.containsKey(evalId)) { return null; } final Map<String, TreeSet<LongRange>> mapDatatypeRange = mapIdDatatypeRange.get(evalId); if (!mapDatatypeRange.containsKey(dataType)) { return null; } return new TreeSet<>(mapDatatypeRange.get(dataType)); }

Target:
public synchronized Set<LongRange> getRangeSet(final String evalId, final String dataType) { if (!evalPartitions.containsKey(evalId)) { LOG.log(Level.WARNING, "The evaluator {0} does not exist.", evalId); return new TreeSet<>(); } final Map<String, TreeSet<LongRange>> evalDataTypeRanges = evalPartitions.get(evalId); if (!evalDataTypeRanges.containsKey(dataType)) { LOG.log(Level.WARNING, "The evaluator {0} does not contain any data whose type is {1}.", new Object[]{evalId, dataType}); return new TreeSet<>(); } return new TreeSet<>(evalDataTypeRanges.get(dataType)); }
Source:
private void testHelper(final SAMRecordSetBuilder samRecordSetBuilder, final SAMFileHeader.SortOrder sortOrder, final boolean presorted) throws Exception { final File bamFile = File.createTempFile("test.", BamFileIoUtils.BAM_FILE_EXTENSION); bamFile.deleteOnExit(); try (final SamReader samReader = samRecordSetBuilder.getSamReader()) { samReader.getFileHeader().setSortOrder(sortOrder); try (final SAMFileWriter bamWriter = new SAMFileWriterFactory().makeSAMOrBAMWriter(samReader.getFileHeader(), presorted, bamFile); final CloseableIterator<SAMRecord> it = samReader.iterator()) { while (it.hasNext()) { bamWriter.addAlignment(it.next()); } } } if (presorted) { verifyBAMFile(samRecordSetBuilder, bamFile); } File tempMetrics = File.createTempFile("CGTagTest", ".validation_metrics"); try (final SamReader samReader = SamReaderFactory.makeDefault().open(bamFile)) { new SamFileValidator(new PrintWriter(new FileOutputStream(tempMetrics)), 100).validateSamFileSummary(samReader, null); } final MetricsFile<SamFileValidator.ValidationMetrics, String> validationMetrics = new MetricsFile<>(); validationMetrics.read(new FileReader(tempMetrics)); Assert.assertTrue(validationMetrics.getHistogram().get("ERROR:CG_TAG_FOUND_IN_ATTRIBUTES") == null); }

Target:
private void testHelper(final SAMRecordSetBuilder samRecordSetBuilder, final SAMFileHeader.SortOrder sortOrder, final boolean presorted) throws Exception { final File bamFile = File.createTempFile("test.", BamFileIoUtils.BAM_FILE_EXTENSION); bamFile.deleteOnExit(); try (final SamReader samReader = samRecordSetBuilder.getSamReader()) { samReader.getFileHeader().setSortOrder(sortOrder); try (final SAMFileWriter bamWriter = new SAMFileWriterFactory().makeSAMOrBAMWriter(samReader.getFileHeader(), presorted, bamFile); final CloseableIterator<SAMRecord> it = samReader.iterator()) { while (it.hasNext()) { bamWriter.addAlignment(it.next()); } } } if (presorted) { verifyBAMFile(samRecordSetBuilder, bamFile); } final File tempMetrics = File.createTempFile("CGTagTest", ".validation_metrics"); try ( final SamReader samReader = SamReaderFactory.makeDefault().open(bamFile); final OutputStream outputStream = new FileOutputStream(tempMetrics); final PrintWriter printWriter = new PrintWriter(outputStream)) { new SamFileValidator(printWriter, 100).validateSamFileSummary(samReader, null); } final MetricsFile<SamFileValidator.ValidationMetrics, String> validationMetrics = new MetricsFile<>(); validationMetrics.read(new FileReader(tempMetrics)); Assert.assertNull(validationMetrics.getHistogram().get("ERROR:CG_TAG_FOUND_IN_ATTRIBUTES")); }
Source:
public long getLong() { return (long) 0; }

Target:
public long getLong() { return 0L; }
Source:
public static URI createRestURI(final String commonURL, final String matrixId, final int row, final int col, final WMTSLayerParam layerParam) throws URISyntaxException { String path = layerParam.baseURL; if (layerParam.dimensions != null) { for (int i = 0; i < layerParam.dimensions.length; i++) { String dimension = layerParam.dimensions[i]; final String value = layerParam.dimensionParams.getString(dimension.toUpperCase()); path = path.replace("{" + dimension + "}", value); } } path = path.replace("{TileMatrixSet}", layerParam.matrixSet); path = path.replace("{TileMatrix}", matrixId); path = path.replace("{TileRow}", String.valueOf(row)); path = path.replace("{TileCol}", String.valueOf(col)); return new URI(path); }

Target:
public static URI createRestURI(final String commonURL, final String matrixId, final int row, final int col, final WMTSLayerParam layerParam) throws URISyntaxException { String path = layerParam.baseURL; if (layerParam.dimensions != null) { for (int i = 0; i < layerParam.dimensions.length; i++) { String dimension = layerParam.dimensions[i]; final String value = layerParam.dimensionParams.getString(dimension.toUpperCase()); path = path.replace("{" + dimension + "}", value); } } path = path.replace("{TileMatrixSet}", layerParam.matrixSet); path = path.replace("{TileMatrix}", matrixId); path = path.replace("{TileRow}", String.valueOf(row)); path = path.replace("{TileCol}", String.valueOf(col)); path = path.replace("{style}", layerParam.style); return new URI(path); }
Source:
public CompletableFuture<ClientResponse> submit(final ClientInvocation request) { HttpMethod method; try { method = HttpMethod.valueOf(request.getMethod()); } catch (IllegalArgumentException e) { method = HttpMethod.OTHER; } Object entity = request.getEntity(); Buffer body; if (entity != null) { body = Buffer.buffer(requestContent(request)); } else { body = null; } RequestOptions options = new RequestOptions(); MultiMap headers = MultiMap.caseInsensitiveMultiMap(); request.getHeaders().asMap().forEach(headers::add); options.setHeaders(headers); if (body != null) { headers.set(HttpHeaders.CONTENT_LENGTH, "" + body.length()); } options.addHeader(HttpHeaders.USER_AGENT.toString(), "Vertx"); URI uri = request.getUri(); options.setHost(uri.getHost()); options.setPort(uri.getPort()); options.setURI(uri.getRawPath()); CompletableFuture<ClientResponse> future = new CompletableFuture<>(); HttpClientRequest clientRequest = httpClient.request(method, options, response -> { future.complete(toRestEasyResponse(request.getClientConfiguration(), response)); }); if (method == HttpMethod.OTHER) { clientRequest.setRawMethod(request.getMethod()); } clientRequest.exceptionHandler(future::completeExceptionally); if (body != null) { clientRequest.end(body); } else { clientRequest.end(); } return future; }

Target:
private CompletableFuture<ClientResponse> submit(final ClientInvocation request) { HttpMethod method; try { method = HttpMethod.valueOf(request.getMethod()); } catch (IllegalArgumentException e) { method = HttpMethod.OTHER; } Object entity = request.getEntity(); Buffer body; if (entity != null) { body = Buffer.buffer(requestContent(request)); } else { body = null; } RequestOptions options = new RequestOptions(); MultiMap headers = MultiMap.caseInsensitiveMultiMap(); request.getHeaders().asMap().forEach(headers::add); options.setHeaders(headers); if (body != null) { headers.set(HttpHeaders.CONTENT_LENGTH, "" + body.length()); } options.addHeader(HttpHeaders.USER_AGENT.toString(), "Vertx"); URI uri = request.getUri(); options.setHost(uri.getHost()); options.setPort(uri.getPort()); options.setURI(uri.getRawPath()); CompletableFuture<ClientResponse> future = new CompletableFuture<>(); @SuppressWarnings("deprecation") HttpClientRequest clientRequest = httpClient.request(method, options, response -> { future.complete(toRestEasyResponse(request.getClientConfiguration(), response)); }); if (method == HttpMethod.OTHER) { clientRequest.setRawMethod(request.getMethod()); } Object timeout = request.getConfiguration().getProperty(REQUEST_TIMEOUT_MS); if (timeout != null) { long timeoutMs = unwrapTimeout(timeout); if (timeoutMs > 0) { clientRequest.setTimeout(timeoutMs); } } clientRequest.exceptionHandler(future::completeExceptionally); if (body != null) { clientRequest.end(body); } else { clientRequest.end(); } return future; }
Source:
private static PGPPublicKeyRingCollection readPubRing(final File pub) { try { InputStream in = new FileInputStream(pub); try { return new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(in)); } finally { in.close(); } } catch (IOException e) { throw new ProvisionException("Cannot read " + pub, e); } catch (PGPException e) { throw new ProvisionException("Cannot read " + pub, e); } }

Target:
private static PGPPublicKeyRingCollection readPubRing(final File pub) { try { InputStream in = new FileInputStream(pub); try { in = PGPUtil.getDecoderStream(in); return new PGPPublicKeyRingCollection(in); } finally { in.close(); } } catch (IOException e) { throw new ProvisionException("Cannot read " + pub, e); } catch (PGPException e) { throw new ProvisionException("Cannot read " + pub, e); } }
Source:
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) { if (unsubscribed) { return Subscriptions.unsubscribed(); } action = RxAndroidPlugins.getInstance().getSchedulersHook().onSchedule(action); ScheduledAction scheduledAction = new ScheduledAction(action, handler); Message message = Message.obtain(handler, scheduledAction); message.obj = this; synchronized (this) { if (unsubscribed) { return Subscriptions.unsubscribed(); } handler.sendMessageDelayed(message, unit.toMillis(delayTime)); } return scheduledAction; }

Target:
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) { if (unsubscribed) { return Subscriptions.unsubscribed(); } action = RxAndroidPlugins.getInstance().getSchedulersHook().onSchedule(action); ScheduledAction scheduledAction = new ScheduledAction(action, handler); Message message = Message.obtain(handler, scheduledAction); message.obj = this; handler.sendMessageDelayed(message, unit.toMillis(delayTime)); if (unsubscribed) { handler.removeCallbacks(scheduledAction); return Subscriptions.unsubscribed(); } return scheduledAction; }
Source:
public void calculateSkillLevel() { int skillLevel = 0; int numPlayers = 0; for(Player player : players){ skillLevel+=player.getSurveyByTournament(tournament).getSurveyScore(); numPlayers++; } teamSkillLevel = skillLevel/numPlayers; }

Target:
public void calculateSkillLevel() { int skillLevel = 0; for(Player player : players){ skillLevel+=player.getSurveyByTournament(tournament).getSurveyScore(); } teamSkillLevel = skillLevel/players.size(); }
Source:
public void onException(SQLException e, OperationType operationType) { if (!(e instanceof SQLNonTransientException || (e instanceof BatchUpdateException && e.getCause() instanceof SQLNonTransientException))) { if (operationType == OperationType.Write) { metrics.writeFailureCount.inc(); } else if (operationType == OperationType.Read) { metrics.readFailureCount.inc(); } else if (operationType == OperationType.Copy) { metrics.copyFailureCount.inc(); } closeActiveConnection(); } }

Target:
public void onException(SQLException e, OperationType operationType) { if (operationType == OperationType.Write) { metrics.writeFailureCount.inc(); } else if (operationType == OperationType.Read) { metrics.readFailureCount.inc(); } else if (operationType == OperationType.Copy) { metrics.copyFailureCount.inc(); } if (!(e instanceof SQLNonTransientException || (e instanceof BatchUpdateException && e.getCause() instanceof SQLNonTransientException))) { closeActiveConnection(); } }
Source:
public void testRunWhenError() throws Exception { verifyRunWhenError(); }

Target:
public void testRunWhenError() throws Exception { Thread t = new Thread() { public void run() { try { PipedOutputStream po = new PipedOutputStream(); InputStream is = new PipedInputStream(po); ByteArrayOutputStream out = new ByteArrayOutputStream(); TajoConf tajoConf = new TajoConf(); setVar(tajoCli, SessionVars.CLI_FORMATTER_CLASS, TajoCliOutputTestFormatter.class.getName()); TajoCli tc = new TajoCli(tajoConf, new String[]{}, is, out); tc.executeMetaCommand("\\set ON_ERROR_STOP false"); assertSessionVar(tc, SessionVars.ON_ERROR_STOP.keyname(), "false"); po.write(new String("asdf;\nqwe;\nzxcv;\n").getBytes()); tc.runShell(); } catch (Exception e) { throw new RuntimeException("Cannot run thread in testRunWhenError", e); } } }; t.start(); Thread.sleep(1000); if(!t.isAlive()) { fail("TSQL should be alive"); } else { t.interrupt(); t.join(); } }
Source:
public synchronized ResponseStatus getStatus() { ResponseStatus status = null; try { if (responseMetadata.has(RESPONSE_STATUS_KEY)) { status = ResponseStatus.valueOf(responseMetadata.getString(RESPONSE_STATUS_KEY)); } } catch (Exception e) { throw new IllegalStateException(e); } return status; }

Target:
public ResponseStatus getStatus() { ResponseStatus status = null; try { if (responseMetadata.has(RESPONSE_STATUS_KEY)) { status = ResponseStatus.valueOf(responseMetadata.getString(RESPONSE_STATUS_KEY)); } } catch (Exception e) { throw new IllegalStateException(e); } return status; }
Source:
public int answerQuestion(FormIndex index, IAnswerData data) { QuestionDef q = model.getQuestionPrompt(index).getQuestion(); if (model.getEvent(index) != FormEntryController.EVENT_QUESTION) { throw new RuntimeException("Non-Question object at the form index."); } TreeElement element = model.getTreeElement(index); boolean complexQuestion = q.isComplex(); boolean hasConstraints = false; if (element.isRequired() && data == null) { return ANSWER_REQUIRED_BUT_EMPTY; } if (complexQuestion) { if (hasConstraints) { throw new RuntimeException("Itemsets do not currently evaluate constraints. Your constraint will not work, please remove it before proceeding."); } else { try { model.getForm().copyItemsetAnswer(q, element, data); } catch (InvalidReferenceException ire) { ire.printStackTrace(); throw new RuntimeException("Invalid reference while copying itemset answer: " + ire.getMessage() + " Reference: " + ire.getInvalidReference().toString()); } q.getActionController().triggerActionsFromEvent(Action.EVENT_QUESTION_VALUE_CHANGED, model.getForm()); return ANSWER_OK; } } else { if (!model.getForm().evaluateConstraint(index.getReference(), data)) { return ANSWER_CONSTRAINT_VIOLATED; } commitAnswer(element, index, data); q.getActionController().triggerActionsFromEvent(Action.EVENT_QUESTION_VALUE_CHANGED, model.getForm()); return ANSWER_OK; } }

Target:
public int answerQuestion(FormIndex index, IAnswerData data) { QuestionDef q = model.getQuestionPrompt(index).getQuestion(); if (model.getEvent(index) != FormEntryController.EVENT_QUESTION) { throw new RuntimeException("Non-Question object at the form index."); } TreeElement element = model.getTreeElement(index); boolean complexQuestion = q.isComplex(); boolean hasConstraints = false; if (element.isRequired() && data == null) { return ANSWER_REQUIRED_BUT_EMPTY; } if (complexQuestion) { if (hasConstraints) { throw new RuntimeException("Itemsets do not currently evaluate constraints. Your constraint will not work, please remove it before proceeding."); } else { try { model.getForm().copyItemsetAnswer(q, element, data); } catch (InvalidReferenceException ire) { ire.printStackTrace(); String referenceMessage = ire.getInvalidReference() != null ? " Reference: " + ire.getInvalidReference() : ""; throw new RuntimeException("Invalid reference while copying itemset answer: " + ire.getMessage() + referenceMessage); } q.getActionController().triggerActionsFromEvent(Action.EVENT_QUESTION_VALUE_CHANGED, model.getForm()); return ANSWER_OK; } } else { if (!model.getForm().evaluateConstraint(index.getReference(), data)) { return ANSWER_CONSTRAINT_VIOLATED; } commitAnswer(element, index, data); q.getActionController().triggerActionsFromEvent(Action.EVENT_QUESTION_VALUE_CHANGED, model.getForm()); return ANSWER_OK; } }
Source:
public int compareTo(String traceId) { UUID uuid = stringToUuidConverter.convert(traceId); if (uuid == null) { return GREATER_THAN_THRESHOLD; } BigInteger asInteger = BigInteger.valueOf(uuid.getMostSignificantBits()) .shiftLeft(EIGHT_BYTES) .add(BigInteger.valueOf(uuid.getLeastSignificantBits())) .abs(); return asInteger.compareTo(threshold); }

Target:
public int compareTo(String traceId) { UUID uuid = stringToUuidConverter.convert(traceId); if (uuid == null) { return GREATER_THAN_THRESHOLD; } BigInteger asInteger = BigInteger.valueOf(uuid.getMostSignificantBits()) .shiftLeft(SIXTY_FOUR_BITS) .add(BigInteger.valueOf(uuid.getLeastSignificantBits())) .abs(); return asInteger.compareTo(threshold); }
Source:
protected boolean addHandler(InvocationComposeHandler composeHandler) { synchronized (this) { if (frozen) { return false; } handlers[tail & mask] = composeHandler; if (((tail + 1 - head) & mask) == 0) { frozen = true; return false; } tail++; return true; } }

Target:
protected boolean addHandler(InvocationComposeHandler composeHandler) { synchronized (this) { if (frozen) { return false; } handlers[tail & mask] = composeHandler; tail++; if (((tail - head) & mask) == 0) { frozen = true; } return true; } }
Source:
private Optional<TableReference> logDecision(Optional<TableReference> chosenTable, Map<TableReference, Double> scores) { if (!log.isDebugEnabled()) { return chosenTable; } String safeTableNamesToScore = scores.entrySet().stream() .sorted(Comparator.comparingDouble(Map.Entry::getValue)) .map(entry -> LoggingArgs.safeTableOrPlaceholder(entry.getKey()) + "->" + entry.getValue()) .collect(Collectors.joining(", ", "[", "]")); String chosenTableString = chosenTable.isPresent() ? LoggingArgs.safeTableOrPlaceholder(chosenTable.get()).toString() : "no table"; log.debug("Chose from priorities {}", SafeArg.of("chosenTable", chosenTableString), SafeArg.of("priorities", safeTableNamesToScore)); return chosenTable; }

Target:
private Optional<TableReference> logDecision(Optional<TableReference> chosenTable, Map<TableReference, Double> scores) { if (!log.isDebugEnabled()) { return chosenTable; } String safeTableNamesToScore = scores.entrySet().stream() .sorted(Comparator.comparingDouble(Map.Entry::getValue)) .map(entry -> LoggingArgs.safeTableOrPlaceholder(entry.getKey()) + "->" + entry.getValue()) .collect(Collectors.joining(", ", "[", "]")); String chosenTableString = chosenTable.isPresent() ? LoggingArgs.safeTableOrPlaceholder(chosenTable.get()).toString() : "no table"; log.debug("Chose from scores: {}, unsafeScores: {}", SafeArg.of("chosenTable", chosenTableString), SafeArg.of("scores", safeTableNamesToScore), UnsafeArg.of("unsafeScores", scores)); return chosenTable; }
Source:
private void waitExportJobComplete(MarketoRESTEndpoint marketoRESTEndpoint, String exportId, int pollingInterval, int waitTimeout) throws InterruptedException { long waitTime = 0; while (true) { MarketoResponse<ObjectNode> marketoResponse = doGet(this.endPoint + marketoRESTEndpoint.getEndpoint( new ImmutableMap.Builder<String, String>().put("export_id", exportId).build()), null, null, new MarketoResponseJetty92EntityReader<ObjectNode>(READ_TIMEOUT_MILLIS)); if (marketoResponse.isSuccess()) { ObjectNode objectNode = marketoResponse.getResult().get(0); String status = objectNode.get("status").asText(); if (status == null) { throw new DataException("Can't get bulk extract status export job id: " + exportId); } LOGGER.info("Jobs status is [{}]", exportId, status); switch (status) { case "Completed": return; case "Failed": throw new DataException("Bulk extract job failed exportId: " + exportId + " errorMessage: " + objectNode.get("errorMsg").asText()); case "Cancel": throw new DataException("Bulk extract job canceled, exportId: " + exportId); } } Thread.sleep(pollingInterval * 1000); waitTime = waitTime + pollingInterval; if (waitTime >= waitTimeout) { throw new DataException("Job timeout exception, exportJob: " + exportId + ", run longer than " + waitTimeout + " seconds"); } } }

Target:
private void waitExportJobComplete(MarketoRESTEndpoint marketoRESTEndpoint, String exportId, int pollingInterval, int waitTimeout) throws InterruptedException { long waitTime = 0; long waitTimeoutMs = waitTimeout * 1000; long now = System.currentTimeMillis(); while (true) { MarketoResponse<ObjectNode> marketoResponse = doGet(this.endPoint + marketoRESTEndpoint.getEndpoint( new ImmutableMap.Builder<String, String>().put("export_id", exportId).build()), null, null, new MarketoResponseJetty92EntityReader<ObjectNode>(READ_TIMEOUT_MILLIS)); if (marketoResponse.isSuccess()) { ObjectNode objectNode = marketoResponse.getResult().get(0); String status = objectNode.get("status").asText(); if (status == null) { throw new DataException("Can't get bulk extract status export job id: " + exportId); } LOGGER.info("Jobs status is [{}]", exportId, status); switch (status) { case "Completed": LOGGER.info("Total wait time ms is [{}]", waitTime); return; case "Failed": throw new DataException("Bulk extract job failed exportId: " + exportId + " errorMessage: " + objectNode.get("errorMsg").asText()); case "Cancel": throw new DataException("Bulk extract job canceled, exportId: " + exportId); } } Thread.sleep(pollingInterval * 1000); waitTime = waitTime + (System.currentTimeMillis() - now); if (waitTime >= waitTimeoutMs) { throw new DataException("Job timeout exception, exportJob: " + exportId + ", run longer than " + waitTimeout + " seconds"); } } }
Source:
public DataTransactionResult removeFrom(ValueContainer<?> container) { if (container instanceof ItemStack) { final ItemStack stack = (ItemStack) container; final DataTransactionBuilder builder = DataTransactionBuilder.builder(); final Optional<Color> optional = getVal(stack); if (ColorUtil.hasNbtColor(stack) && optional.isPresent()) { try { NbtDataUtil.removeColorFromNBT(stack); return builder.replace(new ImmutableSpongeValue<>(Keys.COLOR, optional.get())).result(DataTransactionResult.Type.SUCCESS).build(); } catch (Exception e) { Sponge.getLogger().error("There was an issue removing the color from an itemstack!", e); return builder.result(DataTransactionResult.Type.ERROR).build(); } } else { return builder.result(DataTransactionResult.Type.SUCCESS).build(); } } return DataTransactionBuilder.failNoData(); }

Target:
public DataTransactionResult removeFrom(ValueContainer<?> container) { if (supports(container)) { final ItemStack stack = (ItemStack) container; final Optional<Color> optional = getVal(stack); if (ColorUtil.hasColorInNbt(stack) && optional.isPresent()) { final DataTransactionBuilder builder = DataTransactionBuilder.builder(); try { NbtDataUtil.removeColorFromNBT(stack); return builder.replace(new ImmutableSpongeValue<>(Keys.COLOR, optional.get())).result(DataTransactionResult.Type.SUCCESS).build(); } catch (Exception e) { Sponge.getLogger().error("There was an issue removing the color from an itemstack!", e); return builder.result(DataTransactionResult.Type.ERROR).build(); } } else { return DataTransactionBuilder.failNoData(); } } return DataTransactionBuilder.failNoData(); }
Source:
public List<InputSplit> getSplits(JobContext job) throws IOException { List<InputSplit> fileSplits = super.getSplits(job); Configuration hConf = job.getConfiguration(); boolean copyHeader = hConf.getBoolean(PathTrackingInputFormat.COPY_HEADER, false); List<InputSplit> splits = new ArrayList<>(fileSplits.size()); if (!copyHeader) { for (InputSplit split : fileSplits) { splits.add(new CombineHeaderFileSplit((CombineFileSplit) split, null)); } return splits; } String header = null; for (InputSplit split : fileSplits) { CombineFileSplit combineFileSplit = (CombineFileSplit) split; Path[] paths = combineFileSplit.getPaths(); if (header == null) { for (Path path : paths) { header = getHeader(path.getFileSystem(hConf), path); if (header != null) { break; } } } splits.add(new CombineHeaderFileSplit(combineFileSplit, header)); } return splits; }

Target:
public List<InputSplit> getSplits(JobContext job) throws IOException { List<InputSplit> fileSplits = super.getSplits(job); Configuration hConf = job.getConfiguration(); boolean shouldCopyHeader = hConf.getBoolean(PathTrackingInputFormat.COPY_HEADER, false); List<InputSplit> splits = new ArrayList<>(fileSplits.size()); String header = null; for (InputSplit split : fileSplits) { CombineFileSplit combineFileSplit = (CombineFileSplit) split; if (shouldCopyHeader && header == null) { header = getHeader(hConf, combineFileSplit); } splits.add(new CombineHeaderFileSplit(combineFileSplit, header)); } return splits; }
Source:
private void storeCredentials(AddRemotePage remotePage) { if (remotePage.getStoreInSecureStore()) { URIish uri = remotePage.getSelection().getURI(); if (uri != null) SecureStoreUtils.storeCredentials(remotePage.getCredentials(), uri); } }

Target:
private void storeCredentials(AddRemotePage remotePage) { if (remotePage.getStoreInSecureStore()) { URIish uri = remotePage.getSelection().getURI(); if (uri != null) { SecureStoreUtils.storeCredentials(remotePage.getCredentials(), uri); } } }
Source:
public void run() { future.completeExceptionally(null == timeoutMsg ? new TimeoutException() : new TimeoutException(timeoutMsg)); }

Target:
public void run() { future.completeExceptionally(new TimeoutException(timeoutMsg)); }
Source:
private Object readValue( ValueMetaInterface meta, Row row, int i ) { switch ( meta.getType() ) { case ValueMetaInterface.TYPE_INTEGER: return row.getLong( i ); case ValueMetaInterface.TYPE_NUMBER: return row.getDouble( i ); case ValueMetaInterface.TYPE_BIGNUMBER: return row.getDecimal( i ); case ValueMetaInterface.TYPE_TIMESTAMP: case ValueMetaInterface.TYPE_DATE: return row.getTimestamp( i ); default: return row.getObject( i ); } }

Target:
public static Object readValue( ValueMetaInterface meta, Row row, int i ) { switch ( meta.getType() ) { case ValueMetaInterface.TYPE_INTEGER: return row.getLong( i ); case ValueMetaInterface.TYPE_NUMBER: return row.getDouble( i ); case ValueMetaInterface.TYPE_BIGNUMBER: return row.getDecimal( i ); case ValueMetaInterface.TYPE_DATE: return row.getDate( i ); case ValueMetaInterface.TYPE_TIMESTAMP: return row.getTimestamp( i ); default: return row.getObject( i ); } }
Source:
BlobReadOptions(Log log, Offset offset, MessageInfo info) { segment = log.getSegment(offset.getName()); if (offset.getOffset() + info.getSize() > segment.getEndOffset()) { throw new IllegalArgumentException( "Invalid offset [" + offset + "] and size [" + info.getSize() + "]. Segment end offset: " + "[" + segment.getEndOffset() + "]"); } segmentView = segment.getView(); this.offset = offset; this.info = info; logger.trace("BlobReadOption offset size expiresAtMs storeKey isDeleted crc accountId " + "containerId operationTimeMs ", offset, info.getSize(), info.getExpirationTimeInMs(), info.getStoreKey(), info.isDeleted(), info.getCrc(), info.getAccountId(), info.getContainerId(), info.getOperationTimeMs()); }

Target:
BlobReadOptions(Log log, Offset offset, MessageInfo info) { segment = log.getSegment(offset.getName()); if (offset.getOffset() + info.getSize() > segment.getEndOffset()) { throw new IllegalArgumentException( "Invalid offset [" + offset + "] and size [" + info.getSize() + "]. Segment end offset: " + "[" + segment.getEndOffset() + "]"); } segmentView = segment.getView(); this.offset = offset; this.info = info; logger.trace("BlobReadOption offset size MessageInfo ", offset, info.getSize(), info); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.actvity_contact_us); ButterKnife.bind(this); presenter = new ContactUsPresenter(this); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setDisplayHomeAsUpEnabled(true); } mailButton.setOnClickListener(v -> { Intent i = new Intent(Intent.ACTION_SENDTO); String mailTo = "mailto:".concat(mailTextView.getText().toString()); i.setData(Uri.parse(mailTo)); try { startActivity(i); } catch (android.content.ActivityNotFoundException ex) { ToastUtil.showShortToast(this, ToastUtil.ToastType.ERROR, "There are no email clients installed."); } }); talkButton.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.contact_forum_url))); startActivity(intent); }); ircButton.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.contact_irc_url))); startActivity(intent); }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = ActvityContactUsBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); presenter = new ContactUsPresenter(this); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setDisplayHomeAsUpEnabled(true); } binding.contactEmailButton.setOnClickListener(v -> { Intent sendMailIntent = new Intent(Intent.ACTION_SENDTO); String mailTo = "mailto:".concat(binding.contactEmailText.getText().toString()); sendMailIntent.setData(Uri.parse(mailTo)); try { startActivity(sendMailIntent); } catch (android.content.ActivityNotFoundException ex) { ToastUtil.showShortToast(this, ToastUtil.ToastType.ERROR, getString(R.string.no_mailing_client_found)); } }); binding.talksButton.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.contact_forum_url))); startActivity(intent); }); binding.ircButton.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.contact_irc_url))); startActivity(intent); }); }
Source:
public void testUnicastSerialDataReceiveSubscribedRx64() throws Exception { dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx64Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_NOT_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).serialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }

Target:
public void testUnicastSerialDataReceiveSubscribedRx64() throws Exception { dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx64Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_NOT_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).serialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); Mockito.verify(receiveSerialDataListener, Mockito.never()).broadcastSerialDataReceived(Mockito.anyString(), (byte[])Mockito.any()); assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }
Source:
public String getInviteURL(UUID newUserID, String tempPassword) { return UserController.getUserLinkWithTempPassword(newUserID, tempPassword).getHref(); }

Target:
public String getInviteURL(UUID newUserID, String tempPassword) { return UserController.getUserSelfLinkWithTempPassword(newUserID, tempPassword).getHref(); }
Source:
public boolean equals(Object obj) { return (obj != null) && (obj instanceof GlusterGeoRepSessionConfiguration) && ObjectUtils.objectsEqual(getSessionId(), ((GlusterGeoRepSessionConfiguration) obj).getSessionId()) && ObjectUtils.objectsEqual(getKey(), ((GlusterGeoRepSessionConfiguration) obj).getKey()) && ObjectUtils.objectsEqual(getValue(), ((GlusterGeoRepSessionConfiguration) obj).getValue()); }

Target:
public boolean equals(Object obj) { return ObjectUtils.checkEquals(obj, this); }
Source:
protected Guid CreateTask(AsyncTaskCreationInfo asyncTaskCreationInfo, VdcActionType parentCommand, String description) { Guid retValue = Guid.Empty; Transaction transaction = TransactionSupport.suspend(); try { Step taskStep = ExecutionHandler.addTaskStep(getExecutionContext(), StepEnum.getStepNameByTaskType(asyncTaskCreationInfo.getTaskType()), description); if (taskStep != null) { asyncTaskCreationInfo.setStepId(taskStep.getId()); } SPMAsyncTask task = ConcreteCreateTask(asyncTaskCreationInfo, parentCommand); retValue = (task != null) ? task.getTaskID() : null; ExecutionHandler.updateStepExternalId(taskStep, retValue, ExternalSystemType.VDSM); } catch (RuntimeException ex) { log.errorFormat("Error during CreateTask for command: {0}. Exception {1}", getClass().getName(), ex); } finally { TransactionSupport.resume(transaction); } return retValue; }

Target:
protected Guid CreateTask(AsyncTaskCreationInfo asyncTaskCreationInfo, VdcActionType parentCommand, String description) { Guid retValue = Guid.Empty; Transaction transaction = TransactionSupport.suspend(); try { Step taskStep = ExecutionHandler.addTaskStep(getExecutionContext(), StepEnum.getStepNameByTaskType(asyncTaskCreationInfo.getTaskType()), description); if (taskStep != null) { asyncTaskCreationInfo.setStepId(taskStep.getId()); } SPMAsyncTask task = ConcreteCreateTask(asyncTaskCreationInfo, parentCommand); retValue = task.getTaskID(); ExecutionHandler.updateStepExternalId(taskStep, retValue, ExternalSystemType.VDSM); } catch (RuntimeException ex) { log.errorFormat("Error during CreateTask for command: {0}. Exception {1}", getClass().getName(), ex); } finally { TransactionSupport.resume(transaction); } return retValue; }
Source:
public void centerLayoutVertical(Region region) { region.layoutYProperty().bind(this.heightProperty().divide(2).subtract(region.heightProperty().divide(2))); }

Target:
private void centerLayoutVertical(Region region) { region.layoutYProperty().bind(this.heightProperty().divide(2).subtract(region.heightProperty().divide(2))); }
Source:
protected void runInContext() { try { s_logger.debug("Value of attempts is " + maxAttempts); SnapshotInfo backupedSnapshot = snapshotStrategy.backupSnapshot(snapshot); if (backupedSnapshot != null) { snapshotStrategy.cleanSnapshotAfterCreation(snapshot); } } catch (final Exception e) { if (maxAttempts >= 0) { s_logger.debug("Attempt failed, in retrying backup"); backupSnapshotExecutor.schedule(new BackupSnapshotTask(snapshot, --maxAttempts, snapshotStrategy), retryInterval, TimeUnit.SECONDS); } else { s_logger.debug("Done with attempts, with backing up"); snapshotSrv.performEventsOnBackupFaiureAndRemove(snapshot); } } }

Target:
protected void runInContext() { try { s_logger.debug("Value of attempts is " + (snapshotBackupRetries-attempts)); SnapshotInfo backupedSnapshot = snapshotStrategy.backupSnapshot(snapshot); if (backupedSnapshot != null) { snapshotStrategy.postSnapshotCreation(snapshot); } } catch (final Exception e) { if (attempts >= 0) { s_logger.debug("Backing up of snapshot failed, for snapshot with ID "+snapshot.getSnapshotId()+", left with "+attempts+" more attempts"); backupSnapshotExecutor.schedule(new BackupSnapshotTask(snapshot, --attempts, snapshotStrategy), snapshotBackupRetryInterval, TimeUnit.SECONDS); } else { s_logger.debug("Done with "+snapshotBackupRetries+" attempts in backing up of snapshot with ID "+snapshot.getSnapshotId()); snapshotSrv.cleanupOnSnapshotBackupFailure(snapshot); } } }
Source:
public boolean onActivate(Level level, Player player, Block block, Block target, int face, double fx, double fy, double fz) { Block targetBlock = Block.get(this.meta); if (targetBlock instanceof BlockAir) { if (target instanceof BlockLiquid && target.getDamage() == 0) { Item result = Item.get(BUCKET, this.getDamageByTarget(target.getId()), 1); PlayerBucketFillEvent ev; player.getServer().getPluginManager() .callEvent(ev = new PlayerBucketFillEvent(player, block, face, this, result)); if (!ev.isCancelled()) { player.getLevel().setBlock(target, new BlockAir(), true, true); if (player.isSurvival()) { if (this.getCount() == 1) { player.getInventory().setItemInHand(ev.getItem()); } else { this.setCount(this.getCount() - 1); player.getInventory().setItemInHand(this); player.getInventory().addItem(ev.getItem()); } } return true; } else { player.getInventory().sendContents(player); } } } else if (targetBlock instanceof BlockLiquid) { Item result = Item.get(BUCKET, 0, 1); PlayerBucketEmptyEvent ev; player.getServer().getPluginManager() .callEvent(ev = new PlayerBucketEmptyEvent(player, block, face, this, result)); if (!ev.isCancelled()) { player.getLevel().setBlock(block, targetBlock, true, true); if (player.isSurvival()) { if (this.getCount() == 1) { player.getInventory().setItemInHand(ev.getItem()); } else { this.setCount(this.getCount() - 1); player.getInventory().setItemInHand(this); player.getInventory().addItem(ev.getItem()); } } return true; } else { player.getInventory().sendContents(player); } } return false; }

Target:
public boolean onActivate(Level level, Player player, Block block, Block target, int face, double fx, double fy, double fz) { Block targetBlock = Block.get(this.meta); if (targetBlock instanceof BlockAir) { if (target instanceof BlockLiquid && target.getDamage() == 0) { Item result = Item.get(BUCKET, this.getDamageByTarget(target.getId()), 1); PlayerBucketFillEvent ev; player.getServer().getPluginManager() .callEvent(ev = new PlayerBucketFillEvent(player, block, face, this, result)); if (!ev.isCancelled()) { player.getLevel().setBlock(target, new BlockAir(), true, true); if (player.isSurvival()) { if (this.getCount() == 1) { player.getInventory().setItemInHand(ev.getItem()); } else { this.setCount(this.getCount() - 1); player.getInventory().setItemInHand(this); player.getInventory().addItem(ev.getItem()); } } return true; } else { player.getInventory().sendContents(player); } } } else if (targetBlock instanceof BlockLiquid) { Item result = Item.get(BUCKET, 0, 1); PlayerBucketEmptyEvent ev; player.getServer().getPluginManager() .callEvent(ev = new PlayerBucketEmptyEvent(player, block, face, this, result)); if (!ev.isCancelled()) { player.getLevel().setBlock(block, targetBlock, true, true); if (player.isSurvival()) { player.getInventory().setItemInHand(ev.getItem()); } return true; } else { player.getInventory().sendContents(player); } } return false; }
Source:
public void shouldReturn400IfBadParameter() { Response response = envTarget("verify") .queryParam("apiKey", "short/\\;") .request() .get(); assertEquals(HttpStatusCode.BAD_REQUEST_400, response.getStatus()); }

Target:
public void shouldReturn400IfBadParameter() { Response response = envTarget("_verify") .queryParam("apiKey", "short/\\;") .request() .post(null); assertEquals(HttpStatusCode.BAD_REQUEST_400, response.getStatus()); }
Source:
public void run() { output .println("# Welcome to Saros Server (type 'help' for available commands)"); while (true) { output.print("> "); String line = input.nextLine(); if (!line.startsWith("#")) { if (line.equalsIgnoreCase("quit")) { break; } else if (line.equalsIgnoreCase("help")) { for (ConsoleCommand command : commands) { output.println(command.help()); } output.println("help - Print this help"); output.println("quit - Quit Saros Server"); } else { found: { for (ConsoleCommand command : commands) { if (command.matches(line)) { command.execute(line, output); break found; } } output .printf( "Command '%s' is not known. (Type 'help' for available commands)", line); } } } } }

Target:
public void run() { output .println("# Welcome to Saros Server (type 'help' for available commands)"); while (true) { output.print("> "); String line = input.nextLine().trim(); if (line.startsWith("#")) { continue; } if (line.equalsIgnoreCase("quit")) { break; } if (line.equalsIgnoreCase("help")) { for (ConsoleCommand command : commands) { output.println(command.help()); } output.println("help - Print this help"); output.println("quit - Quit Saros Server"); } else { for (ConsoleCommand command : commands) { if (command.matches(line)) { command.execute(line, output); break; } } output .printf( "Command '%s' is not known. (Type 'help' for available commands)", line); } } }