auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void run(PortBindings portBindings, Configuration conf, Map<String, String> parameters) { metricPusherCreatorProducer.create(parameters) .ifPresent(metricPusherCreator -> { logger.info("Using MetricPusherCreatorProducer: {}", metricPusherCreator); metricPusherProducer.create(metricPusherCreator, parameters) .ifPresent(metricPusher -> { logger.info("Using MetricPusher: {}", metricPusher); fileSystemProducer.create(conf) .ifPresent(fs -> { logger.info("Using FileSystem: {}", fs); reportLocationsFinder.find(parameters) .ifPresent(paths -> { logger.info("Using report locations of size: {}", paths.size()); labelNamesByMetricNameProducer.create(parameters) .ifPresent(labelNamesByMetricName -> { logger.info("Using label map of size: {}", labelNamesByMetricName.size()); List<Optional<List<Gauge>>> optionals = paths.stream() .map(path -> reportEntryReader.read(fs, new Path(path)) .flatMap(reportEntries -> reportEntryConverter.convert(reportEntries, path, labelNamesByMetricName))) .collect(Collectors.toList()); unwrapOptionals(optionals) .map(gauges -> gauges.stream().flatMap(Collection::stream).collect(Collectors.toList())) .ifPresent(gauges -> { logger.info("Using gauges of size: {}", gauges.size()); gaugesRegistrar.register(gauges) .ifPresent(registry -> { logger.info("Using registry: {}", registry); jobNameProducer.create(parameters) .ifPresent(jobName -> { logger.info("Using job name: {}", jobName); metricPusher.pushSafe(registry, jobName); }); }); }); }); }); }); }); }); }

Target:
public void run(PortBindings portBindings, Configuration conf, Map<String, String> parameters) { metricPusherCreatorProducer.create(parameters) .ifPresent(metricPusherCreator -> { logger.info("Using MetricPusherCreatorProducer: {}", metricPusherCreator); metricPusherProducer.create(metricPusherCreator, parameters) .ifPresent(metricPusher -> { logger.info("Using MetricPusher: {}", metricPusher); fileSystemProducer.create(conf) .ifPresent(fs -> { logger.info("Using FileSystem: {}", fs); reportLocationsFinder.find(parameters) .ifPresent(paths -> { logger.info("Using report locations of size: {}", paths.size()); labeledMetricConfByPatternProducer.create(parameters) .ifPresent(labeledMetricConfByPattern -> { logger.info("Using label map of size: {}", labeledMetricConfByPattern.size()); List<Optional<List<ReportEntry>>> collect = paths.stream() .map(path -> reportEntryReader.read(fs, new Path(path))) .collect(Collectors.toList()); unwrapOptionals(collect) .map(x -> x.stream().flatMap(Collection::stream).collect(Collectors.toList())) .ifPresent(reportEntries -> { logger.info("Using report entries of size: {}", reportEntries.size()); reportEntryConverter.convert(reportEntries, parameters.get(REPORTS_DIR_PATH), labeledMetricConfByPattern) .ifPresent(gauges -> { logger.info("Using gauges of size: {}", gauges.size()); gaugesRegistrar.register(gauges) .ifPresent(registry -> { logger.info("Using registry: {}", registry); groupingKeyProducer.create(parameters) .ifPresent(groupingKey -> { logger.info("Using grouping key of size: {}", groupingKey.size()); metricPusher.pushSafe(registry, JOB, groupingKey); }); }); }); }); }); }); }); }); }); }
Source:
protected TargetBundle[] resolveBundles(ITargetDefinition definition, IProgressMonitor monitor) throws CoreException { File dir = getDirectory(); if (dir.isDirectory()) { File site = getSite(dir); File[] files = site.listFiles(); SubMonitor localMonitor = SubMonitor.convert(monitor, Messages.DirectoryBundleContainer_0, files.length); List<TargetBundle> bundles = new ArrayList<>(files.length); for (File file : files) { try { TargetBundle rb = new TargetBundle(file); bundles.add(rb); } catch (CoreException e) { if (e.getStatus().getCode() == ManifestUtils.STATUS_CODE_PLUGIN_CONVERTER_UNAVAILABLE) { PDECore.log(e); } } localMonitor.step(1); } localMonitor.done(); return bundles.toArray(new TargetBundle[bundles.size()]); } throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.DirectoryBundleContainer_1, dir.toString()))); }

Target:
protected TargetBundle[] resolveBundles(ITargetDefinition definition, IProgressMonitor monitor) throws CoreException { File dir = getDirectory(); if (dir.isDirectory()) { File site = getSite(dir); File[] files = site.listFiles(); SubMonitor localMonitor = SubMonitor.convert(monitor, Messages.DirectoryBundleContainer_0, files.length); List<TargetBundle> bundles = new ArrayList<>(files.length); for (File file : files) { try { TargetBundle rb = new TargetBundle(file); bundles.add(rb); } catch (CoreException e) { if (e.getStatus().getCode() == ManifestUtils.STATUS_CODE_PLUGIN_CONVERTER_UNAVAILABLE) { PDECore.log(e); } } localMonitor.step(1); } return bundles.toArray(new TargetBundle[bundles.size()]); } throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.DirectoryBundleContainer_1, dir.toString()))); }
Source:
public List<Object> getValue() { List<Object> values = super.getValue(); values.add( new VisitableElement<Double>() { @Override public String getName() { return null; } @Override public Double getValue() { return buffer; } @Override public void accept(FilterVisitor2 visitor) { visitor.visitDistanceType(this); } }); return values; }

Target:
public List<Object> getValue() { List<Object> values = super.getValue(); values.add( new VisitableElement<Double>() { @Override public String getName() { return "Distance"; } @Override public Double getValue() { return buffer; } @Override public void accept(FilterVisitor2 visitor) { visitor.visitDistanceType(this); } }); return values; }
Source:
public String toHtmlString() { StringBuilder str = new StringBuilder("<html>"); str.append("&nbsp;name: ").append("<b>") .append(component.getName()).append("</b><br>") .append("&nbsp;class: ").append("<b>") .append(component.getClass().getName()).append("</b><br>"); return str.toString(); }

