auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { mPhoneTextView = view.findViewById(R.id.edit_phone_number); mCountDownTextView = view.findViewById(R.id.ticker); mResendCodeTextView = view.findViewById(R.id.resend_code); mConfirmationCodeEditText = view.findViewById(R.id.confirmation_code); mSubmitConfirmationButton = view.findViewById(R.id.submit_confirmation_code); getActivity().setTitle(getString(R.string.fui_verify_your_phone_title)); mCountdown.run(); setupSubmitConfirmationButton(); setupConfirmationCodeEditText(); setupEditPhoneNumberTextView(); setupResendConfirmationCodeTextView(); PreambleHandler.setup( getContext(), getFlowParams(), R.string.fui_continue_phone_login, view.<TextView>findViewById(R.id.create_account_tos)); }

Target:
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { mProgressBar = view.findViewById(R.id.top_progress_bar); mPhoneTextView = view.findViewById(R.id.edit_phone_number); mCountDownTextView = view.findViewById(R.id.ticker); mResendCodeTextView = view.findViewById(R.id.resend_code); mConfirmationCodeEditText = view.findViewById(R.id.confirmation_code); mSubmitConfirmationButton = view.findViewById(R.id.submit_confirmation_code); requireActivity().setTitle(getString(R.string.fui_verify_your_phone_title)); processCountdownTick(); setupSubmitConfirmationButton(); setupConfirmationCodeEditText(); setupEditPhoneNumberTextView(); setupResendConfirmationCodeTextView(); PrivacyDisclosureUtils.setupTermsOfServiceFooter( requireContext(), getFlowParams(), view.<TextView>findViewById(R.id.email_footer_tos_and_pp_text)); }
Source:
public void writePlane(final int imageIndex, final long planeIndex, final Plane plane, final long[] planeMin, final long[] planeMax) throws FormatException, IOException { final byte[] buf = plane.getBytes(); final Metadata meta = getMetadata(); checkParams(imageIndex, planeIndex, buf, planeMin, planeMax); if (!SCIFIOMetadataTools.wholePlane(imageIndex, meta, planeMin, planeMax)) { throw new FormatException( "JavaWriter does not yet support saving image tiles."); } final ImageMetadata imageMeta = meta.get(imageIndex); final int type = imageMeta.getPixelType(); if (!ArrayUtils.contains(getPixelTypes(getCompression()), type)) { final String typeString = FormatTools.getPixelTypeString(type); throw new FormatException("Unsupported image type '" + typeString + "'."); } final int bpp = FormatTools.getBytesPerPixel(type); final boolean fp = FormatTools.isFloatingPoint(type); final boolean little = imageMeta.isLittleEndian(); final String varName = "image" + imageIndex + "Plane" + planeIndex; final Object array = Bytes.makeArray(buf, bpp, fp, little); final RandomAccessOutputStream output = getStream(); output.seek(output.length()); writePlane(varName, getType(array), (int) planeMax[0], (int) planeMax[1]); }

Target:
public void writePlane(final int imageIndex, final long planeIndex, final Plane plane, final long[] planeMin, final long[] planeMax) throws FormatException, IOException { final byte[] buf = plane.getBytes(); final Metadata meta = getMetadata(); checkParams(imageIndex, planeIndex, buf, planeMin, planeMax); if (!SCIFIOMetadataTools.wholePlane(imageIndex, meta, planeMin, planeMax)) { throw new FormatException( "JavaWriter does not yet support saving image tiles."); } final ImageMetadata imageMeta = meta.get(imageIndex); final int type = imageMeta.getPixelType(); if (!ArrayUtils.contains(getPixelTypes(getCompression()), type)) { final String typeString = FormatTools.getPixelTypeString(type); throw new FormatException("Unsupported image type '" + typeString + "'."); } final int bpp = FormatTools.getBytesPerPixel(type); final boolean fp = FormatTools.isFloatingPoint(type); final boolean little = imageMeta.isLittleEndian(); final String varName = "image" + imageIndex + "Plane" + planeIndex; final Object array = Bytes.makeArray(buf, bpp, fp, little); getStream().seek(getStream().length()); writePlane(varName, getType(array), (int) planeMax[0], (int) planeMax[1]); }
Source:
public static <E> Map<String, E> copyMap( Map<String, E> dest, Map<String, E> source, Function<E, E> copyFn) { dest.clear(); source.entrySet() .forEach(entry -> dest.put(entry.getKey(), copyFn.apply(entry.getValue()))); return dest; }

Target:
private static <E> Map<String, E> copyMap( Map<String, E> dest, Map<String, E> source, Function<E, E> copyFn) { dest.clear(); source.entrySet() .forEach(entry -> dest.put(entry.getKey(), copyFn.apply(entry.getValue()))); return dest; }
Source:
private Set<String> filterAuthorizedSupervisorIds( final HttpServletRequest req, SupervisorManager manager, Collection<String> supervisorIds ) { final Set<String> authorizedSupervisorIds = Sets.newHashSet(); if (supervisorIds.size() == 0) { AuthorizationUtils.authorizeAllResourceActions( req, Lists.newArrayList(), authorizerMapper ); } else { Function<String, Iterable<ResourceAction>> raGenerator = supervisorId -> { Optional<SupervisorSpec> supervisorSpecOptional = manager.getSupervisorSpec(supervisorId); if (supervisorSpecOptional.isPresent()) { return Iterables.transform( supervisorSpecOptional.get().getDataSources(), AuthorizationUtils.DATASOURCE_WRITE_RA_GENERATOR ); } else { return null; } }; AuthorizationUtils.filterAuthorizedResources( req, supervisorIds, raGenerator, authorizerMapper, authorizedSupervisorIds ); } return authorizedSupervisorIds; }

