auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void choosePicture() { Intent getIntent = new Intent(); getIntent.setType("image/*"); getIntent.setAction(Intent.ACTION_GET_CONTENT); Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); pickIntent.setType("image/*"); Intent takePhotoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File externalFile = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), "userPic" + System.currentTimeMillis() + ".jpg"); imageUri = Uri.fromFile(externalFile); if(BuildConfig.DEBUG) { Log.d("photo location", imageUri.toString()); } takePhotoIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); String pickTitle = getString(R.string.select_picture); Intent chooserIntent = Intent.createChooser(getIntent, pickTitle); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {pickIntent, takePhotoIntent}); startActivityForResult(chooserIntent, SELECT_PICTURE); }

Target:
public void choosePicture() { Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); pickIntent.setType("image/*"); Intent takePhotoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File externalFile = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), "userPic" + System.currentTimeMillis() + ".jpg"); imageUri = Uri.fromFile(externalFile); if(BuildConfig.DEBUG) { Log.d("photo location", imageUri.toString()); } takePhotoIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); String pickTitle = getString(R.string.select_picture); Intent chooserIntent = Intent.createChooser(takePhotoIntent, pickTitle); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {pickIntent}); startActivityForResult(chooserIntent, SELECT_PICTURE); }
Source:
private void cleanup(ConsumerProcess consumerProcess) { kill(consumerProcess); runningProcesses.remove(consumerProcess); }

Target:
private void cleanup(ConsumerProcess consumerProcess) { kill(consumerProcess); }
Source:
public ServiceName getServiceName() { return getServiceName(name); }

Target:
public ServiceName getServiceName() { return super.getServiceName().append("configuration"); }
Source:
public void invalidProviderType() { provider.setType(NON_NETWORK_PROVIDER_TYPE); assertThat(validator.providerTypeValid(), failsWith(VdcBllMessages.ACTION_TYPE_FAILED_PROVIDER_TYPE_MISMATCH)); }

Target:
public void invalidProviderType() { when(provider.getType()).thenReturn(NON_NETWORK_PROVIDER_TYPE); assertThat(validator.providerTypeValid(), failsWith(VdcBllMessages.ACTION_TYPE_FAILED_PROVIDER_TYPE_MISMATCH)); }
Source:
public void visitNode(Tree tree) { AnnotationTree annotation = (AnnotationTree) tree; Set<String> scanPackageAttributeNames = SCAN_PACKAGE_ATTRIBUTES.get(annotation.symbolType().fullyQualifiedName()); if (scanPackageAttributeNames != null) { List<ExpressionTree> scanPackageAttributes = annotation.arguments().stream() .filter(argument -> scanPackageAttributeNames.contains(attributeName(argument))) .collect(Collectors.toList()); if (scanPackageAttributes.isEmpty()) { checkIfAnnotationIsInDefaultPackage(annotation); } else { checkAnnotationPackageAttributes(annotation, scanPackageAttributes); } } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } AnnotationTree annotation = (AnnotationTree) tree; Set<String> scanPackageAttributeNames = SCAN_PACKAGE_ATTRIBUTES.get(annotation.symbolType().fullyQualifiedName()); if (scanPackageAttributeNames != null) { List<ExpressionTree> scanPackageAttributeValues = annotation.arguments().stream() .filter(argument -> scanPackageAttributeNames.contains(attributeName(argument))) .flatMap(SpringScanDefaultPackageCheck::extractValues) .collect(Collectors.toList()); checkAnnotationPackageAttributes(annotation, scanPackageAttributeValues); } }
Source:
public void runToolToMissingS3() { File cwlFile = new File(ResourceHelpers.resourceFilePath("file_provision/split.cwl")); File cwlJSON = new File(ResourceHelpers.resourceFilePath("file_provision/split_to_s3_failed.json")); final ByteArrayOutputStream launcherOutput = new ByteArrayOutputStream(); System.setOut(new PrintStream(launcherOutput)); thrown.expect(AssertionError.class); runTool(cwlFile, cwlJSON); final String standardOutput = launcherOutput.toString(); assertTrue("Error should occur, caused by Amazon S3 Exception", standardOutput.contains("Caused by: com.amazonaws.services.s3.model.AmazonS3Exception")); }

Target:
public void runToolToMissingS3() { File cwlFile = new File(ResourceHelpers.resourceFilePath("file_provision/split.cwl")); File cwlJSON = new File(ResourceHelpers.resourceFilePath("file_provision/split_to_s3_failed.json")); ByteArrayOutputStream launcherOutput = null; try { launcherOutput = new ByteArrayOutputStream(); System.setOut(new PrintStream(launcherOutput)); thrown.expect(AssertionError.class); runTool(cwlFile, cwlJSON); final String standardOutput = launcherOutput.toString(); assertTrue("Error should occur, caused by Amazon S3 Exception", standardOutput.contains("Caused by: com.amazonaws.services.s3.model.AmazonS3Exception")); } finally { try { if (launcherOutput != null) { launcherOutput.close(); } } catch (IOException ex) { assertTrue("Error closing output stream.", true); } } }
Source:
public boolean isVideoPlaying() { wait.forElementVisible(videoFeedback); return videoFeedback.isDisplayed(); }

Target:
public boolean isVideoPlaying() { wait.forElementVisible(playerStatePlaying); return playerStatePlaying.isDisplayed(); }
Source:
public Iterator<InodeView> iterator() { return RocksUtils.createIterator(db().newIterator(mInodesColumn.get()), (iter) -> getMutable(Longs.fromByteArray(iter.key()), ReadOption.defaults()).get()); }

Target:
public Iterator<InodeView> iterator() { return RocksUtils.createIterator(db().newIterator(mInodesColumn.get(), mIteratorOption), (iter) -> getMutable(Longs.fromByteArray(iter.key()), ReadOption.defaults()).get()); }
Source:
public IBinder getLegacyBrowserServiceBinder() { if (mBrowserServiceLegacyStub != null) { Intent intent = new Intent(MediaBrowserServiceCompat.SERVICE_INTERFACE); return mBrowserServiceLegacyStub.onBind(intent); } return null; }