Target:
public String toHtmlString() { return new StringBuilder("<html>").append("&nbsp;name: ") .append("<b>").append(component.getName()) .append("</b><br>").append("&nbsp;class: ").append("<b>") .append(component.getClass().getName()).append("</b><br>") .toString(); }
Source:
public void onCreate() { super.onCreate(); HandlerThread thread = new HandlerThread("IntentService[" + mName + "]", Process.THREAD_PRIORITY_BACKGROUND); thread.start(); mServiceLooper = thread.getLooper(); mServiceHandler = new ServiceHandler(mServiceLooper); }

Target:
public void onCreate() { super.onCreate(); HandlerThread thread = new HandlerThread("IntentService[" + mName + "]", mPriority); thread.start(); mServiceLooper = thread.getLooper(); mServiceHandler = new ServiceHandler(mServiceLooper); }
Source:
public void testHistogramMetric() { List<String> keys = new ArrayList<>(); List<String> values = new ArrayList<>(); for (int i = 0; i < 1000; i++) { keys.add(getRandomString()); values.add(getRandomString()); } Collections.shuffle(keys); Collections.shuffle(values); for (int i = 0; i < keys.size(); i++) { store.put(keys.get(i), values.get(i)); } metricsRegistry.getGroups().forEach(group -> metricsRegistry.getGroup(group.toString()).forEach((name, metric) -> { if (name.contains("size-bytes-histogram")) { metric.visit(new MetricsVisitor() { @Override public void counter(Counter counter) { } @Override public <T> void gauge(Gauge<T> gauge) { Assert.assertNotEquals(0D, (Double) gauge.getValue(), 0.0001); } @Override public void timer(Timer timer) { } }); } })); }

Target:
public void testHistogramMetric() { List<String> keys = new ArrayList<>(); List<String> values = new ArrayList<>(); for (int i = 0; i < 300; i++) { keys.add(getRandomString()); values.add(getRandomString()); } for (int i = 0; i < keys.size(); i++) { store.put(keys.get(i), values.get(i)); } Set<String> names = new HashSet<>(); for (Double p : serializedKeyValueStoreMetrics.record_key_size_percentiles()) { names.add(storeName + "-" + keyPrefix + "_" + p); } for (Double p : serializedKeyValueStoreMetrics.record_value_size_percentiles()) { names.add(storeName + "-" + valuePrefix + "_" + p); } metricsRegistry.getGroups().forEach(group -> metricsRegistry.getGroup(group.toString()).forEach((name, metric) -> { if (names.contains(name)) { metric.visit(new MetricsVisitor() { @Override public void counter(Counter counter) { } @Override public <T> void gauge(Gauge<T> gauge) { Double num = (Double) gauge.getValue(); Assert.assertNotEquals(0D, (Double) gauge.getValue(), 0.0001); } @Override public void timer(Timer timer) { } }); } })); }
Source:
private ObjList<ExpressionNode> getOrderByAdvice(QueryModel model) { orderByAdvice.clear(); final ObjList<ExpressionNode> orderBy = model.getOrderBy(); final int len = orderBy.size(); if (len == 0) { return orderByAdvice; } CharSequenceObjHashMap<QueryColumn> map = model.getAliasToColumnMap(); for (int i = 0; i < len; i++) { QueryColumn queryColumn = map.get(orderBy.getQuick(i).token); if (queryColumn.getAst().type == ExpressionNode.LITERAL) { orderByAdvice.add(nextLiteral(queryColumn.getAst().token)); } } return orderByAdvice; }

Target:
private ObjList<ExpressionNode> getOrderByAdvice(QueryModel model) { orderByAdvice.clear(); final ObjList<ExpressionNode> orderBy = model.getOrderBy(); final int len = orderBy.size(); if (len == 0) { return orderByAdvice; } CharSequenceObjHashMap<QueryColumn> map = model.getAliasToColumnMap(); for (int i = 0; i < len; i++) { QueryColumn queryColumn = map.get(orderBy.getQuick(i).token); if (queryColumn.getAst().type == ExpressionNode.LITERAL) { orderByAdvice.add(nextLiteral(queryColumn.getAst().token)); } else { orderByAdvice.clear(); break; } } return orderByAdvice; }
Source:
public FutureResult<Void> loadDatasets(final Project project, final Collection<DatasetManifest> datasets) { notNull(project, "project"); notEmpty(datasets, "datasets"); for (DatasetManifest datasetManifest : datasets) { if (datasetManifest.getSource() == null) { throw new IllegalArgumentException(format("Source for dataset '%s' is null", datasetManifest.getDataSet())); } } final List<String> datasetsNames = new ArrayList<>(datasets.size()); try { final Path dirPath = Paths.get("/", project.getId() + "_" + RandomStringUtils.randomAlphabetic(3), "/"); for (DatasetManifest datasetManifest : datasets) { datasetsNames.add(datasetManifest.getDataSet()); dataStoreService.upload(dirPath.resolve(datasetManifest.getFile()).toString(), datasetManifest.getSource()); } final String manifestJson = mapper.writeValueAsString(new DatasetManifestList(datasets)); final ByteArrayInputStream inputStream = new ByteArrayInputStream(manifestJson.getBytes(UTF_8)); dataStoreService.upload(dirPath.resolve(MANIFEST_FILE_NAME).toString(), inputStream); return pullLoad(project, dirPath, datasetsNames); } catch (IOException e) { throw new DatasetException("Unable to serialize manifest", datasetsNames, e); } catch (DataStoreException | GoodDataRestException | RestClientException e) { throw new DatasetException("Unable to load", datasetsNames, e); } }

