auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int execute(DriverContext driverContext) { if (Utilities.FILE_OP_LOGGER.isTraceEnabled()) { Utilities.FILE_OP_LOGGER.trace("Executing ReplTxnTask for " + work.getTxnIds()); } try { if (work.getOperationType() == ReplTxnWork.OperationType.REPL_OPEN_TXN) { List<Long> txnIdsItr = driverContext.getCtx().getHiveTxnManager() .replOpenTxn(work.getReplPolicy(), work.getTxnIds(), work.getNumTxns()); for (int i = 0; i < txnIdsItr.size(); i++) { LOG.info( "Replayed OpenTxn Event for policy " + work.getReplPolicy() + " with srcTxn " + work .getTxnId(i) + " and target txn id " + txnIdsItr.get(i)); } } else if (work.getOperationType() == ReplTxnWork.OperationType.REPL_COMMI_TXN) { driverContext.getCtx().getHiveTxnManager().replCommitTxn(work.getReplPolicy(), work.getTxnId(0)); LOG.info("Replayed CommitTxn Event for policy " + work.getReplPolicy() + " with srcTxn " + work.getTxnId(0) + " and target txn id " + work.getTxnId(0)); } else if (work.getOperationType() == ReplTxnWork.OperationType.REPL_ABORT_TXN) { driverContext.getCtx().getHiveTxnManager().replRollbackTxn(work.getReplPolicy(), work.getTxnId(0)); LOG.info("Replayed AbortTxn Event for policy " + work.getReplPolicy() + " with srcTxn " + work.getTxnId(0)); } return 0; } catch (Exception e) { console.printError("Failed with exception " + e.getMessage(), "\n" + StringUtils.stringifyException(e)); setException(e); return 1; } }

Target:
public int execute(DriverContext driverContext) { String replPolicy = work.getReplPolicy(); if (Utilities.FILE_OP_LOGGER.isTraceEnabled()) { Utilities.FILE_OP_LOGGER.trace("Executing ReplTxnTask " + work.getOperationType().toString() + " for txn ids : " + work.getTxnIds().toString() + " replPolicy : " + replPolicy); } try { HiveTxnManager txnManager = driverContext.getCtx().getHiveTxnManager(); String user = UserGroupInformation.getCurrentUser().getUserName(); LOG.debug("Replaying " + work.getOperationType().toString() + " Event for policy " + replPolicy + " with srcTxn " + work.getTxnIds().toString()); switch(work.getOperationType()) { case REPL_OPEN_TXN: List<Long> txnIds = txnManager.replOpenTxn(replPolicy, work.getTxnIds(), user); assert txnIds.size() == work.getTxnIds().size(); LOG.info("Replayed OpenTxn Event for policy " + replPolicy + " with srcTxn " + work.getTxnIds().toString() + " and target txn id " + txnIds.toString()); return 0; case REPL_ABORT_TXN: for (long txnId : work.getTxnIds()) { txnManager.replRollbackTxn(replPolicy, txnId); LOG.info("Replayed AbortTxn Event for policy " + replPolicy + " with srcTxn " + txnId); } return 0; case REPL_COMMIT_TXN: for (long txnId : work.getTxnIds()) { txnManager.replCommitTxn(replPolicy, txnId); LOG.info("Replayed CommitTxn Event for policy " + replPolicy + " with srcTxn " + txnId); } return 0; default: LOG.error("Operation Type " + work.getOperationType() + " is not supported "); return 1; } } catch (Exception e) { console.printError("Failed with exception " + e.getMessage(), "\n" + StringUtils.stringifyException(e)); setException(e); return 1; } }
Source:
public void exceptional_SV_should_contain_exception_type_in_toString() { SymbolicValue.ExceptionalSymbolicValue unknownException = new SymbolicValue.ExceptionalSymbolicValue(null); assertThat(unknownException.toString()).contains(String.valueOf(unknownException.hashCode() % 100)); assertThat(unknownException.toString()).contains("!unknownException!"); JavaSymbol.PackageJavaSymbol packageSymbol = new JavaSymbol.PackageJavaSymbol("org.foo.bar", null); JavaSymbol.TypeJavaSymbol exceptionSymbol = new JavaSymbol.TypeJavaSymbol(Flags.PUBLIC, "MyException", packageSymbol); Type exceptionType = new ClassJavaType(exceptionSymbol); SymbolicValue.ExceptionalSymbolicValue knownException = new SymbolicValue.ExceptionalSymbolicValue(exceptionType); assertThat(knownException.toString()).contains(String.valueOf(knownException.hashCode() % 100)); assertThat(knownException.toString()).contains("org.foo.bar.MyException!"); }

Target:
public void exceptional_SV_should_contain_exception_type_in_toString() { SymbolicValue.ExceptionalSymbolicValue unknownException = new SymbolicValue.ExceptionalSymbolicValue(null); assertThat(unknownException.toString()).contains("!unknownException!"); JavaSymbol.PackageJavaSymbol packageSymbol = new JavaSymbol.PackageJavaSymbol("org.foo.bar", null); JavaSymbol.TypeJavaSymbol exceptionSymbol = new JavaSymbol.TypeJavaSymbol(Flags.PUBLIC, "MyException", packageSymbol); Type exceptionType = new ClassJavaType(exceptionSymbol); SymbolicValue.ExceptionalSymbolicValue knownException = new SymbolicValue.ExceptionalSymbolicValue(exceptionType); assertThat(knownException.toString()).contains("org.foo.bar.MyException!"); }
Source:
public Connection getConnectionInternal() { int MAX_RETRIES = 7; for (int retryCount = 0; retryCount < MAX_RETRIES; ++retryCount) { try { if (conn == null) { Class.forName(driverClass); conn = DriverManager.getConnection(connectionString, username.orNull(), password.orNull()); } else if (isExpired() || conn.isClosed()) { resetConnection(); } updateExpiration(); return conn; } catch (Exception e) { if (retryCount == MAX_RETRIES - 1) { throw new RuntimeException(e); } try { Thread.sleep(Math.round(Math.pow(2, retryCount)) * 1000); } catch (Exception ignored) { } } } return null; }

