auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<? extends DataType> getOutputTypes(String portalName) { List<DataType> result = null; Portal portal = getSafePortal(portalName); AnalyzedStatement analyzedStatement = portal.boundOrUnboundStatement(); if (analyzedStatement instanceof ResultSetStatement) { ResultSetStatement update = (ResultSetStatement) analyzedStatement; List<Field> fields = update.fields(); if (fields != null) { result = Symbols.typeView(fields); } } return result; }

Target:
public List<? extends DataType> getOutputTypes(String portalName) { Portal portal = getSafePortal(portalName); AnalyzedStatement analyzedStatement = portal.boundOrUnboundStatement(); List<Field> fields = analyzedStatement.fields(); if (fields != null) { return Symbols.typeView(fields); } return null; }
Source:
private void AlteBilderAufraeumen() throws IOException { URI path = ConfigCore.getTempImagesPathAsCompleteDirectory(); FilenameFilter filter = new FileNameEndsWithFilter(".png"); ArrayList<URI> files = serviceManager.getFileService().getSubUris(filter, path); if (files != null) { for (URI aFiles : files) { URI file = path.resolve(aFiles); if ((System.currentTimeMillis() - new File(file).lastModified()) > 7200000) { serviceManager.getFileService().delete(file); } } } }

Target:
private void AlteBilderAufraeumen() throws IOException { URI path = ConfigCore.getTempImagesPathAsCompleteDirectory(); FilenameFilter filter = new FileNameEndsWithFilter(".png"); ArrayList<URI> uris = serviceManager.getFileService().getSubUris(filter, path); if (uris != null) { for (URI uri : uris) { URI file = path.resolve(uri); if ((System.currentTimeMillis() - new File(file).lastModified()) > 7200000) { serviceManager.getFileService().delete(file); } } } }
Source:
public void testCpuMapping() { VDS vds = new VDS(); vds.setId(Guid.Empty); vds.setCpuCores(6); vds.setCpuSockets(3); vds.setCpuThreads(12); vds.setCpuModel("some cpu model"); vds.setCpuSpeedMh(5.5); Host host = HostMapper.map(vds, (Host) null); assertNotNull(host.getCpu()); assertEquals(host.getCpu().getTopology().getCores().intValue(), 2); assertEquals(host.getCpu().getTopology().getSockets().intValue(), 3); assertEquals(host.getCpu().getTopology().getThreads().intValue(), 2); assertEquals(host.getCpu().getName(), "some cpu model"); assertEquals(host.getCpu().getSpeed(), new BigDecimal(5.5)); }

Target:
public void testCpuMapping() { VDS vds = new VDS(); vds.setId(Guid.Empty); vds.setCpuCores(6); vds.setCpuSockets(3); vds.setCpuThreads(12); vds.setCpuModel("some cpu model"); vds.setCpuSpeedMh(5.5); Host host = HostMapper.map(vds, (Host) null); assertNotNull(host.getCpu()); assertEquals(host.getCpu().getTopology().getCores(), Integer.valueOf(2)); assertEquals(host.getCpu().getTopology().getSockets(), Integer.valueOf(3)); assertEquals(host.getCpu().getTopology().getThreads(), Integer.valueOf(2)); assertEquals(host.getCpu().getName(), "some cpu model"); assertEquals(host.getCpu().getSpeed(), new BigDecimal(5.5)); }
Source:
private Optional<Collection<String>> getCurrentRootResourceDirs(Configuration configuration) { Dictionary<String, Object> properties = configuration.getProperties(); if (properties == null) { return Optional.empty(); } Object currentRootResourceDirs = properties.get(ROOT_RESOURCE_DIRECTORIES_PROPERTY_KEY); if (!(currentRootResourceDirs instanceof Collection)) { return Optional.empty(); } return Optional.of((Collection) currentRootResourceDirs); }

Target:
private Collection<String> getCurrentRootResourceDirs(Configuration configuration) { Dictionary<String, Object> properties = configuration.getProperties(); if (properties == null) { return null; } Object currentRootResourceDirs = properties.get(ROOT_RESOURCE_DIRECTORIES_PROPERTY_KEY); if (!(currentRootResourceDirs instanceof Collection)) { return null; } return (Collection<String>) currentRootResourceDirs; }
Source:
public void testList() { List<Lan> lans = lanApi().list(dataCenter.id()); assertNotNull(lans); assertFalse(lans.isEmpty()); assertEquals(lans.size(), 1); }

Target:
public void testList() { List<Lan> lans = lanApi().list(dataCenter.id()); assertNotNull(lans); assertFalse(lans.isEmpty()); assertTrue(Iterables.any(lans, new Predicate<Lan>() { @Override public boolean apply(Lan input) { return input.id().equals(testLan.id()); } })); }
Source:
public static DeploymentType getDeployment(InputStream deployIS) { final String parsingHelper = "^SichuanGourmet_"; try { if (m_jc == null || m_schema == null) { throw new RuntimeException("Error schema validation."); } StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(deployIS)); String line; boolean inDelimiter = false; try { while ((line = br.readLine()) != null) { if (line.contains("property name=\"delimiters\"")) { inDelimiter = true; } if (inDelimiter) { line = line.replace("&#01;", parsingHelper); line = line.replace("\1", parsingHelper); } if (line.contains("</property>") && inDelimiter) { inDelimiter = false; } sb.append(line + "\n"); } } catch (IOException ignore) InputStream newIS = new ByteArrayInputStream(sb.toString().trim().getBytes()); Unmarshaller unmarshaller = m_jc.createUnmarshaller(); unmarshaller.setSchema(m_schema); JAXBElement<DeploymentType> result = (JAXBElement<DeploymentType>) unmarshaller.unmarshal(newIS); DeploymentType deployment = result.getValue(); try { for (ExportConfigurationType t: deployment.getExport().getConfiguration()) { for (PropertyType p : t.getProperty()) { if (p.getName().equals("delimiters")) { String delim = p.getValue(); p.setValue(delim.replace(parsingHelper, "\1")); } } } } catch (NullPointerException ignore) populateDefaultDeployment(deployment); return deployment; } catch (JAXBException e) { if (e.getLinkedException() instanceof java.io.FileNotFoundException) { hostLog.error(e.getLinkedException().getMessage()); return null; } else if (e.getLinkedException() instanceof org.xml.sax.SAXParseException) { hostLog.error("Error schema validating deployment.xml file. " + e.getLinkedException().getMessage()); return null; } else { throw new RuntimeException(e); } } }

