auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void many_sessions_logout() throws Exception { final String WILL_NOT_BE_SENT = "/will-not-be-sent"; final String LOCALHOST = "localhost"; final String JSESSIONID = "JSESSIONID"; JenkinsRule.WebClient wc = j.createWebClient(); CookieManager manager = wc.getCookieManager(); manager.setCookiesEnabled(true); wc.goTo("login"); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); Date tomorrow = calendar.getTime(); byte[] array = new byte[7]; Collections.nCopies(8, 1) .stream() .forEach(i -> addSessionCookie(manager, LOCALHOST, "/jenkins", tomorrow)); addSessionCookie(manager, LOCALHOST, WILL_NOT_BE_SENT, tomorrow); HtmlPage page = wc.goTo("logout"); int unexpectedSessionCookies = 2; StringBuilder builder = new StringBuilder(); builder.append("Session cookies: "); for (Cookie cookie : manager.getCookies()) { if (cookie.getName().startsWith(JSESSIONID)) { String path = cookie.getPath(); builder.append(cookie.getName()); if (path != null) builder.append("; Path=").append(path); builder.append("\n"); if (WILL_NOT_BE_SENT.equals(path)) { --unexpectedSessionCookies; } else if (JSESSIONID.equals(cookie.getName())) { --unexpectedSessionCookies; } } } System.err.println(builder.toString()); assertThat(unexpectedSessionCookies, is(0)); }

Target:
public void many_sessions_logout() throws Exception { final String WILL_NOT_BE_SENT = "/will-not-be-sent"; final String LOCALHOST = "localhost"; final String JSESSIONID = "JSESSIONID"; JenkinsRule.WebClient wc = j.createWebClient(); CookieManager manager = wc.getCookieManager(); manager.setCookiesEnabled(true); wc.goTo("login"); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); Date tomorrow = calendar.getTime(); Collections.nCopies(8, 1) .stream() .forEach(i -> addSessionCookie(manager, LOCALHOST, "/jenkins", tomorrow)); addSessionCookie(manager, LOCALHOST, WILL_NOT_BE_SENT, tomorrow); HtmlPage page = wc.goTo("logout"); int unexpectedSessionCookies = 2; StringBuilder builder = new StringBuilder(); builder.append("Session cookies: "); for (Cookie cookie : manager.getCookies()) { if (cookie.getName().startsWith(JSESSIONID)) { String path = cookie.getPath(); builder.append(cookie.getName()); if (path != null) builder.append("; Path=").append(path); builder.append("\n"); if (WILL_NOT_BE_SENT.equals(path)) { --unexpectedSessionCookies; } else if (JSESSIONID.equals(cookie.getName())) { --unexpectedSessionCookies; } } } System.err.println(builder.toString()); assertThat(unexpectedSessionCookies, is(0)); }
Source:
public AbstractExecutionEnvironment(Config config) { if (config == null) { throw new NullPointerException(); } this.config = config; }

Target:
public AbstractExecutionEnvironment(Config config) { if (config == null) { throw new NullPointerException("Parameter 'config' cannot be null."); } this.config = config; }
Source:
public void visitNode(Tree tree) { List<? extends Tree> trees = Collections.emptyList(); switch (tree.kind()) { case INITIALIZER: case STATIC_INITIALIZER: trees = ((BlockTree) tree).body(); break; case VARIABLE: VariableTree variableTree = (VariableTree) tree; trees = visitVariable(variableTree); break; case LAMBDA_EXPRESSION: LambdaExpressionTree lambda = (LambdaExpressionTree) tree; trees = visitLambda(lambda); break; case METHOD: case CONSTRUCTOR: trees = visitMethod((MethodTree) tree); break; case FOR_STATEMENT: case FOR_EACH_STATEMENT: case WHILE_STATEMENT: case DO_STATEMENT: executableLines.add(tree.lastToken().line()); break; default: } computeExecutableLines(trees); }

Target:
public void visitNode(Tree tree) { List<? extends Tree> trees = Collections.emptyList(); switch (tree.kind()) { case INITIALIZER: case STATIC_INITIALIZER: trees = ((BlockTree) tree).body(); break; case VARIABLE: trees = visitVariable((VariableTree) tree); break; case LAMBDA_EXPRESSION: trees = visitLambda((LambdaExpressionTree) tree); break; case METHOD: case CONSTRUCTOR: trees = visitMethod((MethodTree) tree); break; case FOR_STATEMENT: case FOR_EACH_STATEMENT: case WHILE_STATEMENT: case DO_STATEMENT: executableLines.add(tree.lastToken().line()); break; default: } computeExecutableLines(trees); }
Source:
public static PipelineTriggerService.MaterialForScheduling fromJSON(JsonReader jsonReader) { if (jsonReader == null) { return null; } String name = jsonReader.getString("fingerprint"); String value = jsonReader.getString("revision"); return new PipelineTriggerService.MaterialForScheduling(name, value); }

Target:
public static MaterialForScheduling fromJSON(JsonReader jsonReader) { String name = jsonReader.getString("fingerprint"); String value = jsonReader.getString("revision"); return new MaterialForScheduling(name, value); }
Source:
private void prepareTransactionInternal(HotRodHeader header, AdvancedCache<byte[], byte[]> cache, XidImpl xid, boolean onePhaseCommit, List<TransactionWrite> writes, boolean recoverable, long timeout) { try { if (writes.isEmpty()) { if (isTrace) { log.tracef("Transaction %s is read only.", xid); } writeResponse(header, createTransactionResponse(header, XAResource.XA_RDONLY)); return; } PrepareCoordinator txContext = new PrepareCoordinator(cache, xid, recoverable, timeout); if (checkExistingTxForPrepare(header, txContext)) { if (isTrace) { log.tracef("Transaction %s conflicts with another node.", xid); } return; } if (!txContext.startTransaction()) { if (isTrace) { log.tracef("Unable to start transaction %s", xid); } writeNotExecuted(header); return; } AdvancedCache<byte[], byte[]> txCache = txContext.decorateCache(cache); try { boolean rollback = false; for (TransactionWrite write : writes) { if (isValid(write, txCache)) { if (write.isRemove()) { txCache.remove(write.key); } else { txCache.put(write.key, write.value, write.metadata); } } else { txContext.setRollbackOnly(); rollback = true; break; } } int xaCode = rollback ? txContext.rollback() : txContext.prepare(onePhaseCommit); writeResponse(header, createTransactionResponse(header, xaCode)); } catch (Exception e) { writeResponse(header, createTransactionResponse(header, txContext.rollback())); } finally { EmbeddedTransactionManager.dissociateTransaction(); } } catch (Throwable t) { log.error("meh...", t); writeException(header, t); } }

