auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void applyProjectsVolumes(List<PodData> podsData, List<HasMetadata> componentObjects) { if (componentObjects .stream() .noneMatch( hasMeta -> hasMeta instanceof PersistentVolumeClaim && hasMeta.getMetadata().getName().equals(PROJECTS_VOLUME_NAME))) { PersistentVolumeClaim volumeClaim = newPVC( PROJECTS_VOLUME_NAME, defaultPVCAccessMode, defaultProjectPVCSize, pvcStorageClassName); componentObjects.add(volumeClaim); } for (PodData podData : podsData) { final String podVolumeName = PROJECTS_VOLUME_NAME + "-" + podData.getMetadata().getName(); if (podData .getSpec() .getVolumes() .stream() .noneMatch(volume -> volume.getName().equals(PROJECTS_VOLUME_NAME))) { Volume volume = newVolume(podVolumeName, PROJECTS_VOLUME_NAME); podData.getSpec().getVolumes().add(volume); } for (Container container : podData.getSpec().getContainers()) { if (container .getVolumeMounts() .stream() .noneMatch(mount -> mount.getName().equals(PROJECTS_VOLUME_NAME))) { VolumeMount volumeMount = newVolumeMount(podVolumeName, projectFolderPath, null); container.getVolumeMounts().add(volumeMount); } } } }

Target:
private void applyProjectsVolumes(List<PodData> podsData, List<HasMetadata> componentObjects) { if (componentObjects .stream() .noneMatch( hasMeta -> hasMeta instanceof PersistentVolumeClaim && hasMeta.getMetadata().getName().equals(PROJECTS_VOLUME_NAME))) { PersistentVolumeClaim volumeClaim = newPVC( PROJECTS_VOLUME_NAME, defaultPVCAccessMode, defaultProjectPVCSize, pvcStorageClassName); componentObjects.add(volumeClaim); } for (PodData podData : podsData) { if (podData .getSpec() .getVolumes() .stream() .noneMatch(volume -> volume.getName().equals(PROJECTS_VOLUME_NAME))) { Volume volume = newVolume(PROJECTS_VOLUME_NAME, PROJECTS_VOLUME_NAME); podData.getSpec().getVolumes().add(volume); } for (Container container : podData.getSpec().getContainers()) { if (container .getVolumeMounts() .stream() .noneMatch(mount -> mount.getName().equals(PROJECTS_VOLUME_NAME))) { VolumeMount volumeMount = newVolumeMount(PROJECTS_VOLUME_NAME, projectFolderPath, null); container.getVolumeMounts().add(volumeMount); } } } }
Source:
public void visitMethod(MethodTree tree) { boolean isUnitTest = isUnitTest(tree); inUnitTest.push(isUnitTest); methodContainsAssertion.push(Boolean.FALSE); super.visitMethod(tree); inUnitTest.pop(); if (isUnitTest && !methodContainsAssertion.pop()) { context.addIssue(tree, this, "Add at least one assertion to this test case."); } }

Target:
public void visitMethod(MethodTree tree) { boolean isUnitTest = isUnitTest(tree); inUnitTest.push(isUnitTest); methodContainsAssertion.push(false); super.visitMethod(tree); inUnitTest.pop(); if (isUnitTest && !methodContainsAssertion.pop()) { context.addIssue(tree, this, "Add at least one assertion to this test case."); } }
Source:
protected DependentTypesHelper createDependentTypesHelper() { return new DependentTypesHelper(this) { @Override protected void reportErrors(Tree errorTree, List<DependentTypesError> errors) { List<DependentTypesError> superErrors = new ArrayList<>(); for (DependentTypesError error : errors) { if (error.error.equals(NOT_EFFECTIVELY_FINAL)) { checker.reportError( errorTree, "lock.expression.not.final", error.expression); } else { superErrors.add(error); } } super.reportErrors(errorTree, superErrors); } @Override protected String standardizeString( String expression, FlowExpressionContext context, TreePath localScope, boolean useLocalScope, boolean removeErroneousExpressions) { if (DependentTypesError.isExpressionError(expression)) { return null; } if (LockVisitor.SELF_RECEIVER_PATTERN.matcher(expression).matches()) { return expression; } try { Receiver result = FlowExpressionParseUtil.parse( expression, context, localScope, useLocalScope); if (result == null) { if (removeErroneousExpressions) { return null; } else { return new DependentTypesError(expression, " ").toString(); } } if (!isExpressionEffectivelyFinal(result)) { if (removeErroneousExpressions) { return null; } else { return new DependentTypesError(expression, NOT_EFFECTIVELY_FINAL) .toString(); } } return result.toString(); } catch (FlowExpressionParseUtil.FlowExpressionParseException e) { if (removeErroneousExpressions) { return null; } else { return new DependentTypesError(expression, e).toString(); } } } }; }