Target:
public Connection getConnectionInternal() { for (int retryCount = 0; retryCount < GET_CONNECTION_MAX_RETRIES; ++retryCount) { try { if (conn == null) { Class.forName(driverClass); conn = DriverManager.getConnection(connectionString, username.orNull(), password.orNull()); } else if (isExpired() || conn.isClosed()) { resetConnection(); } updateExpiration(); return conn; } catch (Exception e) { if (retryCount == GET_CONNECTION_MAX_RETRIES - 1) { throw new RuntimeException(String.format("Could not establish connection after %d attempts", GET_CONNECTION_MAX_RETRIES), e); } try { Thread.sleep(Math.round(Math.pow(2, retryCount)) * 1000); } catch (Exception ignored) { } } } throw new RuntimeException(String.format("Could not establish connection after %d attempts", GET_CONNECTION_MAX_RETRIES)); }
Source:
public boolean select(Viewer viewer, Object parentElement, Object element) { DRepresentationDescriptor repDesc = null; if (element instanceof DRepresentationDescriptor) { repDesc = (DRepresentationDescriptor) element; } else if (element instanceof RepresentationItemImpl) { repDesc = ((RepresentationItemImpl) element).getDRepresentationDescriptor(); } if (repDesc != null) { return !new DRepresentationQuery(repDesc.getRepresentation()).isDanglingRepresentation(); } return true; }

Target:
public boolean select(Viewer viewer, Object parentElement, Object element) { DRepresentation representation = null; if (element instanceof DRepresentation) { representation = (DRepresentation) element; } else if (element instanceof DRepresentationDescriptor) { representation = ((DRepresentationDescriptor) element).getRepresentation(); } else if (element instanceof RepresentationItemImpl) { DRepresentationDescriptor repDesc = ((RepresentationItemImpl) element).getDRepresentationDescriptor(); if (repDesc != null) { representation = repDesc.getRepresentation(); } } if (representation != null) { return !new DRepresentationQuery(representation).isDanglingRepresentation(); } return true; }
Source:
Collection<Session> getSessionsByIp(final InetAddress ip) { return listeningSessions.containsKey(ip) ? listeningSessions.get(ip).values() : Set.of(); }

Target:
Collection<Session> getSessionsByIp(final InetAddress ip) { return listeningSessions.getOrDefault(ip, Map.of()).values(); }
Source:
default void onMessageBatch(List<Message> messages) { throw new UnsupportedOperationException( "The container has been configured with 'consumerBatchEnabled' but the listener is not " + "a 'BatchMessageListener"); }

Target:
default void onMessageBatch(List<Message> messages) { throw new UnsupportedOperationException("This listener does not support message batches"); }
Source:
private void interrogateClassLoader(ClassLoader cl, Application application, List<LogDestination> appenders) { String applicationName = (application != null ? "application \"" + application.getName() + "\"" : "server"); try { Jdk14ManagerAccessor jdk14accessor = new Jdk14ManagerAccessor(cl); jdk14accessor.setApplication(application); appenders.addAll(jdk14accessor.getHandlers()); } catch (ThreadDeath t) { throw (ThreadDeath) t; } catch (Throwable t) { logger.debug("Could not resolve JDK loggers for " + applicationName, t); } try { Log4JManagerAccessor log4JAccessor = new Log4JManagerAccessor(cl); log4JAccessor.setApplication(application); appenders.addAll(log4JAccessor.getAppenders()); } catch (ThreadDeath t) { throw (ThreadDeath) t; } catch (Throwable t) { logger.debug("Could not resolve log4j loggers for " + applicationName, t); } try { LogbackFactoryAccessor logbackAccessor = new LogbackFactoryAccessor(cl); logbackAccessor.setApplication(application); appenders.addAll(logbackAccessor.getAppenders()); } catch (ThreadDeath t) { throw (ThreadDeath) t; } catch (Throwable t) { logger.debug("Could not resolve logback loggers for " + applicationName, t); } try { TomcatSlf4jLogbackFactoryAccessor tomcatSlf4jLogbackAccessor = new TomcatSlf4jLogbackFactoryAccessor(cl); tomcatSlf4jLogbackAccessor.setApplication(application); appenders.addAll(tomcatSlf4jLogbackAccessor.getAppenders()); } catch (ThreadDeath t) { throw (ThreadDeath) t; } catch (Throwable t) { logger.debug("Could not resolve tomcat-slf4j-logback loggers for " + applicationName, t); } }

Target:
private void interrogateClassLoader(ClassLoader cl, Application application, List<LogDestination> appenders) { String applicationName = (application != null ? "application \"" + application.getName() + "\"" : "server"); try { Jdk14ManagerAccessor jdk14accessor = new Jdk14ManagerAccessor(cl); jdk14accessor.setApplication(application); appenders.addAll(jdk14accessor.getHandlers()); } catch (ThreadDeath t) { throw t; } catch (Throwable t) { logger.debug("Could not resolve JDK loggers for " + applicationName, t); } try { Log4JManagerAccessor log4JAccessor = new Log4JManagerAccessor(cl); log4JAccessor.setApplication(application); appenders.addAll(log4JAccessor.getAppenders()); } catch (ThreadDeath t) { throw t; } catch (Throwable t) { logger.debug("Could not resolve log4j loggers for " + applicationName, t); } try { LogbackFactoryAccessor logbackAccessor = new LogbackFactoryAccessor(cl); logbackAccessor.setApplication(application); appenders.addAll(logbackAccessor.getAppenders()); } catch (ThreadDeath t) { throw t; } catch (Throwable t) { logger.debug("Could not resolve logback loggers for " + applicationName, t); } try { TomcatSlf4jLogbackFactoryAccessor tomcatSlf4jLogbackAccessor = new TomcatSlf4jLogbackFactoryAccessor(cl); tomcatSlf4jLogbackAccessor.setApplication(application); appenders.addAll(tomcatSlf4jLogbackAccessor.getAppenders()); } catch (ThreadDeath t) { throw t; } catch (Throwable t) { logger.debug("Could not resolve tomcat-slf4j-logback loggers for " + applicationName, t); } }
Source:
public void whenReadEventsConsumerIsBlocked() throws Exception { final FloodService.Flooder flooder = new FloodService.Flooder(EVENT_TYPE_NAME, FloodService.Type.CONSUMER_ET); new Thread(() -> { try { Thread.sleep(3000); NakadiControllerAT.blockFlooder(flooder); } catch (final Exception e) { e.printStackTrace(); } }).start(); given() .header(new Header("X-nakadi-cursors", xNakadiCursors)) .param("batch_limit", "1") .param("stream_timeout", "60") .param("batch_flush_timeout", "10") .when() .get(STREAM_ENDPOINT); NakadiControllerAT.unblockFlooder(flooder); }