Target:
private Set<String> filterAuthorizedSupervisorIds( final HttpServletRequest req, SupervisorManager manager, Collection<String> supervisorIds ) { Function<String, Iterable<ResourceAction>> raGenerator = supervisorId -> { Optional<SupervisorSpec> supervisorSpecOptional = manager.getSupervisorSpec(supervisorId); if (supervisorSpecOptional.isPresent()) { return Iterables.transform( supervisorSpecOptional.get().getDataSources(), AuthorizationUtils.DATASOURCE_WRITE_RA_GENERATOR ); } else { return null; } }; return Sets.newHashSet( AuthorizationUtils.filterAuthorizedResources( req, supervisorIds, raGenerator, authorizerMapper ) ); }
Source:
private void processBlockElements(CFG.Block block, Set<Symbol> blockKill, Set<Symbol> blockGen) { Set<Tree> assignmentLHS = new HashSet<>(); for (Tree element : block.elements) { Symbol symbol; switch (element.kind()) { case ASSIGNMENT: ExpressionTree lhs = ((AssignmentExpressionTree) element).variable(); if (lhs.is(Tree.Kind.IDENTIFIER)) { symbol = ((IdentifierTree) lhs).symbol(); if (isLocalVariable(symbol)) { assignmentLHS.add(lhs); blockGen.remove(symbol); blockKill.add(symbol); } } break; case IDENTIFIER: symbol = ((IdentifierTree) element).symbol(); if (!assignmentLHS.contains(element) && isLocalVariable(symbol)) { blockGen.add(symbol); } break; case VARIABLE: blockKill.add(((VariableTree) element).symbol()); blockGen.remove(((VariableTree) element).symbol()); break; case LAMBDA_EXPRESSION: LocalVariableReadExtractor extractor = new LocalVariableReadExtractor(cfg.methodSymbol()); ((LambdaExpressionTree) element).body().accept(extractor); blockGen.addAll(extractor.usedVariables()); break; case NEW_CLASS: ClassTree body = ((NewClassTree) element).classBody(); if (body != null) { LocalVariableReadExtractor extractorFromClass = new LocalVariableReadExtractor(cfg.methodSymbol()); body.accept(extractorFromClass); blockGen.addAll(extractorFromClass.usedVariables()); } break; default: } } }

Target:
private void processBlockElements(CFG.Block block, Set<Symbol> blockKill, Set<Symbol> blockGen) { Set<Tree> assignmentLHS = new HashSet<>(); for (Tree element : Lists.reverse(block.elements())) { Symbol symbol; switch (element.kind()) { case ASSIGNMENT: ExpressionTree lhs = ((AssignmentExpressionTree) element).variable(); if (lhs.is(Tree.Kind.IDENTIFIER)) { symbol = ((IdentifierTree) lhs).symbol(); if (isLocalVariable(symbol)) { assignmentLHS.add(lhs); blockGen.remove(symbol); blockKill.add(symbol); } } break; case IDENTIFIER: symbol = ((IdentifierTree) element).symbol(); if (!assignmentLHS.contains(element) && isLocalVariable(symbol)) { blockGen.add(symbol); } break; case VARIABLE: blockKill.add(((VariableTree) element).symbol()); blockGen.remove(((VariableTree) element).symbol()); break; case LAMBDA_EXPRESSION: LocalVariableReadExtractor extractor = new LocalVariableReadExtractor(cfg.methodSymbol()); ((LambdaExpressionTree) element).body().accept(extractor); blockGen.addAll(extractor.usedVariables()); break; case NEW_CLASS: ClassTree body = ((NewClassTree) element).classBody(); if (body != null) { LocalVariableReadExtractor extractorFromClass = new LocalVariableReadExtractor(cfg.methodSymbol()); body.accept(extractorFromClass); blockGen.addAll(extractorFromClass.usedVariables()); } break; default: } } }
Source:
public boolean hasDictionarySupport() { return delegate.hasDictionarySupport(); }

Target:
public boolean hasDictionarySupport() { return true; }
Source:
public static QueryInfo parseQuery(String sql) { Planner planner = createPlanner(); SqlNode sqlNode; try { sqlNode = planner.parse(sql); } catch (SqlParseException e) { throw new SamzaException(e); } String sink; String selectQuery; ArrayList<String> sources; if (sqlNode instanceof SqlInsert) { SqlInsert sqlInsert = ((SqlInsert) sqlNode); sink = sqlInsert.getTargetTable().toString(); if (sqlInsert.getSource() instanceof SqlSelect) { SqlSelect sqlSelect = (SqlSelect) sqlInsert.getSource(); selectQuery = sqlSelect.toString(); LOG.info("Parsed select query from sql {}", selectQuery, sql); sources = getSourcesFromSelectQuery(sqlSelect); } else { throw new SamzaException("Sql query is not of the expected format"); } } else { throw new SamzaException("Sql query is not of the expected format"); } return new QueryInfo(selectQuery, sources, sink, sql); }

Target:
public static QueryInfo parseQuery(String sql) { Planner planner = createPlanner(); SqlNode sqlNode; try { sqlNode = planner.parse(sql); } catch (SqlParseException e) { throw new SamzaException(e); } String sink; String selectQuery; ArrayList<String> sources; if (sqlNode instanceof SqlInsert) { SqlInsert sqlInsert = ((SqlInsert) sqlNode); sink = sqlInsert.getTargetTable().toString(); if (sqlInsert.getSource() instanceof SqlSelect) { SqlSelect sqlSelect = (SqlSelect) sqlInsert.getSource(); selectQuery = sqlSelect.toString(); LOG.info("Parsed select query from sql {}", selectQuery, sql); sources = getSourcesFromSelectQuery(sqlSelect); } else { String msg = String.format("Sql query is not of the expected format. Select node expected, found %s", sqlInsert.getSource().getClass().toString()); LOG.error(msg); throw new SamzaException(msg); } } else { String msg = String.format("Sql query is not of the expected format. Insert node expected, found %s", sqlNode.getClass().toString()); LOG.error(msg); throw new SamzaException(msg); } return new QueryInfo(selectQuery, sources, sink, sql); }
Source:
private void setupLoggers() { final boolean isDebugMode = Boolean.getBoolean("saros.debug") || isDebugging(); try { File mainLogDir = getStateLocation().toFile(); final String logDir = mainLogDir + File.separator + "SarosLogs"; final String logLevel = isDebugMode ? LOG_LEVEL_DEBUG : LOG_LEVEL_RELEASE; URL configFileU = getBundle().getResource(LOG4J2_CONFIG_FILENAME); if (configFileU == null) { throw new RuntimeException( "Failed to get the log4j2 config file from the bundle class loader"); } String configFileUri = configFileU.toString(); System.setProperty("log4j.configurationFile", configFileUri); System.setProperty("logging.logDir", logDir); System.setProperty("logging.logLevel", logLevel); LoggerContext context = (LoggerContext) LogManager.getContext(false); context.reconfigure(); } catch (RuntimeException e) { System.err.println("initializing log support failed"); e.printStackTrace(); } log = Logger.getLogger(this.getClass()); }