Target:
public IBinder getLegacyBrowserServiceBinder() { Intent intent = new Intent(MediaBrowserServiceCompat.SERVICE_INTERFACE); return mBrowserServiceLegacyStub.onBind(intent); }
Source:
public RecordWriter getRecordWriter(TaskAttemptContext context) throws IOException { Configuration conf = context.getConfiguration(); Connection conn = null; PreparedStatement ps = null; String dbProductName = conf.get(JdbcStorageConfig.DATABASE_TYPE.getPropertyName()).toUpperCase(); String tableName = conf.get(JdbcStorageConfig.TABLE.getPropertyName()); if (tableName == null || tableName.isEmpty()) { throw new IllegalArgumentException("Table name should be defined"); } String[] columnNames = conf.get(serdeConstants.LIST_COLUMNS).split(","); try { initializeDatabaseConnection(conf); conn = dbcpDataSource.getConnection(); ps = conn.prepareStatement( constructQuery(tableName, columnNames, dbProductName)); return new org.apache.hadoop.mapreduce.lib.db.DBOutputFormat() .new DBRecordWriter(conn, ps); } catch (Exception e) { cleanupResources(conn, ps, null); throw new IOException(e.getMessage()); } }

Target:
public RecordWriter getRecordWriter(TaskAttemptContext context) throws IOException { Configuration conf = context.getConfiguration(); String tableName = conf.get(JdbcStorageConfig.TABLE.getPropertyName()); if (tableName == null || tableName.isEmpty()) { throw new IllegalArgumentException("Table name should be defined"); } Connection conn = null; PreparedStatement ps = null; String[] columnNames = conf.get(serdeConstants.LIST_COLUMNS).split(","); try { initializeDatabaseConnection(conf); conn = dbcpDataSource.getConnection(); ps = conn.prepareStatement(constructQuery(tableName, columnNames)); return new org.apache.hadoop.mapreduce.lib.db.DBOutputFormat() .new DBRecordWriter(conn, ps); } catch (Exception e) { cleanupResources(conn, ps, null); throw new IOException(e.getMessage()); } }
Source:
@Test void testProject() { CalciteAssert.that() .with(TWISSANDRA) .query("select \"tweet_id\" from \"userline\" where \"username\" = '!PUBLIC!' limit 2") .returns("tweet_id=f3c329de-d05b-11e5-b58b-90e2ba530b12\n" + "tweet_id=f3dbb03a-d05b-11e5-b58b-90e2ba530b12\n") .explainContains("PLAN=CassandraToEnumerableConverter\n" + " CassandraProject(tweet_id=[$2])\n" + " CassandraLimit(fetch=[2])\n" + " CassandraFilter(condition=[=($0, '!PUBLIC!')])\n"); }

Target:
@Test void testProject() { CalciteAssert.that() .with(TWISSANDRA) .query("select \"tweet_id\" from \"userline\" where \"username\" = '!PUBLIC!' limit 2") .returns("tweet_id=f3c329de-d05b-11e5-b58b-90e2ba530b12\n" + "tweet_id=f3dbb03a-d05b-11e5-b58b-90e2ba530b12\n") .explainContains("PLAN=CassandraToEnumerableConverter\n" + " CassandraLimit(fetch=[2])\n" + " CassandraProject(tweet_id=[$2])\n" + " CassandraFilter(condition=[=($0, '!PUBLIC!')])\n"); }
Source:
public List<PreConfiguredTokenFilter> getPreConfiguredTokenFilters() { return Collections.singletonList(PreConfiguredTokenFilter.singleton("homoglyph_norm", true, HomoglyphTokenFilter::new)); }

Target:
public List<PreConfiguredTokenFilter> getPreConfiguredTokenFilters() { return singletonList(PreConfiguredTokenFilter.singleton("homoglyph_norm", true, in -> new HomoglyphTokenFilter(in, new TranslationTable(TranslationTableDictionaries.latinToCyrillic)))); }
Source:
public Optional<Response> handle(HandlerInput input) { String speechText; String favoriteColor = (String) input.getAttributesManager().getSessionAttributes().get(COLOR_KEY); boolean isAskResponse = false; if (favoriteColor != null && !favoriteColor.isEmpty()) { speechText = String.format("Your favorite color is %s. Goodbye.", favoriteColor); isAskResponse = true; } else { speechText = "I'm not sure what your favorite color is. You can say, my favorite color is " + "red."; } ResponseBuilder responseBuilder = input.getResponseBuilder(); responseBuilder.withSimpleCard("ColorSession", speechText) .withSpeech(speechText); if(!isAskResponse) { responseBuilder.withShouldEndSession(false); } return responseBuilder.build(); }

Target:
public Optional<Response> handle(HandlerInput input) { String speechText; String favoriteColor = (String) input.getAttributesManager().getSessionAttributes().get(COLOR_KEY); boolean noAnswerProvided = false; if (favoriteColor != null && !favoriteColor.isEmpty()) { speechText = String.format("Your favorite color is %s. Goodbye.", favoriteColor); } else { speechText = "I'm not sure what your favorite color is. You can say, my favorite color is " + "red."; noAnswerProvided = true; } return input.getResponseBuilder() .withSimpleCard("ColorSession", speechText) .withSpeech(speechText) .withShouldEndSession(!noAnswerProvided) .build(); }
Source:
public void handleError(ClientHttpResponse response) throws IOException { HttpStatus status = response.getStatusCode(); switch (status) { case FORBIDDEN: log.warn("FORBIDDEN response code received. If you are trying to connect to the AWS S3 Repository, you need to be running ths ICGC client on an EC2 VM instance."); throw new NotRetryableException(new IOException( "Amazon S3 error: Access refused by object store. Confirm request host is on permitted list" + IOUtils.toString(response.getBody()))); case REQUEST_TIMEOUT: log.warn("Unable to connect to repository endpoint. You need to be running on a compute node within the repository cloud. Or else your network connection is hinky."); throw new NotRetryableException(new IOException( "Cloud error: Access refused by object store. Confirm request host is on permitted list" + IOUtils.toString(response.getBody()))); default: log.warn("Non-Retryable exception: {}", response.getStatusText()); throw new NotRetryableException(new IOException("Unable to verify connectivity to repository: " + IOUtils.toString(response.getBody()))); } }