Target:
public FutureResult<Void> loadDatasets(final Project project, final Collection<DatasetManifest> datasets) { notNull(project, "project"); validateUploadManifests(datasets); final List<String> datasetsNames = new ArrayList<>(datasets.size()); try { final Path dirPath = Paths.get("/", project.getId() + "_" + RandomStringUtils.randomAlphabetic(3), "/"); for (DatasetManifest datasetManifest : datasets) { datasetsNames.add(datasetManifest.getDataSet()); dataStoreService.upload(dirPath.resolve(datasetManifest.getFile()).toString(), datasetManifest.getSource()); } final String manifestJson = mapper.writeValueAsString(new DatasetManifests(datasets)); final ByteArrayInputStream inputStream = new ByteArrayInputStream(manifestJson.getBytes(UTF_8)); dataStoreService.upload(dirPath.resolve(MANIFEST_FILE_NAME).toString(), inputStream); return pullLoad(project, dirPath, datasetsNames); } catch (IOException e) { throw new DatasetException("Unable to serialize manifest", datasetsNames, e); } catch (DataStoreException | GoodDataRestException | RestClientException e) { throw new DatasetException("Unable to load", datasetsNames, e); } }
Source:
public <K, V> void forward(final K key, final V value, final To to) { throwUnsupportedOperationExceptionIfStandby("forward"); final ProcessorNode<?, ?> previousNode = currentNode(); final ProcessorRecordContext previousContext = recordContext; try { toInternal.update(to); if (toInternal.hasTimestamp()) { recordContext = new ProcessorRecordContext( toInternal.timestamp(), recordContext.offset(), recordContext.partition(), recordContext.topic(), recordContext.headers()); } final String sendTo = toInternal.child(); if (currentNode() == null) { throw new StreamsException("Current node is unknown when forwarding to: " + key); } if (sendTo == null) { final List<ProcessorNode<?, ?>> children = currentNode().children(); for (final ProcessorNode<?, ?> child : children) { forward((ProcessorNode<K, V>) child, key, value); } } else { final ProcessorNode<K, V> child = currentNode().getChild(sendTo); if (child == null) { throw new StreamsException("Unknown downstream node: " + sendTo + " either does not exist or is not connected to this processor."); } forward(child, key, value); } } finally { recordContext = previousContext; setCurrentNode(previousNode); } }

Target:
public <K, V> void forward(final K key, final V value, final To to) { throwUnsupportedOperationExceptionIfStandby("forward"); final ProcessorNode<?, ?> previousNode = currentNode(); final ProcessorRecordContext previousContext = recordContext; try { toInternal.update(to); if (toInternal.hasTimestamp()) { recordContext = new ProcessorRecordContext( toInternal.timestamp(), recordContext.offset(), recordContext.partition(), recordContext.topic(), recordContext.headers()); } final String sendTo = toInternal.child(); if (currentNode() == null) { throw new StreamsException("Current node is unknown. This can happen if 'forward()' is called " + "in an illegal scope. The root cause could be that a 'Processor' or 'Transformer' instance" + " is shared. To avoid this error, make sure that your suppliers return new instances " + "each time 'get()' of Supplier is called and do not return the same object reference " + "multiple times."); } if (sendTo == null) { final List<ProcessorNode<?, ?>> children = currentNode().children(); for (final ProcessorNode<?, ?> child : children) { forward((ProcessorNode<K, V>) child, key, value); } } else { final ProcessorNode<K, V> child = currentNode().getChild(sendTo); if (child == null) { throw new StreamsException("Unknown downstream node: " + sendTo + " either does not exist or is not connected to this processor."); } forward(child, key, value); } } finally { recordContext = previousContext; setCurrentNode(previousNode); } }
Source:
public Matrix select(int[] rowIndices, int[] columnIndices, Factory factory) { int newRows = rowIndices.length; int newCols = columnIndices.length; checkIndexBounds(rowIndices, this.rows); checkIndexBounds(columnIndices, this.columns); Matrix newMat = factory.createMatrix(newRows, newCols); for (int i = 0; i < newRows; i++) { for (int j = 0; j < newCols; j++) { newMat.set(i, j, get(rowIndices[i], columnIndices[j])); } } return newMat; }

Target:
public Matrix select(int[] rowIndices, int[] columnIndices, Factory factory) { int newRows = rowIndices.length; int newCols = columnIndices.length; if (newRows == 0 || newCols == 0) { fail("No rows or columns selected"); } checkIndexBounds(rowIndices, rows); checkIndexBounds(columnIndices, columns); Matrix result = factory.createMatrix(newRows, newCols); for (int i = 0; i < newRows; i++) { for (int j = 0; j < newCols; j++) { result.set(i, j, get(rowIndices[i], columnIndices[j])); } } return result; }
Source:
public PagingLinks build() { List<String> urls = new ArrayList<String>(); PagingLinks pagingList = new PagingLinks(); if (offset == null || limit == null || total == null) { return pagingList; } for (long i = 0; i < total; i += limit) { StringBuilder url = new StringBuilder(baseUrl); url.append("?"); url.append(buildParameter(offsetParameter, String.valueOf(startIndex + i))); url.append("&"); url.append(buildParameter(limitParameter, String.valueOf(limit))); for (String curKey : parameters.keySet()) { Object[] value = parameters.get(curKey); if (value != null) { url.append("&"); url.append(buildParameter(curKey, value)); } } if (i + startIndex == offset) { pagingList.setCurLink(url.toString()); } urls.add(url.toString()); } if (pagingList.getCurLink() == null) { pagingList.setCurLink(urls.get(urls.size() - 1)); } pagingList.setLinks(urls); if (pagingList.getLinks().size() > 0) { int indexOfCurLink = pagingList.getLinks().indexOf(pagingList.getCurLink()); if (indexOfCurLink != -1) { if ((indexOfCurLink + 1) < pagingList.getLinks().size()) { pagingList.setNextLink(pagingList.getLinks().get(indexOfCurLink + 1)); } if ((indexOfCurLink - 1) >= 0 && pagingList.getLinks().size() != 0) { pagingList.setPrevLink(pagingList.getLinks().get(indexOfCurLink - 1)); } } } return pagingList; }

Target:
public PagingLinks build() { PagingLinks pagingList = new PagingLinks(); if (offset == null || limit == null || total == null) { return pagingList; } configurePagingLinks(pagingList); configurePrevAndNext(pagingList); return pagingList; }
Source:
public RuntimeContext( T internalEnvironment, RuntimeIdentity identity, RuntimeInfrastructure infrastructure) { this.environment = internalEnvironment; this.identity = identity; this.infrastructure = infrastructure; }