Target:
protected DependentTypesHelper createDependentTypesHelper() { return new DependentTypesHelper(this) { @Override protected void reportErrors(Tree errorTree, List<DependentTypesError> errors) { List<DependentTypesError> superErrors = new ArrayList<>(); for (DependentTypesError error : errors) { if (error.error.equals(NOT_EFFECTIVELY_FINAL)) { checker.reportError( errorTree, "lock.expression.not.final", error.expression); } else { superErrors.add(error); } } super.reportErrors(errorTree, superErrors); } @Override protected String standardizeString( String expression, FlowExpressionContext context, TreePath localScope, boolean useLocalScope) { if (DependentTypesError.isExpressionError(expression)) { return expression; } if (LockVisitor.SELF_RECEIVER_PATTERN.matcher(expression).matches()) { return expression; } try { Receiver result = FlowExpressionParseUtil.parse( expression, context, localScope, useLocalScope); if (result == null) { return new DependentTypesError(expression, " ").toString(); } if (!isExpressionEffectivelyFinal(result)) { return new DependentTypesError(expression, NOT_EFFECTIVELY_FINAL) .toString(); } return result.toString(); } catch (FlowExpressionParseUtil.FlowExpressionParseException e) { return new DependentTypesError(expression, e).toString(); } } }; }
Source:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpRequest httpRequest = context.getHttpRequest(); if ("http".equals(httpRequest.getUrl().getProtocol())) { return Mono.error(new IllegalStateException( "Shared access signature credentials require HTTPS to prevent leaking the shared access signature.")); } String signature = credential.getSignature(); if (signature.startsWith("?")) { signature = signature.substring(1); } String query = httpRequest.getUrl().getQuery(); String url = httpRequest.getUrl().toString(); if (query == null || query.isEmpty()) { url = url + "?" + signature; } else if (!query.contains(signature)) { url = url + "&" + signature; } httpRequest.setUrl(url); return next.process(); }

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpRequest httpRequest = context.getHttpRequest(); if ("http".equals(httpRequest.getUrl().getProtocol())) { return Mono.error(new IllegalStateException( "Shared access signature credentials require HTTPS to prevent leaking the shared access signature.")); } String signature = credential.getSignature(); if (signature.startsWith("?")) { signature = signature.substring(1); } String query = httpRequest.getUrl().getQuery(); String url = httpRequest.getUrl().toString(); if (query == null || query.isEmpty()) { if (url.endsWith("?")) { url = url + signature; } else { url = url + "?" + signature; } } else if (!query.contains(signature)) { url = url + "&" + signature; } httpRequest.setUrl(url); return next.process(); }
Source:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.doGet(request, response); String target = request.getPathInfo(); if (target == null) target = "/"; try { response.setContentType(JSON_CONTENT_TYPE); if (VoltDB.instance().getHttpAdminListener().m_jsonEnabled) { if (target.equals("/")) { httpClientInterface.process((Request )request, response); } else { response.setStatus(HttpServletResponse.SC_NOT_FOUND); response.getWriter().println("Resource not found"); } } else { response.setStatus(HttpServletResponse.SC_FORBIDDEN); response.getWriter().println("JSON API IS CURRENTLY DISABLED"); } } catch (Exception ex) { m_log.info("Not servicing url: " + target + " Details: " + ex.getMessage(), ex); } }

Target:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.doGet(request, response); String target = request.getPathInfo(); if (target == null) target = "/"; try { response.setContentType(JSON_CONTENT_TYPE); if (VoltDB.instance().getHttpAdminListener().m_jsonEnabled) { if (target.equals("/")) { httpClientInterface.process((Request )request, response); } else { response.setStatus(HttpServletResponse.SC_NOT_FOUND); response.getWriter().println("Resource not found"); } } else { response.setStatus(HttpServletResponse.SC_FORBIDDEN); response.getWriter().println("JSON API IS CURRENTLY DISABLED"); } } catch (Exception ex) { rateLimitedLogWarn("Not servicing url: %s Details: ", target, ex.getMessage()); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); response.getWriter().print(buildClientResponse(null, ClientResponse.UNEXPECTED_FAILURE, Throwables.getStackTraceAsString(ex))); } }
Source:
public AeroGearGCMPushJsonConfiguration loadConfigJson(Context context) { try { InputStream fileStream = context.getResources().getAssets().open(getFileName()); int size = fileStream.available(); byte[] buffer = new byte[size]; fileStream.read(buffer); fileStream.close(); String json = new String(buffer); JSONObject pushConfig = new JSONObject(json); JSONObject pushAndroidConfig = pushConfig.getJSONObject("android"); this.pushConfig.setPushServerURI(new URI(pushConfig.getString("pushServerURL"))); this.pushConfig.addSenderId(pushAndroidConfig.getString("senderID")); this.pushConfig.setVariantID(pushAndroidConfig.getString("variantID")); this.pushConfig.setSecret(pushAndroidConfig.getString("variantSecret")); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); } return this; }

Target:
public AeroGearGCMPushJsonConfiguration loadConfigJson(Context context) { InputStream fileStream = null; try { fileStream = context.getResources().getAssets().open(getFileName()); int size = fileStream.available(); byte[] buffer = new byte[size]; fileStream.read(buffer); fileStream.close(); String json = new String(buffer); JSONObject pushConfig = new JSONObject(json); JSONObject pushAndroidConfig = pushConfig.getJSONObject(JSON_OBJECT); this.pushConfig.setPushServerURI(new URI(pushConfig.getString(JSON_URL))); this.pushConfig.addSenderId(pushAndroidConfig.getString(JSON_SENDER_ID)); this.pushConfig.setVariantID(pushAndroidConfig.getString(JSON_VARIANT_ID)); this.pushConfig.setSecret(pushAndroidConfig.getString(JSON_VARIANT_SECRET)); } catch (URISyntaxException e) { Log.e(TAG, e.getMessage(), e); } catch (JSONException e) { Log.e(TAG, e.getMessage(), e); throw new RuntimeException("An error occurred while parsing the " + getFileName() + ". Please check the file format"); } catch (IOException e) { Log.e(TAG, e.getMessage(), e); throw new RuntimeException("An error occurred while parsing the " + getFileName() + ". Please check if the file exists"); } finally { if (fileStream != null) { try { fileStream.close(); } catch (IOException e) { } } } return this; }
Source:
public List<TypeMirror> uses() { List<TypeMirror> result = new ArrayList<TypeMirror>(); Set<TypeMirror> alreadyAdded = new HashSet<TypeMirror>(); addAllOnce( result, alreadyAdded, mapperPrism.uses() ); if ( mapperConfigPrism != null ) { addAllOnce( result, alreadyAdded, mapperConfigPrism.uses() ); } return result; }