Target:
public void whenReadEventsConsumerIsBlocked() throws Exception { final FloodService.Flooder flooder = new FloodService.Flooder(EVENT_TYPE_NAME, FloodService.Type.CONSUMER_ET); new Thread(() -> { try { Thread.sleep(3000); SettingsControllerAT.blockFlooder(flooder); } catch (final Exception e) { e.printStackTrace(); } }).start(); given() .header(new Header("X-nakadi-cursors", xNakadiCursors)) .param("batch_limit", "1") .param("stream_timeout", "60") .param("batch_flush_timeout", "10") .when() .get(STREAM_ENDPOINT); SettingsControllerAT.unblockFlooder(flooder); }
Source:
private static List<Type> toTypes(List<Type> groupByTypes, List<Aggregator> aggregates) { ImmutableList.Builder<Type> builder = ImmutableList.builder(); builder.addAll(groupByTypes); aggregates.stream().forEach(aggregator -> builder.add(aggregator.getType())); return builder.build(); }

Target:
private static List<Type> toTypes(List<Type> groupByTypes, List<Aggregator> aggregates) { ImmutableList.Builder<Type> builder = ImmutableList.builder(); builder.addAll(groupByTypes); aggregates.stream() .map(Aggregator::getType) .forEach(builder::add); return builder.build(); }
Source:
private String formatHour(int hour) { int hourToDisplay = hour; if(timeSetting == WearableConfigurationUtil.TIME_12_HOUR) { hourToDisplay = (hour % WearableConfigurationUtil.TIME_12_HOUR) == 0 ? WearableConfigurationUtil.TIME_12_HOUR : hour%WearableConfigurationUtil.TIME_12_HOUR; } return String.format(Locale.getDefault(), "%02d", hourToDisplay); }

Target:
private String formatHour(int hour) { int hourToDisplay = hour; if(mTimeSetting == WearableConfigurationUtil.TIME_12_HOUR) { hourToDisplay = (hour % WearableConfigurationUtil.TIME_12_HOUR) == 0 ? WearableConfigurationUtil.TIME_12_HOUR : hour % WearableConfigurationUtil.TIME_12_HOUR; } return String.format(Locale.getDefault(), "%02d", hourToDisplay); }
Source:
private void endSuccessfullySynchronous() { if (reloadVmTemplateFromDB() != null) { endDefaultOperations(); } sealVmTemplate(); setSucceeded(true); }

Target:
private void endSuccessfullySynchronous() { if (reloadVmTemplateFromDB() != null) { endDefaultOperations(); } setSucceeded(true); }
Source:
public <T> T readUnmarshallByteArray(Transport transport, short status) { byte[] bytes = transport.readArray(); Marshaller marshaller = transport.getTransportFactory().getMarshaller(); return MarshallerUtil.bytes2obj(marshaller, bytes, status); }

Target:
public <T> T readUnmarshallByteArray(Transport transport, short status) { return CodecUtils.readUnmarshallByteArray(transport, status); }
Source:
public boolean isUpToDate(NdResourceFile file) throws CoreException { if (file != null && file.isDoneIndexing()) { String location = file.getLocation().getString(); FileStateCache cache = FileStateCache.getCache(getNd()); Boolean cachedResult = cache.get(location); if (cachedResult != null) { return cachedResult; } Path locationPath = new Path(location); boolean result = file.getFingerprint().test(locationPath, null).matches(); cache.put(location, result); return result; } return false; }

Target:
public boolean isUpToDate(NdResourceFile file) throws CoreException { if (file != null && file.isDoneIndexing()) { String location = file.getLocation().getString(); FileStateCache cache = FileStateCache.getCache(getNd()); Boolean cachedResult = cache.isUpToDate(location); if (cachedResult != null) { return cachedResult; } Path locationPath = new Path(location); boolean result = file.getFingerprint().test(locationPath, null).matches(); cache.put(location, result); return result; } return false; }
Source:
private ExchangeInfoDAOFileImpl() { super(); String fileName = getExchangeFileLocation(); LOG.debug("Reading exchangeInfo from file: " + fileName); if (fileName != null) { file = new File(fileName); } }

Target:
private ExchangeInfoDAOFileImpl() { super(); String fileName = getExchangeFileLocation(); LOG.debug("Reading exchangeInfo from file: {}", fileName); if (fileName != null) { file = new File(fileName); } }
Source:
public void commit() { try { orcWriter.close(); } catch (IOException | UncheckedIOException e) { try { rollbackAction.call(); } catch (Exception ignored) { } throw new PrestoException(HIVE_WRITER_CLOSE_ERROR, "Error committing write to Hive", e); } if (validationInputFactory.isPresent()) { try { try (OrcDataSource input = validationInputFactory.get().get()) { long startThreadCpuTime = THREAD_MX_BEAN.getCurrentThreadCpuTime(); orcWriter.validate(input); validationCpuNanos.getAndAdd(THREAD_MX_BEAN.getCurrentThreadCpuTime() - startThreadCpuTime); } } catch (IOException | UncheckedIOException e) { throw new PrestoException(HIVE_WRITE_VALIDATION_FAILED, e); } } }