Target:
public RuntimeContext( T internalEnvironment, RuntimeIdentity identity, RuntimeInfrastructure infrastructure) throws ValidationException, InfrastructureException { this.environment = internalEnvironment; this.identity = identity; this.infrastructure = infrastructure; }
Source:
public boolean isGenerateDroolsTestOnError() { return generateDroolsTestOnError != null && generateDroolsTestOnError.booleanValue(); }

Target:
public Boolean isGenerateDroolsTestOnError() { return generateDroolsTestOnError; }
Source:
private boolean isSessionTokenValid(String actualToken) { String sessionId = request.getRequestedSessionId(); if (sessionId == null) { sessionId = session.getId(); } else { sessionId = sessionId.replaceFirst("\\.node0$", ""); } String expectedToken = CryptoHelper.computeSessionToken(sessionId); return actualToken.equals(expectedToken); }

Target:
private boolean isSessionTokenValid(String actualToken) { String sessionId = request.getRequestedSessionId(); if (sessionId == null) { sessionId = session.getId(); } try { return sessionId.startsWith(StringHelper.decrypt(actualToken)); } catch (InvalidParametersException e) { return false; } }
Source:
public void show() { DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property; RelationType relationTypeValue = (RelationType) fieldInfo.getCurrentValue( RELATION_TYPE ); if ( relationTypeValue != null ) { relationType.setSelectedValue( relationTypeValue.name( ) ); } else { relationType.setSelectedValue( DataModelerUtils.NOT_SELECTED ); } GWT.log( "relationTypeValue: " + relationTypeValue ); enableRelationDependentFields( relationTypeValue ); GWT.log( "1 relationTypeValue: " + relationTypeValue ); GWT.log( "2 fieldInfo.getCurrentValue( CASCADE ): " + fieldInfo.getCurrentValue( CASCADE ) ); CascadeType cascadeTypeValue = (CascadeType) fieldInfo.getCurrentValue( CASCADE ); GWT.log( "3 xxxxxxx"); if ( cascadeTypeValue != null ) { cascadeType.setSelectedValue( cascadeTypeValue.name() ); } else { cascadeType.setSelectedValue( DataModelerUtils.NOT_SELECTED ); } FetchMode fetchModeValue = (FetchMode) fieldInfo.getCurrentValue( FETCH ); if ( fetchModeValue != null ) { fetchMode.setSelectedValue( fetchModeValue.name() ); } else { fetchMode.setSelectedValue( DataModelerUtils.NOT_SELECTED ); } String mappedBy = (String) fieldInfo.getCurrentValue( MAPPED_BY ); this.mappedBy.setText( mappedBy ); Boolean orphanRemovalValue = (Boolean) fieldInfo.getCurrentValue( ORPHAN_REMOVAL ); if ( orphanRemovalValue != null) orphanRemoval.setValue( orphanRemovalValue ); super.show(); }