Target:
public void handleError(ClientHttpResponse response) throws IOException { val status = response.getStatusCode(); switch (status) { case FORBIDDEN: log.warn("FORBIDDEN response code received. If you are trying to connect to the AWS S3 Repository, you need to be running ths ICGC client on an EC2 VM instance."); throw notRetryableException( "Amazon S3 error: Access refused by object store. Confirm request host is on permitted list", response); case REQUEST_TIMEOUT: log.warn("Unable to connect to repository endpoint. You need to be running on a compute node within the repository cloud. Or else your network connection is hinky."); throw notRetryableException( "Cloud error: Access refused by object store. Confirm request host is on permitted list", response); default: log.warn("Non-Retryable exception: {}", response.getStatusText()); throw notRetryableException("Unable to verify connectivity to repository: ", response); } }
Source:
private String resolveUrl(URI uri, String link) { String url = cfg.getString("gerrit", null, "canonicalWebUrl"); if (Strings.isNullOrEmpty(url)) { url = uri.toString(); } if (!url.endsWith("/")) { url += "/"; } if (Strings.isNullOrEmpty(link)) { url += "#" + link; } return url; }

Target:
private String resolveUrl(URI uri, String link) { String url = cfg.getString("gerrit", null, "canonicalWebUrl"); if (Strings.isNullOrEmpty(url)) { url = uri.toString(); } if (!url.endsWith("/")) { url += "/"; } if (!Strings.isNullOrEmpty(link)) { url += "#" + link; } return url; }
Source:
public Reader readRaw() throws IOException { FileInputStream fileInputStream = new FileInputStream(file); try { return new InputStreamReader(fileInputStream, sniffEncoding()); } catch(IOException ex) { fileInputStream.close(); throw ex; } }

Target:
public Reader readRaw() throws IOException { FileInputStream fileInputStream = new FileInputStream(file); try { return new InputStreamReader(fileInputStream, sniffEncoding()); } catch(IOException ex) { Util.closeAndLogFailures(fileInputStream, LOGGER, "FileInputStream", file.toString()); throw ex; } }
Source:
private void populateColumns(JsonNode propertiesNode, List<String> arrays, List<ElasticsearchColumn> columns) throws IOException { TreeMap<String, Type> fieldsMap = new TreeMap<>(new Comparator<String>() { @Override public int compare(String key1, String key2) { int length1 = key1.split("\\.").length; int length2 = key2.split("\\.").length; if (length1 == length2) { return key1.compareTo(key2); } return length2 - length1; } }); for (String columnMetadata : getColumnsMetadata(null, propertiesNode)) { String[] items = columnMetadata.split(":"); if (items.length != 2) { log.debug("Invalid column path format: " + columnMetadata); continue; } if (!items[0].endsWith(".type")) { log.debug("Ignore column with no type info: " + columnMetadata); continue; } String propertyName = items[0].substring(0, items[0].lastIndexOf('.')); String nestedName = propertyName.replaceAll("properties\\.", ""); if (nestedName.contains(".")) { fieldsMap.put(nestedName, getPrestoType(items[1])); } else { if (!columns.stream().anyMatch(column -> column.getName().equalsIgnoreCase(nestedName))) { columns.add(new ElasticsearchColumn(nestedName, getPrestoType(items[1]), nestedName, items[1], arrays.contains(nestedName), -1)); } } } processNestedFields(fieldsMap, columns, arrays); }

Target:
private void populateColumns(JsonNode propertiesNode, List<String> arrays, List<ElasticsearchColumn> columns) throws IOException { Comparator<String> stringComparator = (key1, key2) -> { int length1 = key1.split("\\.").length; int length2 = key2.split("\\.").length; if (length1 == length2) { return key1.compareTo(key2); } return length2 - length1; }; TreeMap<String, Type> fieldsMap = new TreeMap<>(stringComparator); for (String columnMetadata : getColumnsMetadata(null, propertiesNode)) { int delimiterIndex = columnMetadata.lastIndexOf(":"); if (delimiterIndex == -1 || delimiterIndex == columnMetadata.length() - 1) { LOG.debug("Invalid column path format: " + columnMetadata); continue; } String fieldName = columnMetadata.substring(0, delimiterIndex); String typeName = columnMetadata.substring(delimiterIndex + 1); if (!fieldName.endsWith(".type")) { LOG.debug("Ignoring column with no type info: " + columnMetadata); continue; } String propertyName = fieldName.substring(0, fieldName.lastIndexOf('.')); String nestedName = propertyName.replaceAll("properties\\.", ""); if (nestedName.contains(".")) { fieldsMap.put(nestedName, getPrestoType(typeName)); } else { boolean newNestedColumn = columns.stream().noneMatch(column -> column.getName().equalsIgnoreCase(nestedName)); if (newNestedColumn) { columns.add(new ElasticsearchColumn(nestedName, getPrestoType(typeName), nestedName, typeName, arrays.contains(nestedName), -1)); } } } processNestedFields(fieldsMap, columns, arrays); }
Source:
public void refresh() { logger.info("Refresh"); ServerInfo i = visibleList.getSelection(); visibleList.setSelection(null); extInfo.clear(); visibleList.setSelection(i); }

Target:
public void refresh() { ServerInfo i = visibleList.getSelection(); visibleList.setSelection(null); extInfo.clear(); visibleList.setSelection(i); }
Source:
String applyCSS(String html, String css, XWikiContext context) { LOGGER.debug("Applying the following CSS to HTML [{}]", css, html); try { Reader re = new StringReader(html); InputSource source = new InputSource(re); XHTMLDocumentFactory docFactory = XHTMLDocumentFactory.getInstance(); SAXReader reader = new SAXReader(docFactory); XMLReader xmlReader = Utils.getComponent(XMLReaderFactory.class).createXMLReader(); try { xmlReader.setFeature("<LINK_0>", true); } catch (SAXNotRecognizedException | SAXNotSupportedException e) { } reader.setXMLReader(xmlReader); reader.setEntityResolver(new DefaultEntityResolver()); XHTMLDocument document = (XHTMLDocument) reader.read(source); document.setBaseURL(new URL(context.getDoc().getExternalURL("view", context))); document.addStyleSheet(new io.sf.carte.doc.style.css.nsac.InputSource(new StringReader(css))); applyInlineStyle(document.getRootElement()); OutputFormat outputFormat = new OutputFormat("", false); if ((context == null) || (context.getWiki() == null)) { outputFormat.setEncoding("UTF-8"); } else { outputFormat.setEncoding(context.getWiki().getEncoding()); } StringWriter out = new StringWriter(); XMLWriter writer = new XMLWriter(out, outputFormat); writer.write(document); String result = out.toString(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("HTML with CSS applied [{}]", result); } return result; } catch (Exception e) { LOGGER.warn("Failed to apply CSS to HTML [{}]", css, html, e); return html; } }