Target:
public static DeploymentType getDeployment(InputStream deployIS) { try { if (m_jc == null || m_schema == null) { throw new RuntimeException("Error schema validation."); } Unmarshaller unmarshaller = m_jc.createUnmarshaller(); unmarshaller.setSchema(m_schema); JAXBElement<DeploymentType> result = (JAXBElement<DeploymentType>) unmarshaller.unmarshal(deployIS); DeploymentType deployment = result.getValue(); populateDefaultDeployment(deployment); return deployment; } catch (JAXBException e) { if (e.getLinkedException() instanceof java.io.FileNotFoundException) { hostLog.error(e.getLinkedException().getMessage()); return null; } else if (e.getLinkedException() instanceof org.xml.sax.SAXParseException) { hostLog.error("Error schema validating deployment.xml file. " + e.getLinkedException().getMessage()); return null; } else { throw new RuntimeException(e); } } }
Source:
BackgroundProcess(String threadName, final ActionInvocation invocation, int threadPriority) { this.invocation = invocation; try { final Thread t = new Thread(new Runnable() { public void run() { try { beforeInvocation(); result = invocation.invokeActionOnly(); afterInvocation(); } catch (Exception e) { exception = e; } done = true; } }); t.setName(threadName); t.setPriority(threadPriority); t.start(); } catch (Exception e) { exception = e; } }

Target:
public BackgroundProcess(String threadName, final ActionInvocation invocation, int threadPriority) { this.invocation = invocation; try { final Thread t = new Thread(new Runnable() { public void run() { try { beforeInvocation(); result = invocation.invokeActionOnly(); afterInvocation(); } catch (Exception e) { exception = e; } done = true; } }); t.setName(threadName); t.setPriority(threadPriority); t.start(); } catch (Exception e) { exception = e; } }
Source:
public void close() throws SQLException { try { if ( dataInputStream != null ) { dataInputStream.close(); } if ( stopped.compareAndSet( false, true ) ) { String id = thinResultHeader.getServiceObjectId(); if ( !Const.isEmpty( id ) ) { DataInputStream errorInputStream = client.query( "[ errors " + thinResultHeader.getServiceObjectId() + " ]", 0 ); DataInputStream stopInputStream = client.query( "[ stop " + thinResultHeader.getServiceObjectId() + " ]", 0 ); Boolean hasErrors = "true".equals( errorInputStream.readUTF() ); errorInputStream.close(); stopInputStream.close(); if ( hasErrors ) { throw new SQLException( "An error occurred while processing request." ); } } } } catch ( IOException e ) { ThinDriver.logger.warning( e.getMessage() ); } finally { dataInputStream = null; } }

Target:
public void close() throws SQLException { try { if ( dataInputStream != null ) { dataInputStream.close(); } if ( stopped.compareAndSet( false, true ) ) { String id = thinResultHeader.getServiceObjectId(); if ( !Const.isEmpty( id ) ) { Boolean hasErrors = false; DataInputStream errorInputStream = client.query( "[ errors " + thinResultHeader.getServiceObjectId() + " ]", 0 ); try { hasErrors = "true".equals( errorInputStream.readUTF() ); } finally { errorInputStream.close(); } DataInputStream stopInputStream = client.query( "[ stop " + thinResultHeader.getServiceObjectId() + " ]", 0 ); stopInputStream.close(); if ( hasErrors ) { throw new SQLException( "An error occurred while processing request." ); } } } } catch ( IOException e ) { ThinDriver.logger.warning( e.getMessage() ); } finally { dataInputStream = null; } }
Source:
@Test public void testEqualSansNullability() { final RelDataTypeFactory factory = f.typeFactory; RelDataType bigIntType = f.sqlBigInt; RelDataType nullableBigIntType = f.sqlBigIntNullable; RelDataType varCharType = f.sqlVarchar; assertThat( SqlTypeUtil.equalSansNullability(factory, bigIntType, varCharType), is(false)); assertThat( SqlTypeUtil.equalSansNullability(bigIntType, varCharType), is(false)); assertThat( SqlTypeUtil.equalSansNullability(factory, bigIntType, nullableBigIntType), is(true)); assertThat( SqlTypeUtil.equalSansNullability(bigIntType, nullableBigIntType), is(true)); RelDataType bigIntType1 = factory.createTypeWithNullability(nullableBigIntType, false); assertThat( SqlTypeUtil.equalSansNullability(factory, bigIntType, bigIntType1), is(true)); assertThat( SqlTypeUtil.equalSansNullability(bigIntType, bigIntType1), is(true)); }

Target:
@Test public void testEqualSansNullability() { RelDataType bigIntType = f.sqlBigInt; RelDataType nullableBigIntType = f.sqlBigIntNullable; RelDataType varCharType = f.sqlVarchar; RelDataType bigIntType1 = f.typeFactory.createTypeWithNullability(nullableBigIntType, false); compareTypesIgnoringNullability("different types should return false. ", bigIntType, varCharType, false); compareTypesIgnoringNullability("types differing only in nullability should return true.", bigIntType, nullableBigIntType, true); compareTypesIgnoringNullability("identical types should return true.", bigIntType, bigIntType1, true); }
Source:
private void guaranteeHasAllSubnets(Collection<String> subnetIds, LoadBalancer loadBalancer) { Collection<String> subnetsOnLoadBalancer = getSubnetsFromLoadBalancer(loadBalancer); Collection<String> subnetsToAdd = new HashSet<>(); for (String subnetId : subnetIds) { if (! subnetsOnLoadBalancer.contains(subnetId)) { subnetsToAdd.add(subnetId); } } try { SetSubnetsRequest subnetsRequest = new SetSubnetsRequest() .withLoadBalancerArn(loadBalancer.getLoadBalancerArn()) .withSubnets(subnetsToAdd); elbClient.setSubnets(subnetsRequest); } catch (AmazonClientException acexn) { LOG.error("Could not attach subnets to load balancer due to error", subnetsToAdd, loadBalancer.getLoadBalancerName(), acexn); exceptionNotifier.notify(acexn, ImmutableMap.of( "elb", loadBalancer.getLoadBalancerName(), "subnets", subnetsToAdd.toString())); } }