Target:
private void prepareTransactionInternal(HotRodHeader header, AdvancedCache<byte[], byte[]> cache, XidImpl xid, boolean onePhaseCommit, List<TransactionWrite> writes, boolean recoverable, long timeout) { try { if (writes.isEmpty()) { if (isTrace) { log.tracef("Transaction %s is read only.", xid); } writeResponse(header, createTransactionResponse(header, XAResource.XA_RDONLY)); return; } PrepareCoordinator prepareCoordinator = new PrepareCoordinator(cache, xid, recoverable, timeout); if (checkExistingTxForPrepare(header, prepareCoordinator)) { if (isTrace) { log.tracef("Transaction %s conflicts with another node.", xid); } return; } if (!prepareCoordinator.startTransaction()) { if (isTrace) { log.tracef("Unable to start transaction %s", xid); } writeNotExecuted(header); return; } AdvancedCache<byte[], byte[]> txCache = prepareCoordinator.decorateCache(cache); try { boolean rollback = false; for (TransactionWrite write : writes) { if (isValid(write, txCache)) { if (write.isRemove()) { txCache.remove(write.key); } else { txCache.put(write.key, write.value, write.metadata); } } else { prepareCoordinator.setRollbackOnly(); rollback = true; break; } } int xaCode = rollback ? prepareCoordinator.rollback() : prepareCoordinator.prepare(onePhaseCommit); writeResponse(header, createTransactionResponse(header, xaCode)); } catch (Exception e) { writeResponse(header, createTransactionResponse(header, prepareCoordinator.rollback())); } finally { EmbeddedTransactionManager.dissociateTransaction(); } } catch (Throwable t) { log.debugf(t, "Exception while replaying transaction %s for cache %s", xid, cache.getName()); writeException(header, t); } }
Source:
public String resolveDeploymentContextBasedVipAddresses(String vipAddressMacro) { String result = vipAddressMacro; if (vipAddressMacro == null) { return null; } Matcher matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); while (matcher.find()) { String key = matcher.group(1); String value = DynamicPropertyFactory.getInstance().getStringProperty(key, "").get(); logger.debug("att:" + matcher.group()); logger.debug(", att key:" + key); logger.debug(", att value:" + value); logger.debug(""); result = result.replaceAll("\\$\\{" + key + "\\}", value); matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); } return result; }

Target:
public String resolveDeploymentContextBasedVipAddresses(String vipAddressMacro) { if (vipAddressMacro == null) { return null; } String result = vipAddressMacro; Matcher matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); while (matcher.find()) { String key = matcher.group(1); String value = DynamicPropertyFactory.getInstance().getStringProperty(key, "").get(); logger.debug("att:" + matcher.group()); logger.debug(", att key:" + key); logger.debug(", att value:" + value); logger.debug(""); result = result.replaceAll("\\$\\{" + key + "\\}", value); matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); } return result; }
Source:
private AddIfSystemPropertyDialog invokeDefaultAddIfSystemPropertyDialog(String property){ new ContextMenu().getItem("Add System Property").select(); new WaitUntil(new ShellIsAvailable("Add If System Property")); new DefaultShell("Add If System Property"); return new AddIfSystemPropertyDialog(); }

Target:
private AddIfSystemPropertyDialog invokeDefaultAddIfSystemPropertyDialog(String property){ new ContextMenu().getItem("Add System Property").select(); new DefaultShell("Add If System Property"); return new AddIfSystemPropertyDialog(); }
Source:
private boolean validate() { List<Text> percentTexts = Arrays.asList(allocatedInstances, actionGeneration, sendAction); if (container == null) return false; Optional<String> errorMsg = Arrays.stream(container.getChildren()).filter(Text.class::isInstance) .map(ctrl -> (Text) ctrl).map(text -> { if (percentTexts.contains(text)) return containsPercent(text) ? null : "Enter percentage"; else return containsNonNegativeNumber(text) ? null : "Enter a non-negative integer"; }).filter(msg -> msg != null).findFirst(); setErrorMessage(errorMsg.orElse(null)); return !errorMsg.isPresent(); }

Target:
private boolean validate() { List<Text> percentTexts = Arrays.asList(allocatedInstances, actionGeneration, sendAction); if (container == null) return false; Optional<String> errorMsg = Arrays.stream(container.getChildren()).filter(Text.class::isInstance).map(ctrl -> { Text text = (Text) ctrl; if (percentTexts.contains(text)) return containsPercent(text) ? null : "Enter percentage"; else return containsNonNegativeNumber(text) ? null : "Enter a non-negative integer"; }).filter(msg -> msg != null).findFirst(); setErrorMessage(errorMsg.orElse(null)); return !errorMsg.isPresent(); }
Source:
public Request(StreamInput in) throws IOException { super(in); if (in.getVersion().onOrAfter(Version.V_7_8_0)) { this.requestsPerSecond = in.readOptionalFloat(); this.timeout = in.readOptionalTimeValue(); } else { this.requestsPerSecond = null; this.timeout = null; } if (in.getVersion().onOrAfter(Version.CURRENT)) { jobId = in.readString(); } }