Target:
String applyCSS(String html, String css, XWikiContext context) { LOGGER.debug("Applying the following CSS to HTML [{}]", css, html); try { Reader re = new StringReader(html); InputSource source = new InputSource(re); XHTMLDocumentFactory docFactory = XHTMLDocumentFactory.getInstance(); SAXReader reader = new SAXReader(docFactory); XMLReader xmlReader = Utils.getComponent(XMLReaderFactory.class).createXMLReader(); reader.setXMLReader(xmlReader); reader.setEntityResolver(new DefaultEntityResolver()); XHTMLDocument document = (XHTMLDocument) reader.read(source); document.setBaseURL(new URL(context.getDoc().getExternalURL("view", context))); document.addStyleSheet(new io.sf.carte.doc.style.css.nsac.InputSource(new StringReader(css))); applyInlineStyle(document.getRootElement()); OutputFormat outputFormat = new OutputFormat("", false); if ((context == null) || (context.getWiki() == null)) { outputFormat.setEncoding("UTF-8"); } else { outputFormat.setEncoding(context.getWiki().getEncoding()); } StringWriter out = new StringWriter(); XMLWriter writer = new XMLWriter(out, outputFormat); writer.write(document); String result = out.toString(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("HTML with CSS applied [{}]", result); } return result; } catch (Exception e) { LOGGER.warn("Failed to apply CSS to HTML [{}]", css, html, e); return html; } }
Source:
private void addCPESearchLevel() { Predicate<Release> isPossible = r -> r.isSetCpeid() && isCpe(r.getCpeid().toLowerCase()); searchLevels.add(r -> { if (isPossible.test(r)) { return singletonList(new NeedleWithMeta(cleanupCPE(r.getCpeid()), "CPE")); } return ImmutableList.of(); }); }

Target:
private void addCPESearchLevel() { Predicate<Release> isPossible = r -> r.isSetCpeid() && isCpe(r.getCpeid().toLowerCase()); searchLevels.add(r -> { if(isPossible.test(r)){ return singletonList(new NeedleWithMeta(cleanupCPE(r.getCpeid()), "CPE")); } return Collections.emptyList(); }); }
Source:
public Set<Operand> getAllOperands() { List<Operand> allOperands = null; LinkedHashSet<Operand> allOrderedOperands = null; if (useCache) { if (allOperandsCache != null) { allOperands = Lists.newArrayList(allOperandsCache); } allOrderedOperands = allOrderedOperandsCache; } if (allOrderedOperands == null) { if (allOperands == null) { allOperands = Lists.newArrayList(); for (Node node : Iterables.filter(Iterables.filter(AllContents.of(getNotationDiagram()), Node.class), Operand.notationPredicate())) { Option<Operand> exec = ISequenceElementAccessor.getOperand(node); assert exec.some() : INTERNAL_ERROR; allOperands.add(exec.get()); } if (useCache) { allOperandsCache = Lists.newArrayList(allOperands); } } Collections.sort(allOperands, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); allOrderedOperands = Sets.newLinkedHashSet(allOperands); if (useCache) { allOrderedOperandsCache = allOrderedOperands; } } return allOrderedOperands; }

Target:
public Set<Operand> getAllOperands() { List<Operand> allOperands = null; LinkedHashSet<Operand> allOrderedOperands = null; if (useCache) { if (allOperandsCache != null) { allOperands = Lists.newArrayList(allOperandsCache); } allOrderedOperands = allOrderedOperandsCache; } if (allOrderedOperands == null) { if (allOperands == null) { allOperands = Lists.newArrayList(); for (Node node : Iterables.filter(Iterables.filter(AllContents.of(getNotationDiagram()), Node.class), Operand.notationPredicate())) { Option<Operand> exec = ISequenceElementAccessor.getOperand(node); assert exec.some() : INTERNAL_ERROR; allOperands.add(exec.get()); } if (useCache) { allOperandsCache = allOperands; } } Collections.sort(allOperands, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); allOrderedOperands = Sets.newLinkedHashSet(allOperands); if (useCache) { allOrderedOperandsCache = allOrderedOperands; } } return allOrderedOperands; }
Source:
public ListenableFuture<PagesResponse> getResults(long token, DataSize maxResponseSize) { URI uriBase = asyncPageTransportLocation.isPresent() ? asyncPageTransportLocation.get() : location; URI uri = uriBuilderFrom(uriBase).appendPath(String.valueOf(token)).build(); return httpClient.executeAsync( prepareGet() .setHeader(PRESTO_MAX_SIZE, maxResponseSize.toString()) .setUri(uri).build(), new PageResponseHandler()); }

Target:
public ListenableFuture<PagesResponse> getResults(long token, DataSize maxResponseSize) { URI uriBase = asyncPageTransportLocation.orElse(location); URI uri = uriBuilderFrom(uriBase).appendPath(String.valueOf(token)).build(); return httpClient.executeAsync( prepareGet() .setHeader(PRESTO_MAX_SIZE, maxResponseSize.toString()) .setUri(uri).build(), new PageResponseHandler()); }
Source:
public MapType(boolean useNewMapBlock, Type keyType, Type valueType, MethodHandle keyBlockNativeEquals, MethodHandle keyNativeHashCode, MethodHandle keyBlockHashCode) { super(new TypeSignature(StandardTypes.MAP, TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature())), Block.class); if (!keyType.isComparable()) { throw new IllegalArgumentException(format("key type must be comparable, got %s", keyType)); } this.useNewMapBlock = useNewMapBlock; this.keyType = keyType; this.valueType = valueType; if (useNewMapBlock) { requireNonNull(keyBlockNativeEquals, "keyBlockNativeEquals is null"); requireNonNull(keyNativeHashCode, "keyNativeHashCode is null"); requireNonNull(keyBlockHashCode, "keyBlockHashCode is null"); } this.keyBlockNativeEquals = keyBlockNativeEquals; this.keyNativeHashCode = keyNativeHashCode; this.keyBlockHashCode = keyBlockHashCode; }