Target:
public List<TypeMirror> uses() { Set<TypeMirror> uses = new LinkedHashSet<TypeMirror>( mapperPrism.uses() ); if ( mapperConfigPrism != null ) { uses.addAll( mapperConfigPrism.uses() ); } return new ArrayList<TypeMirror>( uses ); }
Source:
public PEMWriter(@Nonnull File file) throws IOException { targetFile = file; tmpFile = File.createTempFile("jack-server", file.getName(), file.getParentFile()); if (!tmpFile.exists()) { if (!tmpFile.createNewFile()) { throw new IOException("Failed to create temp file '" + tmpFile.getPath() + "'"); } if (!(tmpFile.setExecutable(false, false) && tmpFile.setWritable(false, false) && tmpFile.setReadable(false, false) && tmpFile.setWritable(true, true) && tmpFile.setReadable(true, true))) { throw new IOException("Failed to set permission of '" + tmpFile.getPath() + "'"); } } out = new OutputStreamWriter(new FileOutputStream(tmpFile), CHARSET); }

Target:
public PEMWriter(@Nonnull File file) throws IOException { targetFile = file; tmpFile = File.createTempFile("jackserver-", file.getName(), file.getParentFile()); if (!tmpFile.exists()) { if (!tmpFile.createNewFile()) { throw new IOException("Failed to create temp file '" + tmpFile.getPath() + "'"); } if (!(tmpFile.setExecutable(false, false) && tmpFile.setWritable(false, false) && tmpFile.setReadable(false, false) && tmpFile.setWritable(true, true) && tmpFile.setReadable(true, true))) { throw new IOException("Failed to set permission of '" + tmpFile.getPath() + "'"); } } out = new OutputStreamWriter(new FileOutputStream(tmpFile), CHARSET); }
Source:
public static void main(String[] args) throws IOException { String ddfListUrl = "<LINK_0>"; String ddfFilesPath = Ddf2JsonGenerator.DEFAULT_DDF_FILES_PATH; if (args.length >= 1) ddfFilesPath = args[0]; if (args.length >= 2) ddfListUrl = args[1]; new DdfList2JsonGenerator().processDdfList(ddfListUrl, ddfFilesPath); LOG.debug("DDF list processed to {}, proceeding with JSON generation", ddfListUrl, ddfFilesPath); Ddf2JsonGenerator.main(new String[] { ddfFilesPath }); }

Target:
public static void main(String[] args) throws IOException { String ddfFilesPath = Ddf2JsonGenerator.DEFAULT_DDF_FILES_PATH; String outputPath = Ddf2JsonGenerator.DEFAULT_OUTPUT_PATH; String ddfListUrl = "<LINK_0>"; if (args.length >= 1) ddfFilesPath = args[0]; if (args.length >= 2) outputPath = args[1]; if (args.length >= 3) ddfListUrl = args[2]; new DdfList2JsonGenerator().processDdfList(ddfListUrl, ddfFilesPath); LOG.debug("DDF list processed to {}, proceeding with JSON generation", ddfListUrl, ddfFilesPath); Ddf2JsonGenerator ddfJsonGenerator = new Ddf2JsonGenerator(); try (FileOutputStream fileOutputStream = new FileOutputStream(outputPath)) { ddfJsonGenerator.generate(new File(ddfFilesPath), fileOutputStream); } }
Source:
public <S extends TargetState> S getTargetState( @NonNull String alias) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (!this.stateTypes.containsKey(alias)) { throw new IllegalArgumentException("Unknown alias: " + alias); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/states/aliases/{2}", this.app.getAppID(), this.target.getTypedID().toString(), alias); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); JsonObject object = new JsonParser().parse(responseBody.toString()).getAsJsonObject(); return (S)this.gson.fromJson(object, this.stateTypes.get(alias)); }

Target:
public <S extends TargetState> S getTargetState( @NonNull String alias) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (!this.stateTypes.containsKey(alias)) { throw new UnregisteredAliasException(alias, false); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/states/aliases/{2}", this.app.getAppID(), this.target.getTypedID().toString(), alias); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); JsonObject object = new JsonParser().parse(responseBody.toString()).getAsJsonObject(); return (S)this.gson.fromJson(object, this.stateTypes.get(alias)); }
Source:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_CANCELLING, ""); }

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_CANCELLING, EMPTY_VALUE); }
Source:
public void updateParticipant(Study study, StudyParticipant participant) { checkNotNull(study); checkNotNull(participant); StudyParticipantValidator validator = new StudyParticipantValidator( externalIdService, substudyService, study, false); Validate.entityThrowingException(validator, participant); Account account = getAccountThrowingException(study, participant.getId()); Set<Roles> callerRoles = BridgeUtils.getRequestContext().getCallerRoles(); boolean isSimpleAdd = account.getExternalId() == null && participant.getExternalId() != null; boolean isResearcherChange = callerRoles.contains(Roles.RESEARCHER) && !Objects.equals(account.getExternalId(), participant.getExternalId()); boolean assigningExternalId = isSimpleAdd || isResearcherChange; if (assigningExternalId) { if (account.getExternalId() != null) { externalIdService.unassignExternalId(account, account.getExternalId()); } account.setExternalId(participant.getExternalId()); } updateAccountAndRoles(study, account, participant, false); if (participant.getStatus() != null) { if (callerRoles.contains(Roles.ADMIN) || callerRoles.contains(Roles.WORKER)) { account.setStatus(participant.getStatus()); } } if (assigningExternalId) { final ExternalIdentifier externalId = externalIdService.beginAssignExternalId(account, participant.getExternalId()); accountDao.updateAccount(account, (modifiedAccount) -> externalIdService.commitAssignExternalId(externalId)); } else { accountDao.updateAccount(account, null); } }