Target:
public void show() { DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property; RelationType relationTypeValue = (RelationType) fieldInfo.getCurrentValue( RELATION_TYPE ); if ( relationTypeValue != null ) { relationType.setSelectedValue( relationTypeValue.name( ) ); } else { relationType.setSelectedValue( DataModelerUtils.NOT_SELECTED ); } enableRelationDependentFields( relationTypeValue ); CascadeType cascadeTypeValue = (CascadeType) fieldInfo.getCurrentValue( CASCADE ); if ( cascadeTypeValue != null ) { cascadeType.setSelectedValue( cascadeTypeValue.name() ); } else { cascadeType.setSelectedValue( DataModelerUtils.NOT_SELECTED ); } FetchMode fetchModeValue = (FetchMode) fieldInfo.getCurrentValue( FETCH ); if ( fetchModeValue != null ) { fetchMode.setSelectedValue( fetchModeValue.name() ); } else { fetchMode.setSelectedValue( DataModelerUtils.NOT_SELECTED ); } String mappedBy = (String) fieldInfo.getCurrentValue( MAPPED_BY ); this.mappedBy.setText( mappedBy ); Boolean orphanRemovalValue = (Boolean) fieldInfo.getCurrentValue( ORPHAN_REMOVAL ); if ( orphanRemovalValue != null) orphanRemoval.setValue( orphanRemovalValue ); super.show(); }
Source:
private KeyPair getKeyPairFromAndroidKeyStore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, NoSuchProviderException, InvalidAlgorithmParameterException, UnrecoverableEntryException { KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); if (!keyStore.containsAlias("AdalKey")) { Logger.v(TAG, "Key entry is not available"); Calendar start = Calendar.getInstance(); Calendar end = Calendar.getInstance(); end.add(Calendar.YEAR, 100); final KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(mContext) .setAlias("AdalKey") .setSubject( new X500Principal(String.format("CN=%s, OU=%s", "AdalKey", mContext.getPackageName()))).setSerialNumber(BigInteger.ONE) .setStartDate(start.getTime()).setEndDate(end.getTime()).build(); final KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore"); generator.initialize(spec); generator.generateKeyPair(); Logger.v(TAG, "Key entry is generated"); } else { Logger.v(TAG, "Key entry is available"); } Logger.v(TAG, "Reading Key entry"); final KeyStore.PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry)keyStore.getEntry( "AdalKey", null); return new KeyPair(entry.getCertificate().getPublicKey(), entry.getPrivateKey()); }

Target:
private synchronized KeyPair getKeyPairFromAndroidKeyStore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, NoSuchProviderException, InvalidAlgorithmParameterException, UnrecoverableEntryException { KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); if (!keyStore.containsAlias(KEY_STORE_CERT_ALIAS)) { Logger.v(TAG, "Key entry is not available"); Calendar start = Calendar.getInstance(); Calendar end = Calendar.getInstance(); end.add(Calendar.YEAR, 100); String certInfo = String.format("CN=%s, OU=%s", KEY_STORE_CERT_ALIAS, mContext.getPackageName()); final KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(mContext) .setAlias(KEY_STORE_CERT_ALIAS).setSubject(new X500Principal(certInfo)) .setSerialNumber(BigInteger.ONE).setStartDate(start.getTime()) .setEndDate(end.getTime()).build(); final KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore"); generator.initialize(spec); generator.generateKeyPair(); Logger.v(TAG, "Key entry is generated for cert " + certInfo); } else { Logger.v(TAG, "Key entry is available"); } Logger.v(TAG, "Reading Key entry"); final KeyStore.PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry)keyStore.getEntry( KEY_STORE_CERT_ALIAS, null); return new KeyPair(entry.getCertificate().getPublicKey(), entry.getPrivateKey()); }
Source:
public void testSubSliceAndCopy() { byte[] byteArray = {(byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5}; Slice slice = new Slice(byteArray); assertCompact(slice.slice(0, slice.length())); assertCompact(Slices.copyOf(slice)); assertCompact(Slices.copyOf(slice, 0, slice.length() - 1)); assertCompact(Slices.copyOf(slice, 1, slice.length() - 1)); Slice subSlice1 = slice.slice(0, slice.length() - 1); Slice subSlice2 = slice.slice(1, slice.length() - 1); assertNotCompact(subSlice1); assertNotCompact(subSlice2); assertCompact(Slices.copyOf(subSlice1)); assertCompact(Slices.copyOf(subSlice2)); }

Target:
public void testSubSliceAndCopy() { byte[] byteArray = {(byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5}; Slice slice = new Slice(byteArray); assertCompact(slice); assertCompact(slice.slice(0, slice.length())); assertSame(slice.slice(0, slice.length()), slice); assertCompact(Slices.copyOf(slice)); assertNotSame(Slices.copyOf(slice).getBase(), slice.getBase()); assertCompact(Slices.copyOf(slice, 0, slice.length() - 1)); assertCompact(Slices.copyOf(slice, 1, slice.length() - 1)); Slice subSlice1 = slice.slice(0, slice.length() - 1); Slice subSlice2 = slice.slice(1, slice.length() - 1); assertNotCompact(subSlice1); assertNotCompact(subSlice2); assertCompact(Slices.copyOf(subSlice1)); assertCompact(Slices.copyOf(subSlice2)); }
Source:
public static ICPPFunction createForName(char[] name) { return new CPPDeferredFunction(null, name, new ICPPFunction[]{}); }

Target:
public static ICPPFunction createForName(char[] name) { return new CPPDeferredFunction(null, name, NO_CANDIDATES); }
Source:
private static void writeCookie(Writer writer, HttpCookie cookie, URL url, Date creationDate) throws IOException { String domain = ""; if (cookie.isHttpOnly()) { domain = HTTP_ONLY_PREAMBLE; } if (cookie.getDomain() != null) { domain += cookie.getDomain(); } else { domain += url.getHost(); } writer.write(domain); writer.write(COLUMN_SEPARATOR); writer.write("TRUE"); writer.write(COLUMN_SEPARATOR); String path = cookie.getPath(); if (path == null) { path = url.getPath(); } writer.write(path); writer.write(COLUMN_SEPARATOR); writer.write(Boolean.toString(cookie.getSecure()).toUpperCase()); writer.write(COLUMN_SEPARATOR); final String expirationDate; if (cookie.getMaxAge() == -1) { expirationDate = "0"; } else { if (creationDate == null) { creationDate = new Date(); } expirationDate = String .valueOf(creationDate.getTime() + (cookie.getMaxAge() * 1000)); } writer.write(expirationDate); writer.write(COLUMN_SEPARATOR); writer.write(cookie.getName()); writer.write(COLUMN_SEPARATOR); writer.write(cookie.getValue()); writer.write(LINE_SEPARATOR); }

Target:
private static void writeCookie(Writer writer, HttpCookie cookie, URL url, Date creationDate) throws IOException { String domain = ""; if (cookie.isHttpOnly()) { domain = HTTP_ONLY_PREAMBLE; } if (cookie.getDomain() != null) { domain += cookie.getDomain(); } else { domain += url.getHost(); } writer.write(domain); writer.write(COLUMN_SEPARATOR); writer.write("TRUE"); writer.write(COLUMN_SEPARATOR); String path = cookie.getPath(); if (path == null) { path = url.getPath(); } writer.write(path); writer.write(COLUMN_SEPARATOR); writer.write(Boolean.toString(cookie.getSecure()).toUpperCase()); writer.write(COLUMN_SEPARATOR); final String expirationDate; if (cookie.getMaxAge() == -1) { expirationDate = "0"; } else { expirationDate = String .valueOf(creationDate.getTime() + (cookie.getMaxAge() * 1000)); } writer.write(expirationDate); writer.write(COLUMN_SEPARATOR); writer.write(cookie.getName()); writer.write(COLUMN_SEPARATOR); writer.write(cookie.getValue()); writer.write(LINE_SEPARATOR); }
Source:
public void addLogMessageConsumer(Consumer<String> consumer) { addOutPutStream(new OutputStream() { StringBuilder lineBuilder = new StringBuilder(); @Override public void write(int chr) throws IOException { try { lineBuilder.append((char) chr); Matcher matcher = LOG_MESSAGE_PATTERN.matcher(lineBuilder.toString()); if (matcher.matches()) { consumer.accept(matcher.group(1)); lineBuilder = new StringBuilder(); } } catch (Exception e) { LOG.warn("Log message consumer crashed!", e); } } }); }

Target:
public void addLogMessageConsumer(Consumer<String> consumer) { checkNotNull(consumer, "consumer parameter is NULL!"); addOutPutStream(new OutputStream() { StringBuilder lineBuilder = new StringBuilder(); @Override public void write(int chr) throws IOException { try { lineBuilder.append((char) chr); Matcher matcher = LOG_MESSAGE_PATTERN.matcher(lineBuilder.toString()); if (matcher.matches()) { consumer.accept(matcher.group(1)); lineBuilder = new StringBuilder(); } } catch (Exception e) { LOG.warn("Log message consumer crashed!", e); } } }); }
Source:
public String generateScript(Condition condition) throws GenerateConditionException { final StringBuilder script = new StringBuilder(); if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } String function = condition.getFunction().trim(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } } script.append(");"); return script.toString(); }

Target:
public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); }
Source:
public void mustEvaluateEqualsTest() throws Exception { final Take take = req -> new RsEmpty(); new Assertion<>( "Must evaluate true equality", new FkContentType( "text/xml", take ), new IsEqual<>( new FkContentType( "text/xml", take ) ) ).affirm(); }