Target:
public MapType(boolean useNewMapBlock, Type keyType, Type valueType, MethodHandle keyBlockNativeEquals, MethodHandle keyNativeHashCode, MethodHandle keyBlockHashCode) { super(new TypeSignature(StandardTypes.MAP, TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature())), Block.class); if (!keyType.isComparable()) { throw new IllegalArgumentException(format("key type must be comparable, got %s", keyType)); } this.useNewMapBlock = useNewMapBlock; this.keyType = keyType; this.valueType = valueType; if (useNewMapBlock) { requireNonNull(keyBlockNativeEquals, "keyBlockNativeEquals is null"); requireNonNull(keyNativeHashCode, "keyNativeHashCode is null"); requireNonNull(keyBlockHashCode, "keyBlockHashCode is null"); } else { if (keyBlockNativeEquals != null) { throw new IllegalArgumentException("When useNewMapBlock is false, keyBlockNativeEquals should be null."); } if (keyNativeHashCode != null) { throw new IllegalArgumentException("When useNewMapBlock is false, keyNativeHashCode should be null."); } if (keyBlockHashCode != null) { throw new IllegalArgumentException("When useNewMapBlock is false, keyBlockHashCode should be null."); } } this.keyBlockNativeEquals = keyBlockNativeEquals; this.keyNativeHashCode = keyNativeHashCode; this.keyBlockHashCode = keyBlockHashCode; }
Source:
public void login() throws Exception { CommonUtil.openPerspective("WSO2 APIManager"); apimUtils.login(userName, passWord); }

Target:
public void login() throws Exception { FunctionalUtil.openPerspective(APIMConstants.WSO2_API_MANAGER); apimUtils.login(userName, passWord, url, null); try{ APIMUtils.expandTree(userName, url); } catch(Exception e){ } }
Source:
public void testUnexpectedTaskManagerTerminationFailsRunnerFatally() throws Exception { final CompletableFuture<Void> terminationFuture = new CompletableFuture<>(); final TestingTaskExecutorService taskExecutorService = TestingTaskExecutorService.newBuilder() .setTerminationFuture(terminationFuture) .build(); final TaskManagerRunner taskManagerRunner = createTaskManagerRunner( createConfiguration(), (configuration, resourceID, rpcService, highAvailabilityServices, heartbeatServices, metricRegistry, blobCacheService, localCommunicationOnly, externalResourceInfoProvider, fatalErrorHandler) -> taskExecutorService); terminationFuture.completeExceptionally(new FlinkException("Test exception.")); Integer statusCode = systemExitTrackingSecurityManager.getSystemExitFuture().get(); assertThat(statusCode, is(equalTo(TaskManagerRunner.RUNTIME_FAILURE_RETURN_CODE))); }

Target:
public void testUnexpectedTaskManagerTerminationFailsRunnerFatally() throws Exception { final CompletableFuture<Void> terminationFuture = new CompletableFuture<>(); final TestingTaskExecutorService taskExecutorService = TestingTaskExecutorService.newBuilder() .setTerminationFuture(terminationFuture) .build(); final TaskManagerRunner taskManagerRunner = createTaskManagerRunner( createConfiguration(), createTaskExecutorServiceFactory(taskExecutorService)); terminationFuture.completeExceptionally(new FlinkException("Test exception.")); Integer statusCode = systemExitTrackingSecurityManager.getSystemExitFuture().get(); assertThat(statusCode, is(equalTo(TaskManagerRunner.RUNTIME_FAILURE_RETURN_CODE))); }
Source:
public List<AttributeRights> getAttributeRights(PerunSession sess, final int attributeId) throws InternalErrorException { List<AttributeRights> rights; try { rights = jdbc.query("SELECT " + attributeRightSelectQuery + " FROM attributes_authz JOIN roles ON " + "attributes_authz.role_id=roles.id JOIN action_types ON attributes_authz.action_type_id=action_types.id WHERE " + "attributes_authz.attr_id=?", new AttributeRightsExtractor(attributeId), attributeId); } catch (RuntimeException e) { throw new InternalErrorException(e); } Utils.notNull(rights, "rights"); boolean roleExists; List<Role> listOfRoles = new ArrayList<>(); listOfRoles.add(Role.FACILITYADMIN); listOfRoles.add(Role.GROUPADMIN); listOfRoles.add(Role.SELF); listOfRoles.add(Role.VOADMIN); for (Role roleToTry : listOfRoles) { roleExists = false; Iterator itr = rights.iterator(); while ((itr.hasNext()) && (!roleExists)) { AttributeRights right = (AttributeRights) itr.next(); if (right.getRole().equals(roleToTry)) { roleExists = true; } } if (!roleExists) { rights.add(new AttributeRights(attributeId, roleToTry, new ArrayList<>())); } } return rights; }

Target:
public List<AttributeRights> getAttributeRights(PerunSession sess, final int attributeId) throws InternalErrorException { List<AttributeRights> rights; try { rights = jdbc.query("SELECT " + attributeRightSelectQuery + " FROM attributes_authz JOIN roles ON " + "attributes_authz.role_id=roles.id JOIN action_types ON attributes_authz.action_type_id=action_types.id WHERE " + "attributes_authz.attr_id=?", new AttributeRightsExtractor(attributeId), attributeId); } catch (RuntimeException e) { throw new InternalErrorException(e); } if (rights == null) { throw new InternalErrorException("The attribute rights for the attribute with id " + attributeId + " were null."); } boolean roleExists; List<Role> listOfRoles = new ArrayList<>(); listOfRoles.add(Role.FACILITYADMIN); listOfRoles.add(Role.GROUPADMIN); listOfRoles.add(Role.SELF); listOfRoles.add(Role.VOADMIN); for (Role roleToTry : listOfRoles) { roleExists = false; Iterator itr = rights.iterator(); while ((itr.hasNext()) && (!roleExists)) { AttributeRights right = (AttributeRights) itr.next(); if (right.getRole().equals(roleToTry)) { roleExists = true; } } if (!roleExists) { rights.add(new AttributeRights(attributeId, roleToTry, new ArrayList<>())); } } return rights; }
Source:
public void setUp() { tester = new RuleTester(); }