Target:
public void updateParticipant(Study study, StudyParticipant participant) { checkNotNull(study); checkNotNull(participant); Account account = null; if (participant.getId() != null) { account = getAccountThrowingExceptionIfSubstudyMatches( AccountId.forId(study.getIdentifier(), participant.getId())); } StudyParticipantValidator validator = new StudyParticipantValidator( externalIdService, substudyService, study, false); Validate.entityThrowingException(validator, participant); Set<Roles> callerRoles = BridgeUtils.getRequestContext().getCallerRoles(); Set<String> allExternalIds = BridgeUtils.collectExternalIds(account); boolean isSimpleAdd = allExternalIds.isEmpty() && participant.getExternalId() != null; boolean isResearcherAdd = callerRoles.contains(Roles.RESEARCHER) && !allExternalIds.contains(participant.getExternalId()) && participant.getExternalId() != null; boolean assigningExternalId = isSimpleAdd || isResearcherAdd; if (assigningExternalId) { account.setExternalId(participant.getExternalId()); } updateAccountAndRoles(study, account, participant, false); if (participant.getStatus() != null) { if (callerRoles.contains(Roles.ADMIN) || callerRoles.contains(Roles.WORKER)) { account.setStatus(participant.getStatus()); } } if (!assigningExternalId) { accountDao.updateAccount(account, null); return; } ExternalIdentifier externalId = beginAssignExternalId(account, participant.getExternalId()); try { accountDao.updateAccount(account, (modifiedAccount) -> externalIdService.commitAssignExternalId(externalId)); } catch (Exception e) { if (externalId != null) { externalIdService.unassignExternalId(account, externalId.getIdentifier()); } throw e; } }
Source:
private String createFormattedRemittanceIdTextBasedOnPresenceOfInvoiceDataForDv(String invoiceNumber, Date invoiceDate, String customerPaymentDocumentNumber) { StringBuffer formattedRemittanceIdText = new StringBuffer(""); if (StringUtils.isNotBlank(invoiceNumber) && ObjectUtils.isNotNull(invoiceDate)) { formattedRemittanceIdText.append(invoiceNumber); formattedRemittanceIdText.append(" Doc No:"); formattedRemittanceIdText.append(customerPaymentDocumentNumber); } else if (StringUtils.isNotBlank(customerPaymentDocumentNumber)) { formattedRemittanceIdText.append("Doc No:"); formattedRemittanceIdText.append(customerPaymentDocumentNumber); } return formattedRemittanceIdText.toString(); }

Target:
private String createFormattedRemittanceIdTextBasedOnPresenceOfInvoiceDataForDv(String invoiceNumber, Date invoiceDate, String customerPaymentDocumentNumber) { StringBuilder formattedRemittanceIdText = new StringBuilder(""); if (StringUtils.isNotBlank(invoiceNumber) && ObjectUtils.isNotNull(invoiceDate)) { formattedRemittanceIdText.append(invoiceNumber); formattedRemittanceIdText.append(" Doc:"); formattedRemittanceIdText.append(customerPaymentDocumentNumber); } else if (StringUtils.isNotBlank(customerPaymentDocumentNumber)) { formattedRemittanceIdText.append("Doc:"); formattedRemittanceIdText.append(customerPaymentDocumentNumber); } return formattedRemittanceIdText.toString(); }
Source:
public void registerSingleFileToLongleaf() throws Exception { Bag workBag = addContainerObject(depBag, Cdr.Work); Resource fileResc = addFileObject(workBag, FILE_CONTENT1, true); fileResc.addProperty(CdrDeposit.storageUri, LOC2_ID); workBag.addProperty(Cdr.primaryObject, fileResc); job.closeModel(); job.run(); String registrationArguments = "register -f " + LOC2_ID + " --checksums 'md5:" + MD5 + "' --force"; File file = new File(outputPath); BufferedReader br = new BufferedReader(new FileReader(file)); String output = br.readLine(); assertEquals(registrationArguments, output); }

Target:
public void registerSingleFileToLongleaf() throws Exception { Bag workBag = addContainerObject(depBag, Cdr.Work); Resource fileResc = addFileObject(workBag, FILE_CONTENT1, true); fileResc.addProperty(CdrDeposit.storageUri, FILE_SCHEME + LOC2_ID + "/original_file"); workBag.addProperty(Cdr.primaryObject, fileResc); job.closeModel(); job.run(); String output = FileUtils.readFileToString(new File(outputPath), StandardCharsets.UTF_8); assertRegisterCalled(LOC1_ID + "/event_log", 3, output); assertRegisterCalled(LOC2_ID + "/original_file --checksums \"md5:" + MD5 + "\"", 1, output); }
Source:
public ResolvedOvernightFutureTrade resolve(ReferenceData refData) { ResolvedOvernightFuture resolved = getProduct().resolve(refData); TradedPrice tradedPrice = info.getTradeDate() .map(tradeDate -> TradedPrice.of(tradeDate, price)) .orElse(null); return new ResolvedOvernightFutureTrade(info, resolved, quantity, tradedPrice); }

Target:
public ResolvedOvernightFutureTrade resolve(ReferenceData refData) { if (!info.getTradeDate().isPresent()) { throw new IllegalArgumentException("Trade date on TradeInfo must be present"); } ResolvedOvernightFuture resolved = getProduct().resolve(refData); TradedPrice tradedPrice = TradedPrice.of(info.getTradeDate().get(), price); return new ResolvedOvernightFutureTrade(info, resolved, quantity, tradedPrice); }
Source:
public Response remove(@PathParam("id") long id) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); if (!Context.getPermissionsManager().isAdmin(getUserId())) { AttributeAlias attrbuteAlias = Context.getAliasesManager().getAttributeAliasById(id); Context.getPermissionsManager().checkDevice(getUserId(), attrbuteAlias != null ? attrbuteAlias.getDeviceId() : 0); } Context.getAliasesManager().removeArrtibuteAlias(id); return Response.noContent().build(); }