Target:
public void commit() { try { orcWriter.close(); } catch (IOException | UncheckedIOException e) { try { rollbackAction.call(); } catch (Exception ignored) { } throw new PrestoException(HIVE_WRITER_CLOSE_ERROR, "Error committing write to Hive", e); } if (validationInputFactory.isPresent()) { try { try (OrcDataSource input = validationInputFactory.get().get()) { long startThreadCpuTime = THREAD_MX_BEAN.getCurrentThreadCpuTime(); orcWriter.validate(input); validationCpuNanos += THREAD_MX_BEAN.getCurrentThreadCpuTime() - startThreadCpuTime; } } catch (IOException | UncheckedIOException e) { throw new PrestoException(HIVE_WRITE_VALIDATION_FAILED, e); } } }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse rsp = (HttpServletResponse) response; ReceivePack rp; try { rp = receivePackFactory.create(req, getRepository(req)); if (postReceiveHook != null) rp.setPostReceiveHook(PostReceiveHookChain.newChain( postReceiveHook, rp.getPostReceiveHook())); } catch (ServiceNotAuthorizedException e) { rsp.sendError(SC_UNAUTHORIZED); return; } catch (ServiceNotEnabledException e) { sendError(req, rsp, SC_FORBIDDEN); return; } try { req.setAttribute(ATTRIBUTE_HANDLER, rp); chain.doFilter(req, rsp); } finally { req.removeAttribute(ATTRIBUTE_HANDLER); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse rsp = (HttpServletResponse) response; ReceivePack rp; try { rp = receivePackFactory.create(req, getRepository(req)); rp.setPostReceiveHook(PostReceiveHookChain.newChain( postReceiveHook, rp.getPostReceiveHook())); } catch (ServiceNotAuthorizedException e) { rsp.sendError(SC_UNAUTHORIZED); return; } catch (ServiceNotEnabledException e) { sendError(req, rsp, SC_FORBIDDEN); return; } try { req.setAttribute(ATTRIBUTE_HANDLER, rp); chain.doFilter(req, rsp); } finally { req.removeAttribute(ATTRIBUTE_HANDLER); } }
Source:
public boolean matches(NameKey name) { if (projectPatterns.isEmpty()) { return true; } else { String projectName = name.get(); for (String pattern : projectPatterns) { if (isRE(pattern)) { if (projectName.matches(pattern)) { return true; } } else if (isWildcard(pattern)) { if (projectName.startsWith(pattern.substring(0, pattern.length() - 1))) { return true; } } else { if (projectName.equals(pattern)) { return true; } } } return false; } }

Target:
public boolean matches(NameKey name) { boolean isMatch; if (projectPatterns.isEmpty()) { isMatch = true; } else { isMatch = false; String projectName = name.get(); for (String pattern : projectPatterns) { isMatch = matchesPattern(projectName, pattern); if (isMatch) { break; } } } return isMatch; }
Source:
private String generateOvfStoreDescription(Date updateDate, boolean isUpdated, Long size) { Map<String, Object> description = new HashMap<>(); description.put(OvfInfoFileConstants.IsUpdated, isUpdated); description.put(OvfInfoFileConstants.DiskDescription, OvfInfoFileConstants.OvfStoreDescriptionLabel); description.put(OvfInfoFileConstants.LastUpdated, updateDate.toString()); description.put(OvfInfoFileConstants.Domains, Arrays.asList(getParameters().getStorageDomainId())); if (size != null) { description.put(OvfInfoFileConstants.Size, size); } return buildJson(description); }

Target:
private String generateOvfStoreDescription(Date updateDate, boolean isUpdated, Long size) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(OvfInfoFileConstants.IsUpdated); stringBuilder.append(":"); stringBuilder.append(isUpdated); stringBuilder.append(","); stringBuilder.append(OvfInfoFileConstants.DiskDescription); stringBuilder.append(":"); stringBuilder.append(OvfInfoFileConstants.OvfStoreDescriptionLabel); stringBuilder.append(","); stringBuilder.append(OvfInfoFileConstants.LastUpdated); stringBuilder.append(":"); stringBuilder.append(updateDate); stringBuilder.append(","); stringBuilder.append(OvfInfoFileConstants.Domains); stringBuilder.append(":"); stringBuilder.append(Arrays.asList(getParameters().getStorageDomainId())); if (size != null) { stringBuilder.append(","); stringBuilder.append(OvfInfoFileConstants.OvfDataSize); stringBuilder.append(":"); stringBuilder.append(size); } return stringBuilder.toString(); }
Source:
public Slot requestSlot(String filename, long fileSize, String contentType) throws SmackException.NotConnectedException, InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException { if (uploadService == null) { discoverUploadService(); } if (maxFileSize != null) { if (fileSize > maxFileSize) { throw new IllegalArgumentException("File size must not be greater than " + maxFileSize); } } SlotRequest slotRequest = new SlotRequest(filename, fileSize, contentType); slotRequest.setTo(uploadService); return connection().createStanzaCollectorAndSend(slotRequest).nextResultOrThrow(); }

Target:
public Slot requestSlot(String filename, long fileSize, String contentType) throws SmackException, InterruptedException, XMPPException.XMPPErrorException { return requestSlot(filename, fileSize, contentType, null); }
Source:
protected ActionResult execute() { data = new FileUploadPageData(account); BlobInfo blobInfo = extractImageKey(Const.ParamsNames.IMAGE_TO_UPLOAD); if (blobInfo == null) { data.isFileUploaded = false; data.fileSrcUrl = null; log.warning("Image Upload Failed"); statusToAdmin = "Image Upload Failed"; return createAjaxResult(data); } BlobKey blobKey = blobInfo.getBlobKey(); data.isFileUploaded = true; data.fileSrcUrl = Const.ActionURIs.PUBLIC_IMAGE_SERVE + "?blob-key=" + blobKey.getKeyString(); String absoluteFileSrcUrl = Config.getAppUrl(data.fileSrcUrl).toAbsoluteString(); log.info("New Image Uploaded : " + absoluteFileSrcUrl); statusToAdmin = "New Image Uploaded : " + "<a href=" + data.fileSrcUrl + " target=blank>" + absoluteFileSrcUrl + "</a>"; data.ajaxStatus = "Image Successfully Uploaded to Google Cloud Storage"; return createAjaxResult(data); }

Target:
protected ActionResult execute() { data = prepareData(); return createAjaxResult(data); }
Source:
private void removeNodeAndUpdateServers(final String hostToRemove) { discoveredServerList.remove(hostToRemove); if (!discoveredServerList.isEmpty()) { client.setServers(discoveredServerList); } else { client.setServers(bootstrapServerList); } }

Target:
protected void removeNodeAndUpdateServers(final String hostToRemove) { log.warn("Removing host {}", hostToRemove); discoveredServerList.remove(hostToRemove); if (log.isInfoEnabled()) { log.info("Discovered server pool is now: {}", StringUtils.join(discoveredServerList, ",")); } if (!discoveredServerList.isEmpty()) { client.setServers(discoveredServerList); } else { client.setServers(bootstrapServerList); } }
Source:
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { Lg.i("onActivityResult"); if (requestCode == PICK_CONTACT && resultCode == RESULT_OK) { final Uri contactUri = data.getData(); final Cursor cursor = getActivity().getContentResolver().query(contactUri, null, null, null, null); if (cursor != null) { cursor.moveToFirst(); final String name = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.SORT_KEY_PRIMARY)); final String telephoneNumber = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); cursor.close(); final String simlarId = SimlarNumber.createSimlarId(telephoneNumber); Lg.i("contact: ", name, " ", telephoneNumber, " -> ", simlarId); CallActivity.createCallView(getActivity(), simlarId); } } }