Target:
public final void setUp() { tester = new RuleTester(); }
Source:
public AbfsInputStream( final AbfsClient client, final Statistics statistics, final String path, final long contentLength, final AbfsInputStreamContext abfsInputStreamContext, final String eTag) { this.client = client; this.statistics = statistics; this.path = path; this.contentLength = contentLength; this.bufferSize = abfsInputStreamContext.getReadBufferSize(); this.readAheadQueueDepth = abfsInputStreamContext.getReadAheadQueueDepth(); this.tolerateOobAppends = abfsInputStreamContext.isTolerateOobAppends(); this.eTag = eTag; this.readAheadEnabled = true; this.cachedSasToken = new CachedSASToken( abfsInputStreamContext.getSasTokenRenewPeriodForStreamsInSeconds()); this.streamStatistics = abfsInputStreamContext.getStreamStatistics(); this.readSmallFilesCompletely = abfsInputStreamContext .readSmallFilesCompletely(); this.optimizeFooterRead = abfsInputStreamContext.optimizeFooterRead(); }

Target:
public AbfsInputStream( final AbfsClient client, final Statistics statistics, final String path, final long contentLength, final AbfsInputStreamContext abfsInputStreamContext, final String eTag) { this.client = client; this.statistics = statistics; this.path = path; this.contentLength = contentLength; this.bufferSize = abfsInputStreamContext.getReadBufferSize(); this.readAheadQueueDepth = abfsInputStreamContext.getReadAheadQueueDepth(); this.tolerateOobAppends = abfsInputStreamContext.isTolerateOobAppends(); this.eTag = eTag; this.readAheadEnabled = true; this.alwaysReadBufferSize = abfsInputStreamContext.shouldReadBufferSizeAlways(); this.cachedSasToken = new CachedSASToken( abfsInputStreamContext.getSasTokenRenewPeriodForStreamsInSeconds()); this.streamStatistics = abfsInputStreamContext.getStreamStatistics(); this.context = abfsInputStreamContext; readAheadBlockSize = abfsInputStreamContext.getReadAheadBlockSize(); ReadBufferManager.setReadBufferManagerConfigs(readAheadBlockSize); }
Source:
protected void onResume() { super.onResume(); disposable = RxTextView.textChangeEvents(searchInputView) .debounce(200, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .toFlowable( BackpressureStrategy.BUFFER) .flatMap(new Function<TextViewTextChangeEvent, Publisher<RealmResults<Person>>>() { public Publisher<RealmResults<Person>> apply(TextViewTextChangeEvent textViewTextChangeEvent) throws Exception { return realm.where(Person.class) .beginsWith("name", textViewTextChangeEvent.text().toString()) .findAllSortedAsync("name") .asFlowable(); } }) .filter(new Predicate<RealmResults<Person>>() { @Override public boolean test(RealmResults<Person> people) throws Exception { return people.isLoaded(); } }) .subscribe(new Consumer<RealmResults<Person>>() { @Override public void accept(RealmResults<Person> people) throws Exception { searchResultsView.removeAllViews(); for (Person person : people) { TextView view = new TextView(ThrottleSearchActivity.this); view.setText(person.getName()); searchResultsView.addView(view); } } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { throwable.printStackTrace(); } }); }

Target:
protected void onResume() { super.onResume(); disposable = RxTextView.textChangeEvents(searchInputView) .debounce(200, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .toFlowable(BackpressureStrategy.BUFFER) .switchMap(textChangeEvent -> { return realm.where(Person.class) .beginsWith("name", textChangeEvent.text().toString()) .findAllSortedAsync("name") .asFlowable(); }) .filter(people -> people.isLoaded()) .subscribe(people -> { searchResultsView.removeAllViews(); for (Person person : people) { TextView view = new TextView(ThrottleSearchActivity.this); view.setText(person.getName()); searchResultsView.addView(view); } }, throwable -> throwable.printStackTrace()); }
Source:
public ValueNode leftBind() throws StandardException { TypeId receiverType; TypeId resultType = TypeId.getBuiltInTypeId(Types.VARCHAR); if (receiver.requiresTypeFromContext()) { receiver.setType(getVarcharDescriptor()); receiver.setCollationUsingCompilationSchema(); } if (leftOperand.requiresTypeFromContext()) { leftOperand.setType(new DataTypeDescriptor(TypeId.INTEGER_ID, false)); } if ((rightOperand != null) && rightOperand.requiresTypeFromContext()) { rightOperand.setType(new DataTypeDescriptor(TypeId.getBuiltInTypeId(Types.VARCHAR), true)); } bindToBuiltIn(); if (!leftOperand.getTypeId().isIntegerNumericTypeId()) throw StandardException.newException(SQLState.LANG_DB2_FUNCTION_INCOMPATIBLE, "LEFT", "FUNCTION"); receiverType = receiver.getTypeId(); switch (receiverType.getJDBCTypeId()) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: break; default: { throwBadType("LEFT", receiverType.getSQLTypeName()); } } if (rightOperand != null) { switch (rightOperand.getTypeId().getJDBCTypeId()) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: break; default: { StandardException.newException(SQLState.LANG_DB2_FUNCTION_INCOMPATIBLE, "LEFT", "FUNCTION"); } } } if (receiverType.getTypeFormatId() == StoredFormatIds.CLOB_TYPE_ID) { resultType = receiverType; } int resultLen = receiver.getTypeServices().getMaximumWidth(); if (leftOperand != null && leftOperand instanceof ConstantNode) { if (((ConstantNode)leftOperand).getValue().getInt() > resultLen) resultLen = ((ConstantNode)leftOperand).getValue().getInt(); } setType(new DataTypeDescriptor( resultType, true, resultLen )); setCollationInfo(receiver.getTypeServices()); return this; }