Target:
public Response remove(@PathParam("id") long id) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); if (!Context.getPermissionsManager().isAdmin(getUserId())) { AttributeAlias entity = Context.getAliasesManager().getAttributeAlias(id); Context.getPermissionsManager().checkDevice(getUserId(), entity.getDeviceId()); } Context.getAliasesManager().removeArrtibuteAlias(id); return Response.noContent().build(); }
Source:
public ModelAndView loadCandidate(@PathVariable(value = "candidateId") Long candidateId) throws CandidateNotFoundException { ModelAndView modelAndView = new ModelAndView(VIEW_NAME); CandidateDTO candidate = candidateService.getCandidate(candidateId); if (candidate == null) throw new CandidateNotFoundException(); modelAndView.addObject(CANDIDATE_OBJECT_KEY, candidate); return modelAndView; }

Target:
public ModelAndView loadCandidate(@PathVariable(value = "candidateId") Long candidateId) { ModelAndView modelAndView = new ModelAndView(VIEW_NAME); CandidateDTO candidate = candidateService.getCandidate(candidateId); if (candidate == null) { throw new CandidateNotFoundException(candidateId); } modelAndView.addObject(CANDIDATE_OBJECT_KEY, candidate); return modelAndView; }
Source:
private void onSessionStateChange(SessionState state, Exception exception) { if (exception != null) { if (loginContext != null) { handleError(exception, loginContext); } } else { final Session session = Session.getActiveSession(); if (state.isOpened()) { if (loginContext != null) { getUserInfo(session); } else if (graphContext != null) { makeGraphCall(); } } } }

Target:
private void onSessionStateChange(SessionState state, Exception exception) { if (exception != null && exception instanceof FacebookOperationCanceledException) { Log.e(TAG, "exception:" + exception.toString()); handleError(exception, loginContext); } else { final Session session = Session.getActiveSession(); if (state.isOpened()) { if (loginContext != null) { getUserInfo(session); } else if (graphContext != null) { makeGraphCall(); } } } }
Source:
public Response getExtensions() { JSONArray results; try { List<String> extensions = STORE.getExtensions(); results = buildEnumerateResult(extensions); } catch (StoreAccessException e) { LOG.error("Enumerate extensions failed", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } catch (FalconException e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } try { JSONObject response = new JSONObject(); response.put(RESULTS, results); response.put(TOTAL_RESULTS, results.length()); return Response.ok(response).build(); } catch (Throwable e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }

Target:
public Response getExtensions() { JSONArray results; try { List<String> extensions = STORE.getExtensions(); results = buildEnumerateResult(extensions); } catch (StoreAccessException e) { LOG.error("Failed when accessing extension store.", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } catch (FalconException e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } try { JSONObject response = new JSONObject(); response.put(EXTENSION_RESULTS, results); response.put(TOTAL_RESULTS, results.length()); return Response.ok(response).build(); } catch (Throwable e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
private void fireExpireEntityEventTargetItem (final CallbackInfo ci) { try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) { frame.pushCause(this); ExpireEntityEvent.TargetItem event = SpongeEventFactory.createExpireEntityEventTargetItem(Sponge.getCauseStackManager().getCurrentCause(), (Item) this); SpongeImpl.postEvent(event); } }

Target:
private void impl$fireExpireEntityEventTargetItem(final CallbackInfo ci) { if (!SpongeImplHooks.isMainThread() || this.getItem().isEmpty()) { return; } try (final CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) { frame.pushCause(this); final ExpireEntityEvent.TargetItem event = SpongeEventFactory.createExpireEntityEventTargetItem(frame.getCurrentCause(), (Item) this); SpongeImpl.postEvent(event); } }
Source:
public void processTuple(byte[] tuple) { if (tuple == null) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(null, "Blank/null tuple")); } errorTupleCount++; return; } String incomingString = new String(tuple); if (StringUtils.isBlank(incomingString) || StringUtils.equals(incomingString, header)) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(incomingString, "Blank/header tuple")); } errorTupleCount++; return; } try { if (parsedOutput.isConnected()) { csvStringReader.open(incomingString); Map<String, Object> map = csvMapReader.read(nameMapping, processors); parsedOutput.emit(map); parsedOutputCount++; } if (out.isConnected() && clazz != null) { csvStringReader.open(incomingString); Object obj = csvBeanReader.read(clazz, nameMapping, processors); out.emit(obj); emittedObjectCount++; } } catch (SuperCsvException e) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(incomingString, e.getMessage())); } errorTupleCount++; logger.error("Tuple could not be parsed. Reason {}", e.getMessage()); } catch (IOException e) { logger.error("Exception in process method {}", e.getMessage()); DTThrowable.rethrow(e); } }

Target:
public void processTuple(byte[] tuple) { if (tuple == null) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(null, "Blank/null tuple")); } errorTupleCount++; return; } String incomingString = new String(tuple); if (StringUtils.isBlank(incomingString) || StringUtils.equals(incomingString, header)) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(incomingString, "Blank/header tuple")); } errorTupleCount++; return; } try { if (parsedOutput.isConnected()) { csvStringReader.open(incomingString); Map<String, Object> map = csvMapReader.read(nameMapping, processors); parsedOutput.emit(map); parsedOutputCount++; } if (out.isConnected() && clazz != null) { csvStringReader.open(incomingString); Object obj = csvBeanReader.read(clazz, nameMapping, processors); out.emit(obj); emittedObjectCount++; } } catch (SuperCsvException | IOException e) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(incomingString, e.getMessage())); } errorTupleCount++; logger.error("Tuple could not be parsed. Reason {}", e.getMessage()); } }
Source:
protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload, final KuraResponsePayload respPayload) { logger.info(message.cloudGETReqReceiving()); if ("assets".equals(reqTopic.getResources()[0])) { this.findAssets(); if (reqTopic.getResources().length == 1) { this.getAllAssets(respPayload); return; } if (reqTopic.getResources().length != 2) { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_BAD_REQUEST); return; } final Asset asset = this.assets.get(reqTopic.getResources()[1].trim()); if (asset == null) { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_NOTFOUND); return; } final String channelName = extractChannelName(reqPayload); if (channelName == null) { getChannelMetadata(respPayload, asset); } else if (channelName.indexOf(ALL_CHANNELS_WILDCARD) != -1) { readAllChannels(respPayload, asset); } else { readChannels(respPayload, asset, channelName); } } else { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_BAD_REQUEST); } logger.info(message.cloudGETReqReceived()); }