Target:
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { if (requestCode != PICK_CONTACT) { Lg.e("onActivityResult with unknown requestCode=", requestCode); return; } if (resultCode != RESULT_OK) { Lg.i("onActivityResult with resultCode=", resultCode); return; } if (data == null) { Lg.e("onActivityResult without intent data"); return; } final Uri contactUri = data.getData(); if (contactUri == null) { Lg.e("onActivityResult without contactUri data=", data); return; } final Cursor cursor = getActivity().getContentResolver().query(contactUri, null, null, null, null); if (cursor == null) { Lg.e("onActivityResult failed to create cursor for contactUri=", contactUri); return; } cursor.moveToFirst(); final String name = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.SORT_KEY_PRIMARY)); final String telephoneNumber = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); cursor.close(); callContact(name, telephoneNumber); }
Source:
private void analyzeMethod(Method m, ClassContext classContext) throws CFGBuilderException, DataflowAnalysisException { ConstantPoolGen cpg = classContext.getConstantPoolGen(); CFG cfg = classContext.getCFG(m); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext(); ) { Location location = i.next(); Instruction inst = location.getHandle().getInstruction(); if (inst instanceof INVOKEINTERFACE) { INVOKEINTERFACE invoke = (INVOKEINTERFACE) inst; String methodName = invoke.getMethodName(cpg); String className = invoke.getClassName(cpg); if (className.equals("javax.servlet.http.HttpServletResponse") && (methodName.equals("addHeader") || methodName.equals("setHeader"))) { LDC ldc = ByteCode.getPrevInstruction(location.getHandle().getPrev(), LDC.class); if (ldc != null) { if ("Access-Control-Allow-Origin".equals(ldc.getValue(cpg)) && "*".equals(ByteCode.getConstantLDC(location.getHandle().getPrev(), cpg, String.class))) { JavaClass clz = classContext.getJavaClass(); bugReporter.reportBug(new BugInstance(this, PERMISSIVE_CORS, Priorities.HIGH_PRIORITY) .addClass(clz) .addMethod(clz, m) .addSourceLine(classContext, m, location)); } } } } } }

Target:
private void analyzeMethod(Method m, ClassContext classContext) throws CFGBuilderException, DataflowAnalysisException { ConstantPoolGen cpg = classContext.getConstantPoolGen(); CFG cfg = classContext.getCFG(m); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext(); ) { Location location = i.next(); Instruction inst = location.getHandle().getInstruction(); if (inst instanceof INVOKEINTERFACE) { INVOKEINTERFACE invoke = (INVOKEINTERFACE) inst; String methodName = invoke.getMethodName(cpg); String className = invoke.getClassName(cpg); if (className.equals("javax.servlet.http.HttpServletResponse") && (methodName.equals("addHeader") || methodName.equals("setHeader"))) { LDC ldc = ByteCode.getPrevInstruction(location.getHandle().getPrev(), LDC.class); if (ldc != null) { String headerValue = ByteCode.getConstantLDC(location.getHandle().getPrev(), cpg, String.class); if ("Access-Control-Allow-Origin".equalsIgnoreCase((String)ldc.getValue(cpg)) && (headerValue.contains("*") || "null".equalsIgnoreCase(headerValue))) { JavaClass clz = classContext.getJavaClass(); bugReporter.reportBug(new BugInstance(this, PERMISSIVE_CORS, Priorities.HIGH_PRIORITY) .addClass(clz) .addMethod(clz, m) .addSourceLine(classContext, m, location)); } } } } } }
Source:
public DataTransactionResult offerToStore(ValueContainer<?> container, Integer value) { final ImmutableValue<Integer> proposedValue = new ImmutableSpongeValue<Integer>(Keys.FIRE_DAMAGE_DELAY, value); if (supports(container)) { final ImmutableValue<Integer> newFireDelayData = new ImmutableSpongeValue<Integer>(Keys.FIRE_DAMAGE_DELAY, value); final ImmutableValue<Integer> oldFireDelayValue = getApiValueFromContainer(container).get().asImmutable(); try { ((net.minecraft.entity.Entity) (container)).fireResistance = value; return DataTransactionBuilder.successReplaceResult(oldFireDelayValue, newFireDelayData); } catch (Exception e) { return DataTransactionBuilder.errorResult(newFireDelayData); } } return DataTransactionBuilder.failResult(proposedValue); }

Target:
public DataTransactionResult offerToStore(ValueContainer<?> container, Integer value) { final ImmutableValue<Integer> proposedValue = new ImmutableSpongeValue<Integer>(Keys.FIRE_DAMAGE_DELAY, value); if (supports(container)) { final ImmutableValue<Integer> newFireDelayData = new ImmutableSpongeValue<Integer>(Keys.FIRE_DAMAGE_DELAY, value); final ImmutableValue<Integer> oldFireDelayValue = getApiValueFromContainer(container).get().asImmutable(); ((net.minecraft.entity.Entity) (container)).fireResistance = value; return DataTransactionBuilder.successReplaceResult(oldFireDelayValue, newFireDelayData); } return DataTransactionBuilder.failResult(proposedValue); }
Source:
private void loadUsersFromQb() { List<String> tags = new ArrayList<>(); tags.add(App.getSampleConfigs().getUsersTag()); progressBar.setVisibility(View.VISIBLE); QBUsers.getUsersByTags(tags, null).performAsync(new QBEntityCallback<ArrayList<QBUser>>() { @Override public void onSuccess(ArrayList<QBUser> users, Bundle params) { setUserList(users); QBChatDialog oldDialog = (QBChatDialog) getIntent().getSerializableExtra(EXTRA_QB_DIALOG); updateDialog(oldDialog); } @Override public void onError(QBResponseException e) { showErrorSnackbar(R.string.select_users_get_users_error, e, new View.OnClickListener() { @Override public void onClick(View v) { loadUsersFromQb(); } }); progressBar.setVisibility(View.GONE); } }); }