Target:
private void setupLoggers() { final boolean isDebugMode = Boolean.getBoolean("saros.debug") || isDebugging(); try { final File pluginLogDir = new File(getStateLocation().toFile(), "log"); final Level logLevel = isDebugMode ? Level.ALL : Level.WARN; MainMapLookup.setMainArguments("logDir", pluginLogDir.getPath(), "logLevel", logLevel.name()); Configurator.initialize( null, ConfigurationSource.fromResource(LOG4J2_CONFIG_FILENAME, Saros.class.getClassLoader())); } catch (RuntimeException e) { StatusLogger.getLogger().error("initializing loggers failed", e); e.printStackTrace(); } log = Logger.getLogger(this.getClass()); }
Source:
public void testFilterSinglePattern() throws Exception { StringPattern stringPattern = new RegexStringPattern("very simple email pattern", ".+@.+", true); MockInputColumn<String> column = new MockInputColumn<String>("my col", String.class); StringPatternFilter filter = new StringPatternFilter(column, new StringPattern[] { stringPattern }, MatchFilterCriteria.ANY, configuration); filter.init(); assertEquals(ValidationCategory.VALID, filter.categorize(new MockInputRow().put(column, "kasper@eobjects.org"))); assertEquals(ValidationCategory.INVALID, filter.categorize(new MockInputRow().put(column, "kasper@"))); filter.close(); filter = new StringPatternFilter(column, new StringPattern[] { stringPattern }, MatchFilterCriteria.ALL, configuration); filter.init(); assertEquals(ValidationCategory.VALID, filter.categorize(new MockInputRow().put(column, "kasper@eobjects.org"))); assertEquals(ValidationCategory.INVALID, filter.categorize(new MockInputRow().put(column, "kasper@"))); filter.close(); }

Target:
public void testFilterSinglePattern() throws Exception { final LifeCycleHelper lifeCycleHelper = new LifeCycleHelper(new DataCleanerConfigurationImpl(), null, true); final StringPattern stringPattern = new RegexStringPattern("very simple email pattern", ".+@.+", true); final MockInputColumn<String> column = new MockInputColumn<String>("my col", String.class); StringPatternFilter filter = new StringPatternFilter(column, new StringPattern[] { stringPattern }, MatchFilterCriteria.ANY, configuration); lifeCycleHelper.initialize(descriptor, filter); assertEquals(ValidationCategory.VALID, filter.categorize(new MockInputRow().put(column, "kasper@eobjects.org"))); assertEquals(ValidationCategory.INVALID, filter.categorize(new MockInputRow().put(column, "kasper@"))); lifeCycleHelper.close(descriptor, filter, true); filter = new StringPatternFilter(column, new StringPattern[] { stringPattern }, MatchFilterCriteria.ALL, configuration); filter.init(); assertEquals(ValidationCategory.VALID, filter.categorize(new MockInputRow().put(column, "kasper@eobjects.org"))); assertEquals(ValidationCategory.INVALID, filter.categorize(new MockInputRow().put(column, "kasper@"))); filter.close(); }
Source:
public List<MetricFamilySamples> collect() { return Arrays.asList( buildGauge("jetty_queued_thread_pool_threads", "Number of total threads", QueuedThreadPool::getThreads), buildGauge("jetty_queued_thread_pool_threads_idle", "Number of idle threads", QueuedThreadPool::getIdleThreads), buildGauge("jetty_queued_thread_pool_jobs", "Number of total jobs", QueuedThreadPool::getQueueSize), buildGauge("jetty_queued_thread_pool_max", "Max size of thread pool", QueuedThreadPool::getQueueSize)); }

Target:
public List<MetricFamilySamples> collect() { return Arrays.asList( buildGauge("jetty_queued_thread_pool_threads", "Number of total threads", QueuedThreadPool::getThreads), buildGauge("jetty_queued_thread_pool_threads_idle", "Number of idle threads", QueuedThreadPool::getIdleThreads), buildGauge("jetty_queued_thread_pool_threads_max", "Max size of thread pool", QueuedThreadPool::getMaxThreads), buildGauge("jetty_queued_thread_pool_jobs", "Number of total jobs", QueuedThreadPool::getQueueSize)); }
Source:
public Builder newBuilder() { log.warn("Attempting to copy RemotingOkHttpClient. Some of the functionality like rate limiting and qos will " + "not be available to the new client"); return super.newBuilder(); }

Target:
public Builder newBuilder() { log.warn("Attempting to copy RemotingOkHttpClient. Some of the functionality like rate limiting and qos will " + "not be available to the new client", new SafeRuntimeException("stacktrace")); return super.newBuilder(); }
Source:
public static void main(String[] args) throws IOException, GeneralSecurityException { if (!CONFIG_DIR.exists() && !CONFIG_DIR.mkdirs()) { throw new IOException("Cannot create " + CONFIG_DIR.getAbsolutePath()); } if (args.length > 0 && "init".equals(args[0])) { String password = new Auth(CONFIG_DIR).init(); System.out.println(password); } else { int port = Integer.parseInt(System.getProperty("batmSshTunnelPort", "22222")); new SshServer(CONFIG_DIR, port).start(); while (true) { try { Thread.sleep(10000); } catch (InterruptedException e) { } } } }

Target:
public static void main(String[] args) throws IOException, GeneralSecurityException { if (!CONFIG_DIR.exists() && !CONFIG_DIR.mkdirs()) { throw new IOException("Cannot create " + CONFIG_DIR.getAbsolutePath()); } if (args.length > 0 && "init".equals(args[0])) { String password = new Auth(CONFIG_DIR).init(); System.out.println(password); } else { new SshServer(CONFIG_DIR, PORT).start(); while (true) { try { Thread.sleep(10000); } catch (InterruptedException e) { } } } }
Source:
private PlanNode buildProjectedIndexSource(PlanBuilder p, Predicate<Symbol> projectionFilter) { Symbol orderkey = p.symbol("orderkey", INTEGER); Symbol custkey = p.symbol("custkey", INTEGER); Symbol totalprice = p.symbol("totalprice", DOUBLE); ColumnHandle orderkeyHandle = new TpchColumnHandle(orderkey.getName(), INTEGER); ColumnHandle custkeyHandle = new TpchColumnHandle(custkey.getName(), INTEGER); ColumnHandle totalpriceHandle = new TpchColumnHandle(totalprice.getName(), DOUBLE); return p.project( Assignments.identity( ImmutableList.of(orderkey, custkey, totalprice).stream() .filter(projectionFilter) .collect(toImmutableList())), p.indexSource( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "orders", TINY_SCALE_FACTOR)), ImmutableSet.of(orderkey, custkey), ImmutableList.of(orderkey, custkey, totalprice), ImmutableMap.of( orderkey, orderkeyHandle, custkey, custkeyHandle, totalprice, totalpriceHandle), TupleDomain.fromFixedValues(ImmutableMap.of(totalpriceHandle, asNull(DOUBLE))))); }