Target:
public Request(StreamInput in) throws IOException { super(in); if (in.getVersion().onOrAfter(Version.V_7_8_0)) { this.requestsPerSecond = in.readOptionalFloat(); this.timeout = in.readOptionalTimeValue(); } else { this.requestsPerSecond = null; this.timeout = null; } if (in.getVersion().onOrAfter(Version.V_8_0_0)) { jobId = in.readString(); } }
Source:
public void testVerticalScrollbar() { SWTBotView viewBot = openView(); List<? extends @NonNull Slider> scrollers = viewBot.bot().widgets(WidgetOfType.widgetOfType(Slider.class)); assertTrue("The view has " + scrollers.size() + " sliders", scrollers.size() >= 2); SWTBotScroller vScroller = new SWTBotScroller(scrollers.get(VERTICAL_SCROLLBAR_INDEX)); Rectangle scrollerRect = vScroller.getBounds(); SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class))); Rectangle timegraphRect = tgBot.getBounds(); assertEquals("Incorrect vertical scroller start position", timegraphRect.width, scrollerRect.x); assertEquals("Incorrect vertical scroller height", timegraphRect.height, scrollerRect.height); }

Target:
public void testVerticalScrollbar() { SWTBotView viewBot = openView(); List<? extends @NonNull Slider> sliders = viewBot.bot().widgets(WidgetOfType.widgetOfType(Slider.class)); assertTrue("The view has " + sliders.size() + " sliders", sliders.size() >= 2); SWTBotScroller vSlider = new SWTBotScroller(sliders.get(VERTICAL_SCROLLBAR_INDEX)); Rectangle scrollerRect = vSlider.getBounds(); SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class))); Rectangle timegraphRect = tgBot.getBounds(); assertEquals("Incorrect vertical scroller start position", timegraphRect.width, scrollerRect.x); assertEquals("Incorrect vertical scroller height", timegraphRect.height, scrollerRect.height); }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); config.validate(collector); FileFormat fileFormat = getFileFormat(); Schema schema = null; if (fileFormat != null) { ValidatingInputFormatProvider inputFormatProvider = pipelineConfigurer.usePlugin("inputformat", fileFormat.name().toLowerCase(), FORMAT_PLUGIN_ID, config.getProperties()); FormatContext context = new FormatContext(collector, null); validateInputFormatProvider(context, fileFormat, inputFormatProvider); if (inputFormatProvider != null) { schema = inputFormatProvider.getSchema(context); } } validatePathField(collector, schema); pipelineConfigurer.getStageConfigurer().setOutputSchema(schema); }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); config.validate(collector); FileFormat fileFormat = config.getFormat(); Schema schema = null; ValidatingInputFormat validatingInputFormat = pipelineConfigurer.usePlugin(ValidatingInputFormat.PLUGIN_TYPE, fileFormat.name().toLowerCase(), FORMAT_PLUGIN_ID, config.getProperties()); FormatContext context = new FormatContext(collector, null); validateInputFormatProvider(context, fileFormat, validatingInputFormat); if (validatingInputFormat != null) { schema = validatingInputFormat.getSchema(context); } validatePathField(collector, schema); pipelineConfigurer.getStageConfigurer().setOutputSchema(schema); }
Source:
public PageCachedNumberArrayFactory( PageCache pageCache, File storeDir ) { this.pageCache = pageCache; this.storeDir = storeDir; }

Target:
PageCachedNumberArrayFactory( PageCache pageCache, File storeDir ) { this.pageCache = pageCache; this.storeDir = storeDir; }
Source:
public void setEventList(List<ITimeEvent> eventList) { fEventList = eventList; }

Target:
public void setEventList(List<ITimeEvent> eventList) { fEventList = new EventList(eventList, Long.MAX_VALUE, Long.MIN_VALUE); }
Source:
private void generalSendMessage(String jsonMessage) { CloseableHttpClient client = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(this.hookURL); StringEntity entity = null; try { entity = new StringEntity(jsonMessage); } catch (UnsupportedEncodingException e) { LOG.error("Cannot encode json"); } httpPost.setEntity(entity); httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); try { CloseableHttpResponse response = client.execute(httpPost); client.close(); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { LOG.warn("Did not successfully send notification"); } } catch (IOException e) { LOG.error("Cannot send jsonMessage"); } }

Target:
private void generalSendMessage(String jsonMessage) { HttpPost httpPost = new HttpPost(this.hookURL); StringEntity entity = null; try { entity = new StringEntity(jsonMessage); } catch (UnsupportedEncodingException e) { LOG.error("Cannot encode json"); } httpPost.setEntity(entity); httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); try (CloseableHttpClient client = HttpClients.createDefault()) { CloseableHttpResponse response = client.execute(httpPost); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { LOG.warn("Did not successfully send notification"); } } catch (IOException e) { LOG.error("Cannot send jsonMessage"); } }
Source:
public void testCollectorFailureDoesNotResultInTwoErrorEmissions() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaHooks.setOnError(new Action1<Throwable>() { @Override public void call(Throwable t) { list.add(t); } }); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); TestSubscriber<List<Integer>> ts = TestSubscriber.create(); Observable.create(new OnSubscribe<Integer>() { @Override public void call(final Subscriber<? super Integer> sub) { sub.setProducer(new Producer() { @Override public void request(long n) { if (n > 0) { sub.onNext(1); sub.onError(e2); } } }); } }).collect(new Func0<List<Integer>>() { @Override public List<Integer> call() { return new ArrayList<Integer>(); } }, new Action2<List<Integer>, Integer>() { @Override public void call(List<Integer> t1, Integer t2) { throw e1; } }).unsafeSubscribe(ts); assertEquals(Arrays.asList(e1), ts.getOnErrorEvents()); ts.assertNotCompleted(); assertEquals(Arrays.asList(e2), list); } finally { RxJavaHooks.setOnError(null); } }