Target:
public ValueNode leftBind() throws StandardException { TypeId receiverType; TypeId resultType = TypeId.getBuiltInTypeId(Types.VARCHAR); if (receiver.requiresTypeFromContext()) { receiver.setType(getVarcharDescriptor()); receiver.setCollationUsingCompilationSchema(); } if (leftOperand.requiresTypeFromContext()) { leftOperand.setType(new DataTypeDescriptor(TypeId.INTEGER_ID, false)); } bindToBuiltIn(); if (!leftOperand.getTypeId().isIntegerNumericTypeId()) throwBadType("LEFT", leftOperand.getTypeId().getSQLTypeName()); receiverType = receiver.getTypeId(); switch (receiverType.getJDBCTypeId()) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: break; default: { throwBadType("LEFT", receiverType.getSQLTypeName()); } } if (receiverType.getTypeFormatId() == StoredFormatIds.CLOB_TYPE_ID) { resultType = receiverType; } int resultLen = receiver.getTypeServices().getMaximumWidth(); if (leftOperand instanceof ConstantNode) { if (((ConstantNode)leftOperand).getValue().getInt() > resultLen) resultLen = ((ConstantNode)leftOperand).getValue().getInt(); } setType(new DataTypeDescriptor( resultType, true, resultLen )); setCollationInfo(receiver.getTypeServices()); return this; }
Source:
public void configureFieldMetadata(String name, FieldMetadataBuilder builder) { builder.field( "value", FieldType.OBJECT ); }

Target:
public void configureFieldMetadata(String name, FieldMetadataBuilder builder) { builder.field( name, FieldType.OBJECT ); }
Source:
public final void visitNewClass(NewClassTree tree) { scan(tree.arguments()); SymbolicValue newValue = createSymbolicInstanceValue(); for (ExecutionState executionState : currentStates) { SymbolicValue[] arguments = new SymbolicValue[tree.arguments().size()]; for (int i = arguments.length - 1; i >= 0; i -= 1) { arguments[i] = executionState.pop(); } executionState.push(newValue); check.onExecutableElementInvocation(executionState, tree, Arrays.asList(arguments)); } }

Target:
public final void visitNewClass(NewClassTree tree) { scan(tree.arguments()); SymbolicValue newValue = createSymbolicInstanceValue(); for (ExecutionState executionState : currentStates) { SymbolicValue[] arguments = new SymbolicValue[tree.arguments().size()]; for (int i = arguments.length - 1; i >= 0; i--) { arguments[i] = executionState.pop(); } executionState.push(newValue); check.onExecutableElementInvocation(executionState, tree, Arrays.asList(arguments)); } }
Source:
@Override public Set<T> get() { Set<T> result = new LinkedHashSet<T>(contributors.size()); for (Binding<?> contributor : contributors) { Object contribution = contributor.get(); if (contribution instanceof Set) { result.addAll((Set<T>) contribution); } else { result.add((T) contribution); } } return Collections.unmodifiableSet(result); }

Target:
@Override public Set<T> get() { Set<T> result = new LinkedHashSet<T>(contributors.size()); for (Binding<?> contributor : contributors) { Object contribution = contributor.get(); if (contributor.provideKey.equals(provideKey)) { result.addAll((Set<T>) contribution); } else { result.add((T) contribution); } } return Collections.unmodifiableSet(result); }
Source:
private void wireChangeHandler(ServiceRegistry serviceRegistry) throws ConfigurationException { try { LeaseDuration leaseDuration = getService(serviceRegistry, new BasicServiceConfiguration<>(LeaseDuration.class)); ConfigChangeHandlerManager configChangeHandlerManager = serviceRegistry.getService(new BasicServiceConfiguration<>(ConfigChangeHandlerManager.class)); if (configChangeHandlerManager != null) { configChangeHandlerManager.compute(CLIENT_LEASE_DURATION, () -> new LeaseConfigChangeHandler(leaseDuration)); } } catch (ServiceException e) { throw new IllegalStateException("Failed to obtain Backup and Restore Service Instance. Ex: " + e); } }

Target:
private void wireChangeHandler(ServiceRegistry serviceRegistry) throws ConfigurationException { try { LeaseConfiguration leaseConfiguration = serviceRegistry.getService(new BasicServiceConfiguration<>(LeaseConfiguration.class)); ConfigChangeHandlerManager configChangeHandlerManager = serviceRegistry.getService(new BasicServiceConfiguration<>(ConfigChangeHandlerManager.class)); if (configChangeHandlerManager != null) { configChangeHandlerManager.compute(CLIENT_LEASE_DURATION, () -> new LeaseConfigChangeHandler(leaseConfiguration)); } } catch (ServiceException e) { throw new ConfigurationException(e.getMessage(), e); } }
Source:
public AutoScalingData terminate(List<String> ips) { log.info("Asked to terminate: [%s]", String.join(",", ips)); if (ips.isEmpty()) { return new AutoScalingData(new ArrayList<>()); } List<String> nodeIds = ipToIdLookup(ips); try { return new AutoScalingData(idToIpLookup( terminateWithIds(nodeIds != null ? nodeIds : new ArrayList<>()).getNodeIds()) ); } catch (Exception e) { log.error(e, "Unable to terminate any instances."); } return new AutoScalingData(new ArrayList<>()); }

Target:
public AutoScalingData terminate(List<String> ips) { log.info("Asked to terminate: [%s]", String.join(",", ips)); if (ips.isEmpty()) { return new AutoScalingData(new ArrayList<>()); } List<String> nodeIds = ipToIdLookup(ips); try { return terminateWithIds(nodeIds != null ? nodeIds : new ArrayList<>()); } catch (Exception e) { log.error(e, "Unable to terminate any instances."); } return new AutoScalingData(new ArrayList<>()); }
Source:
public void whenCommitInvalidCursorsThenOk() throws Exception { when(cursorsService.commitCursors(any(), any())) .thenReturn(Collections.singletonMap(any(), false)); putCursors(DUMMY_CURSORS) .andExpect(status().isOk()); }