Target:
private void guaranteeHasAllSubnets(Collection<String> subnetIds, LoadBalancer loadBalancer) { Collection<String> subnetsOnLoadBalancer = getSubnetsFromLoadBalancer(loadBalancer); Set<String> subnetsToAdd = new HashSet<>(); for (String subnetId : subnetIds) { if (! subnetsOnLoadBalancer.contains(subnetId)) { subnetsToAdd.add(subnetId); } } subnetsToAdd = Sets.union(new HashSet<>(subnetsOnLoadBalancer), subnetsToAdd); try { SetSubnetsRequest subnetsRequest = new SetSubnetsRequest() .withLoadBalancerArn(loadBalancer.getLoadBalancerArn()) .withSubnets(subnetsToAdd); elbClient.setSubnets(subnetsRequest); } catch (AmazonClientException acexn) { LOG.error("Could not attach subnets to load balancer due to error", subnetsToAdd, loadBalancer.getLoadBalancerName(), acexn); exceptionNotifier.notify(acexn, ImmutableMap.of( "elb", loadBalancer.getLoadBalancerName(), "subnets", subnetsToAdd.toString())); } }
Source:
public Mono<AccessToken> getToken(TokenRequestContext request) { final StringBuilder errorMsg = new StringBuilder(); return Flux.fromIterable(credentials).flatMap(p -> p.getToken(request).onErrorResume(t -> { if (t.getMessage() != null && !t.getMessage().contains("authentication unavailable")) { throw new RuntimeException(UnavailableError+p.getClass().getSimpleName()+"authentication failed.",t); } errorMsg.append(" ").append(t.getMessage()); return Mono.empty(); }), 1) .next() .switchIfEmpty(Mono.defer(() -> Mono.error(new RuntimeException(FailedError+errorMsg.toString()+" )")))); }

Target:
public Mono<AccessToken> getToken(TokenRequestContext request) { List<CredentialUnavailableException> exceptions = new ArrayList<>(4); return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(request).onErrorResume(Exception.class, t -> { if (!t.getClass().getSimpleName().equals("CredentialUnavailableException")) { return Mono.error(new ClientAuthenticationException( unavailableError + p.getClass().getSimpleName() + " authentication failed. Error Details: " + t.getMessage(), null, t)); } exceptions.add((CredentialUnavailableException) t); return Mono.empty(); }), 1) .next() .switchIfEmpty(Mono.defer(() -> { CredentialUnavailableException last = exceptions.get(exceptions.size() - 1); for (int z = exceptions.size() - 2; z >= 0; z--) { CredentialUnavailableException current = exceptions.get(z); last = new CredentialUnavailableException(current.getMessage() + "\r\n" + last.getMessage(), last.getCause()); } return Mono.error(last); })); }
Source:
public Task execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; Task task = context.getTaskQueryService().getTaskInstanceById(taskId); if (task == null) { throw new IllegalStateException("Unable to find task with id " + taskId); } if (!isPotentialOwner(userId, task, context)) { throw new PermissionDeniedException("User " + userId + " isn't allowed to see thask " + taskId); } return task; }

Target:
public Task execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; Task task = context.getTaskQueryService().getTaskInstanceById(taskId); if (task == null) { throw new IllegalStateException("Unable to find task with id " + taskId); } if (!checkUserPermissions(userId, task, context)) { throw new PermissionDeniedException("User " + userId + " isn't allowed to see the task " + taskId); } return task; }
Source:
synchronized PgPool getPool() { PgPool ret = pool.get(); if(ret == null) { ret = pgClientFactory.sqlClient(4); pool.set(ret); } return ret; }

Target:
synchronized PgPool getPool() { PgPool ret = pool.get(); if(ret == null) { ret = pgClientFactory.sqlClient(POOL_SIZE); pool.set(ret); } return ret; }
Source:
public void isToSkip() { FactMapping otherFactMapping = new FactMapping(FactIdentifier.DESCRIPTION, ExpressionIdentifier.create("value", FactMappingType.OTHER)); assertTrue(AbstractScenarioValidation.isToSkip(otherFactMapping)); FactMapping descriptionFactMapping = new FactMapping(FactIdentifier.DESCRIPTION, ExpressionIdentifier.create("value", FactMappingType.OTHER)); assertTrue(AbstractScenarioValidation.isToSkip(descriptionFactMapping)); FactMapping emptyFactMapping = new FactMapping(FactIdentifier.EMPTY, ExpressionIdentifier.create("value", FactMappingType.GIVEN)); assertTrue(AbstractScenarioValidation.isToSkip(emptyFactMapping)); FactMapping expressionFactMapping = new FactMapping(FactIdentifier.create("myType", "anyClass"), ExpressionIdentifier.create("expression", FactMappingType.GIVEN)); assertTrue(AbstractScenarioValidation.isToSkip(expressionFactMapping)); }