Target:
public void testCollectorFailureDoesNotResultInTwoErrorEmissions() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaHooks.setOnError(new Action1<Throwable>() { @Override public void call(Throwable t) { list.add(t); } }); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); TestSubscriber<List<Integer>> ts = TestSubscriber.create(); Observable.create(new OnSubscribe<Integer>() { @Override public void call(final Subscriber<? super Integer> sub) { sub.setProducer(new Producer() { @Override public void request(long n) { if (n > 0) { sub.onNext(1); sub.onError(e2); } } }); } }).collect(new Func0<List<Integer>>() { @Override public List<Integer> call() { return new ArrayList<Integer>(); } }, new Action2<List<Integer>, Integer>() { @Override public void call(List<Integer> t1, Integer t2) { throw e1; } }).unsafeSubscribe(ts); assertEquals(Arrays.asList(e1), ts.getOnErrorEvents()); ts.assertNotCompleted(); assertEquals(Arrays.asList(e2), list); } finally { RxJavaHooks.reset(); } }
Source:
public Mono<Void> updateCheckpoint(long sequenceNumber, String offset){ Checkpoint checkpoint = new Checkpoint() .consumerGroupName(partitionContext.consumerGroupName()) .eventHubName(partitionContext.eventHubName()) .instanceId(partitionContext.instanceId()) .partitionId(partitionContext.partitionId()) .sequenceNumber(sequenceNumber) .offset(offset) .eTag(eTag); return this.partitionManager.updateCheckpoint(checkpoint).flatMap(eTag -> { this.eTag = eTag; return Mono.empty(); }); }

Target:
public Mono<Void> updateCheckpoint(long sequenceNumber, String offset) { String previousETag = this.eTag.get(); Checkpoint checkpoint = new Checkpoint() .consumerGroupName(partitionContext.consumerGroupName()) .eventHubName(partitionContext.eventHubName()) .ownerId(ownerId) .partitionId(partitionContext.partitionId()) .sequenceNumber(sequenceNumber) .offset(offset) .eTag(previousETag); return this.partitionManager.updateCheckpoint(checkpoint) .map(eTag -> this.eTag.compareAndSet(previousETag, eTag)) .then(); }
Source:
public ColumnMatchResult validate(Column column, ChecksumResult controlResult, ChecksumResult testResult) { String checksumColumnAlias = getChecksumColumnAlias(column); Object controlChecksum = controlResult.getChecksum(checksumColumnAlias); Object testChecksum = testResult.getChecksum(checksumColumnAlias); String cardinalitySumColumnAlias = getCardinalitySumColumnAlias(column); Object controlCardinalitySum = controlResult.getChecksum(cardinalitySumColumnAlias); Object testCardinalitySum = testResult.getChecksum(cardinalitySumColumnAlias); return new ColumnMatchResult( Objects.equals(controlChecksum, testChecksum) && Objects.equals(controlCardinalitySum, testCardinalitySum), format( "control(checksum: %s, cardinality_sum: %s) test(checksum: %s, cardinality_sum: %s)", controlChecksum, controlCardinalitySum, testChecksum, testCardinalitySum)); }

Target:
public List<ColumnMatchResult> validate(Column column, ChecksumResult controlResult, ChecksumResult testResult) { String checksumColumnAlias = getChecksumColumnAlias(column); Object controlChecksum = controlResult.getChecksum(checksumColumnAlias); Object testChecksum = testResult.getChecksum(checksumColumnAlias); String keysChecksumColumnAlias = getKeysChecksumColumnAlias(column); Object controlKeysChecksum = controlResult.getChecksum(keysChecksumColumnAlias); Object testKeysChecksum = testResult.getChecksum(keysChecksumColumnAlias); String valuesChecksumColumnAlias = getValuesChecksumColumnAlias(column); Object controlValuesChecksum = controlResult.getChecksum(valuesChecksumColumnAlias); Object testValuesChecksum = testResult.getChecksum(valuesChecksumColumnAlias); String cardinalitySumColumnAlias = getCardinalitySumColumnAlias(column); Object controlCardinalitySum = controlResult.getChecksum(cardinalitySumColumnAlias); Object testCardinalitySum = testResult.getChecksum(cardinalitySumColumnAlias); return ImmutableList.of(new ColumnMatchResult( Objects.equals(controlChecksum, testChecksum) && Objects.equals(controlKeysChecksum, testKeysChecksum) && Objects.equals(controlValuesChecksum, testValuesChecksum) && Objects.equals(controlCardinalitySum, testCardinalitySum), column, format( "control(checksum: %s, keys_checksum: %s, values_checksum: %s, cardinality_sum: %s) " + "test(checksum: %s, keys_checksum: %s, values_checksum: %s, cardinality_sum: %s)", controlChecksum, controlKeysChecksum, controlValuesChecksum, controlCardinalitySum, testChecksum, testKeysChecksum, testValuesChecksum, testCardinalitySum))); }
Source:
public int getHeight() { int height = 0; try { height = ImageUtil.getInstance().getDimension(getFile()).height; } catch(Exception e) { Logger.error(this, e.getMessage()); } return height; }

Target:
public int getHeight() { try { if (fileDimension.height == 0) { fileDimension = ImageUtil.getInstance().getDimension(getFile()); } } catch (Exception e) { Logger.error(this, e.getMessage()); } return fileDimension.height; }
Source:
protected static boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String[] hostOs) { boolean alert = false; String[] hostOsVersionParts = hostOs[1].split("\\."); for (int counter = 0; counter < 4 - hostOsVersionParts.length; counter++) { hostOs[1] = hostOs[1] + ".0"; } Version hostVersion = new Version(hostOs[1].trim()); String releaseHost = hostOs[2].trim(); for (RpmVersion iso : isos) { if (hostVersion.getMajor() == iso.getMajor()) { if (iso.getMinor() > hostVersion.getMinor() || iso.getBuild() > hostVersion.getBuild()) { alert = true; break; } String rpmFromIso = iso.getRpmName(); int isoIndex = rpmFromIso.indexOf(".iso"); if (isoIndex != -1) { rpmFromIso = iso.getRpmName().substring(0, isoIndex); } if (RpmVersionUtils.compareRpmPart(RpmVersionUtils.splitRpmToParts(rpmFromIso)[2], releaseHost) > 0) { alert = true; break; } } } return alert; }