Target:
protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload, final KuraResponsePayload respPayload) { final String[] resources = reqTopic.getResources(); logger.info(message.cloudGETReqReceiving()); if ("assets".equals(resources[0])) { this.findAssets(); if (resources.length == 1) { this.getAllAssets(respPayload); return; } if (resources.length != 2) { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_BAD_REQUEST); return; } final Asset asset = this.assets.get(resources[1].trim()); if (asset == null) { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_NOTFOUND); return; } final String channelName = extractChannelName(reqPayload); if (channelName == null) { getChannelMetadata(respPayload, asset); } else if (channelName.indexOf(ALL_CHANNELS_WILDCARD) != -1) { readAllChannels(respPayload, asset); } else { readChannels(respPayload, asset, channelName); } } else { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_BAD_REQUEST); } logger.info(message.cloudGETReqReceived()); }
Source:
public String getStatusFor(final String issueKey) throws IssueTrackerUpdateException { try { Optional<IssueSummary> issue = jiraConnection.getRestJiraClient().loadByKey(issueKey); return issue.get().getStatus(); } catch (JSONException e) { throw new IssueTrackerUpdateException(e.getMessage(),e); } }

Target:
public String getStatusFor(final String issueKey) throws IssueTrackerUpdateException { try { Optional<IssueSummary> issue = jiraConnection.getRestJiraClient().loadByKey(issueKey); if(issue.isPresent()) { return issue.get().getStatus(); } else { logJiraIssueNotFound(issueKey); throw new IssueTrackerUpdateException("Issue not found " + issueKey, new NoSuchIssueException(issueKey)); } } catch (JSONException e) { throw new IssueTrackerUpdateException(e.getMessage(),e); } }
Source:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = new HashMap<String, String>(); List<PermissionSubject> subjects = getPermissionCheckSubjects(); if (subjects != null) { if (!subjects.isEmpty()) { VdcObjectType entityType; Guid entityId; String value; for (PermissionSubject permSubject : subjects) { entityType = permSubject.getObjectType(); entityId = permSubject.getObjectId(); if (entityType != null && entityId != null) { value = DbFacade.getInstance().getEntityNameByIdAndType(entityId, entityType); if (value == null) { value = entityId.toString(); } jobProperties.put(entityType.name().toLowerCase(), value); } } } } } return jobProperties; }

Target:
public Map<String, String> getJobMessageProperties() { jobProperties = new HashMap<String, String>(); List<PermissionSubject> subjects = getPermissionCheckSubjects(); if (jobProperties == null && subjects != null) { if (!subjects.isEmpty()) { VdcObjectType entityType; Guid entityId; String value; for (PermissionSubject permSubject : subjects) { entityType = permSubject.getObjectType(); entityId = permSubject.getObjectId(); if (entityType != null && entityId != null) { value = DbFacade.getInstance().getEntityNameByIdAndType(entityId, entityType); if (value == null) { value = entityId.toString(); } jobProperties.put(entityType.name().toLowerCase(), value); } } } } return jobProperties; }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String username = req.getParameter("user"); User currentUser = sessionUser.get(); try { Boolean password_hashed = (req.getParameter("password_hashed") == null ? false : (req.getParameter("password_hashed").equals("1") ? true : false) ); if (currentUser == null) { dataService.login(username, req.getParameter("password"), password_hashed); } String locale = req.getParameter("locale"); resp.sendRedirect("/" + (locale == null ? "" : ("?locale=" + locale))); } catch (Exception ex) { resp.getWriter().println("Authentication failed"); } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String username = req.getParameter("user"); User currentUser = sessionUser.get(); try { boolean passwordHashed = req.getParameter("password_hashed") != null && req.getParameter("password_hashed").equals("1"); if (currentUser == null) { dataService.login(username, req.getParameter("password"), passwordHashed); } String locale = req.getParameter("locale"); resp.sendRedirect("/" + (locale == null ? "" : ("?locale=" + locale))); } catch (Exception ex) { resp.getWriter().println("Authentication failed"); } }
Source:
public IDebugViewHelper getDebugViewHelper() { return this.debugViewHelpers.get(oldJobType); }

Target:
public IDebugViewHelper getDebugViewHelper() { return lastDebugType != null && debugViewHelpers.get(lastDebugType) != null ? debugViewHelpers.get(lastDebugType) : debugViewHelpers.get(EDebugProcessType.DI); }
Source:
private void testBinaryNumeric() throws SQLException { if (!getPgJdbcDriver()) { return; } Server server = createPgServer( "-ifNotExists", "-pgPort", "5535", "-pgDaemon", "-key", "pgserver", "mem:pgserver"); supportedBinaryOids.add(1700); try { Properties props = new Properties(); props.setProperty("user", "sa"); props.setProperty("password", "sa"); props.setProperty("prepareThreshold", "-1"); Connection conn = DriverManager.getConnection( "jdbc:postgresql://localhost:5535/pgserver", props); Statement stat = conn.createStatement(); try (ResultSet rs = stat.executeQuery("SELECT 1E-16383, 1E-16384, 1E+1")) { rs.next(); assertEquals(new BigDecimal("1E-16383"), rs.getBigDecimal(1)); for (int i = 2; i <= 3; i ++) { try { rs.getBigDecimal(i); fail(); } catch (IllegalArgumentException e) { } } } conn.close(); } finally { supportedBinaryOids.remove(1700); server.stop(); } }