Target:
public void isToSkip() { FactMapping otherFactMapping = new FactMapping(FactIdentifier.INDEX, ExpressionIdentifier.create("value", FactMappingType.OTHER)); assertTrue(AbstractScenarioValidation.isToSkip(otherFactMapping)); FactMapping descriptionFactMapping = new FactMapping(FactIdentifier.DESCRIPTION, ExpressionIdentifier.create("value", FactMappingType.OTHER)); assertTrue(AbstractScenarioValidation.isToSkip(descriptionFactMapping)); FactMapping emptyFactMapping = new FactMapping(FactIdentifier.EMPTY, ExpressionIdentifier.create("value", FactMappingType.GIVEN)); assertTrue(AbstractScenarioValidation.isToSkip(emptyFactMapping)); FactMapping expressionFactMapping = new FactMapping(FactIdentifier.create("myType", "anyClass"), ExpressionIdentifier.create(ConstantsHolder.EXPRESSION_CLASSNAME, FactMappingType.GIVEN)); assertTrue(AbstractScenarioValidation.isToSkip(expressionFactMapping)); FactMapping simpleTypeFactMapping = new FactMapping(FactIdentifier.create("mySimpleType", "com.mySimpleType"), ExpressionIdentifier.create("value", FactMappingType.GIVEN)); assertTrue(AbstractScenarioValidation.isToSkip(simpleTypeFactMapping)); FactMapping complexTypeFactMapping = new FactMapping(FactIdentifier.create("myComplexType", "com.myComplexType"), ExpressionIdentifier.create("value", FactMappingType.GIVEN)); complexTypeFactMapping.addExpressionElement("name", "com.lang.String"); assertFalse(AbstractScenarioValidation.isToSkip(complexTypeFactMapping)); }
Source:
public void deleteStoreFiles() throws StoreException, IOException { if (started) { throw new IllegalStateException("Store is still started. Deleting store files is not allowed."); } String[] swapSegmentsInUse = compactor.getSwapSegmentsInUse(); if (swapSegmentsInUse.length > 0) { for (String fileName : swapSegmentsInUse) { logger.trace("Returning swap segment to reserve pool", fileName); File swapSegmentTempFile = new File(dataDir, fileName); diskSpaceAllocator.free(swapSegmentTempFile, config.storeSegmentSizeInBytes, storeId, true); } } logger.info("Deleting store directory", storeId); File storeDir = new File(dataDir); try { Files.walk(storeDir.toPath()).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete); } catch (Exception e) { throw new IOException("Couldn't delete store directory " + dataDir); } logger.info("All files of store deleted", storeId); }

Target:
public void deleteStoreFiles() throws StoreException, IOException { if (started) { throw new IllegalStateException("Store is still started. Deleting store files is not allowed."); } String[] swapSegmentsInUse = compactor.getSwapSegmentsInUse(); for (String fileName : swapSegmentsInUse) { logger.info("Returning swap segment to reserve pool", fileName); File swapSegmentTempFile = new File(dataDir, fileName); diskSpaceAllocator.free(swapSegmentTempFile, config.storeSegmentSizeInBytes, storeId, true); } logger.info("Deleting store directory", storeId); File storeDir = new File(dataDir); try { Utils.deleteFileOrDirectory(storeDir); } catch (Exception e) { throw new IOException("Couldn't delete store directory " + dataDir, e); } logger.info("All files of store deleted", storeId); }
Source:
public Map<Capability, CapReqBuilder> from(Resource bundle) { Map<Capability, CapReqBuilder> mapping = new HashMap<>(); addRequirements(bundle.getRequirements(null)); for (Capability c : bundle.getCapabilities(null)) { CapReqBuilder clone = CapReqBuilder.clone(c); addCapability0(clone); mapping.put(c, clone); } return mapping; }

Target:
public Map<Capability, Capability> from(Resource bundle) { Map<Capability, Capability> mapping = new HashMap<>(); addRequirements(bundle.getRequirements(null)); for (Capability c : bundle.getCapabilities(null)) { CapReqBuilder clone = CapReqBuilder.clone(c); Capability addedCapability = addCapability0(clone); mapping.put(c, addedCapability); } return mapping; }
Source:
public void setUp() throws NoSuchFieldException, NoSuchMethodException { configMap = new HashMap<>(); configMap.put("job.name", "test-job"); configMap.put("job.coordinator.system", "kafka"); configMap.put("task.inputs", "kafka.topic1"); configMap.put("systems.kafka.samza.factory", "org.apache.samza.system.MockSystemFactory"); configMap.put("samza.cluster-manager.factory", "org.apache.samza.clustermanager.MockClusterResourceManagerFactory"); MockSystemFactory.MSG_QUEUES.put(new SystemStreamPartition("kafka", "topic1", new Partition(0)), new ArrayList<>()); this.monitorField = ClusterBasedJobCoordinator.class.getDeclaredField("partitionMonitor"); this.monitorField.setAccessible(true); this.appStateField = ClusterBasedJobCoordinator.class.getDeclaredField("state"); this.appStateField.setAccessible(true); this.updatePartitionCountMethod = StreamPartitionCountMonitor.class.getDeclaredMethod("updatePartitionCountMetric"); this.updatePartitionCountMethod.setAccessible(true); }