Target:
protected static boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String[] hostOs) { final int VERSION_FIELDS_NUMBER = 4; boolean alert = false; String[] hostOsVersionParts = hostOs[1].split("\\."); for (int counter = 0; counter < VERSION_FIELDS_NUMBER - hostOsVersionParts.length; counter++) { hostOs[1] = hostOs[1].trim() + ".0"; } Version hostVersion = new Version(hostOs[1].trim()); String releaseHost = hostOs[2].trim(); for (RpmVersion iso : isos) { if (hostVersion.getMajor() == iso.getMajor()) { if (iso.getMinor() > hostVersion.getMinor() || iso.getBuild() > hostVersion.getBuild()) { alert = true; break; } String rpmFromIso = iso.getRpmName(); int isoIndex = rpmFromIso.indexOf(".iso"); if (isoIndex != -1) { rpmFromIso = iso.getRpmName().substring(0, isoIndex); } if (RpmVersionUtils.compareRpmParts(RpmVersionUtils.splitRpmToParts(rpmFromIso)[2], releaseHost) > 0) { alert = true; break; } } } return alert; }
Source:
public SingleOutputStreamOperator<T> assignTimestampsAndWatermarks( AssignerWithPeriodicWatermarks<T> timestampAndWatermarkAssigner) { final int inputParallelism = getTransformation().getParallelism(); final AssignerWithPeriodicWatermarks<T> cleanedAssigner = clean(timestampAndWatermarkAssigner); final WatermarkStrategy<T> wms = new AssignerWithPeriodicWatermarksAdapter.Strategy<>(cleanedAssigner); final TimestampsAndWatermarksOperator<T> operator = new TimestampsAndWatermarksOperator<>(wms); return transform("Timestamps/Watermarks", getTransformation().getOutputType(), operator) .setParallelism(inputParallelism); }

Target:
public SingleOutputStreamOperator<T> assignTimestampsAndWatermarks( AssignerWithPeriodicWatermarks<T> timestampAndWatermarkAssigner) { final AssignerWithPeriodicWatermarks<T> cleanedAssigner = clean(timestampAndWatermarkAssigner); final WatermarkStrategy<T> wms = new AssignerWithPeriodicWatermarksAdapter.Strategy<>(cleanedAssigner); return assignTimestampsAndWatermarks(wms); }
Source:
private ProtocolResponseMessage createResponseMessage(final Message message) throws JMSException { final ResponseMessage responseMessage = (ResponseMessage) ((ObjectMessage) message).getObject(); final ObjectMessage objectMessage = (ObjectMessage) message; final OsgpException osgpException = responseMessage.getOsgpException() == null ? null : responseMessage .getOsgpException(); final String correlationUid = objectMessage.getJMSCorrelationID(); final String messageType = objectMessage.getJMSType(); final String domain = objectMessage.getStringProperty(Constants.DOMAIN); final String domainVersion = objectMessage.getStringProperty(Constants.DOMAIN_VERSION); final String organisationIdentification = objectMessage .getStringProperty(Constants.ORGANISATION_IDENTIFICATION); final String deviceIdentification = objectMessage.getStringProperty(Constants.DEVICE_IDENTIFICATION); final ResponseMessageResultType responseMessageResultType = ResponseMessageResultType.valueOf(objectMessage .getStringProperty(Constants.RESULT)); final Serializable dataObject = responseMessage.getDataObject() == null ? null : responseMessage .getDataObject(); final boolean scheduled = objectMessage.propertyExists(Constants.IS_SCHEDULED) ? objectMessage .getBooleanProperty(Constants.IS_SCHEDULED) : false; final int retryCount = objectMessage.getIntProperty(Constants.RETRY_COUNT); final int messagePriority = message.getJMSPriority(); return new ProtocolResponseMessage.Builder() .domain(domain) .domainVersion(domainVersion) .messageType(messageType) .correlationUid(correlationUid) .organisationIdentification(organisationIdentification) .deviceIdentification(deviceIdentification) .result(responseMessageResultType) .osgpException(osgpException) .dataObject(dataObject) .scheduled(scheduled) .retryCount(retryCount) .messagePriority(messagePriority) .build(); }

Target:
private ProtocolResponseMessage createResponseMessage(final Message message) throws JMSException { final ResponseMessage responseMessage = (ResponseMessage) ((ObjectMessage) message).getObject(); final OsgpException osgpException = responseMessage.getOsgpException() == null ? null : responseMessage .getOsgpException(); final String domain = message.getStringProperty(Constants.DOMAIN); final String domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION); final ResponseMessageResultType responseMessageResultType = ResponseMessageResultType.valueOf(message .getStringProperty(Constants.RESULT)); final Serializable dataObject = responseMessage.getDataObject(); boolean scheduled = false; if (message.propertyExists(Constants.IS_SCHEDULED)) { scheduled = message.getBooleanProperty(Constants.IS_SCHEDULED); } final int retryCount = message.getIntProperty(Constants.RETRY_COUNT); final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(message); return new ProtocolResponseMessage.Builder() .deviceMessageMetadata(deviceMessageMetadata) .domain(domain) .domainVersion(domainVersion) .result(responseMessageResultType) .osgpException(osgpException) .dataObject(dataObject) .scheduled(scheduled) .retryCount(retryCount) .build(); }
Source:
public void testNullSerializer() throws Exception { defaultInboundGateway.setSerializer(null); defaultInboundGateway.start(); try { sendChannel.send(new GenericMessage<String>("test1")); } catch(Exception e) { assertTrue(e.getMessage().contains("No reply produced")); } defaultInboundGateway.stop(); }

Target:
public void testNullSerializer() throws Exception { defaultInboundGateway.setSerializer(null); try { sendChannel.send(new GenericMessage<String>("test1")); } catch(Exception e) { assertTrue(e.getMessage().contains("No reply produced")); } finally { defaultInboundGateway.setSerializer(new StringRedisSerializer()); } }
Source:
public Object nextRecord(Object reuse) throws IOException { @SuppressWarnings("unchecked") IndexedRecord r = (IndexedRecord) super.nextRecord(record); GenericRowData row = AvroRowDataDeserializationSchema.convertAvroRecordToRowData( schema, formatRowType, r); for (int i = 0; i < selectFieldToFormatField.length; i++) { rowData.setField(selectFieldToProjectField[i], row.getField(selectFieldToFormatField[i])); } emitted++; return rowData; }