Target:
private static PlanNode buildProjectedIndexSource(PlanBuilder p, Predicate<Symbol> projectionFilter) { Symbol orderkey = p.symbol("orderkey", INTEGER); Symbol custkey = p.symbol("custkey", INTEGER); Symbol totalprice = p.symbol("totalprice", DOUBLE); ColumnHandle orderkeyHandle = new TpchColumnHandle(orderkey.getName(), INTEGER); ColumnHandle custkeyHandle = new TpchColumnHandle(custkey.getName(), INTEGER); ColumnHandle totalpriceHandle = new TpchColumnHandle(totalprice.getName(), DOUBLE); return p.project( Assignments.identity( ImmutableList.of(orderkey, custkey, totalprice).stream() .filter(projectionFilter) .collect(toImmutableList())), p.indexSource( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "orders", TINY_SCALE_FACTOR)), ImmutableSet.of(orderkey, custkey), ImmutableList.of(orderkey, custkey, totalprice), ImmutableMap.of( orderkey, orderkeyHandle, custkey, custkeyHandle, totalprice, totalpriceHandle), TupleDomain.fromFixedValues(ImmutableMap.of(totalpriceHandle, asNull(DOUBLE))))); }
Source:
public Optional<RecordCursor> createRecordCursor(Configuration configuration, ConnectorSession session, Path path, long start, long length, long fileSize, Properties schema, List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> effectivePredicate, DateTimeZone hiveStorageTimeZone, TypeManager typeManager) { boolean isOptimizedForS3 = configuration.getBoolean(S3_SELECT_OPTIMIZED, false); if (!isOptimizedForS3) { log.info("S3Select is not used for path: %s", path); return Optional.empty(); } try { this.hdfsEnvironment.getFileSystem(session.getUser(), path, configuration); } catch (IOException e) { throw new PrestoException(HIVE_FILESYSTEM_ERROR, "Failed getting FileSystem: " + path, e); } S3SelectClient selectClient = new PrestoS3SelectClient(configuration, clientConfig); String serdeName = HiveUtil.getDeserializerClassName(schema); if (csvSerdes.contains(serdeName)) { S3SelectLineRecordReader recordReader = new S3SelectCsvRecordReader(selectClient, path, start, length, schema, columns, effectivePredicate, typeManager); return Optional.of(new S3SelectRecordCursor(recordReader, length, schema, columns, hiveStorageTimeZone, typeManager)); } else { return Optional.empty(); } }

Target:
public Optional<RecordCursor> createRecordCursor( Configuration configuration, ConnectorSession session, Path path, long start, long length, long fileSize, Properties schema, List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> effectivePredicate, DateTimeZone hiveStorageTimeZone, TypeManager typeManager) { boolean isS3SelectPushdownEnabled = configuration.getBoolean(S3_SELECT_PUSHDOWN_ENABLED, false); if (!isS3SelectPushdownEnabled) { return Optional.empty(); } try { this.hdfsEnvironment.getFileSystem(session.getUser(), path, configuration); } catch (IOException e) { throw new PrestoException(HIVE_FILESYSTEM_ERROR, "Failed getting filesystem for path: " + path, e); } String serdeName = getDeserializerClassName(schema); if (CSV_SERDES.contains(serdeName)) { IonSqlQueryBuilder queryBuilder = new IonSqlQueryBuilder(typeManager); String ionSqlQuery = buildQuery(queryBuilder, columns, effectivePredicate); S3SelectLineRecordReader recordReader = new S3SelectCsvRecordReader(configuration, clientConfig, path, start, length, schema, ionSqlQuery, s3ClientFactory); return Optional.of(new S3SelectRecordCursor(configuration, path, recordReader, length, schema, columns, hiveStorageTimeZone, typeManager)); } return Optional.empty(); }
Source:
private void destroyTree(RepositoryObject rootOfTree) throws FedoraException { if (rootOfTree instanceof ContentContainerObject) { ContentContainerObject container = (ContentContainerObject) rootOfTree; List<ContentObject> members = container.getMembers(); for (ContentObject member : members) { destroyTree(member); } } else if (rootOfTree instanceof FileObject) { FileObject file = (FileObject) rootOfTree; List<BinaryObject> binaries = file.getBinaryObjects(); for (BinaryObject binary : binaries) { destroyTree(binary); } } Model stoneModel = rootOfTree.getModel(); stoneModel = convertModelToTombstone(rootOfTree); repoObjFactory.createObject(rootOfTree.getUri(), stoneModel); rootOfTree.getPremisLog().buildEvent(Premis.Deletion) .addImplementorAgent(agent.getUsernameUri()) .addEventDetail("Item deleted from repository and replaced by tombstone") .write(); repoObjFactory.createObject(rootOfTree.getUri(), stoneModel); }

Target:
private void destroyTree(RepositoryObject rootOfTree) throws FedoraException, IOException, FcrepoOperationFailedException { if (rootOfTree instanceof ContentContainerObject) { ContentContainerObject container = (ContentContainerObject) rootOfTree; List<ContentObject> members = container.getMembers(); for (ContentObject member : members) { destroyTree(member); } } Resource rootResc = rootOfTree.getResource(); Model rootModel = rootResc.getModel(); if (rootOfTree instanceof FileObject) { FileObject file = (FileObject) rootOfTree; BinaryObject origFile = file.getOriginalFile(); if (origFile != null) { addBinaryMetadataToParent(rootResc, origFile); } } boolean hasLdpContains = rootModel.contains(rootResc, Ldp.contains); if (hasLdpContains) { deleteNonContentObjects(rootModel); } Model stoneModel = convertModelToTombstone(rootOfTree, rootResc); repoObjFactory.createOrTransformObject(rootOfTree.getUri(), stoneModel); rootOfTree.getPremisLog().buildEvent(Premis.Deletion) .addEventDetail("Item deleted from repository and replaced by tombstone") .write(); }
Source:
public DrugOrder map(EncounterTransaction.DrugOrder drugOrder, Encounter encounter) { DrugOrder openMRSDrugOrder = createDrugOrder(drugOrder); openMRSDrugOrder.setCareSetting(getCareSettingFrom(drugOrder, openMRSDrugOrder)); openMRSDrugOrder.setDrug(getDrugFrom(drugOrder, openMRSDrugOrder)); openMRSDrugOrder.setConcept(openMRSDrugOrder.getDrug().getConcept()); openMRSDrugOrder.setEncounter(encounter); openMRSDrugOrder.setOrderType(orderService.getOrderTypeByName(drugOrder.getOrderType())); openMRSDrugOrder.setDateActivated(drugOrder.getDateActivated()); if (drugOrder.getScheduledDate() != null && drugOrder.getScheduledDate().after(new Date())) { openMRSDrugOrder.setScheduledDate(drugOrder.getScheduledDate()); openMRSDrugOrder.setUrgency(Order.Urgency.ON_SCHEDULED_DATE); } openMRSDrugOrder.setDuration(drugOrder.getDuration()); openMRSDrugOrder.setDurationUnits(conceptService.getConceptByName(drugOrder.getDurationUnits())); try { if (drugOrder.getDosingInstructionType() != null) { openMRSDrugOrder.setDosingType((Class<? extends DosingInstructions>) Context.loadClass(drugOrder.getDosingInstructionType())); } } catch (ClassNotFoundException e) { throw new APIException("Class not found for : DosingInstructionType " + drugOrder.getDosingInstructionType(), e); } dosingInstructionsMapper.map(drugOrder.getDosingInstructions(), openMRSDrugOrder); openMRSDrugOrder.setInstructions(drugOrder.getInstructions()); Provider provider = encounter.getEncounterProviders().iterator().next().getProvider(); openMRSDrugOrder.setOrderer(provider); return openMRSDrugOrder; }