Target:
public void setUp() throws NoSuchFieldException, NoSuchMethodException { configMap = new HashMap<>(); configMap.put("job.name", "test-job"); configMap.put("job.coordinator.system", "kafka"); configMap.put("task.inputs", "kafka.topic1"); configMap.put("systems.kafka.samza.factory", "org.apache.samza.system.MockSystemFactory"); configMap.put("samza.cluster-manager.factory", "org.apache.samza.clustermanager.MockClusterResourceManagerFactory"); configMap.put("job.coordinator.monitor-partition-change.frequency.ms", "1"); MockSystemFactory.MSG_QUEUES.put(new SystemStreamPartition("kafka", "topic1", new Partition(0)), new ArrayList<>()); }
Source:
private void testFailureCases() { FeedbackResponseCommentAttributes feedbackResponseComment = getCommentFromInstructor1(); assertNotNull("response comment not found", feedbackResponseComment); InstructorAttributes instructor = dataBundle.instructors.get("instructor1InCourse1"); gaeSimulation.loginAsInstructor(instructor.googleId); ______TS("Unsuccessful case: not enough parameters"); verifyAssumptionFailure(); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment to first response", Const.ParamsNames.USER_ID, instructor.googleId }; verifyAssumptionFailure(submissionParams); ______TS("Non-existent feedback response comment: fails silently"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, "123123123123123", }; AjaxResult result = getAjaxResult(getAction(submissionParams)); FeedbackResponseCommentAjaxPageData data = (FeedbackResponseCommentAjaxPageData) result.data; assertFalse(data.isError); assertEquals("", result.getStatusMessage()); }

Target:
public void testFailureCases() { FeedbackResponseCommentAttributes feedbackResponseComment = getCommentFromInstructor1AsFeedbackParticipant(); assertNotNull("response comment not found", feedbackResponseComment); InstructorAttributes instructor = dataBundle.instructors.get("instructor1InCourse1"); gaeSimulation.loginAsInstructor(instructor.googleId); ______TS("Unsuccessful case: not enough parameters"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, }; verifyAssumptionFailure(); verifyAssumptionFailure(submissionParams); ______TS("Non-existent feedback response comment: fails silently"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, "123123123123123", }; AjaxResult result = getAjaxResult(getAction(submissionParams)); FeedbackResponseCommentAjaxPageData data = (FeedbackResponseCommentAjaxPageData) result.data; assertFalse(data.isError); assertEquals("", result.getStatusMessage()); }
Source:
public void onReceive(final Context context, final Intent intent) { final Intent redirect; Log.i(LOGTAG, "Got intent " + intent.getAction()); if (intent.getAction().equals(ACTION_LAUNCH_BROWSER)) { redirect = buildRedirectIntent(Intent.ACTION_MAIN, AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS_NAME, intent); Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, TelemetryContract.Method.WIDGET, "launch-browser"); } else if (intent.getAction().equals(ACTION_LAUNCH_NEW_TAB)) { redirect = buildRedirectIntent(Intent.ACTION_VIEW, AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS_NAME, intent); Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, TelemetryContract.Method.WIDGET, "launch-new-tab"); } else if (intent.getAction().equals(ACTION_LAUNCH_SEARCH)) { redirect = buildRedirectIntent(Intent.ACTION_VIEW, AppConstants.SEARCH_PACKAGE_NAME, AppConstants.SEARCH_INTENT_CLASS_NAME, intent); Telemetry.sendUIEvent(TelemetryContract.Event.SEARCH, TelemetryContract.Method.WIDGET, "launch-search"); } else { redirect = null; } if (redirect != null) { try { context.startActivity(redirect); } catch(Exception ex) { Intent redirect2 = buildRedirectIntent(Intent.ACTION_VIEW, null, null, intent); context.startActivity(redirect2); } } super.onReceive(context, intent); }

Target:
public void onReceive(final Context context, final Intent intent) { final Intent redirect; Log.i(LOGTAG, "Got intent " + intent.getAction()); if (intent.getAction().equals(ACTION_LAUNCH_BROWSER)) { redirect = buildRedirectIntent(Intent.ACTION_MAIN, AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS_NAME, intent); Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, TelemetryContract.Method.WIDGET, "browser"); } else if (intent.getAction().equals(ACTION_LAUNCH_NEW_TAB)) { redirect = buildRedirectIntent(Intent.ACTION_VIEW, AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS_NAME, intent); Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, TelemetryContract.Method.WIDGET, "new-tab"); } else if (intent.getAction().equals(ACTION_LAUNCH_SEARCH)) { redirect = buildRedirectIntent(Intent.ACTION_VIEW, AppConstants.SEARCH_PACKAGE_NAME, AppConstants.SEARCH_INTENT_CLASS_NAME, intent); Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, TelemetryContract.Method.WIDGET, "search"); } else { redirect = null; } if (redirect != null) { try { context.startActivity(redirect); } catch(Exception ex) { Intent redirect2 = buildRedirectIntent(Intent.ACTION_VIEW, null, null, intent); context.startActivity(redirect2); } } super.onReceive(context, intent); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initWhatsNew(); configureDrawer(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initWhatsNew(); addClickListenerOnProfileButton(); }
Source:
private int compareTo( ServerVersion o ) { if ( !product.equals( o.product ) ) { throw new IllegalArgumentException("Comparing different products"); } int c = compare( major, o.major ); if (c == 0) { c = compare( minor, o.minor ); if (c == 0) { c = compare( patch, o.patch ); } } return c; }

Target:
private int compareTo( ServerVersion o ) { if ( !product.equals( o.product ) ) { throw new IllegalArgumentException( "Comparing different products '" + product + "' with '" + o.product + "'" ); } int c = compare( major, o.major ); if (c == 0) { c = compare( minor, o.minor ); if (c == 0) { c = compare( patch, o.patch ); } } return c; }
Source:
public static List<ItemStack> modifyLoot(List<ItemStack> list, LootContext context) { LootModifierManager man = LootModifierManager.getInstance(); for(IGlobalLootModifier mod : man.getAllLootMods()) { list = mod.apply(list, context); } return list; }

Target:
public static List<ItemStack> modifyLoot(List<ItemStack> list, LootContext context) { LootModifierManager man = context.getWorld().getServer().getLootModifierManager(); for(IGlobalLootModifier mod : man.getAllLootMods()) { list = mod.apply(list, context); } return list; }
Source:
public Tenor visitCouponIborAverageDefinition(CouponIborAverageIndexDefinition payment) { return null; }