Target:
public void whenCommitInvalidCursorsThenOk() throws Exception { when(cursorsService.commitCursors(any(), any())) .thenReturn(Collections.singletonMap(DUMMY_CURSORS.get(0), false)); postCursors(DUMMY_CURSORS) .andExpect(status().isOk()) .andExpect(content().string(jsonHelper.matchesObject(new ItemsWrapper<>( Collections.singletonList( new CursorsController.CursorCommitResult(DUMMY_CURSORS.get(0), false)))))); }
Source:
protected Expression visitBindExpression(BindExpression node, Context<C> context) { if (!context.isDefaultRewrite()) { Expression result = rewriter.rewriteBindExpression(node, context.get(), ExpressionTreeRewriter.this); if (result != null) { return result; } } List<Expression> values = node.getValues().stream() .map(value -> rewrite(value, context.get())) .collect(toImmutableList()); Expression function = rewrite(node.getFunction(), context.get()); if ((!Objects.equals(values, node.getValues())) || (function != node.getFunction())) { return new BindExpression(values, function); } return node; }

Target:
protected Expression visitBindExpression(BindExpression node, Context<C> context) { if (!context.isDefaultRewrite()) { Expression result = rewriter.rewriteBindExpression(node, context.get(), ExpressionTreeRewriter.this); if (result != null) { return result; } } List<Expression> values = node.getValues().stream() .map(value -> rewrite(value, context.get())) .collect(toImmutableList()); Expression function = rewrite(node.getFunction(), context.get()); if (!sameElements(values, node.getValues()) || (function != node.getFunction())) { return new BindExpression(values, function); } return node; }
Source:
public void testFullBucketOwnerControlAcl() throws Exception { Configuration config = new Configuration(); config.set(S3_ACL_TYPE, "BucketOwnerFullControl"); try (PrestoS3FileSystem fs = new PrestoS3FileSystem()) { MockAmazonS3 s3 = new MockAmazonS3(); String expectedBucketName = "test-bucket"; fs.initialize(new URI("s3n://" + expectedBucketName + "/"), config); fs.setS3Client(s3); try (FSDataOutputStream stream = fs.create(new Path("s3n://test-bucket/test"))) { stream.close(); assertEquals(CannedAccessControlList.BucketOwnerFullControl, s3.getAcl()); } } }

Target:
public void testFullBucketOwnerControlAcl() throws Exception { Configuration config = new Configuration(); config.set(S3_ACL_TYPE, "BucketOwnerFullControl"); try (PrestoS3FileSystem fs = new PrestoS3FileSystem()) { MockAmazonS3 s3 = new MockAmazonS3(); String expectedBucketName = "test-bucket"; fs.initialize(new URI("s3n://" + expectedBucketName + "/"), config); fs.setS3Client(s3); try (FSDataOutputStream stream = fs.create(new Path("s3n://test-bucket/test"))) { } assertEquals(CannedAccessControlList.BucketOwnerFullControl, s3.getAcl()); } }
Source:
public void shouldExecuteTestClassSuccessfully() throws InterruptedException { projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_ANOTHER_TEST_CLASS); projectExplorer.openItemByPath(PATH_TO_TEST_CLASS); editor.waitActiveEditor(); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully."); pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne"); pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne"); Assert.assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); Assert.assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); String testErrorMessage = pluginConsole.getTestErrorMessage(); assertTrue( testErrorMessage.startsWith(APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE), "Actual message was: " + testErrorMessage); }

Target:
public void shouldExecuteTestClassSuccessfully() throws InterruptedException { projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_ANOTHER_TEST_CLASS); projectExplorer.openItemByPath(PATH_TO_TEST_CLASS); editor.waitActiveEditor(); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully."); pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne"); pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne"); assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); String testErrorMessage = pluginConsole.getTestErrorMessage(); assertTrue( testErrorMessage.startsWith(APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE), "Actual message was: " + testErrorMessage); }
Source:
public void delete(String parentUniqueId, String uuid, String reason, RequestContext context) throws ResponseException { if (parentUniqueId != null && uuid != null) { Allergy allergy = getByUniqueId(uuid); Patient patient = Context.getPatientService().getPatientByUuid(parentUniqueId); setParent(allergy, patient); delete(allergy, reason, context); } else if (parentUniqueId != null && uuid == null) { Patient patient = Context.getPatientService().getPatientByUuid(parentUniqueId); Allergies allergies = new Allergies(); Context.getPatientService().setAllergies(patient, allergies); } else if (uuid != null) { Allergy allergy = getByUniqueId(uuid); delete(allergy, reason); } }

Target:
public void delete(String parentUniqueId, String uuid, String reason, RequestContext context) throws ResponseException { if (parentUniqueId != null && uuid != null) { Allergy allergy = getByUniqueId(uuid); Context.getPatientService().voidAllergy(allergy, reason); } else if (parentUniqueId != null && uuid == null) { Patient patient = Context.getPatientService().getPatientByUuid(parentUniqueId); Allergies allergies = Context.getPatientService().getAllergies(patient); for (Allergy allergy : allergies) { Context.getPatientService().voidAllergy(allergy, reason); } } }
Source:
public void addParticipant(TestParticipant participant , String user , String password) { sendJson(zatesRegistrationURL, "{\"subjectId\":\"" + participant.id + "\"," + "\"name\":\"" + participant.name + "\"," + "\"language\":\"" + participant.language + "\"," + "\"phoneNumber\":\"" + participant.phoneNumber + "\"," + "\"siteId\":\"" + participant.siteId + "\",\"headOfHousehold\":\"" + participant.headOfHousehold + "\"," + "\"householdName\":\"" + participant.householdName + "\"," + "\"community\":\"" + participant.community + "\",\"address\":\"" + participant.address + "\"" + "}" , user , password); }

Target:
public void addParticipant(TestParticipant participant , String user , String password) { sendJson(zatesRegistrationURL, "{\"subjectId\":\"" + participant.getId() + "\"," + "\"name\":\"" + participant.getName() + "\"," + "\"language\":\"" + participant.getLanguage() + "\"," + "\"phoneNumber\":\"" + participant.getPhoneNumber() + "\"," + "\"siteId\":\"" + participant.getSiteId() + "\",\"headOfHousehold\":\"" + participant.getHeadOfHousehold() + "\"," + "\"householdName\":\"" + participant.getHeadOfHousehold() + "\"," + "\"community\":\"" + participant.getCommunity() + "\",\"address\":\"" + participant.getAddress() + "\"" + "}" , user , password); }