Target:
public Object nextRecord(Object reuse) throws IOException { @SuppressWarnings("unchecked") IndexedRecord r = (IndexedRecord) super.nextRecord(record); if (r == null) { return null; } GenericRowData row = (GenericRowData) converter.convert(r); for (int i = 0; i < selectFieldToFormatField.length; i++) { rowData.setField(selectFieldToProjectField[i], row.getField(selectFieldToFormatField[i])); } emitted++; return rowData; }
Source:
private String formatMonth(int count, int value, int maxIntCount, StringBuffer buffer, boolean useDateFormatSymbols, boolean standalone, int field, int style) { String current = null; if (useDateFormatSymbols) { final String[] months; if (count == 4) { months = standalone ? formatData.getStandAloneMonths() : formatData.getMonths(); } else if (count == 5) { months = standalone ? formatData.getTinyStandAloneMonths() : formatData.getTinyMonths(); } else if (count == 3) { months = standalone ? formatData.getShortStandAloneMonths() : formatData.getShortMonths(); } else { months = null; } if (months != null) { current = months[value]; } } else { if (count < 3) { current = null; } else { if (standalone) { style |= 0x8000; } current = calendar.getDisplayName(field, style, locale); } } if (current == null) { zeroPaddingNumber(value+1, count, maxIntCount, buffer); } return current; }

Target:
private String formatMonth(int count, int value, int maxIntCount, StringBuffer buffer, boolean useDateFormatSymbols, boolean standalone, int field, int style) { String current = null; if (useDateFormatSymbols) { final String[] months; if (count == 4) { months = standalone ? formatData.getStandAloneMonths() : formatData.getMonths(); } else if (count == 5) { months = standalone ? formatData.getTinyStandAloneMonths() : formatData.getTinyMonths(); } else if (count == 3) { months = standalone ? formatData.getShortStandAloneMonths() : formatData.getShortMonths(); } else { months = null; } if (months != null) { current = months[value]; } } else { if (count < 3) { current = null; } else { if (standalone) { style = Calendar.toStandaloneStyle(style); } current = calendar.getDisplayName(field, style, locale); } } if (current == null) { zeroPaddingNumber(value+1, count, maxIntCount, buffer); } return current; }
Source:
public static <E> void forwardToRss(String title, String url, Collection<? extends E> entries, FeedAdapter<E> adapter, StaplerRequest req, HttpServletResponse rsp) throws IOException, ServletException { req.setAttribute("adapter",adapter); String fixedTitle = title; String brokenFragment = "All all "; if (title.startsWith(brokenFragment)) { StringBuilder fixing = new StringBuilder("All "); fixing.append(title.substring(brokenFragment.length())); fixedTitle = fixing.toString(); } req.setAttribute("title",fixedTitle); req.setAttribute("url",url); req.setAttribute("entries",entries); String flavor = req.getParameter("flavor"); if(flavor==null) flavor="atom"; flavor = flavor.replace('/', '_'); if (flavor.equals("atom")) { rsp.setContentType("application/atom+xml; charset=UTF-8"); } else { rsp.setContentType("text/xml; charset=UTF-8"); } req.getView(Jenkins.get(),"/hudson/"+flavor+".jelly").forward(req,rsp); }

Target:
public static <E> void forwardToRss(String title, String url, Collection<? extends E> entries, FeedAdapter<E> adapter, StaplerRequest req, HttpServletResponse rsp) throws IOException, ServletException { req.setAttribute("adapter",adapter); req.setAttribute("title",title); req.setAttribute("url",url); req.setAttribute("entries",entries); String flavor = req.getParameter("flavor"); if(flavor==null) flavor="atom"; flavor = flavor.replace('/', '_'); if (flavor.equals("atom")) { rsp.setContentType("application/atom+xml; charset=UTF-8"); } else { rsp.setContentType("text/xml; charset=UTF-8"); } req.getView(Jenkins.get(),"/hudson/"+flavor+".jelly").forward(req,rsp); }
Source:
public static String getAssignedDomain(String hostname, boolean strict, boolean excludePrivate) { hostname = hostname.toLowerCase(Locale.ROOT); SuffixTrie.LookupResult<EffectiveTLD> res = findEffectiveTLD(hostname, excludePrivate); if (res == null) { return (strict ? null : hostname); } EffectiveTLD etld = res.value; if (etld.isException()) { return etld.domain; } if (res.offset == 0) { return (strict ? null : hostname); } int etldStartPos = res.offset - 1; if (hostname.charAt(etldStartPos) != DOT) { return (strict ? null : hostname); } int start = 0; int pos; while ((pos = hostname.indexOf(DOT, start)) != -1) { if (pos == start) { return (strict ? null : hostname); } if (pos >= etldStartPos) break; start = pos + 1; } return hostname.substring(start); }

Target:
public static String getAssignedDomain(String hostname, boolean strict, boolean excludePrivate) { hostname = hostname.toLowerCase(Locale.ROOT); SuffixTrie.LookupResult<EffectiveTLD> res = findEffectiveTLD(hostname, excludePrivate); if (res == null) { return (strict ? null : hostname); } EffectiveTLD etld = res.value; if (etld.isException()) { return etld.domain; } if (res.offset == 0) { return (strict ? null : hostname); } int etldStartPos = res.offset - 1; if (hostname.charAt(etldStartPos) != DOT) { LOGGER.debug("No dot before eTLD in {}", hostname.substring(res.offset), hostname); return (strict ? null : hostname); } int start = 0; int pos; while ((pos = hostname.indexOf(DOT, start)) != -1) { if (pos == start) { LOGGER.debug("Two immediately consecutive dots in hostname: {}", hostname); return (strict ? null : hostname); } if (pos >= etldStartPos) break; start = pos + 1; } return hostname.substring(start); }
Source:
public AsyncFuture<Void> configure() { final IndicesAdminClient indices = client.getClient().admin().indices(); final List<AsyncFuture<AcknowledgedResponse>> writes = new ArrayList<>(); for (final Map.Entry<String, Map<String, Object>> mapping : type.getMappings().entrySet()) { final String indexType = mapping.getKey(); final String templateWithType = templateName + "-" + indexType; final String pattern = index.template().replaceAll("\\*", indexType + "-*"); log.info("[{}] updating template for {}", templateWithType, pattern); Map<String, Object> settings = new HashMap<>(); settings.put("index", index.settings()); final PutIndexTemplateRequestBuilder put = indices.preparePutTemplate(templateWithType) .setSettings(settings) .setPatterns(List.of(pattern)) .addMapping(mapping.getKey(), mapping.getValue()); final ResolvableFuture<AcknowledgedResponse> future = async.future(); writes.add(future); put.execute(new ActionListener<>() { @Override public void onResponse(AcknowledgedResponse response) { if (!response.isAcknowledged()) { future.fail(new Exception("request not acknowledged")); return; } future.resolve(null); } @Override public void onFailure(Exception e) { future.fail(e); } }); } return async.collectAndDiscard(writes); }