Target:
private void loadUsersFromQb() { List<String> tags = new ArrayList<>(); tags.add(App.getSampleConfigs().getUsersTag()); progressBar.setVisibility(View.VISIBLE); QBUsers.getUsersByTags(tags, null).performAsync(new QBEntityCallback<ArrayList<QBUser>>() { @Override public void onSuccess(ArrayList<QBUser> usersByTags, Bundle params) { users = usersByTags; QBChatDialog dialog = (QBChatDialog) getIntent().getSerializableExtra(EXTRA_QB_DIALOG); getDialog(dialog); } @Override public void onError(QBResponseException e) { showErrorSnackbar(R.string.select_users_get_users_error, e, new View.OnClickListener() { @Override public void onClick(View v) { loadUsersFromQb(); } }); progressBar.setVisibility(View.GONE); } }); }
Source:
public void updateInfo(@NotNull final Machine machine) { if (machine.getRecipeType().equals("dockerfile")) { recipeScriptClient.getRecipeScript(machine).then(new Operation<String>() { @Override public void apply(String recipe) throws OperationException { view.setScript(recipe); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError error) throws OperationException { Log.error(RecipeTabPresenter.class, "Failed to get recipe script for machine " + machine.getId() + ": " + error.getMessage()); } }); } view.setScript(""); }

Target:
public void updateInfo(@NotNull final Machine machine) { if (machine.getRecipeType() == null) { Log.error(RecipeTabPresenter.class, "Recipe type is null for machine '" + machine.getId() + "'"); view.setScript("Recipe type is null for machine '" + machine.getId() + "'"); return; } switch (machine.getRecipeType()) { case "image": view.setScript("Image location: " + machine.getRecipeLocation()); break; case "dockerfile": recipeScriptClient.getRecipeScript(machine).then(new Operation<String>() { @Override public void apply(String recipe) throws OperationException { view.setScript(recipe); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError error) throws OperationException { Log.error(RecipeTabPresenter.class, "Failed to get recipe script for machine " + machine.getId() + ": " + error.getMessage()); view.setScript("Failed to get recipe script for machine '" + machine.getId() + "'"); } }); break; case "default": view.setScript("Recipe type: " + machine.getRecipeType()); } }
Source:
public void stapPermissionError() { Process p = null; try { p = new ProcessBuilder("/usr/bin/bash", "-c", "whoami").start(); } catch (IOException e) { e.printStackTrace(); } InputStreamReader isr = new InputStreamReader(p.getInputStream()); BufferedReader br = new BufferedReader(isr); String user = null; try { user = br.readLine(); } catch (IOException e) { e.printStackTrace(); } SystemTapUIErrorMessages message = new SystemTapUIErrorMessages(Messages.getString("CallgraphView.StapError1"), Messages.getString("CallgraphView.StapError1"), Messages.getString("CallgraphView.StapError2") + user + " " + Messages.getString("CallgraphView.StapError3") + "usermod -aG stapdev " + user); message.schedule(); }

Target:
public void stapPermissionError() { Process p = null; try { p = new ProcessBuilder("/usr/bin/bash", "-c", "whoami").start(); } catch (IOException e) { e.printStackTrace(); } InputStreamReader isr = new InputStreamReader(p.getInputStream()); BufferedReader br = new BufferedReader(isr); String user = null; try { user = br.readLine(); } catch (IOException e) { e.printStackTrace(); } SystemTapUIErrorMessages message = new SystemTapUIErrorMessages( Messages.getString("CallgraphView.StapError1"), Messages.getString("CallgraphView.StapError1"), NLS.bind( Messages.getString("CallgraphView.StapError2"), user)); message.schedule(); }
Source:
public HdfsCopyStats(String source, File destination, boolean enableStatsFile, int maxVersionsStatsFile, boolean isFileCopy, HdfsPathInfo pathInfo) { this.sourceFile = source; this.totalBytesTransferred = 0L; this.bytesTransferredSinceLastReport = 0L; this.pathInfo = pathInfo; this.lastReportNs = System.nanoTime(); this.startTimeMS = System.currentTimeMillis(); initializeStatsFile(destination, enableStatsFile, maxVersionsStatsFile, isFileCopy); aggStats = HdfsFetcherAggStats.getStats(); }

Target:
public HdfsCopyStats(String source, File destination, boolean enableStatsFile, int maxVersionsStatsFile, boolean isFileCopy, HdfsPathInfo pathInfo) { this.sourceFile = source; this.totalBytesTransferred = 0L; this.bytesTransferredSinceLastReport = 0L; this.pathInfo = pathInfo; this.lastReportNs = System.nanoTime(); this.startTimeMS = System.currentTimeMillis(); initializeStatsFile(destination, enableStatsFile, maxVersionsStatsFile, isFileCopy); }
Source:
public static boolean isLoggingEnabled() { if (CommCareApplication.instance().getCurrentApp() == null) { return true; } SharedPreferences properties = CommCareApplication.instance().getCurrentApp().getAppPreferences(); String logsEnabled = properties.getString(LOGS_ENABLED, LOGS_ENABLED_YES); return !properties.contains(LOGS_ENABLED) || logsEnabled.equals(LOGS_ENABLED_YES) || logsEnabled.equals(LOGS_ENABLED_ON_DEMAND); }

Target:
public static boolean isLoggingEnabled() { if (CommCareApplication.instance().getCurrentApp() == null) { return true; } String logsEnabled = getLogsEnabled(); return logsEnabled.equals(LOGS_ENABLED_YES) || logsEnabled.equals(LOGS_ENABLED_ON_DEMAND); }
Source:
public void unparse( SqlWriter writer, int leftPrec, int rightPrec) { final SqlOperator operator = getOperator(); final SqlDialect dialect = writer.getDialect(); if (leftPrec > operator.getLeftPrec() || (operator.getRightPrec() <= rightPrec && (rightPrec != 0)) || writer.isAlwaysUseParentheses() && isA(SqlKind.EXPRESSION)) { final SqlWriter.Frame frame; if (operator instanceof SqlUnnestOperator) { frame = writer.startList(SqlWriter.FrameTypeEnum.SIMPLE); } else { frame = writer.startList("(", ")"); } dialect.unparseCall(writer, this, 0, 0); writer.endList(frame); } else { dialect.unparseCall(writer, this, leftPrec, rightPrec); } }