Target:
public DrugOrder map(EncounterTransaction.DrugOrder drugOrder, Encounter encounter) { DrugOrder openMRSDrugOrder = createDrugOrder(drugOrder); openMRSDrugOrder.setCareSetting(getCareSettingFrom(drugOrder, openMRSDrugOrder)); Drug drug = getDrugFrom(drugOrder, openMRSDrugOrder); if(drug == null) { throw new APIException("No such drug : " + drugOrder.getDrug().getName()); } openMRSDrugOrder.setDrug(drug); openMRSDrugOrder.setEncounter(encounter); openMRSDrugOrder.setDateActivated(drugOrder.getDateActivated()); if (drugOrder.getScheduledDate() != null && drugOrder.getScheduledDate().after(new Date())) { openMRSDrugOrder.setScheduledDate(drugOrder.getScheduledDate()); openMRSDrugOrder.setUrgency(Order.Urgency.ON_SCHEDULED_DATE); } openMRSDrugOrder.setDuration(drugOrder.getDuration()); openMRSDrugOrder.setDurationUnits(orderMetadataService.getDurationUnitsConceptByName(drugOrder.getDurationUnits())); try { if (drugOrder.getDosingInstructionType() != null) { openMRSDrugOrder.setDosingType((Class<? extends DosingInstructions>) Context.loadClass(drugOrder.getDosingInstructionType())); } } catch (ClassNotFoundException e) { throw new APIException("Class not found for : DosingInstructionType " + drugOrder.getDosingInstructionType(), e); } dosingInstructionsMapper.map(drugOrder.getDosingInstructions(), openMRSDrugOrder); openMRSDrugOrder.setInstructions(drugOrder.getInstructions()); Provider provider = encounter.getEncounterProviders().iterator().next().getProvider(); openMRSDrugOrder.setOrderer(provider); return openMRSDrugOrder; }
Source:
public void onRefreshEvent(RefreshEvent event) { Log.d("YOLO", getClass().getSimpleName() + " is refrehshing!"); startLoadingData(); }

Target:
public void onRefreshEvent(RefreshEvent event) { startLoadingData(); }
Source:
public void testPersistentParamString() throws Exception { org.junit.Assert.assertEquals(DEFAULT_STRING, m_stringParam.value()); String randomString = getRandomString(); m_stringParam.set(randomString); org.junit.Assert.assertEquals(randomString, m_stringParam.value()); org.junit.Assert.assertEquals(randomString, m_stringParam.value(true)); randomString = getRandomString(); m_stringParam.set(randomString); org.junit.Assert.assertEquals(randomString, m_stringParam.value()); org.junit.Assert.assertEquals(randomString, m_stringParam.value(true)); }

Target:
public void testPersistentParamString() throws Exception { assertEquals(DEFAULT_STRING, m_stringParam.value()); String randomString = getRandomString(); m_stringParam.set(randomString); assertEquals(randomString, m_stringParam.value()); assertEquals(randomString, m_stringParam.value(true)); randomString = getRandomString(); m_stringParam.set(randomString); assertEquals(randomString, m_stringParam.value()); assertEquals(randomString, m_stringParam.value(true)); }
Source:
public Form(final FormType type) { this(); setType(type); }

Target:
public Form(final FormType type) { setType(type); }
Source:
public InputStream prefetchStream(URI uri, Map<?, ?> options) throws IOException { InputStream stream = createInputStream(uri, options); if (stream != null) { synchronized(prefetchedStreams) { prefetchedStreams.put(uri, stream); } } return stream; }

Target:
public boolean prefetchStream(URI uri, Map<?, ?> options) throws IOException { InputStream stream = createInputStream(uri, options); if (stream != null) { prefetchedStreams.put(uri, stream); } return stream != null; }
Source:
public static AffinityGroup map(org.ovirt.engine.core.common.scheduling.AffinityGroup entity, AffinityGroup template) { AffinityGroup model = template != null ? template : new AffinityGroup(); model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setDescription(entity.getDescription()); model.setPositive(entity.isVmAffinityEnabled() ? entity.getVmPolarityBooleanObject() : null); model.setEnforcing(entity.isVmEnforcing()); AffinityRule hostsRule = model.getHostsRule(); if (hostsRule == null) { hostsRule = new AffinityRule(); model.setHostsRule(hostsRule); } hostsRule.setEnabled(true); hostsRule.setEnforcing(entity.isVdsEnforcing()); hostsRule.setPositive(entity.isVdsPositive()); AffinityRule vmsRule = model.getVmsRule(); if (vmsRule == null) { vmsRule = new AffinityRule(); model.setVmsRule(vmsRule); } vmsRule.setEnabled(entity.isVmAffinityEnabled()); vmsRule.setEnforcing(entity.isVmEnforcing()); vmsRule.setPositive(entity.isVmPositive()); Cluster cluster = new Cluster(); cluster.setId(entity.getClusterId().toString()); model.setCluster(cluster); return model; }