Target:
public AsyncFuture<Void> configure() { final IndicesAdminClient indices = client.getClient().admin().indices(); final List<AsyncFuture<AcknowledgedResponse>> writes = new ArrayList<>(); for (final Map.Entry<String, Map<String, Object>> mapping : type.getMappings().entrySet()) { final String indexType = mapping.getKey(); final String templateWithType = templateName + "-" + indexType; final String pattern = index.getTemplate().replaceAll("\\*", indexType + "-*"); log.info("[{}] updating template for {}", templateWithType, pattern); Map<String, Object> settings = new HashMap<>(type.getSettings()); settings.put("index", index.getSettings()); final PutIndexTemplateRequestBuilder put = indices.preparePutTemplate(templateWithType) .setSettings(settings) .setPatterns(List.of(pattern)) .addMapping(mapping.getKey(), mapping.getValue()); final ResolvableFuture<AcknowledgedResponse> future = async.future(); writes.add(future); put.execute(new ActionListener<>() { @Override public void onResponse(AcknowledgedResponse response) { if (!response.isAcknowledged()) { future.fail(new Exception("request not acknowledged")); return; } future.resolve(null); } @Override public void onFailure(Exception e) { future.fail(e); } }); } return async.collectAndDiscard(writes); }
Source:
public String generateTicket(String data) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException { Base64 base64 = new Base64(0); Map<String, String> map = new HashMap<String, String>(); byte[] random = new byte[8]; new Random().nextBytes(random); map.put("salt", base64.encodeToString(random)); map.put( "time", new SimpleDateFormat("yyyyMMddHHmmss").format( Calendar.getInstance( TimeZone.getTimeZone("UTC") ).getTime() ) ); map.put("data", data); Signature signature = Signature.getInstance("SHA1withRSA"); signature.initSign(_key); StringBuilder fields = new StringBuilder(); for (Map.Entry<String, String> entry : map.entrySet()) { if (fields.length() > 0) { fields.append(","); } fields.append(entry.getKey()); signature.update(entry.getValue().getBytes(Charset.forName("UTF-8"))); } map.put("signedFields", fields.toString()); map.put("signature", base64.encodeToString(signature.sign())); StringBuilder ret = new StringBuilder(); ret.append("{"); boolean first = true; for (Map.Entry<String, String> entry : map.entrySet()) { if (first) { first = false; } else { ret.append(","); } ret.append(String.format("\"%s\":\"%s\"", entry.getKey(), entry.getValue())); } ret.append("}"); return base64.encodeToString(ret.toString().getBytes(Charset.forName("UTF-8"))); }

Target:
public String generateTicket(String data) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException { Base64 base64 = new Base64(0); Map<String, String> map = new HashMap<String, String>(); byte[] random = new byte[8]; new Random().nextBytes(random); map.put("salt", base64.encodeToString(random)); SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); df.setTimeZone(TimeZone.getTimeZone("UTC")); map.put( "validFrom", df.format(new Date()) ); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); cal.add(Calendar.SECOND, lifetime); map.put( "validTo", df.format(cal.getTime()) ); map.put("data", data); Signature signature = Signature.getInstance("SHA1withRSA"); signature.initSign(key); StringBuilder fields = new StringBuilder(); for (Map.Entry<String, String> entry : map.entrySet()) { if (fields.length() > 0) { fields.append(","); } fields.append(entry.getKey()); signature.update(entry.getValue().getBytes(Charset.forName("UTF-8"))); } map.put("signedFields", fields.toString()); map.put("signature", base64.encodeToString(signature.sign())); StringBuilder ret = new StringBuilder(); ret.append("{"); boolean first = true; for (Map.Entry<String, String> entry : map.entrySet()) { if (first) { first = false; } else { ret.append(","); } ret.append(String.format("\"%s\":\"%s\"", entry.getKey(), entry.getValue())); } ret.append("}"); return base64.encodeToString(ret.toString().getBytes(Charset.forName("UTF-8"))); }
Source:
public void init() { Font.loadFont(FafClientApplication.class.getResourceAsStream("/font/dfc-icons.ttf"), 10); JavaFxUtil.fixTooltipDuration(); CountDownLatch runAndWaitLatch = new CountDownLatch(1); Runnable initRunnable = () -> { applicationContext = new SpringApplicationBuilder(FafClientApplication.class) .profiles(getAdditionalProfiles()) .bannerMode(Mode.OFF) .run(getParameters().getRaw().toArray(new String[0])); runAndWaitLatch.countDown(); }; if (!Platform.isFxApplicationThread()) { Platform.runLater(initRunnable); } else { initRunnable.run(); } noCatch((NoCatchRunnable) runAndWaitLatch::await); }

Target:
public void init() { Font.loadFont(FafClientApplication.class.getResourceAsStream("/font/dfc-icons.ttf"), 10); JavaFxUtil.fixTooltipDuration(); applicationContext = new SpringApplicationBuilder(FafClientApplication.class) .profiles(getAdditionalProfiles()) .bannerMode(Mode.OFF) .run(getParameters().getRaw().toArray(new String[0])); }
Source:
public void invalidate(@Nullable String path) { if (path == null) { return; } invalidate(Uri.parse(path)); }