Target:
public void unparse( SqlWriter writer, int leftPrec, int rightPrec) { final SqlOperator operator = getOperator(); final SqlDialect dialect = writer.getDialect(); if (leftPrec > operator.getLeftPrec() || (operator.getRightPrec() <= rightPrec && (rightPrec != 0)) || writer.isAlwaysUseParentheses() && isA(SqlKind.EXPRESSION)) { final SqlWriter.Frame frame = writer.startList("(", ")"); dialect.unparseCall(writer, this, 0, 0); writer.endList(frame); } else { dialect.unparseCall(writer, this, leftPrec, rightPrec); } }
Source:
protected void onEvent(GHEvent event, String payload) { try { GHEventPayload.Ping ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class); GHRepository repository = ping.getRepository(); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getHtmlUrl()); monitor.resolveProblem(GitHubRepositoryName.create(repository.getHtmlUrl().toExternalForm())); } else { GHOrganization organization = ping.getOrganization(); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getUrl()); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } } catch (IOException e) { LOGGER.warn("Received malformed PingEvent: " + payload, e); } }

Target:
protected void onEvent(GHEvent event, String payload) { GHEventPayload.Ping ping; try { ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class); } catch (IOException e) { LOGGER.warn("Received malformed PingEvent: " + payload, e); return; } GHRepository repository = ping.getRepository(); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getHtmlUrl()); monitor.resolveProblem(GitHubRepositoryName.create(repository.getHtmlUrl().toExternalForm())); } else { GHOrganization organization = ping.getOrganization(); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getUrl()); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } }
Source:
public SMRLogEntry() { this.type = LogEntryType.SMR_LOG; }

Target:
public SMRLogEntry() { this.type = LogEntryType.SMRLOG; }
Source:
public static String graphvizLogicalPlan(PlanNode plan, TypeProvider types) { PlanFragment fragment = new PlanFragment( new PlanFragmentId("graphviz_plan"), plan, types.allTypes(), SINGLE_DISTRIBUTION, ImmutableList.of(plan.getId()), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getOutputSymbols()), StageExecutionStrategy.ungroupedExecution(), new StatsAndCosts(ImmutableMap.of(), ImmutableMap.of())); return GraphvizPrinter.printLogical(ImmutableList.of(fragment)); }

Target:
public static String graphvizLogicalPlan(PlanNode plan, TypeProvider types) { PlanFragment fragment = new PlanFragment( new PlanFragmentId("graphviz_plan"), plan, types.allTypes(), SINGLE_DISTRIBUTION, ImmutableList.of(plan.getId()), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getOutputSymbols()), StageExecutionStrategy.ungroupedExecution(), StatsAndCosts.empty()); return GraphvizPrinter.printLogical(ImmutableList.of(fragment)); }
Source:
public void testFindCreditMemoDocument() { VendorCreditMemoDocument vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_TWO.createEntry()); assertNotNull("vendor credit memo should have been non-null", vendorCreditMemoDocument); assertEquals("Wrong credit memo document was retrieved", CuCamsTestConstants.DOC_5686500, vendorCreditMemoDocument.getDocumentNumber()); vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_ONE.createEntry()); assertNotNull("vendor credit memo should have been non-null", vendorCreditMemoDocument); assertEquals("Wrong credit memo document was retrieved", CuCamsTestConstants.DOC_5319793, vendorCreditMemoDocument.getDocumentNumber()); vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_THREE.createEntry()); assertNull("vendor credit memo should have been null", vendorCreditMemoDocument); }

Target:
public void testFindCreditMemoDocument() { VendorCreditMemoDocument vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_5319793.createEntry()); assertNotNull("vendor credit memo should have been non-null", vendorCreditMemoDocument); assertEquals("Wrong credit memo document was retrieved", CuCamsTestConstants.DOC_5319793, vendorCreditMemoDocument.getDocumentNumber()); vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_NONEXISTENT_DOC.createEntry()); assertNull("vendor credit memo should have been null", vendorCreditMemoDocument); }
Source:
public void onClick(View v) { Parameters params = drone.getAttribute(AttributeType.PARAMETERS); Parameter speed = params.getParameter(WPNAV_SPEED); if(mission == null){ mission = drone.getAttribute(AttributeType.MISSION); } switch(v.getId()){ case R.id.mc_pause: { drone.pauseAtCurrentLocation(); break; } case R.id.mc_restart: { if(mission.getCurrentMissionItem() == mission.getMissionItems().size()){ resetAutoMode(); } msg_mission_set_current msg = new msg_mission_set_current(); msg.seq = 0; ExperimentalApi.sendMavlinkMessage(drone, new MavlinkMessageWrapper(msg)); break; } case R.id.mc_next: { msg_mission_set_current msg = new msg_mission_set_current(); msg.seq = mission.getCurrentMissionItem() + 1; ExperimentalApi.sendMavlinkMessage(drone, new MavlinkMessageWrapper(msg)); break; } case R.id.mc_prev: { msg_mission_set_current msg = new msg_mission_set_current(); msg.seq = mission.getCurrentMissionItem() - 1; ExperimentalApi.sendMavlinkMessage(drone, new MavlinkMessageWrapper(msg)); break; } case R.id.wp_speed_plus: changeWaypointSpeedBy(100.0); break; case R.id.wp_speed_minus: changeWaypointSpeedBy(-100.0); break; } }

Target:
public void onClick(View v) { if(mission == null){ mission = drone.getAttribute(AttributeType.MISSION); } switch(v.getId()){ case R.id.mc_pause: { drone.pauseAtCurrentLocation(); break; } case R.id.mc_restart: { gotoMissionItem(0); break; } case R.id.mc_next: { gotoMissionItem(mission.getCurrentMissionItem() + 1); break; } case R.id.mc_prev: { gotoMissionItem(mission.getCurrentMissionItem() - 1); break; } } }
Source:
public static String encode(CustomPage cp) { StringBuilder encodedCP = new StringBuilder(); if (cp.getPageMatcher() != null) { encodedCP .append(Base64.encodeBase64String(cp.getPageMatcher().getBytes())) .append(FIELD_SEPARATOR); } else { encodedCP.append(Base64.encodeBase64String("".getBytes())).append(FIELD_SEPARATOR); } encodedCP.append(cp.getPageMatcherType().getId()).append(FIELD_SEPARATOR); encodedCP.append(cp.isRegex()).append(FIELD_SEPARATOR); encodedCP.append(cp.getType().getId()).append(FIELD_SEPARATOR); encodedCP.append(cp.isEnabled()).append(FIELD_SEPARATOR); return encodedCP.toString(); }