Target:
public void mustEvaluateEqualsTest() throws Exception { final Take take = req -> new RsEmpty(); final String type = "text/xml"; new Assertion<>( "Must evaluate true equality", new FkContentType(type, take), new IsEqual<>(new FkContentType(type, take)) ).affirm(); }
Source:
private void completeShutdown(final boolean cleanRun) { ENDING_SHUTDOWN so it will return false but we setState(State.PENDING_SHUTDOWN); log.info("Shutting down with cleanRun {}", cleanRun); try { taskManager.shutdown(cleanRun); } catch (final Throwable e) { log.error("Failed to close task manager due to the following error:", e); } try { consumer.close(); } catch (final Throwable e) { log.error("Failed to close consumer due to the following error:", e); } try { restoreConsumer.close(); } catch (final Throwable e) { log.error("Failed to close restore consumer due to the following error:", e); } streamsMetrics.removeAllThreadLevelSensors(); setState(State.DEAD); log.info("Shutdown complete"); }

Target:
private void completeShutdown(final boolean cleanRun) { ENDING_SHUTDOWN so it will return false but we setState(State.PENDING_SHUTDOWN); log.info("Shutting down"); try { taskManager.shutdown(cleanRun); } catch (final Throwable e) { log.error("Failed to close task manager due to the following error:", e); } try { consumer.close(); } catch (final Throwable e) { log.error("Failed to close consumer due to the following error:", e); } try { restoreConsumer.close(); } catch (final Throwable e) { log.error("Failed to close restore consumer due to the following error:", e); } streamsMetrics.removeAllThreadLevelSensors(); setState(State.DEAD); log.info("Shutdown complete"); }
Source:
public static OzoneAclInfo convertOzoneAcl(OzoneAcl acl) { OzoneAclInfo.OzoneAclType aclType; switch(acl.getType()) { case USER: aclType = OzoneAclType.USER; break; case GROUP: aclType = OzoneAclType.GROUP; break; case WORLD: aclType = OzoneAclType.WORLD; break; default: throw new IllegalArgumentException("ACL type is not recognized"); } List<OzoneAclRights> aclRights = new ArrayList<>(); for(ACLType right: acl.getRights()) { try { aclRights.add(OzoneAclRights.valueOf(right.name())); } catch (IllegalArgumentException iae) { LOG.error("ACL:{} right is not recognized.", acl); } } return OzoneAclInfo.newBuilder().setType(aclType) .setName(acl.getName()) .addAllRights(aclRights) .build(); }

Target:
public static OzoneAclInfo convertOzoneAcl(OzoneAcl acl) { OzoneAclInfo.OzoneAclType aclType; switch (acl.getType()) { case USER: aclType = OzoneAclType.USER; break; case GROUP: aclType = OzoneAclType.GROUP; break; case WORLD: aclType = OzoneAclType.WORLD; break; case ANONYMOUS: aclType = OzoneAclType.ANONYMOUS; break; case CLIENT_IP: aclType = OzoneAclType.CLIENT_IP; break; default: throw new IllegalArgumentException("ACL type is not recognized"); } List<OzoneAclRights> aclRights = new ArrayList<>(); for (ACLType right : acl.getRights()) { aclRights.add(OzoneAclRights.valueOf(right.name())); } return OzoneAclInfo.newBuilder().setType(aclType) .setName(acl.getName()) .addAllRights(aclRights) .build(); }
Source:
protected HazelcastInstance createInstance(Config config) { if (instanceFactory != null) { throw new IllegalStateException("There should not be multiple creation of TestHazelcastFactory!"); } instanceFactory = new TestHazelcastFactory(); ownerInstance = instanceFactory.newHazelcastInstance(config); ClientConfig clientConfig = new ClientConfig(); clientConfig.getConnectionStrategyConfig().getConnectionRetryConfig().setClusterConnectTimeoutMillis(1_000); if (config.getClassLoader() != null) { final ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { clientConfig.setClassLoader(config.getClassLoader()); Thread.currentThread().setContextClassLoader(config.getClassLoader()); return instanceFactory.newHazelcastClient(clientConfig); } finally { Thread.currentThread().setContextClassLoader(tccl); } } else { return instanceFactory.newHazelcastClient(clientConfig); } }

Target:
protected HazelcastInstance createInstance(Config config) { if (instanceFactory != null) { throw new IllegalStateException("There should not be multiple creation of TestHazelcastFactory!"); } instanceFactory = new TestHazelcastFactory(); ownerInstance = instanceFactory.newHazelcastInstance(config); ClientConfig clientConfig = new ClientConfig(); clientConfig.getConnectionStrategyConfig().getConnectionRetryConfig().setClusterConnectTimeoutMillis(10_000); if (config.getClassLoader() != null) { final ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { clientConfig.setClassLoader(config.getClassLoader()); Thread.currentThread().setContextClassLoader(config.getClassLoader()); return instanceFactory.newHazelcastClient(clientConfig); } finally { Thread.currentThread().setContextClassLoader(tccl); } } else { return instanceFactory.newHazelcastClient(clientConfig); } }
Source:
public JobDetails getJobById(@PathParam("cluster") String cluster, @PathParam("jobId") String jobId, @QueryParam("include") List<String> includeFields) throws IOException { LOG.info("Fetching JobDetails for jobId=" + jobId); Stopwatch timer = new Stopwatch().start(); Predicate<String> includeFilter = null; if (includeFields != null && !includeFields.isEmpty()) { includeFilter = new SerializationContext.FieldNameFilter(includeFields); } serializationContext.set(new SerializationContext( SerializationContext.DetailLevel.EVERYTHING, null, null, includeFilter, null)); JobDetails jobDetails = getJobHistoryService().getJobByJobID(cluster, jobId); timer.stop(); StringBuilder builderIncludeJobRegex = new StringBuilder(); for(String s : includeFields) { builderIncludeJobRegex.append(s); } if (jobDetails != null) { LOG.info("For job/{cluster}/{jobId} with input query:" + " job/" + cluster + SLASH + jobId + "&includeJobField=" + builderIncludeJobRegex + " fetched jobDetails for " + jobDetails.getJobName() + " in " + timer); } else { LOG.info("For job/{cluster}/{jobId} with input query:" + " job/" + cluster + SLASH + jobId + "&includeJobField=" + builderIncludeJobRegex + " No jobDetails found, but spent " + timer); } HravenResponseMetrics.JOB_API_LATENCY_VALUE .set(timer.elapsed(TimeUnit.MILLISECONDS)); return jobDetails; }