Target:
public Set<Tenor> visitCouponIborAverageDefinition(CouponIborAverageIndexDefinition payment) { return Sets.newHashSet(Tenor.of(payment.getIndex1().getTenor()), Tenor.of(payment.getIndex2().getTenor())); }
Source:
public void visit(ClazzNode clazzNode) { scope = clazzNode.getScope(); cn = clazzNode; blockCount = 0; cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES + ClassWriter.COMPUTE_MAXS); cw.visit(52, ACC_PUBLIC + ACC_SUPER, clazzNode.getName(), null, clazzNode.getSuperclass(), null); cw.visitInnerClass("org/twnc/runtime/BObject", "org/twnc/runtime/Core", "BObject", ACC_PUBLIC + ACC_STATIC); for (VarDeclNode decl : scope.values()) { System.out.println("Declaring field: " + decl.getName()); FieldVisitor fv = cw.visitField(ACC_PUBLIC, decl.getName(), "Lorg/twnc/runtime/BObject;", null, null); fv.visitEnd(); } mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getSuperclass(), "<init>", "()V", false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); if (clazzNode.hasMain()) { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, clazzNode.getName()); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getName(), "<init>", "()V", false); mv.visitMethodInsn(INVOKEVIRTUAL, clazzNode.getName(), "_main", "()Lorg/twnc/runtime/BObject;", false); mv.visitInsn(POP); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } super.visit(clazzNode); cw.visitEnd(); String path = outDir + clazzNode.getName() + ".class"; try (OutputStream out = new FileOutputStream(path)) { out.write(cw.toByteArray()); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void visit(ClazzNode clazzNode) { scope = clazzNode.getScope(); cn = clazzNode; blockCount = 0; cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES + ClassWriter.COMPUTE_MAXS); cw.visit(52, ACC_PUBLIC + ACC_SUPER, clazzNode.getName(), null, clazzNode.getSuperclass(), null); cw.visitInnerClass("org/twnc/runtime/BObject", "org/twnc/runtime/Core", "BObject", ACC_PUBLIC + ACC_STATIC); for (VarDeclNode decl : scope.values()) { FieldVisitor fv = cw.visitField(ACC_PUBLIC, decl.getName(), "Lorg/twnc/runtime/BObject;", null, null); fv.visitEnd(); } mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getSuperclass(), "<init>", "()V", false); visit(clazzNode.getDecls()); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); if (clazzNode.hasMain()) { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, clazzNode.getName()); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getName(), "<init>", "()V", false); mv.visitMethodInsn(INVOKEVIRTUAL, clazzNode.getName(), "_main", "()Lorg/twnc/runtime/BObject;", false); mv.visitInsn(POP); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } clazzNode.getMethods().forEach(x -> visit(x)); cw.visitEnd(); String path = outDir + clazzNode.getName() + ".class"; try (OutputStream out = new FileOutputStream(path)) { out.write(cw.toByteArray()); } catch (IOException e) { e.printStackTrace(); } }
Source:
public void mergeInventory(final List<Trackable> newTrackables) { if (inventory != null) { for (final Iterator<Trackable> iterator = inventory.iterator(); iterator.hasNext(); ) { final Trackable trackable = iterator.next(); Boolean removeTrackable = true; Boolean hasBrand = false; for (final Trackable newTrackable : newTrackables) { if (trackable.getBrand() == newTrackable.getBrand()) { hasBrand = true; if (trackable.getUniqueID().equals(newTrackable.getUniqueID())) { removeTrackable = false; break; } } } if (hasBrand && removeTrackable) { iterator.remove(); } } } for (final Trackable newTrackable : newTrackables) { addInventoryItem(newTrackable); } inventoryItems = inventory != null ? inventory.size() : 0; }

Target:
public void mergeInventory(final List<Trackable> newTrackables) { if (inventory != null) { final Iterator<Trackable> iterator = inventory.iterator(); while (iterator.hasNext()) { final Trackable trackable = iterator.next(); Boolean removeTrackable = true; Boolean hasBrand = false; for (final Trackable newTrackable : newTrackables) { if (trackable.getBrand() == newTrackable.getBrand()) { hasBrand = true; if (trackable.getUniqueID().equals(newTrackable.getUniqueID())) { removeTrackable = false; break; } } } if (hasBrand && removeTrackable) { iterator.remove(); } } } for (final Trackable newTrackable : newTrackables) { addInventoryItem(newTrackable); } inventoryItems = CollectionUtils.size(inventory); }
Source:
public Map<Cell, byte[]> get(TableReference tableRef, Set<Cell> cells) { try { return super.getAsync(tableRef, cells).get(); } catch (InterruptedException | ExecutionException e) { throw Throwables.rewrapAndThrowUncheckedException(e.getCause()); } }

Target:
public Map<Cell, byte[]> get(TableReference tableRef, Set<Cell> cells) { try { return super.getAsync(tableRef, cells).get(); } catch (InterruptedException e) { throw Throwables.rewrapAndThrowUncheckedException(e); } catch (ExecutionException e) { throw Throwables.rewrapAndThrowUncheckedException(e.getCause()); } }
Source:
public static Dictionary<String, Object> configureMetacardValidityFilterPlugin( List<String> securityAttributeMappings, boolean filterErrors, boolean filterWarnings, AdminConfig configAdmin) throws IOException { Dictionary<String, Object> properties = new DictionaryMap<>(); properties.put("attributeMap", securityAttributeMappings); properties.put("filterErrors", String.valueOf(filterErrors)); properties.put("filterWarnings", String.valueOf(filterWarnings)); return configureMetacardValidityFilterPlugin(properties, configAdmin); }

Target:
public static Dictionary<String, Object> configureMetacardValidityFilterPlugin( List<String> securityAttributeMappings, boolean filterErrors, boolean filterWarnings, AdminConfig configAdmin) throws IOException { Dictionary<String, Object> properties = new DictionaryMap<>(); properties.put("attributeMap", securityAttributeMappings); properties.put("filterErrors", filterErrors); properties.put("filterWarnings", filterWarnings); return configureMetacardValidityFilterPlugin(properties, configAdmin); }
Source:
public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) { if (!globalSettings.isAutoTrigger()) { return; } Module m = ModuleUtil.findModuleForFile(file, myProject); if (m == null || !SonarLintUtils.shouldAnalyzeAutomatically(file, m)) { return; } analyzer.submitAsync(m, Collections.singleton(file), TriggerType.EDITOR_OPEN); serverIssueUpdater.trackServerIssues(Collections.singleton(file)); }

Target:
public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) { if (!globalSettings.isAutoTrigger()) { return; } Module m = ModuleUtil.findModuleForFile(file, myProject); if (m == null || !SonarLintUtils.shouldAnalyzeAutomatically(file, m)) { return; } analyzer.submitAsync(m, Collections.singleton(file), TriggerType.EDITOR_OPEN); }
Source:
private void runPlugins(BPMN4ToscaPlan plan, AbstractActivity abstractActivity) { if (abstractActivity instanceof ANodeTemplateActivity) { AbstractNodeTemplate nodeTemplate = ((ANodeTemplateActivity) abstractActivity).getNodeTemplate(); LOGGER.debug("Trying to handle NodeTemplate " + nodeTemplate.getId()); IPlanBuilderTypePlugin plugin = this.findTypePlugin(nodeTemplate); if (plugin == null) { } else { LOGGER.info("Handling NodeTemplate with generic plugin", nodeTemplate.getId()); plugin.handle(plan.getElements(), nodeTemplate); } for (IPlanBuilderPostPhasePlugin postPhasePlugin : PluginRegistry.getPostPlugins()) { if (postPhasePlugin.canHandle(nodeTemplate)) { } } } else { } }