Target:
public static String encode(CustomPage cp) { StringBuilder encodedCP = new StringBuilder(); String matcherComponent = cp.getPageMatcher() != null ? cp.getPageMatcher() : ""; encodedCP .append( new String( Base64.getEncoder() .encode(matcherComponent.getBytes(StandardCharsets.UTF_8)), StandardCharsets.US_ASCII)) .append(FIELD_SEPARATOR); encodedCP.append(cp.getPageMatcherLocation().getId()).append(FIELD_SEPARATOR); encodedCP.append(cp.isRegex()).append(FIELD_SEPARATOR); encodedCP.append(cp.getType().getId()).append(FIELD_SEPARATOR); encodedCP.append(cp.isEnabled()).append(FIELD_SEPARATOR); return encodedCP.toString(); }
Source:
public void checkArtifactSize(String storageId, String repositoryId, MultipartFile uploadedFile) throws ArtifactResolutionException { if (uploadedFile.isEmpty() || uploadedFile.getSize() == 0) { throw new ArtifactResolutionException("Uploaded file is empty."); } Repository repository = getConfiguration().getStorage(storageId) .getRepository(repositoryId); long artifactsMaxSize = repository.getArtifactsMaxSize(); if (artifactsMaxSize > 0) { if (uploadedFile.getSize() > artifactsMaxSize) { throw new ArtifactResolutionException("Uploaded artifact is large for repository " + repositoryId + "."); } } }

Target:
public void checkArtifactSize(String storageId, String repositoryId, MultipartFile uploadedFile) throws ArtifactResolutionException { if (uploadedFile.isEmpty() || uploadedFile.getSize() == 0) { throw new ArtifactResolutionException("Uploaded file is empty."); } Repository repository = getConfiguration().getStorage(storageId) .getRepository(repositoryId); long artifactMaxSize = repository.getArtifactMaxSize(); if (artifactMaxSize > 0 && uploadedFile.getSize() > artifactMaxSize) { throw new ArtifactResolutionException("The size of the artifact exceeds the maximum size accepted by " + "this repository (" + uploadedFile.getSize() + "/" + artifactMaxSize + ")."); } }
Source:
public Repository getRepository(final File gitDir) { if (gitDir == null) { return null; } File normalizedGitDir = new Path(gitDir.getAbsolutePath()).toFile(); synchronized (repositoryCache) { Reference<Repository> r = repositoryCache.get(normalizedGitDir); Repository result = r != null ? r.get() : null; if (result != null && result.getDirectory().exists()) { return result; } repositoryCache.remove(normalizedGitDir); } IndexDiffCache cache = Activator.getDefault().getIndexDiffCache(); if (cache != null) { cache.remove(normalizedGitDir); } return null; }

Target:
public Repository getRepository(final File gitDir) { if (gitDir == null) { return null; } File normalizedGitDir = new Path(gitDir.getAbsolutePath()).toFile(); synchronized (repositoryCache) { Reference<Repository> r = repositoryCache.get(normalizedGitDir); if (r == null) { return null; } Repository result = r.get(); if (result != null && result.getDirectory().exists()) { return result; } repositoryCache.remove(normalizedGitDir); } IndexDiffCache cache = Activator.getDefault().getIndexDiffCache(); if (cache != null) { cache.remove(normalizedGitDir); } return null; }
Source:
public void onReceive(Context context, Intent intent) { String referrer = intent.getStringExtra("referrer"); Log.i(SwrveImp.LOG_TAG, "Received referrer:" + referrer); if (referrer != null) { String decodedReferrer = ""; try { decodedReferrer = URLDecoder.decode(referrer, "UTF-8"); } catch (UnsupportedEncodingException e) { Log.e(SwrveImp.LOG_TAG, "Error decoding the referrer:" + referrer, e); } SharedPreferences.Editor prefs = context.getSharedPreferences(SwrveImp.SDK_PREFS_NAME, 0).edit(); prefs.putString(SwrveImp.SWRVE_REFERRER_ID, decodedReferrer).commit(); } else { Log.e(SwrveImp.LOG_TAG, "Referrer is null."); } }

Target:
public void onReceive(Context context, Intent intent) { String referrer = intent.getStringExtra(SwrveImp.REFERRER); Log.i(SwrveImp.LOG_TAG, "Received INSTALL_REFERRER broadcast with referrer:" + referrer); if (!SwrveHelper.isNullOrEmpty(referrer)) { try { String decodedReferrer = URLDecoder.decode(referrer, "UTF-8"); SharedPreferences.Editor prefs = context.getSharedPreferences(SwrveImp.SDK_PREFS_NAME, 0).edit(); prefs.putString(SwrveImp.SWRVE_REFERRER_ID, decodedReferrer).commit(); } catch (UnsupportedEncodingException e) { Log.e(SwrveImp.LOG_TAG, "Error decoding the referrer:" + referrer, e); } } }
Source:
public Multimap<String, Class<?>> getIncludes() { initializeIncludesIfNull(); return includes; }

Target:
public Multimap<String, Class<?>> getIncludes() { if (includes == null) { includes = LinkedListMultimap.create(); } return includes; }
Source:
public List<TestScenario> getScenarios() throws IOException { File folder = new File(directory); File[] scenarioDirectories = folder.listFiles((dir, name) -> name.startsWith(SCENARIO_DIRECTORY_NAME_PREFIX)); List<TestScenario> testScenarios = new ArrayList<>(); for (File directory: scenarioDirectories) { if (directory.isDirectory()) { File scenarioFile = directory.listFiles((dir, name) -> name.equals(SCENARIO_NAME))[0]; String scenarioJson = readFile(scenarioFile); TestScenario testScenario = deserialize(scenarioJson, TestScenario.class); testScenario.setScenarioDirectory(directory.getAbsolutePath()); if (testScenario.getEnvironment().getDockerCompose() != null) { testScenario.getEnvironment().setDockerCompose( directory.getAbsolutePath() + "/" + testScenario.getEnvironment().getDockerCompose()); } testScenarios.add(testScenario); } } return testScenarios; }

Target:
public List<TestScenario> getScenarios() throws IOException { File folder = new File(directory); File[] scenarioDirectories = folder.listFiles((dir, name) -> name.startsWith(SCENARIO_DIRECTORY_NAME_PREFIX)); List<TestScenario> testScenarios = new ArrayList<>(); for (File directory: scenarioDirectories) { if (directory.isDirectory()) { File scenarioFile = directory.listFiles((dir, name) -> name.equals(SCENARIO_NAME))[0]; String scenarioJson = readFile(scenarioFile); TestScenario testScenario = deserialize(scenarioJson, TestScenario.class); testScenario.setScenarioDirectory(directory.getAbsolutePath()); testScenarios.add(testScenario); } } return testScenarios; }