Target:
public JobDetails getJobById(@PathParam("cluster") String cluster, @PathParam("jobId") String jobId, @QueryParam("include") List<String> includeFields) throws IOException { LOG.info("Fetching JobDetails for jobId=" + jobId); Stopwatch timer = new Stopwatch().start(); Predicate<String> includeFilter = null; if (includeFields != null && !includeFields.isEmpty()) { includeFilter = new SerializationContext.FieldNameFilter(includeFields); } serializationContext.set(new SerializationContext( SerializationContext.DetailLevel.EVERYTHING, null, null, includeFilter, null)); JobDetails jobDetails = getJobHistoryService().getJobByJobID(cluster, jobId); timer.stop(); if (jobDetails != null) { LOG.info("For job/{cluster}/{jobId} with input query:" + " job/" + cluster + SLASH + jobId + "&" + StringUtil.buildParam("include", includeFields) + " fetched jobDetails for " + jobDetails.getJobName() + " in " + timer); } else { LOG.info("For job/{cluster}/{jobId} with input query:" + " job/" + cluster + SLASH + jobId + "&" + StringUtil.buildParam("include",includeFields) + " No jobDetails found, but spent " + timer); } HravenResponseMetrics.JOB_API_LATENCY_VALUE .set(timer.elapsed(TimeUnit.MILLISECONDS)); return jobDetails; }
Source:
public void testCreateWebhookFail() throws IOException, InterruptedException { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404).setBody(stringFromResource("/autoscale_webhook_create_response.json")))); try { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); FluentIterable<WebhookResponse> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")); assertAuthentication(server); assertRequest(server.takeRequest(), "POST", "/v1.0/888888/groups/1234567890/policies/321456/webhooks", "/autoscale_webhook_create_request.json"); assertTrue(webhooks.isEmpty()); } finally { server.shutdown(); } }

Target:
public void testCreateWebhookFail() throws IOException, InterruptedException { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404).setBody(stringFromResource("/autoscale_webhook_create_response.json")))); try { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); FluentIterable<WebhookResponse> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")); assertAuthentication(server); assertRequest(server.takeRequest(), "POST", "/v1.0/888888/groups/1234567890/policies/321456/webhooks", "/autoscale_webhook_create_request.json"); assertTrue(webhooks.isEmpty(), "Expected no webhooks, but was: " + webhooks); } finally { server.shutdown(); } }
Source:
public Rectangle getHeaderBounds() { return syncExec(new Result<Rectangle>() { public Rectangle run() { Point location = parent.getParent().toDisplay(parent.getLocation()); Rectangle bounds = new Rectangle(location.x, location.y, widget.getWidth(), parent.getHeaderHeight()); for (int i : parent.getColumnOrder()) { TreeColumn column = parent.getColumns()[i]; if (column.equals(widget)) { break; } else { bounds.x += column.getWidth(); } } return bounds; } }); }

Target:
private Rectangle getHeaderBounds() { return syncExec(new Result<Rectangle>() { public Rectangle run() { Point location = parent.getParent().toDisplay(parent.getLocation()); Rectangle bounds = new Rectangle(location.x, location.y, widget.getWidth(), parent.getHeaderHeight()); for (int i : parent.getColumnOrder()) { TreeColumn column = parent.getColumn(i); if (column.equals(widget)) { break; } else { bounds.x += column.getWidth(); } } return bounds; } }); }
Source:
public HostAddedToFacility(Host host, Facility facility) { this.facility = facility; this.host = host; this.message = formatMessage("%s added to facility %s", host, facility); }

Target:
public HostAddedToFacility(Host host, Facility facility) { this.facility = facility; this.host = host; this.message = formatMessage("%s added to %s.", host, facility); }
Source:
public void write(JsonGenerator jg, NuxeoPrincipal nuxeoPrincipal) throws IOException { UserProfileService ups = Framework.getService(UserProfileService.class); try (RenderingContext.SessionWrapper sw = ctx.getSession(null)) { DocumentModel up = ups.getUserProfileDocument(nuxeoPrincipal.getName(), sw.getSession()); jg.writeFieldName(NAME); if (up == null) { jg.writeNull(); return; } jg.writeStartObject(); ConfigurationService configurationService = Framework.getService(ConfigurationService.class); if (configurationService.isBooleanPropertyTrue(COMPATIBILITY_CONFIGURATION_PARAM)) { writeCompatibilityUserProfile(jg, up); } else { writeUserProfile(jg, up); } jg.writeEndObject(); } }

Target:
public void write(JsonGenerator jg, NuxeoPrincipal nuxeoPrincipal) throws IOException { try (RenderingContext.SessionWrapper sw = ctx.getSession(null)) { DocumentModel up = userProfileService.getUserProfileDocument(nuxeoPrincipal.getName(), sw.getSession()); jg.writeFieldName(NAME); if (up == null) { jg.writeNull(); return; } jg.writeStartObject(); if (configurationService.isBooleanPropertyTrue(COMPATIBILITY_CONFIGURATION_PARAM)) { writeCompatibilityUserProfile(jg, up); } else { writeUserProfile(jg, up); } jg.writeEndObject(); } }
Source:
public List<URL> findAllRepositoriesInStream(String streamName) throws AphroditeException { if (streamName == null) { throw new AphroditeException("stream name is null in find respository stream"); } else { for (StreamService ss : streams) { return ss.findAllRepositories(); } return null; } }