Target:
public static AffinityGroup map(org.ovirt.engine.core.common.scheduling.AffinityGroup entity, AffinityGroup template) { AffinityGroup model = template != null ? template : new AffinityGroup(); model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setDescription(entity.getDescription()); model.setPositive(entity.isVmAffinityEnabled() ? entity.getVmPolarityBooleanObject() : null); model.setEnforcing(entity.isVmEnforcing()); AffinityRule hostsRule = model.getHostsRule(); if (hostsRule == null) { hostsRule = new AffinityRule(); model.setHostsRule(hostsRule); } hostsRule.setEnabled(true); hostsRule.setEnforcing(entity.isVdsEnforcing()); hostsRule.setPositive(entity.isVdsPositive()); AffinityRule vmsRule = model.getVmsRule(); if (vmsRule == null) { vmsRule = new AffinityRule(); model.setVmsRule(vmsRule); } vmsRule.setEnabled(entity.isVmAffinityEnabled()); vmsRule.setEnforcing(entity.isVmEnforcing()); vmsRule.setPositive(entity.isVmPositive()); Cluster cluster = new Cluster(); cluster.setId(entity.getClusterId().toString()); model.setCluster(cluster); Hosts hosts = model.getHosts(); if (hosts == null) { hosts = new Hosts(); model.setHosts(hosts); } entity.getVdsIds().stream().map(id -> { Host host = new Host(); host.setId(id.toString()); return host; }).forEach(model.getHosts().getHosts()::add); Vms vms = model.getVms(); if (vms == null) { vms = new Vms(); model.setVms(vms); } entity.getVmIds().stream().map(id -> { Vm vm = new Vm(); vm.setId(id.toString()); return vm; }).forEach(model.getVms().getVms()::add); return model; }
Source:
public JavaRDD<StructuredRecord> transform(SparkExecutionPluginContext context, JavaRDD<StructuredRecord> input) throws Exception { JavaSparkContext javaSparkContext = context.getSparkContext(); SQLContext sqlContext = new SQLContext(javaSparkContext); outputSchema = Schema.recordOf("outputSchema", Schema.Field.of(config.outputColumn, Schema.arrayOf(Schema.of(Schema.Type.STRING)))); StructType schema = new StructType(new StructField[]{ new StructField(config.columnToBeTokenized, DataTypes.StringType, false, Metadata.empty())}); JavaRDD<Row> rowRDD = input.map(new Function<StructuredRecord, Row>() { @Override public Row call(StructuredRecord rec) throws Exception { return RowFactory.create(rec.get(config.columnToBeTokenized)); } }); DataFrame sentenceDataFrame = sqlContext.createDataFrame(rowRDD, schema); RegexTokenizer tokenizer = new RegexTokenizer().setInputCol(config.columnToBeTokenized) .setOutputCol(config.outputColumn).setPattern(config.delimiter); DataFrame tokenizedDataFrame = tokenizer.transform(sentenceDataFrame); JavaRDD<Row> tokenizedRDD = javaSparkContext.parallelize(tokenizedDataFrame. select(config.outputColumn).collectAsList()); JavaRDD<StructuredRecord> output = tokenizedRDD.map(new Function<Row, StructuredRecord>() { @Override public StructuredRecord call(Row row) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field f : outputSchema.getFields()) { builder.set(f.getName(), row.getList(0)); } return builder.build(); } }); return output; }

Target:
public JavaRDD<StructuredRecord> transform(SparkExecutionPluginContext context, JavaRDD<StructuredRecord> input) throws Exception { JavaSparkContext javaSparkContext = context.getSparkContext(); SQLContext sqlContext = new SQLContext(javaSparkContext); outputSchema = Schema.recordOf("outputSchema", Schema.Field.of(config.outputColumn, Schema.arrayOf(Schema.of(Schema.Type.STRING)))); StructType schema = new StructType(new StructField[]{ new StructField(config.columnToBeTokenized, DataTypes.StringType, false, Metadata.empty())}); JavaRDD<Row> rowRDD = input.map(new Function<StructuredRecord, Row>() { @Override public Row call(StructuredRecord rec) throws Exception { return RowFactory.create(rec.get(config.columnToBeTokenized)); } }); DataFrame sentenceDataFrame = sqlContext.createDataFrame(rowRDD, schema); RegexTokenizer tokenizer = new RegexTokenizer().setInputCol(config.columnToBeTokenized) .setOutputCol(config.outputColumn).setPattern(config.delimiter); DataFrame tokenizedDataFrame = tokenizer.transform(sentenceDataFrame); JavaRDD<Row> tokenizedRDD = javaSparkContext.parallelize(tokenizedDataFrame. select(config.outputColumn).collectAsList()); JavaRDD<StructuredRecord> output = tokenizedRDD.map(new Function<Row, StructuredRecord>() { @Override public StructuredRecord call(Row row) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field field : outputSchema.getFields()) { builder.set(field.getName(), row.getList(0)); } return builder.build(); } }); return output; }
Source:
public FileBasedConfig getConfig() { if (userConfig.isOutdated()) { try { loadUserConfig(); } catch (IOException e) { throw new RuntimeException(e); } } if (repoConfig.isOutdated()) { try { loadRepoConfig(); } catch (IOException e) { throw new RuntimeException(e); } } return repoConfig; }

Target:
public FileBasedConfig getConfig() { if (systemConfig.isOutdated()) { try { loadSystemConfig(); } catch (IOException e) { throw new RuntimeException(e); } } if (userConfig.isOutdated()) { try { loadUserConfig(); } catch (IOException e) { throw new RuntimeException(e); } } if (repoConfig.isOutdated()) { try { loadRepoConfig(); } catch (IOException e) { throw new RuntimeException(e); } } return repoConfig; }
Source:
public static Map<String, List<String>> removeAuthHeaders(Map<String, List<String>> headers) { try { Map<String, List<String>> requestHeaders = new HashMap<String, List<String>>(headers); if (requestHeaders.get(HttpHeaders.AUTHORIZATION) != null) { requestHeaders.remove(HttpHeaders.AUTHORIZATION); } if (requestHeaders.get("Proxy-Authorization") != null) { requestHeaders.remove("Proxy-Authorization"); } return requestHeaders; } catch (NullPointerException e) { return null; } }

Target:
public static Map<String, List<String>> removeAuthHeaders(Map<String, List<String>> headers) { Map<String, List<String>> requestHeaders = new HashMap<String, List<String>>(headers); if (requestHeaders.get(HttpHeaders.AUTHORIZATION) != null) { requestHeaders.remove(HttpHeaders.AUTHORIZATION); } if (requestHeaders.get("Proxy-Authorization") != null) { requestHeaders.remove("Proxy-Authorization"); } return requestHeaders; }
Source:
public void testCompareRanges() { assertTrue(compareRanges("abcdefghij".getBytes(), 0, 10, "abcdefghij".getBytes(), 0, 10) == 0); assertTrue(compareRanges("123abcdefghij".getBytes(), 3, 10, "abcdefghij".getBytes(), 0, 10) == 0); }

Target:
public void testCompareRanges() { assertEquals(compareRanges("abcdefghij".getBytes(), 0, 10, "abcdefghij".getBytes(), 0, 10), 0); assertEquals(compareRanges("123abcdefghij".getBytes(), 3, 10, "abcdefghij".getBytes(), 0, 10), 0); }
Source:
protected IModel<List<Person>> createModel() { return CollectionCopyModel.custom(Suppliers2.<Person>arrayListAsList(), GenericEntityModel.<Person>factory()); }