Target:
private void testBinaryNumeric() throws SQLException { if (!getPgJdbcDriver()) { return; } Server server = createPgServer( "-ifNotExists", "-pgPort", "5535", "-pgDaemon", "-key", "pgserver", "mem:pgserver"); supportedBinaryOids.add(1700); try { Properties props = new Properties(); props.setProperty("user", "sa"); props.setProperty("password", "sa"); props.setProperty("prepareThreshold", "-1"); Connection conn = DriverManager.getConnection( "jdbc:postgresql://localhost:5535/pgserver", props); Statement stat = conn.createStatement(); try (ResultSet rs = stat.executeQuery("SELECT 1E-16383, 1E+1, 1E+89, 1E-16384")) { rs.next(); assertEquals(new BigDecimal("1E-16383"), rs.getBigDecimal(1)); assertEquals(new BigDecimal("10"), rs.getBigDecimal(2)); assertEquals(new BigDecimal("10").pow(89), rs.getBigDecimal(3)); try { rs.getBigDecimal(4); fail(); } catch (IllegalArgumentException e) { } } try (ResultSet rs = stat.executeQuery("SELECT 1E-32768")) { fail(); } catch (SQLException e) { assertEquals("22003", e.getSQLState()); } try (ResultSet rs = stat.executeQuery("SELECT 1E+131072")) { fail(); } catch (SQLException e) { assertEquals("22003", e.getSQLState()); } conn.close(); } finally { supportedBinaryOids.remove(1700); server.stop(); } }
Source:
public boolean insertAmenityIntoPoi(Amenity amenity) throws SQLException { assert IndexConstants.POI_TABLE != null : "use constants here to show table usage "; poiPreparedStatement.setLong(1, amenity.getId()); poiPreparedStatement.setInt(2, MapUtils.get31TileNumberX(amenity.getLocation().getLongitude())); poiPreparedStatement.setInt(3, MapUtils.get31TileNumberY(amenity.getLocation().getLatitude())); poiPreparedStatement.setString(4, amenity.getType().getKeyName()); poiPreparedStatement.setString(5, amenity.getSubType()); poiPreparedStatement.setString(6, encodeAdditionalInfo(amenity, amenity.getAdditionalInfo(), amenity.getName(), amenity.getEnName(false))); try { addBatch(poiPreparedStatement); return true; } catch (SQLException e) { if (e.getMessage().contains("UNIQUE constraint failed: ")) { log.info("Duplicate poi is not inserted: " + amenity.toString()); } else { throw e; } return false; } }

Target:
public void insertAmenityIntoPoi(Amenity amenity) throws SQLException { assert IndexConstants.POI_TABLE != null : "use constants here to show table usage "; poiPreparedStatement.setLong(1, amenity.getId()); poiPreparedStatement.setInt(2, MapUtils.get31TileNumberX(amenity.getLocation().getLongitude())); poiPreparedStatement.setInt(3, MapUtils.get31TileNumberY(amenity.getLocation().getLatitude())); poiPreparedStatement.setString(4, amenity.getType().getKeyName()); poiPreparedStatement.setString(5, amenity.getSubType()); poiPreparedStatement.setString(6, encodeAdditionalInfo(amenity, amenity.getAdditionalInfo(), amenity.getName(), amenity.getEnName(false))); addBatch(poiPreparedStatement); }
Source:
boolean boxedEqual3(Boolean B, Boolean V) { return B == V; }

Target:
void boxedEqual3(Boolean B, Boolean V) { if (B == V) { foo(); } else { bar(); } }
Source:
public ModListScreen(Screen mainMenu) { super(new TranslationTextComponent("fml.menu.mods.title")); this.mainMenu = mainMenu; this.mods = Collections.unmodifiableList(net.minecraftforge.fml.ModList.get().getMods()); this.unsortedMods = Collections.unmodifiableList(this.mods); }

Target:
public ModListScreen(Screen mainMenu) { super(new TranslationTextComponent("fml.menu.mods.title")); this.mainMenu = mainMenu; this.mods = Collections.unmodifiableList(ModList.get().getMods()); this.unsortedMods = Collections.unmodifiableList(this.mods); }
Source:
public void receivingGetAllOrganizationsRequest(final Map<String, String> settings) throws WebServiceSecurityException, GeneralSecurityException, IOException { ScenarioContext.Current().put(Keys.KEY_ORGANIZATION_IDENTIFICATION, getString(settings, Keys.KEY_ORGANIZATION_IDENTIFICATION, Defaults.DEFAULT_ORGANIZATION_IDENTIFICATION)); try { ScenarioContext.Current().put(Keys.RESPONSE, this.client.findAllOrganizations(new FindAllOrganisationsRequest())); } catch (final SoapFaultClientException e) { ScenarioContext.Current().put(Keys.RESPONSE, e); } final Object obj = ScenarioContext.Current().get(Keys.RESPONSE); System.out.println(obj); }

Target:
public void receivingGetAllOrganizationsRequest(final Map<String, String> settings) throws WebServiceSecurityException, GeneralSecurityException, IOException { ScenarioContext.Current().put(Keys.KEY_ORGANIZATION_IDENTIFICATION, getString(settings, Keys.KEY_ORGANIZATION_IDENTIFICATION, Defaults.DEFAULT_ORGANIZATION_IDENTIFICATION)); try { ScenarioContext.Current().put(Keys.RESPONSE, this.client.findAllOrganizations(new FindAllOrganisationsRequest())); } catch (final SoapFaultClientException e) { ScenarioContext.Current().put(Keys.RESPONSE, e); } }
Source:
private void repopulateBufferIfNeeded() { if (_exhaustedSource) { return; } if (_buffer.hasNext()) { return; } synchronized (this) { final List<? extends E> results = _getPage.apply(_offset); _buffer = results.iterator(); _offset += results.size(); } _exhaustedSource = !_buffer.hasNext(); }