Target:
public List<URL> findAllRepositoriesInStream(String streamName) throws AphroditeException { checkStreamServiceExists(); Objects.requireNonNull(streamName,"stream name is null in find respository stream"); List<URL> urls=new ArrayList<>(); for (StreamService ss : streams) { urls.addAll(ss.findAllRepositoriesInStream(streamName)); } return urls; }
Source:
private long testWriteToPipe(final Consumer<String> codeThatWritesToAFilename) throws IOException, InterruptedException, ExecutionException { final File fifo = File.createTempFile("fifo.for.testWriteToPipe", ""); Assert.assertTrue(fifo.delete()); fifo.deleteOnExit(); final Process exec = new ProcessBuilder("mkfifo", fifo.getAbsolutePath()).start(); exec.waitFor(1, TimeUnit.MINUTES); Assert.assertEquals(exec.exitValue(), 0, "mkfifo failed with exit code " + 0); ExecutorService executor = null; try { executor = Executors.newSingleThreadExecutor(); Future result = executor.submit(() -> { try { codeThatWritesToAFilename.accept(fifo.getAbsolutePath()); } catch (Exception x) { x.printStackTrace(); throw(x); } }); InputStream inputStream = Files.newInputStream(fifo.toPath(), StandardOpenOption.READ); int count = 0; while (inputStream.read() >= 0) { count++; } result.get(); return count; } finally { if (executor != null) executor.shutdownNow(); } }

Target:
private static long testWriteToPipe(final Consumer<String> codeThatWritesToAFilename) throws IOException, InterruptedException, ExecutionException { final File fifo = makeFifo(); ExecutorService executor = Executors.newFixedThreadPool(2); try { final Future<?> writeResult = executor.submit(() -> { try { codeThatWritesToAFilename.accept(fifo.getAbsolutePath()); } catch (Exception x) { x.printStackTrace(); throw(x); } }); final Future<Integer> readResult = executor.submit(() -> { try(final InputStream inputStream = Files.newInputStream(fifo.toPath(), StandardOpenOption.READ)) { int count = 0; while (inputStream.read() >= 0) { count++; } return count; } }); writeResult.get(); return readResult.get(); } finally { executor.shutdownNow(); } }
Source:
public boolean resolveConflictsOnMerge() { return resolveConflictsOnMerge && clusterTopologyManager.getManagerStatus().isRunning() && clusterTopologyManager.isRebalancingEnabled() && rebalancingEnabled; }

Target:
public boolean resolveConflictsOnMerge() { return resolveConflictsOnMerge && cacheManager.getStatus().allowInvocations() && clusterTopologyManager.isRebalancingEnabled() && rebalancingEnabled; }
Source:
protected Constructor<A> getEntityConstructor() { final Constructor<A> result = Aggregates.getAggregatePartConstructor(getEntityClass(), rootClass); return result; }

Target:
protected Constructor<A> getEntityConstructor() { final Constructor<A> result = Aggregates.getAggregatePartConstructor(getEntityClass()); return result; }
Source:
public ClientResponse apply(ClientRequest jerseyRequest) { try { final HttpUriRequest apacheRequest = buildApacheRequest(jerseyRequest); final CloseableHttpResponse apacheResponse = client.execute(apacheRequest); final StatusLine statusLine = apacheResponse.getStatusLine(); final Response.StatusType status = Statuses.from(statusLine.getStatusCode(), firstNonNull(statusLine.getReasonPhrase(), "")); final ClientResponse jerseyResponse = new ClientResponse(status, jerseyRequest); for (Header header : apacheResponse.getAllHeaders()) { final List<String> headerValues = jerseyResponse.getHeaders().get(header.getName()); if (headerValues == null) { jerseyResponse.getHeaders().put(header.getName(), new ArrayList<>(Collections.singletonList(header.getValue()))); } else { headerValues.add(header.getValue()); } } final HttpEntity httpEntity = apacheResponse.getEntity(); jerseyResponse.setEntityStream(httpEntity != null ? httpEntity.getContent() : new ByteArrayInputStream(new byte[0])); return jerseyResponse; } catch (Exception e) { throw new ProcessingException(e); } }

Target:
public ClientResponse apply(ClientRequest jerseyRequest) { try { final HttpUriRequest apacheRequest = buildApacheRequest(jerseyRequest); final CloseableHttpResponse apacheResponse = client.execute(apacheRequest); final StatusLine statusLine = apacheResponse.getStatusLine(); final Response.StatusType status = Statuses.from(statusLine.getStatusCode(), firstNonNull(statusLine.getReasonPhrase(), "")); final ClientResponse jerseyResponse = new ClientResponse(status, jerseyRequest); for (Header header : apacheResponse.getAllHeaders()) { final List<String> headerValues = jerseyResponse.getHeaders().get(header.getName()); if (headerValues == null) { jerseyResponse.getHeaders().put(header.getName(), Lists.newArrayList(header.getValue())); } else { headerValues.add(header.getValue()); } } final HttpEntity httpEntity = apacheResponse.getEntity(); jerseyResponse.setEntityStream(httpEntity != null ? httpEntity.getContent() : new ByteArrayInputStream(new byte[0])); return jerseyResponse; } catch (Exception e) { throw new ProcessingException(e); } }
Source:
public void deployUndeployProjectToServer(String projectToDeploy, String serverName) { new ConsoleView().clearConsole(); try { deployProject(projectToDeploy, serverName); checkDeployedProject(projectToDeploy, serverName); unDeployModule(projectToDeploy, serverName); } catch (CoreLayerException ex) { new DefaultShell("Server Error"); new OkButton().click(); } }

Target:
public void deployUndeployProjectToServer(String projectToDeploy, String serverName) { new ConsoleView().clearConsole(); deployProject(projectToDeploy, serverName); checkDeployedProject(projectToDeploy, serverName); unDeployModule(projectToDeploy, serverName); }