Target:
protected IModel<List<Person>> createModel() { return GenericEntityArrayListModel.of(Person.class); }
Source:
public void shouldMarkHostDeadSinceServerIsDown() throws Exception { final Cluster cluster = TestClientFactory.open(); try { assertEquals(0, cluster.availableHosts().size()); final Client client1 = cluster.connect().init(); assertEquals(1, cluster.availableHosts().size()); stopServer(); cluster.connect().init(); try { client1.submit("1+1").all().join(); } catch (Exception ex) { } assertEquals(0, cluster.availableHosts().size()); } finally { cluster.close(); } }

Target:
public void shouldMarkHostDeadSinceServerIsDown() throws Exception { final Cluster cluster = TestClientFactory.open(); try { assertEquals(0, cluster.availableHosts().size()); final Client client1 = cluster.connect().init(); assertEquals(1, cluster.availableHosts().size()); stopServer(); cluster.connect().init(); try { client1.submit("1+1").all().join(); fail("Expecting an exception because the server is shut down."); } catch (Exception ex) { } assertEquals(0, cluster.availableHosts().size()); } finally { cluster.close(); } }
Source:
public Response updateCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId, @QueryParam("command") String commandStr, @QueryParam("type") String type) { HelixZkClient zkClient = getHelixZkClient(); if (!ZKUtil.isClusterSetup(clusterId, zkClient)) { return notFound(); } Command command; if (commandStr == null || commandStr.isEmpty()) { command = Command.update; } else { try { command = getCommand(commandStr); } catch (HelixException ex) { return badRequest(ex.getMessage()); } } HelixAdmin admin = getHelixAdmin(); try { switch (command) { case delete: { admin.removeTypeFromCustomizedStateAggregationConfig(clusterId, type); } break; case update: { admin.addTypeToCustomizedStateAggregationConfig(clusterId, type); } break; default: return badRequest("Unsupported command " + commandStr); } } catch (Exception ex) { _logger.error("Failed to " + command + " CustomizedStateAggregationConfig for cluster " + clusterId + " new type: " + type + ", Exception: " + ex); return serverError(ex); } return OK(); }

Target:
public Response updateCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId, @QueryParam("command") String commandStr, @QueryParam("type") String type) { if (!doesClusterExist(clusterId)) { return notFound(String.format("Cluster %s does not exist", clusterId)); } Command command; if (commandStr == null || commandStr.isEmpty()) { command = Command.add; } else { try { command = getCommand(commandStr); } catch (HelixException ex) { return badRequest(ex.getMessage()); } } HelixAdmin admin = getHelixAdmin(); try { switch (command) { case delete: admin.removeTypeFromCustomizedStateAggregationConfig(clusterId, type); break; case add: admin.addTypeToCustomizedStateAggregationConfig(clusterId, type); break; default: return badRequest("Unsupported command " + commandStr); } } catch (Exception ex) { _logger.error("Failed to CustomizedStateAggregationConfig for cluster new type: {}, Exception: {}", command, clusterId, type, ex); return serverError(ex); } return OK(); }
Source:
public void testBAMThroughCRAMRoundTrip() throws IOException, NoSuchAlgorithmException { final File TEST_DATA_DIR = new File("src/test/resources/htsjdk/samtools/cram"); final File originalBAMInputFile = new File(TEST_DATA_DIR, "CEUTrio.HiSeq.WGS.b37.NA12878.20.first.8000.bam"); final File referenceFile = new File(TEST_DATA_DIR, "human_g1k_v37.20.subset.fasta"); List<SAMRecord> originalBAMRecords = getSAMRecordsFromFile(originalBAMInputFile, referenceFile); for (int i = 0; i < originalBAMRecords.size(); i++) { originalBAMRecords.get(i).setIndexingBin(null); } final File tempCRAMFile = File.createTempFile("testBAMThroughCRAMRoundTrip", CramIO.CRAM_FILE_EXTENSION); tempCRAMFile.deleteOnExit(); SAMFileHeader samHeader = getFileHeader(originalBAMInputFile, referenceFile); writeRecordsToFile(originalBAMRecords, tempCRAMFile, referenceFile, samHeader); List<SAMRecord> cramRecords = getSAMRecordsFromFile(tempCRAMFile, referenceFile); Assert.assertEquals(cramRecords.size(), originalBAMRecords.size()); for (int i = 0; i < originalBAMRecords.size(); i++) { Assert.assertEquals(originalBAMRecords.get(i), cramRecords.get(i)); } final File roundTrippedBAMFile = File.createTempFile("testBAMThroughCRAMRoundTrip", BamFileIoUtils.BAM_FILE_EXTENSION); roundTrippedBAMFile.deleteOnExit(); writeRecordsToFile(cramRecords, roundTrippedBAMFile, referenceFile, samHeader); Assert.assertTrue(compareMD5Digests(roundTrippedBAMFile, originalBAMInputFile)); }

Target:
public void testBAMThroughCRAMRoundTrip() throws IOException, NoSuchAlgorithmException { final File TEST_DATA_DIR = new File("src/test/resources/htsjdk/samtools/cram"); final File originalBAMInputFile = new File(TEST_DATA_DIR, "CEUTrio.HiSeq.WGS.b37.NA12878.20.first.8000.bam"); final File referenceFile = new File(TEST_DATA_DIR, "human_g1k_v37.20.subset.fasta"); List<SAMRecord> originalBAMRecords = getSAMRecordsFromFile(originalBAMInputFile, referenceFile); for (int i = 0; i < originalBAMRecords.size(); i++) { originalBAMRecords.get(i).setIndexingBin(null); } final File tempCRAMFile = File.createTempFile("testBAMThroughCRAMRoundTrip", CramIO.CRAM_FILE_EXTENSION); tempCRAMFile.deleteOnExit(); SAMFileHeader samHeader = getFileHeader(originalBAMInputFile, referenceFile); writeRecordsToFile(originalBAMRecords, tempCRAMFile, referenceFile, samHeader); List<SAMRecord> cramRecords = getSAMRecordsFromFile(tempCRAMFile, referenceFile); Assert.assertEquals(cramRecords.size(), originalBAMRecords.size()); for (int i = 0; i < originalBAMRecords.size(); i++) { Assert.assertEquals(originalBAMRecords.get(i), cramRecords.get(i)); } }
Source:
public void onNext(T t) { if (done) { return; } boolean callOnOverflow = false; Deque<T> dq = deque; synchronized (dq) { if (dq.size() == bufferSize) { switch (strategy) { case DROP_LATEST: dq.pollLast(); dq.offer(t); callOnOverflow = true; break; case DROP_OLDEST: dq.poll(); dq.offer(t); callOnOverflow = true; break; default: break; } } else { dq.offer(t); drain(); return; } } if (callOnOverflow) { if (onOverflow != null) { try { onOverflow.run(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); s.cancel(); onError(ex); } } } else { s.cancel(); onError(new MissingBackpressureException()); } }