Target:
private void runPlugins(BPMN4ToscaPlan plan, AbstractActivity abstractActivity) { if (abstractActivity instanceof ANodeTemplateActivity) { AbstractNodeTemplate nodeTemplate = ((ANodeTemplateActivity) abstractActivity).getNodeTemplate(); LOGGER.debug("Trying to handle NodeTemplate " + nodeTemplate.getId()); IPlanBuilderTypePlugin plugin = this.findTypePlugin(nodeTemplate); if (plugin != null) { LOGGER.info("Handling NodeTemplate with plugin {}", nodeTemplate.getId(), plugin.getID()); plugin.handle(plan.getElements(), nodeTemplate); } else { LOGGER.warn("No Plugins for NodeTemplate {}", nodeTemplate.getId()); } for (IPlanBuilderPostPhasePlugin postPhasePlugin : PluginRegistry.getPostPlugins()) { if (postPhasePlugin.canHandle(nodeTemplate)) { } } } else { } }
Source:
public static NodeList getNodeList(Node contextNode, String xPath) throws Exception { XPathFactory factory = XPathFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile(xPath); NodeList result = (NodeList) expr.evaluate(contextNode, XPathConstants.NODESET); return result; }

Target:
public static NodeList getNodeList(Node contextNode, String xPath) throws Exception { XPathFactory factory = XPathFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile(xPath); return (NodeList) expr.evaluate(contextNode, XPathConstants.NODESET); }
Source:
public FrameDesc findFrameDesc(byte[] buf, int off, int len) { RawPacket pkt = new RawPacket(buf, off, len); return findFrameDesc(pkt.getSSRCAsLong(), pkt.getTimestamp()); }

Target:
public FrameDesc findFrameDesc(byte[] buf, int off, int len) { return findFrameDesc( RawPacket.getSSRCAsLong(buf, off, len), RawPacket.getTimestamp(buf, off, len)); }
Source:
private void assertBlobIdFieldValues(BlobId blobId, BlobId.BlobIdType type, byte datacenterId, short accountId, short containerId, PartitionId partitionId, boolean isEncrypted) throws IOException { assertEquals("Wrong partition id in blobId: " + blobId, partitionId, blobId.getPartition()); assertEquals("Wrong type in blobId: " + blobId, type, blobId.getType()); assertEquals("Wrong datacenter id in blobId: " + blobId, datacenterId, blobId.getDatacenterId()); assertEquals("Wrong account id in blobId: " + blobId, accountId, blobId.getAccountId()); assertEquals("Wrong container id in blobId: " + blobId, containerId, blobId.getContainerId()); assertEquals("Wrong isEncrypted value in blobId: " + blobId, isEncrypted, blobId.isEncrypted()); Pair<Short, Short> accountAndContainer = BlobId.getAccountAndContainerIds(blobId.getID()); assertEquals("Account id from the id string should be the same as the associated account id", blobId.getAccountId(), (short) accountAndContainer.getFirst()); assertEquals("Container id from the id string should be the same as the associated container id", blobId.getContainerId(), (short) accountAndContainer.getSecond()); }

Target:
private void assertBlobIdFieldValues(BlobId blobId, BlobId.BlobIdType type, byte datacenterId, short accountId, short containerId, PartitionId partitionId, boolean isEncrypted) throws IOException { assertEquals("Wrong partition id in blobId: " + blobId, partitionId, blobId.getPartition()); assertEquals("Wrong type in blobId: " + blobId, type, blobId.getType()); assertEquals("Wrong datacenter id in blobId: " + blobId, datacenterId, blobId.getDatacenterId()); assertEquals("Wrong account id in blobId: " + blobId, accountId, blobId.getAccountId()); assertEquals("Wrong container id in blobId: " + blobId, containerId, blobId.getContainerId()); assertEquals("Wrong isEncrypted value in blobId: " + blobId, isEncrypted, blobId.isEncrypted()); }
Source:
public static long greatestCommonDivisor(long a, long b) { while (b != 0) { a = b; b = a % b; } return a; }

Target:
public static long greatestCommonDivisor(long a, long b) { while (b != 0) { long c = b; b = a % b; a = c; } return a; }
Source:
public static String getTag(Class<?> clazz) { return clazz.getSimpleName().substring(0, 23); }

Target:
public static String getTag(Class<?> clazz) { String className = clazz.getSimpleName(); return className.substring(0, Math.min(23, className.length())); }
Source:
default void setMateUnmapped(final boolean mateUnmapped) { addFlag(SAMFlag.MATE_UNMAPPED, mateUnmapped); }

Target:
default void setMateUnmapped(final boolean mateUnmapped) { setFlag(SAMFlag.MATE_UNMAPPED, mateUnmapped); }
Source:
public List<String> getMasters(TajoConf conf) throws ServiceTrackerException { return null; }

Target:
public List<String> getMasters(TajoConf conf) throws ServiceTrackerException { return new ArrayList<String>(); }
Source:
@FromJson public AnInterface read(JsonReader jsonReader) throws IOException { jsonReader.beginObject(); String name = null; while (jsonReader.peek() != JsonReader.Token.END_OBJECT) { switch (jsonReader.nextName()) { case "name": name = jsonReader.nextString(); break; } } jsonReader.endObject(); return new AnImplementation(name); }