Target:
public void invalidate(@Nullable String path) { if (path != null) { invalidate(Uri.parse(path)); } }
Source:
public CompletableFuture<Void> downloadAndInstallMod(String uid) { return fafService.getModVersion(uid) .thenCompose(mod -> downloadAndInstallMod(mod, null, null)) .exceptionally(throwable -> { logger.warn("Sim mod was not installed", throwable); return null; }); }

Target:
public CompletableFuture<Void> downloadAndInstallMod(String uid) { return fafService.getModVersion(uid) .thenCompose(mod -> downloadAndInstallMod(mod, null, null)) .exceptionally(throwable -> { logger.warn("Sim mod could not be installed", throwable); return null; }); }
Source:
public Map<String, String> getHostLabels(final String host) { final ZooKeeperClient client = provider.get("getHostStatus"); if (!ZooKeeperRegistrarUtil.isHostRegistered(client, host)) { log.warn("Host isn't registered in ZooKeeper.", host); return emptyMap(); } final Map<String, String> labels = getLabels(client, host); return labels == null ? emptyMap() : labels; }

Target:
public Map<String, String> getHostLabels(final String host) { final ZooKeeperClient client = provider.get("getHostStatus"); if (!ZooKeeperRegistrarUtil.isHostRegistered(client, host)) { return emptyMap(); } final Map<String, String> labels = getLabels(client, host); return labels == null ? emptyMap() : labels; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_mas_optimization); stops = new ArrayList<Position>(); final Position origin = Position.fromCoordinates(-122.408818, 37.784015); stops.add(origin); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { map = mapboxMap; mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(origin.getLatitude(), origin.getLongitude())) .title("1")); map.setOnMapClickListener(new MapboxMap.OnMapClickListener() { @Override public void onMapClick(@NonNull LatLng point) { if (stops.size() == 12) { Toast.makeText(OptimizationActivity.this, "Only 12 stops allowed on route", Toast.LENGTH_LONG).show(); } else { map.addMarker(new MarkerOptions() .position(new LatLng(point.getLatitude(), point.getLongitude())) .title("1")); stops.add(Position.fromCoordinates(point.getLongitude(), point.getLatitude())); getOptimized(stops); } } }); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_mas_optimization); initializeListOfStops(); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { map = mapboxMap; mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(origin.getLatitude(), origin.getLongitude())) .title(getString(R.string.origin))); map.setOnMapClickListener(new MapboxMap.OnMapClickListener() { @Override public void onMapClick(@NonNull LatLng point) { if (alreadyTwelveMarkersOnMap()) { Toast.makeText(OptimizationActivity.this, R.string.only_twelve_stops_allowed, Toast.LENGTH_LONG).show(); } else { addDestinationMarker(point); addPointToStopsList(point); getOptimizedRoute(stops); } } }); Toast.makeText(OptimizationActivity.this, R.string.click_instructions, Toast.LENGTH_SHORT).show(); } }); }
Source:
public static Map<String, Certificate> getKeystoreMap(final KeyStore keystore) throws KeyStoreException { Map<String, Certificate> retObj = new HashMap<>(); Enumeration<String> alaises = keystore.aliases(); String alias; Certificate cert; String subjectKeyId; while(alaises.hasMoreElements()){ alias = alaises.nextElement(); cert = keystore.getCertificate(alias); subjectKeyId = getCertKeyIdSubject(cert); retObj.put(subjectKeyId, cert); } return retObj; }

Target:
public static Map<String, Certificate> getKeystoreMap(final KeyStore keystore) throws KeyStoreException { Map<String, Certificate> retObj = new HashMap<>(); Enumeration<String> aliases = keystore.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); Certificate cert = keystore.getCertificate(alias); retObj.put(getCertKeyIdSubject(cert), cert); } return retObj; }
Source:
public RecordWriter<Long, SinkRecord> getRecordWriter(Configuration conf, String fileName, SinkRecord record) throws IOException{ Object value = AvroData.convertToAvro(record.getValue()); Schema avroSchema = ((GenericRecord) value).getSchema(); CompressionCodecName compressionCodecName = CompressionCodecName.SNAPPY; int blockSize = 256 * 1024 * 1024; int pageSize = 64 * 1024; Path path = new Path(fileName); path.getFileSystem(conf).create(path); final ParquetWriter<GenericRecord> writer = new AvroParquetWriter<GenericRecord>(path, avroSchema, compressionCodecName, blockSize, pageSize); return new RecordWriter<Long, SinkRecord>(){ @Override public void write(Long key, SinkRecord record) throws IOException{ Object value = AvroData.convertToAvro(record.getValue()); writer.write((GenericRecord) value); } @Override public void close() throws IOException{ writer.close(); } @Override public void flush() throws IOException{ writer.close(); } }; }

Target:
public RecordWriter<Long, SinkRecord> getRecordWriter(Configuration conf, String fileName, SinkRecord record) throws IOException{ Object value = AvroData.convertToAvro(record.getValue()); Schema avroSchema = ((GenericRecord) value).getSchema(); CompressionCodecName compressionCodecName = CompressionCodecName.SNAPPY; int blockSize = 256 * 1024 * 1024; int pageSize = 64 * 1024; Path path = new Path(fileName); path.getFileSystem(conf).create(path); final ParquetWriter<GenericRecord> writer = new AvroParquetWriter<GenericRecord>(path, avroSchema, compressionCodecName, blockSize, pageSize); return new RecordWriter<Long, SinkRecord>(){ @Override public void write(Long key, SinkRecord record) throws IOException{ Object value = AvroData.convertToAvro(record.getValue()); writer.write((GenericRecord) value); } @Override public void close() throws IOException{ writer.close(); } }; }
Source:
public void testSessionUserReadOnlyPrivilegeDefault() { setUp(); assertEquals(HOST.hasReadOnlyAccessPrivilege(), new Boolean(false)); }

Target:
public void testSessionUserReadOnlyPrivilegeDefault() { assertEquals(HOST.hasPrivilege(UserPrivilege.Keys.SESSION_READONLY_ACCESS), false); }