Target:
public void onNext(T t) { if (done) { return; } boolean callOnOverflow = false; boolean callError = false; Deque<T> dq = deque; synchronized (dq) { if (dq.size() == bufferSize) { switch (strategy) { case DROP_LATEST: dq.pollLast(); dq.offer(t); callOnOverflow = true; break; case DROP_OLDEST: dq.poll(); dq.offer(t); callOnOverflow = true; break; default: callError = true; break; } } else { dq.offer(t); } } if (callOnOverflow) { if (onOverflow != null) { try { onOverflow.run(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); s.cancel(); onError(ex); } } } else if(callError) { s.cancel(); onError(new MissingBackpressureException()); } else { drain(); } }
Source:
public Fixture compareStoredQueriesHideMatchingRows(String symbol1, String symbol2) { return new dbfit.fixture.CompareStoredQueries(environment,symbol1, symbol2, true); }

Target:
public Fixture compareStoredQueriesHideMatchingRows(String symbol1, String symbol2) { return new dbfit.fixture.CompareStoredQueriesHideMatchingRows(environment, symbol1, symbol2); }
Source:
private void registerFileType( FileTypeRegistry fileTypeRegistry, MavenResources mavenResources, EditorRegistry editorRegistry) { FileType pomFile = new FileType(mavenResources.maven(), null, ".*pom\\.xml"); fileTypeRegistry.registerFileType(pomFile); }

Target:
private void registerFileType( FileTypeRegistry fileTypeRegistry, MavenResources mavenResources, EditorRegistry editorRegistry) { FileType pomFile = new FileType(mavenResources.maven(), null, ".*[/\\\\]?pom\\.xml$"); fileTypeRegistry.registerFileType(pomFile); }
Source:
private void writeSignatureBlock(CMSTypedData data, X509Certificate publicKey, PrivateKey privateKey) throws IOException, CertificateEncodingException, OperatorCreationException, CMSException { ArrayList<X509Certificate> certList = new ArrayList<X509Certificate>(); certList.add(publicKey); JcaCertStore certs = new JcaCertStore(certList); CMSSignedDataGenerator gen = new CMSSignedDataGenerator(); ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").build(privateKey); gen.addSignerInfoGenerator( new JcaSignerInfoGeneratorBuilder( new JcaDigestCalculatorProviderBuilder() .build()) .setDirectSignature(true) .build(sha1Signer, publicKey)); gen.addCertificates(certs); CMSSignedData sigData = gen.generate(data, false); ASN1InputStream asn1 = new ASN1InputStream(sigData.getEncoded()); DEROutputStream dos = new DEROutputStream(mOutputJar); dos.writeObject(asn1.readObject()); }

Target:
private void writeSignatureBlock(CMSTypedData data, X509Certificate publicKey, PrivateKey privateKey) throws IOException, CertificateEncodingException, OperatorCreationException, CMSException { ArrayList<X509Certificate> certList = new ArrayList<X509Certificate>(); certList.add(publicKey); JcaCertStore certs = new JcaCertStore(certList); CMSSignedDataGenerator gen = new CMSSignedDataGenerator(); ContentSigner sha1Signer = new JcaContentSignerBuilder( "SHA1with" + privateKey.getAlgorithm()) .build(privateKey); gen.addSignerInfoGenerator( new JcaSignerInfoGeneratorBuilder( new JcaDigestCalculatorProviderBuilder() .build()) .setDirectSignature(true) .build(sha1Signer, publicKey)); gen.addCertificates(certs); CMSSignedData sigData = gen.generate(data, false); ASN1InputStream asn1 = new ASN1InputStream(sigData.getEncoded()); DEROutputStream dos = new DEROutputStream(mOutputJar); dos.writeObject(asn1.readObject()); }
Source:
public ClassOrInterfaceType(final int beginLine, final int beginColumn, final int endLine, final int endColumn, final ClassOrInterfaceType scope, final String name, final List<Type> typeArgs) { this(beginLine, beginColumn, endLine, endColumn, scope, name, typeArgs, false); }

Target:
public ClassOrInterfaceType(final int beginLine, final int beginColumn, final int endLine, final int endColumn, final ClassOrInterfaceType scope, final String name, final List<Type> typeArgs) { this(beginLine, beginColumn, endLine, endColumn, scope, name, TypeArguments.withArguments(typeArgs)); }
Source:
public MaxwellParser(Schema currentSchema) throws Exception { this.schema = currentSchema; TimeZone.setDefault(TimeZone.getTimeZone("UTC")); this.binlogEventListener = new MaxwellBinlogEventListener(queue); this.replicator = new OpenReplicator(); this.replicator.setHost("127.0.0.1"); this.replicator.setUser("maxwell"); this.replicator.setPassword("maxwell"); this.replicator.setBinlogEventListener(this.binlogEventListener); }

Target:
public MaxwellParser(Schema currentSchema) throws Exception { this.schema = currentSchema; TimeZone.setDefault(TimeZone.getTimeZone("UTC")); this.binlogEventListener = new MaxwellBinlogEventListener(queue); this.replicator = new OpenReplicator(); this.replicator.setBinlogEventListener(this.binlogEventListener); }
Source:
public Set<String> getEditRoles() { Set<String> roleSet = new HashSet<>(); roleSet.add(edit); return edit != null ? Collections.unmodifiableSet(roleSet) : Collections.emptySet(); }

Target:
public Set<String> getEditRoles() { Set<String> roleSet = new HashSet<>(); if (edit != null) { roleSet.add(edit); } return Collections.unmodifiableSet(roleSet); }
Source:
public ResourcePath getPath() { if (m_location == null || "Default".equals(m_location)) { return ResourcePath.get(m_ipAddress); } else { return ResourcePath.get(ResourcePath.sanitize(m_location), m_ipAddress); } }

Target:
public ResourcePath getPath() { if (LocationUtils.isDefaultLocationName(m_location)) { return ResourcePath.get(m_ipAddress); } else { return ResourcePath.get(ResourcePath.sanitize(m_location), m_ipAddress); } }
Source:
public String getComment() { return null; }

Target:
public String getComment() { log.warn("Can't get comment. SessionInfoService is not supported in {}", jaggerPlace); return null; }