Target:
@FromJson public AnInterface read(JsonReader jsonReader) throws IOException { jsonReader.beginObject(); String name = null; while (jsonReader.hasNext()) { switch (jsonReader.nextName()) { case "name": name = jsonReader.nextString(); break; } } jsonReader.endObject(); return new AnImplementation(name); }
Source:
public synchronized RegisteredProject removeType(String wsPath, String type) throws ConflictException, NotFoundException, ServerException, BadRequestException, ForbiddenException { RegisteredProject project = projectConfigRegistry.getOrNull(wsPath); if (project == null) throw new NotFoundException("Can't find project"); List<String> mixins = project.getMixins(); if (mixins.contains(type)) { mixins.remove(type); NewProjectConfigImpl projectConfig = new NewProjectConfigImpl( project.getPath(), project.getType(), mixins, project.getName(), project.getDescription(), project.getAttributes(), null, project.getSource()); projectConfigRegistry.put(projectConfig, true, false); return projectConfigRegistry.getOrNull(wsPath); } if (project.getType().equals(type) && !project.isDetected()) { NewProjectConfigImpl projectConfig = new NewProjectConfigImpl( project.getPath(), BaseProjectType.ID, project.getMixins(), project.getName(), project.getDescription(), project.getAttributes(), null, project.getSource()); projectConfigRegistry.put(projectConfig, true, false); return projectConfigRegistry.getOrNull(wsPath); } if (project.getType().equals(type) && project.isDetected()) { return projectConfigRegistry.removeOrNull(project.getPath()); } return project; }

Target:
public synchronized RegisteredProject removeType(String wsPath, String type) throws ConflictException, NotFoundException, ServerException, BadRequestException, ForbiddenException { RegisteredProject project = projectConfigRegistry .get(wsPath) .orElseThrow(() -> new NotFoundException("Can't find project")); List<String> mixins = project.getMixins(); if (mixins.contains(type)) { mixins.remove(type); NewProjectConfigImpl projectConfig = new NewProjectConfigImpl( project.getPath(), project.getType(), mixins, project.getName(), project.getDescription(), project.getAttributes(), null, project.getSource()); projectConfigRegistry.put(projectConfig, true, false); return projectConfigRegistry.getOrNull(wsPath); } if (project.getType().equals(type) && !project.isDetected()) { NewProjectConfigImpl projectConfig = new NewProjectConfigImpl( project.getPath(), BaseProjectType.ID, project.getMixins(), project.getName(), project.getDescription(), project.getAttributes(), null, project.getSource()); projectConfigRegistry.put(projectConfig, true, false); return projectConfigRegistry.getOrNull(wsPath); } if (project.getType().equals(type) && project.isDetected()) { return projectConfigRegistry.removeOrNull(project.getPath()); } return project; }
Source:
private double getRequiredSizeForMerge(SubchainInfo subchain) { DiskImage baseSnapshot = subchain.getBaseImage(); DiskImage topSnapshot = subchain.getTopImage(); if (baseSnapshot.getVolumeFormat() == VolumeFormat.RAW) { if (storageDomain.getStorageType().isBlockDomain()) { return 0; } else { return Math.min(topSnapshot.getActualSizeInBytes() / StorageConstants.QCOW_OVERHEAD_FACTOR, baseSnapshot.getSize() - baseSnapshot.getActualSizeInBytes()); } } return Math.min(topSnapshot.getSize() * StorageConstants.QCOW_OVERHEAD_FACTOR - baseSnapshot.getActualSizeInBytes(), topSnapshot.getActualSizeInBytes()); }

Target:
private double getRequiredSizeForMerge(SubchainInfo subchain) { DiskImage baseSnapshot = subchain.getBaseImage(); DiskImage topSnapshot = subchain.getTopImage(); if (baseSnapshot.getVolumeFormat() == VolumeFormat.RAW) { if (storageDomain.getStorageType().isBlockDomain()) { return 0; } else { return Math.min(topSnapshot.getActualSizeInBytes() / StorageConstants.QCOW_OVERHEAD_FACTOR, baseSnapshot.getSize() - baseSnapshot.getActualSizeInBytes()); } } double requiredExtendSize = Math.min(topSnapshot.getSize() * StorageConstants.QCOW_OVERHEAD_FACTOR - baseSnapshot.getActualSizeInBytes(), topSnapshot.getActualSizeInBytes()); return requiredExtendSize; }
Source:
protected void onRestoreInstanceState(@NonNull Bundle savedState) { super.onRestoreInstanceState(savedState); Serializable serializable = savedState.getSerializable(INFO_KEY); if (serializable instanceof ChannelInfo) { currentInfo = (ChannelInfo) serializable; InfoCache.getInstance().putInfo(serviceId, url, currentInfo, InfoItem.InfoType.CHANNEL); } serializable = savedState.getSerializable(STACK_KEY); if (serializable instanceof Collection) { stack.addAll((Collection<? extends StackItem>) serializable); } }

Target:
protected void onRestoreInstanceState(@NonNull Bundle savedState) { super.onRestoreInstanceState(savedState); Serializable serializable = savedState.getSerializable(INFO_KEY); if (serializable instanceof ChannelInfo) { currentInfo = (ChannelInfo) serializable; InfoCache.getInstance().putInfo(serviceId, url, currentInfo, InfoItem.InfoType.CHANNEL); } }
Source:
boolean isConnectionSuccessful(HttpURLConnection conn) { try { int responseCode = conn.getResponseCode(); boolean success = isConnectionSuccessful(responseCode); if (!success && LOG.isDebugEnabled()) { String response; try { InputStream in = conn.getErrorStream(); if (in == null) { in = conn.getInputStream(); } try (Reader reader = new InputStreamReader(in)) { response = CharStreams.toString(reader); } } catch (Exception e) { response = "failed to ready response: " + e.getMessage(); } LOG.debug( "Server check for '{}' request failed with code {}. Response: {}", serverRef, responseCode, response); } return success; } catch (IOException e) { LOG.debug( "Failed to establish http connection to check server '{}'. Cause: {}", serverRef, e.getMessage()); return false; } }

Target:
boolean isConnectionSuccessful(HttpURLConnection conn) { try { int responseCode = conn.getResponseCode(); boolean success = isConnectionSuccessful(responseCode); if (!success && LOG.isDebugEnabled()) { String response; try { InputStream in = conn.getErrorStream(); if (in == null) { in = conn.getInputStream(); } try (Reader reader = new InputStreamReader(in)) { response = CharStreams.toString(reader); } } catch (Exception e) { response = "failed to ready response: " + e.getMessage(); } LOG.debug( "Server check for '{}:{}' request failed with code {}. Response: {}", serverRef, url, responseCode, response); } return success; } catch (IOException e) { LOG.debug( "Failed to establish http connection to check server '{}:{}'. Cause: {}", serverRef, url, e.getMessage()); return false; } }