Target:
private void repopulateBufferIfNeeded() { if (_exhaustedSource) { return; } if (!_buffer.isEmpty()) { return; } final List<? extends E> results = _getPage.apply(_offset); _buffer.addAll(results); _offset += results.size(); _exhaustedSource = _buffer.isEmpty(); }
Source:
public void testGetFileContentWithNonAsciiPath() throws Exception { final GHContent fileContent = gitHub.getRepository("hub4j-test-org/GHContentIntegrationTest") .getFileContent("ghcontent-ro/a-file-with-\u00F6"); assertThat(IOUtils.readLines(fileContent.read(), StandardCharsets.UTF_8), hasItems("test")); }

Target:
public void testGetFileContentWithNonAsciiPath() throws Exception { final GHRepository repo = gitHub.getRepository("hub4j-test-org/GHContentIntegrationTest"); final GHContent fileContent = repo.getFileContent("ghcontent-ro/a-file-with-\u00F6"); assertThat(IOUtils.readLines(fileContent.read(), StandardCharsets.UTF_8), hasItems("test")); final GHContent fileContent2 = repo.getFileContent(fileContent.getPath()); assertThat(IOUtils.readLines(fileContent2.read(), StandardCharsets.UTF_8), hasItems("test")); }
Source:
public Set<Contract.Postcondition> getPostconditions(ExecutableElement executableElement) { Set<Contract.Postcondition> result = super.getPostconditions(executableElement); if (declarationFromElement(executableElement) != null) { if (executableElement.getSimpleName().contentEquals("<init>")) { String[] fieldsToInitialize = fieldsToInitialize( (TypeElement) executableElement.getEnclosingElement()); if (fieldsToInitialize.length != 0) { AnnotationMirror initializedFieldsAnno; { AnnotationBuilder builder = new AnnotationBuilder( processingEnv, InitializedFields.class.getCanonicalName()); builder.setValue("value", fieldsToInitialize); initializedFieldsAnno = builder.build(); } AnnotationMirror ensuresAnno; { AnnotationBuilder builder = new AnnotationBuilder( processingEnv, EnsuresInitializedFields.class.getCanonicalName()); builder.setValue("value", new String[] {"this"}); builder.setValue("fields", fieldsToInitialize); ensuresAnno = builder.build(); } Contract.Postcondition ensuresContract = new Contract.Postcondition( "this", initializedFieldsAnno, ensuresAnno); result.add(ensuresContract); } } } return result; }

Target:
public Set<Contract.Postcondition> getPostconditions(ExecutableElement executableElement) { Set<Contract.Postcondition> result = super.getPostconditions(executableElement); if (declarationFromElement(executableElement) != null) { if (executableElement.getKind() == ElementKind.CONSTRUCTOR) { String[] fieldsToInitialize = fieldsToInitialize( (TypeElement) executableElement.getEnclosingElement()); if (fieldsToInitialize.length != 0) { AnnotationMirror initializedFieldsAnno; { AnnotationBuilder builder = new AnnotationBuilder( processingEnv, InitializedFields.class.getCanonicalName()); builder.setValue("value", fieldsToInitialize); initializedFieldsAnno = builder.build(); } AnnotationMirror ensuresAnno; { AnnotationBuilder builder = new AnnotationBuilder( processingEnv, EnsuresInitializedFields.class.getCanonicalName()); builder.setValue("value", "this"); builder.setValue("fields", fieldsToInitialize); ensuresAnno = builder.build(); } Contract.Postcondition ensuresContract = new Contract.Postcondition( "this", initializedFieldsAnno, ensuresAnno); result.add(ensuresContract); } } } return result; }
Source:
public void testMultipleAcknowledges() throws Exception { MockChannel channel = new MockChannel(); assertNull(channel.getWriteObject()); Dispatcher disp = new Dispatcher(10); DummyHandler handler = new DummyHandler("dummy handler"); disp.addHandler(handler); disp.init(); int numEvents = 1000; for (int i = 0; i < numEvents; i++) { Timber.LogEvent event = Timber.LogEvent.newBuilder(createMessage("meh " + i)) .setConsistencyLevel(ConsistencyLevel.REPLICATED) .setId("" + i) .build(); disp.dispatch(event, channel); } disp.shutdown(); BitSet bits = new BitSet(1000); for (Object obj : channel.getObjects()) { Timber.AckEvent ackEvent = (Timber.AckEvent) obj; for (String id : ackEvent.getIdList()) { bits.set(Integer.parseInt(id)); } } BitSet truth = new BitSet(1000); truth.set(0,1000); assertEquals(truth, bits); }

Target:
public void testMultipleAcknowledges() throws Exception { MockChannel channel = new MockChannel(); assertNull(channel.getWriteObject()); Dispatcher disp = new Dispatcher(10); DummyHandler handler = new DummyHandler("dummy handler"); disp.addHandler(handler); disp.init(); int numEvents = 1000; for (int i = 0; i < numEvents; i++) { Timber.LogEvent event = Timber.LogEvent.newBuilder(createMessage("meh " + i)) .setConsistencyLevel(ConsistencyLevel.REPLICATED) .setId("" + i) .build(); disp.dispatch(event, channel); } disp.shutdown(); BitSet bits = new BitSet(1000); for (Object obj : channel.getObjects()) { Timber.AckEvent ackEvent = (Timber.AckEvent) obj; for (String id : ackEvent.getIdList()) { bits.set(Integer.parseInt(id)); } } BitSet expected = new BitSet(1000); expected.set(0,1000); assertEquals(expected, bits); }
Source:
public static void getDataCenterById(AsyncQuery aQuery, Guid dataCenterId) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { return source; } }; Frontend.getInstance().runQuery(VdcQueryType.GetStoragePoolById, new IdQueryParameters(dataCenterId).withoutRefresh(), aQuery); }

Target:
public static void getDataCenterById(AsyncQuery aQuery, Guid dataCenterId) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { return source; } }; IdQueryParameters params = new IdQueryParameters(dataCenterId); params.setRefresh(false); Frontend.getInstance().runQuery(VdcQueryType.GetStoragePoolById, params, aQuery); }