auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setData() { LineData data = new LineData(); if (graphCheckboxGlucose.isChecked()) { data = generateGlucoseData(); } if (graphCheckboxA1c.isChecked()) { data = generateA1cData(); } if (graphCheckboxKetones.isChecked()) { data = generateKetonesData(); } if (graphCheckboxWeight.isChecked()) { data = generateWeightData(); } if (graphCheckboxPressure.isChecked()) { data = generatePressureData(); } if (graphCheckboxCholesterol.isChecked()) { data = generateCholesterolData(); } if (data.getEntryCount()!=0) { chart.setData(data); } else { chart.setData(null); } <START> Log.e("glucosio", "DATA2 is " + data.getEntryCount()); <END> chart.setPinchZoom(true); chart.setHardwareAccelerationEnabled(true); chart.setNoDataTextColor(getResources().getColor(R.color.glucosio_text)); chart.animateY(1000, Easing.EasingOption.EaseOutCubic); chart.invalidate(); chart.notifyDataSetChanged(); chart.fitScreen(); chart.setDescription(null); chart.setVisibleXRangeMaximum(20); chart.moveViewToX(data.getXMax()); Log.e("glucosio", "Size is: " + xValues.size()); XAxis xAxis = chart.getXAxis(); xAxis.setValueFormatter(null); final LineData finalData = data; IAxisValueFormatter formatter = new IAxisValueFormatter() { @Override public String getFormattedValue(float value, AxisBase axis) { Log.e("glucosio", "Values is " + value + "; Size is: " + xValues.size()); if (value < xValues.size() && value > 0) { return xValues.get((int) value); } else { return ""; } } }; xAxis.setGranularity(1f); xAxis.setValueFormatter(formatter); }</code><technical_language>log error</technical_language>

Target:
private void setData() { LineData data = new LineData(); if (graphCheckboxGlucose.isChecked()) { data = generateGlucoseData(); } if (graphCheckboxA1c.isChecked()) { data = generateA1cData(); } if (graphCheckboxKetones.isChecked()) { data = generateKetonesData(); } if (graphCheckboxWeight.isChecked()) { data = generateWeightData(); } if (graphCheckboxPressure.isChecked()) { data = generatePressureData(); } if (graphCheckboxCholesterol.isChecked()) { data = generateCholesterolData(); } if (data.getEntryCount()!=0) { chart.setData(data); } else { chart.setData(null); } chart.setPinchZoom(true); chart.setHardwareAccelerationEnabled(true); chart.setNoDataTextColor(getResources().getColor(R.color.glucosio_text)); chart.animateY(1000, Easing.EasingOption.EaseOutCubic); chart.invalidate(); chart.notifyDataSetChanged(); chart.fitScreen(); chart.setDescription(null); chart.setVisibleXRangeMaximum(20); chart.moveViewToX(data.getXMax()); XAxis xAxis = chart.getXAxis(); final LineData finalData = data; IAxisValueFormatter formatter = new IAxisValueFormatter() { @Override public String getFormattedValue(float value, AxisBase axis) { if (value < xValues.size() && value > 0) { return xValues.get((int) value); } else { return ""; } } }; xAxis.setGranularity(1f); xAxis.setValueFormatter(formatter); }
Source:
<code>public void addClickHandler(ClickHandler clickHandler) { <START> tabListItem.addClickHandler(clickHandler); <END> }</code><technical_language>this return handler registration object allow destroying handler</technical_language>

Target:
public HandlerRegistration addClickHandler(ClickHandler clickHandler) { return tabListItem.addClickHandler(clickHandler); }
Source:
<code>@Override public Object call() throws Exception { List<Thread> threadList = new ArrayList<>(); final CyclicBarrier b1 = new CyclicBarrier(4); final CyclicBarrier b2 = new CyclicBarrier(5); for (int i = 0; i < 4; i++) { final int ii = i; Thread thread = new Thread(new Runnable() { @Override public void run() { try { b1.await(); if (ii % 2 == 0) <START> ign.configuration().getMarshaller().unmarshal(one, Thread.currentThread().getContextClassLoader()); <END> else ign.configuration().getMarshaller().unmarshal(two, Thread.currentThread().getContextClassLoader()); b2.await(); } catch (Exception e) { e.printStackTrace(); } } }); thread.start(); threadList.add(thread); } try { b2.await(5, TimeUnit.SECONDS); } catch (TimeoutException te) { throw new IllegalStateException("Failed to wait for completion", te); } for (Thread thread : threadList) thread.join(); return null; }</code><technical_language>Is a reason Thread.currentThread().getContextClassLoader() here? Generally, supposed thread's context class loader set it. is useful code is loaded class loader load target class want use. want download a class "whatever current class loader is", this.getClass().getClassLoader()</technical_language>

Target:
@Override public Object call() throws Exception { ExecutorService executor = Executors.newFixedThreadPool(2); final CyclicBarrier start = new CyclicBarrier(2); for (int i = 0; i < 2; i++) { final int ii = i; executor.execute(new Runnable() { @Override public void run() { try { start.await(); if (ii == 0) ign.configuration().getMarshaller().unmarshal(one, null); else ign.configuration().getMarshaller().unmarshal(two, null); } catch (Exception e) { e.printStackTrace(); } } }); } try { executor.shutdown(); executor.awaitTermination(5, TimeUnit.SECONDS); if (!executor.isTerminated()) throw new IllegalStateException("Failed to wait for completion"); } catch (Exception te) { throw new IllegalStateException("Failed to wait for completion", te); } return null; }
Source:
<code>public void loadMethod( ScriptBasedSessionManagementMethod method, String scriptName, List<String> paramValuesS) { if (scriptName != null) { ScriptWrapper script = getScriptsExtension().getScript(scriptName); if (script == null) { log.error( "Unable to find script while loading Script Based Session Management Method for name: " + scriptName); if (View.isInitialised()) { View.getSingleton() .showMessageDialog( Constant.messages.getString( "session.method.script.load.errorScriptNotFound", scriptName)); } return; } log.info("Loaded script:" + script.getName()); method.script = script; <START> SessionScript s = getScriptInterface(script); <END> if (s == null) { log.error( "Unable to load Script Based Session Management method. The script " + scriptName + " does not properly implement the Session Management Script interface."); return; } } Map<String, String> paramValues = null; if (paramValuesS != null && paramValuesS.size() > 0) { paramValues = EncodingUtils.stringToMap(paramValuesS.get(0)); method.paramValues = paramValues; } else { method.paramValues = new HashMap<String, String>(); log.error( "Unable to load script parameter values loading Script Based Session Management Method for name: " + scriptName); } }</code><technical_language>@Override</technical_language>

Target:
private void loadMethod( ScriptBasedSessionManagementMethod method, String scriptName, List<String> paramValuesS) { if (scriptName != null) { ScriptWrapper script = getScriptsExtension().getScript(scriptName); if (script == null) { LOG.error( "Unable to find script while loading Script Based Session Management Method for name: " + scriptName); if (View.isInitialised()) { View.getSingleton() .showMessageDialog( Constant.messages.getString( "session.method.script.load.errorScriptNotFound", scriptName)); } return; } LOG.info("Loaded script:" + script.getName()); method.script = script; SessionScript s = getScriptInterface(script); if (s == null) { LOG.error( "Unable to load Script Based Session Management method. The script " + scriptName + " does not properly implement the Session Management Script interface."); return; } } Map<String, String> paramValues = null; if (paramValuesS != null && paramValuesS.size() > 0) { paramValues = EncodingUtils.stringToMap(paramValuesS.get(0)); method.paramValues = paramValues; } else { method.paramValues = new HashMap<String, String>(); LOG.error( "Unable to load script parameter values loading Script Based Session Management Method for name: " + scriptName); } }
Source:
<code>public <T extends Enum> Converter<String, T> getConverter(Class<T> targetType) { Class<?> enumType = targetType; while (enumType != null && !enumType.isEnum()) { enumType = enumType.getSuperclass(); } <START> Assert.notNull(enumType, "The target type " + targetType.getName() <END> + " does not refer to an enum"); return new StringToEnum(enumType); }</code><technical_language>This throw a null pointer exception if targetType is null</technical_language>

Target:
public <T extends Enum> Converter<String, T> getConverter(Class<T> targetType) { Assert.notNull(targetType, "The target type must not be null."); Class<?> enumType = targetType; while (enumType != null && !enumType.isEnum()) { enumType = enumType.getSuperclass(); } Assert.notNull(enumType, "The target type " + targetType.getName() + " does not refer to an enum"); return new StringToEnum(enumType); }
Source:
<code>default void startLogcatBroadcast() { <START> URL remoteAdress = ((RemoteWebDriver) this).getRemoteAddress(); <END> this.startLogcatBroadcast(remoteAdress.getHost(), remoteAdress.getPort()); }</code><technical_language>This break compatibility consider created another overriden method there, allows set host port in arguments</technical_language>

Target:
default void startLogcatBroadcast() { URL remoteAddress = ((AppiumDriver) this).getRemoteAddress(); this.startLogcatBroadcast(remoteAddress.getHost(), remoteAddress.getPort()); }
Source:
<code>private static SecurityPlan createSecurityPlan( BoltServerAddress address, Config config ) throws GeneralSecurityException, IOException { Config.EncryptionLevel encryptionLevel = config.encryptionLevel(); boolean requiresEncryption = encryptionLevel.equals( REQUIRED ); if ( requiresEncryption ) { Logger logger = config.logging().getLog( "session" ); switch ( config.trustStrategy().strategy() ) { case TRUST_ON_FIRST_USE: logger.warn( "Option `TRUST_ON_FIRST_USE` has been deprecated and will be removed in a future " + "version of the driver. Please switch to use `TRUST_ALL_CERTIFICATES` instead." ); return SecurityPlan.forTrustOnFirstUse( config.trustStrategy().certFile(), address, logger ); case TRUST_SIGNED_CERTIFICATES: logger.warn( "Option `TRUST_SIGNED_CERTIFICATE` has been deprecated and will be removed in a future " + "version of the driver. Please switch to use `TRUST_CUSTOM_CA_SIGNED_CERTIFICATES` instead." ); END OF DEPRECATED CASES <START> case TRUST_ALL_CERTIFICATES: <END> return SecurityPlan.forAllCertificates(); case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES: return SecurityPlan.forCustomCASignedCertificates( config.trustStrategy().certFile() ); case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES: return SecurityPlan.forSystemCASignedCertificates(); default: throw new ClientException( "Unknown TLS authentication strategy: " + config.trustStrategy().strategy().name() ); } } else { return insecure(); } }</code><technical_language>default TRUST_ALL for TRUST_SIGNED? more reasonable fall TRUST_CUSTOM_CA? log.warn line 233 suggests TRUST_CUSTOM_CA</technical_language>

Target:
private static SecurityPlan createSecurityPlan( BoltServerAddress address, Config config ) throws GeneralSecurityException, IOException { Config.EncryptionLevel encryptionLevel = config.encryptionLevel(); boolean requiresEncryption = encryptionLevel.equals( REQUIRED ); if ( requiresEncryption ) { Logger logger = config.logging().getLog( "session" ); switch ( config.trustStrategy().strategy() ) { case TRUST_ON_FIRST_USE: logger.warn( "Option `TRUST_ON_FIRST_USE` has been deprecated and will be removed in a future " + "version of the driver. Please switch to use `TRUST_ALL_CERTIFICATES` instead." ); return SecurityPlan.forTrustOnFirstUse( config.trustStrategy().certFile(), address, logger ); case TRUST_SIGNED_CERTIFICATES: logger.warn( "Option `TRUST_SIGNED_CERTIFICATE` has been deprecated and will be removed in a future " + "version of the driver. Please switch to use `TRUST_CUSTOM_CA_SIGNED_CERTIFICATES` instead." ); END OF DEPRECATED CASES case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES: return SecurityPlan.forCustomCASignedCertificates( config.trustStrategy().certFile() ); case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES: return SecurityPlan.forSystemCASignedCertificates(); case TRUST_ALL_CERTIFICATES: return SecurityPlan.forAllCertificates(); default: throw new ClientException( "Unknown TLS authentication strategy: " + config.trustStrategy().strategy().name() ); } } else { return insecure(); } }
Source:
<code>public void onPlaybackPaused() { setScreenOnWhilePlaying(false); try{ if(player!=null){ double current_time = player.getCurrentPosition()/AppConstants.MILLISECONDS_PER_SECOND ; environment.getAnalyticsRegistry().trackVideoPause(videoEntry.videoId, current_time, <START> videoEntry.eid, videoEntry.lmsUrl, ""); <END> } }catch(Exception e){ logger.error(e); } hideVideoSpeedPopup(); hideCCPopUp(); hideSettingsPopUp(); }</code><technical_language>pass null a parameter</technical_language>

Target:
public void onPlaybackPaused() { setScreenOnWhilePlaying(false); try{ if(player!=null){ double current_time = player.getCurrentPosition()/AppConstants.MILLISECONDS_PER_SECOND ; environment.getAnalyticsRegistry().trackVideoPause(videoEntry.videoId, current_time, videoEntry.eid, videoEntry.lmsUrl, null); } }catch(Exception e){ logger.error(e); } hideVideoSpeedPopup(); hideCCPopUp(); hideSettingsPopUp(); }
Source:
<code>public CopyNumberTriStateHiddenMarkovModel(final double eventRate, final double meanNumberOfTargetsPerEvent, final double deletionMean, final double duplicationMean, final double meanEventTargetDistance) { checkParameterRange(VALID_EVENT_RATE_RANGE, eventRate, "event rate"); <START> checkParameterRange(VALID_MEAN_NUMBER_OF_TARGETS_PER_EVENT_RANGE, meanNumberOfTargetsPerEvent, <END> "mean number of targets per event"); checkParameterRange(VALID_DELETION_CENTER_RANGE, deletionMean, "deletion mean depth coverage shift"); checkParameterRange(VALID_DUPLICATION_CENTER_RANGE, duplicationMean, "duplication mean depth coverage shift"); checkParameterRange(VALID_MEAN_INTRA_EVENT_TARGET_DISTANCE_RANGE, meanEventTargetDistance, "mean intra-event target distance"); P = eventRate; logP = Math.log(eventRate); log1Minus2P = Math.log1p(-2 * eventRate); T = meanNumberOfTargetsPerEvent; logQ = -Math.log(meanNumberOfTargetsPerEvent); log1MinusQ = Math.log1p(-Math.exp(logQ)); D = meanEventTargetDistance; invD = 1.0 / D; deletionDistribution = new NormalDistribution(deletionMean, 1); duplicationDistribution = new NormalDistribution(duplicationMean, 1); }</code><technical_language>IMO ParamUtils.isPositive(eventRate) clearer</technical_language>

Target:
public CopyNumberTriStateHiddenMarkovModel(final double eventRate, final double meanNumberOfTargetsPerEvent, final double deletionMean, final double duplicationMean, final double meanEventTargetDistance) { ParamUtils.inRange(VALID_EVENT_RATE_RANGE, eventRate, "event rate"); ParamUtils.inRange(VALID_MEAN_NUMBER_OF_TARGETS_PER_EVENT_RANGE, meanNumberOfTargetsPerEvent, "mean number of targets per event"); ParamUtils.inRange(VALID_DELETION_CENTER_RANGE, deletionMean, "deletion mean depth coverage shift"); ParamUtils.inRange(VALID_DUPLICATION_CENTER_RANGE, duplicationMean, "duplication mean depth coverage shift"); ParamUtils.inRange(VALID_MEAN_INTRA_EVENT_TARGET_DISTANCE_RANGE, meanEventTargetDistance, "mean intra-event target distance"); P = eventRate; logP = Math.log(eventRate); log1Minus2P = Math.log1p(-2 * eventRate); T = meanNumberOfTargetsPerEvent; logQ = -Math.log(meanNumberOfTargetsPerEvent); log1MinusQ = Math.log1p(-Math.exp(logQ)); D = meanEventTargetDistance; invD = 1.0 / D; emissionDistributionByState = new EnumMap<>(CopyNumberTriState.class); emissionDistributionByState.put(CopyNumberTriState.NEUTRAL, new NormalDistribution(0, NEUTRAL_DISTRIBUTION_SD)); emissionDistributionByState.put(CopyNumberTriState.DELETION, new NormalDistribution(deletionMean, DELETION_DISTRIBUTION_SD)); emissionDistributionByState.put(CopyNumberTriState.DUPLICATION, new NormalDistribution(duplicationMean, DUPLICATION_DISTRIBUTION_SD)); }
Source:
<code>public void resume() { checkRealm(); pauseDepth--; if (pauseDepth < 0) { throw new IllegalStateException( <START> "Resume has unessesarily been called too often, so that the pauseDepth is below zero."); <END> } else if (dirty && pauseDepth == 0) { scheduleUpdate(); } }</code><technical_language>I change message to: "The resume() method called more times pause()."</technical_language>

Target:
public void resume() { checkRealm(); pauseDepth--; if (pauseDepth < 0) { throw new IllegalStateException( "The resume() method was called more often than pause()."); } else if (dirty && pauseDepth == 0) { scheduleUpdate(); } }
Source:
<code>public static void logProjectDetails( String message, String user, String projectName, String projectId, String branch, int revision) { if (!Boolean.getBoolean("emfstore.logDetails")) { return; } logInfo(MessageFormat.format( "Time: {0} | Msg: {1} | User: {2} | Project Name: {3} | Project Id: {4} | Branch: {5} | Revision: {6}", dateFormat.format(new Date()), <START> message, <END> user != null ? user : "not available", projectName != null ? projectName : "not available", projectId != null ? projectId : "not available", branch != null ? branch : "not available", revision != -1 ? revision : "not available")); }</code><technical_language>if message is null</technical_language>

Target:
public static void logProjectDetails( String message, String user, String projectName, String projectId, String branch, int revision) { if (!Boolean.getBoolean("emfstore.logDetails")) { return; } logInfo(MessageFormat.format( "Time: {0} | Msg: {1} | User: {2} | Project Name: {3} | Project Id: {4} | Branch: {5} | Revision: {6}", dateFormat.format(new Date()), message != null ? message : "", user != null ? user : "not available", projectName != null ? projectName : "not available", projectId != null ? projectId : "not available", branch != null ? branch : "not available", revision != -1 ? revision : "not available")); }
Source:
<code>private int labelIndex(JsonReader reader) throws IOException { reader.beginObject(); while (reader.hasNext()) { if (reader.selectName(labelKeyOptions) == -1) { reader.skipName(); reader.skipValue(); continue; } int labelIndex = reader.selectString(labelOptions); if (labelIndex == -1 && defaultValue == null) { throw new JsonDataException("Expected one of " + labels + " for key '" + labelKey + "' but found '" + reader.nextString() + "'. Register a subtype for this label."); } reader.close(); return labelIndex; } <START> return -1; <END> }</code><technical_language>if missing label, i throw. fallback if is a for label expecting</technical_language>

Target:
private int labelIndex(JsonReader reader) throws IOException { reader.beginObject(); while (reader.hasNext()) { if (reader.selectName(labelKeyOptions) == -1) { reader.skipName(); reader.skipValue(); continue; } int labelIndex = reader.selectString(labelOptions); if (labelIndex == -1 && !defaultValueSet) { throw new JsonDataException("Expected one of " + labels + " for key '" + labelKey + "' but found '" + reader.nextString() + "'. Register a subtype for this label."); } reader.close(); return labelIndex; } throw new JsonDataException("Missing label for " + labelKey); }
Source:
<code>@Override public void onAttach(Context context) { <START> super.onAttach(context); <END> AndroidSupportInjection.inject(this); }</code><technical_language>AndroidSupportInjection.inject(this); needs super.onAttach() (per [Dagger docs](<LINK_0></technical_language>

Target:
@Override public void onAttach(Context context) { AndroidSupportInjection.inject(this); super.onAttach(context); }
Source:
<code>public ScheduleInfoResource(String scheduleName, String taskDefinitionName, Map<String, String> scheduleProperties) { <START> Assert.hasText(scheduleName, "scheduleName must not be null nor empty"); <END> Assert.hasText(taskDefinitionName, "taskDefinitionName must not be null nor empty"); Assert.notNull(scheduleProperties, "schedulerProperties must not be null."); this.scheduleName = scheduleName; this.scheduleProperties = new HashMap<>(); this.scheduleProperties.putAll(scheduleProperties); }</code><technical_language>use, instead of</technical_language>

Target:
public ScheduleInfoResource(String scheduleName, String taskDefinitionName, Map<String, String> scheduleProperties) { Assert.hasText(scheduleName, "scheduleName must not be null or empty"); Assert.hasText(taskDefinitionName, "taskDefinitionName must not be null or empty"); Assert.notNull(scheduleProperties, "schedulerProperties must not be null."); this.scheduleName = scheduleName; this.scheduleProperties.putAll(scheduleProperties); }
Source:
<code><START> protected boolean canCheckThisAnnotation(AnnotationMirror annotation) { <END> return annotationClasses.contains( annotation.getAnnotationType().asElement().toString() ); }</code><technical_language>overridden. private then</technical_language>

Target:
private boolean canCheckThisAnnotation(AnnotationMirror annotation) { return annotationClasses.contains( annotation.getAnnotationType().asElement().toString() ); }
Source:
<code>public Exercise call() throws Exception { logger.info("Checking adaptive exercises availability"); Exercise exercise = tmcServerCommunicationTaskFactory.getAdaptiveExercise().call(); if (exercise == null) { return null; } exercise.setName("AdaLovelace"); <START> exercise.setCourseName("None"); <END> byte[] zipb = tmcServerCommunicationTaskFactory.getDownloadingExerciseZipTask(exercise).call(); Progress progress = new Progress(3); extractProject(zipb, exercise, progress); return exercise; }</code><technical_language>set in general set here? set in JSON parser</technical_language>

Target:
public Exercise call() throws Exception { logger.info("Checking adaptive exercises availability"); Exercise exercise = tmcServerCommunicationTaskFactory.getAdaptiveExercise().call(); if (exercise == null) { return null; } exercise.setName("AdaLovelace"); exercise.setCourseName("None"); byte[] zipb = tmcServerCommunicationTaskFactory.getDownloadingExerciseZipTask(exercise).call(); Progress progress = new Progress(1); extractProject(zipb, exercise, progress); return exercise; }
Source:
<code>static FetchBlobRequest newFetchBlobRequest( String instanceName, List<URL> urls, Map<URI, Map<String, String>> authHeaders, com.google.common.base.Optional<Checksum> checksum, String canonicalId) { <START> FetchBlobRequest.Builder requestBuilder = <END> FetchBlobRequest.newBuilder() .setInstanceName(instanceName); for (URL url : urls) { requestBuilder.addUris(url.toString()); } if (checksum.isPresent()) { requestBuilder.addQualifiers( Qualifier.newBuilder() .setName("checksum.sri") .setValue(checksum.get().toSubresourceIntegrity()).build()); } if (!Strings.isNullOrEmpty(canonicalId)) { requestBuilder.addQualifiers( Qualifier.newBuilder() .setName("bazel.canonical_id") .setValue(canonicalId).build()); } if (!authHeaders.isEmpty()) { requestBuilder.addQualifiers( Qualifier.newBuilder() .setName("bazel.auth_headers") .setValue(authHeadersJson(authHeaders)).build()); } return requestBuilder.build(); }</code><technical_language>adding a string error message including some context helpful</technical_language>

Target:
static FetchBlobRequest newFetchBlobRequest( String instanceName, List<URL> urls, Map<URI, Map<String, String>> authHeaders, com.google.common.base.Optional<Checksum> checksum, String canonicalId) { FetchBlobRequest.Builder requestBuilder = FetchBlobRequest.newBuilder().setInstanceName(instanceName); for (URL url : urls) { requestBuilder.addUris(url.toString()); } if (checksum.isPresent()) { requestBuilder.addQualifiers( Qualifier.newBuilder() .setName(QUALIFIER_CHECKSUM_SRI) .setValue(checksum.get().toSubresourceIntegrity()) .build()); } if (!Strings.isNullOrEmpty(canonicalId)) { requestBuilder.addQualifiers( Qualifier.newBuilder().setName(QUALIFIER_CANONICAL_ID).setValue(canonicalId).build()); } if (!authHeaders.isEmpty()) { requestBuilder.addQualifiers( Qualifier.newBuilder() .setName(QUALIFIER_AUTH_HEADERS) .setValue(authHeadersJson(authHeaders)) .build()); } return requestBuilder.build(); }
Source:
<code>public void setup() throws Exception { TypeRegistry typeRegistry = new TypeRegistry(); DBI dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime()); dbi.registerMapper(new TableColumn.Mapper(typeRegistry)); dummyHandle = dbi.open(); metadataDao = dbi.onDemand(MetadataDao.class); createTablesWithRetry(dbi); dataDir = Files.createTempDir(); RaptorConnectorId connectorId = new RaptorConnectorId("test"); NodeManager nodeManager = new TestingNodeManager(); NodeSupplier nodeSupplier = nodeManager::getWorkerNodes; ShardManager shardManager = createShardManager(dbi); StorageManager storageManager = createOrcStorageManager(dbi, dataDir); <START> StorageManagerConfig config = new StorageManagerConfig().setDataDirectory(dataDir).setShardDayBoundaryTimeZone("America/Los_Angeles"); <END> connector = new RaptorConnector( new LifeCycleManager(ImmutableList.of(), null), new TestingNodeManager(), new RaptorMetadataFactory(connectorId, dbi, shardManager), new RaptorSplitManager(connectorId, nodeSupplier, shardManager, false), new RaptorPageSourceProvider(storageManager), new RaptorPageSinkProvider(storageManager, new PagesIndexPageSorter(new PagesIndex.TestingFactory(false)), new TemporalFunctionFactory(config), config), new RaptorNodePartitioningProvider(nodeSupplier), new RaptorSessionProperties(config), new RaptorTableProperties(typeRegistry), ImmutableSet.of(), dbi); }</code><technical_language>Wrap setters</technical_language>

Target:
public void setup() throws Exception { TypeRegistry typeRegistry = new TypeRegistry(); DBI dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime()); dbi.registerMapper(new TableColumn.Mapper(typeRegistry)); dummyHandle = dbi.open(); metadataDao = dbi.onDemand(MetadataDao.class); createTablesWithRetry(dbi); dataDir = Files.createTempDir(); RaptorConnectorId connectorId = new RaptorConnectorId("test"); NodeManager nodeManager = new TestingNodeManager(); NodeSupplier nodeSupplier = nodeManager::getWorkerNodes; ShardManager shardManager = createShardManager(dbi); StorageManager storageManager = createOrcStorageManager(dbi, dataDir); StorageManagerConfig config = new StorageManagerConfig(); connector = new RaptorConnector( new LifeCycleManager(ImmutableList.of(), null), new TestingNodeManager(), new RaptorMetadataFactory(connectorId, dbi, shardManager), new RaptorSplitManager(connectorId, nodeSupplier, shardManager, false), new RaptorPageSourceProvider(storageManager), new RaptorPageSinkProvider(storageManager, new PagesIndexPageSorter(new PagesIndex.TestingFactory(false)), new TemporalFunction(DateTimeZone.forID("America/Los_Angeles")), config), new RaptorNodePartitioningProvider(nodeSupplier), new RaptorSessionProperties(config), new RaptorTableProperties(typeRegistry), ImmutableSet.of(), dbi); }
Source:
<code>public boolean setMaxUploadFileSize(String maxUploadSizeString) throws SizeFormatValidationException { if (!(this.multipartConfigElement instanceof UpdatableMultipartConfigElement)) { return false; } <START> maxUploadSizeString.replaceAll("\\s+",""); <END> maxUploadSizeString = maxUploadSizeString.toUpperCase(); Long uploadSize; if(maxUploadSizeString.equals("UNLIMITED")) { uploadSize = -1l; maxUploadSizeString = maxUploadSizeString.toLowerCase(); } else { uploadSize = parseUploadSize(maxUploadSizeString); } ((UpdatableMultipartConfigElement) multipartConfigElement).setMaxFileSize(uploadSize); this.configuration.setMaxFileUploadSize(maxUploadSizeString); return true; }</code><technical_language>Result of replaceAll is ignored. Please, assign a variable. suggestion maxUploadSizeString = maxUploadSizeString.replaceAll("\\s+", "");</technical_language>

Target:
public boolean setMaxUploadFileSize(String maxUploadSizeString) throws SizeFormatValidationException { if (!(this.multipartConfigElement instanceof UpdatableMultipartConfigElement)) { return false; } maxUploadSizeString = maxUploadSizeString.replaceAll("\\s+", ""); maxUploadSizeString = maxUploadSizeString.toUpperCase(); long uploadSize; if (maxUploadSizeString.equals("UNLIMITED")) { uploadSize = -1L; maxUploadSizeString = maxUploadSizeString.toLowerCase(); } else { uploadSize = parseUploadSize(maxUploadSizeString); } ((UpdatableMultipartConfigElement) multipartConfigElement).setMaxFileSize(uploadSize); this.configuration.setMaxFileUploadSize(maxUploadSizeString); return true; }
Source:
<code>public void revealDefaultPlace() { <START> revealPlace(new PlaceRequest(NameTokens.getHome())); <END> }</code><technical_language>add false parameter entering app, end blocked in app</technical_language>

Target:
public void revealDefaultPlace() { revealPlace(new PlaceRequest(NameTokens.getHome()), false); }
Source:
<code>public void shouldAutomapAndHandleSourceAndTargetPropertyNestingAndExpresion() { FishTank source = createFishTank(); FishTankDto target = FishTankMapperExpression.INSTANCE.map( source ); assertThat( target.getFish().getName() ).isEqualTo( "Jaws" ); assertThat( target.getMaterial() ).isNull(); assertThat( target.getOrnament() ).isNull(); <START> assertThat( target.getPlant() ).isNull(); <END> assertThat( target.getQuality() ).isNotNull(); assertThat( target.getQuality().getReport() ).isNotNull(); assertThat( target.getQuality().getReport().getVerdict() ).isNull(); assertThat( target.getQuality().getReport().getOrganisation() ).isNotNull(); assertThat( target.getQuality().getReport().getOrganisation().getName() ).isEqualTo( "Dunno" ); }</code><technical_language>right. if need leave MapStruct do name based mapping</technical_language>

Target:
public void shouldAutomapAndHandleSourceAndTargetPropertyNestingAndExpresion() { FishTank source = createFishTank(); FishTankDto target = FishTankMapperExpression.INSTANCE.map( source ); assertThat( target.getFish().getName() ).isEqualTo( "Jaws" ); assertThat( target.getMaterial() ).isNull(); assertThat( target.getOrnament() ).isNull(); assertThat( target.getPlant() ).isNull(); assertThat( target.getQuality() ).isNotNull(); assertThat( target.getQuality().getReport() ).isNotNull(); assertThat( target.getQuality().getReport().getVerdict() ) .isEqualTo( source.getQuality().getReport().getVerdict() ); assertThat( target.getQuality().getReport().getOrganisation() ).isNotNull(); assertThat( target.getQuality().getReport().getOrganisation().getApproval() ).isNull(); assertThat( target.getQuality().getReport().getOrganisation().getName() ).isEqualTo( "Dunno" ); }
Source:
<code>public Observable<Response> finishActivityObservable(){ <START> return this.postSucces.compose(ResponseOrError.<Response>onlySuccess()); <END> }</code><technical_language>"this." is unecessary</technical_language>

Target:
public Observable<Object> finishActivityObservable() { return closeActivitySubject; }
Source:
<code>public void castIntToUnsighedShort() { assertEquals(1, safeCastIntToUnsignedShort( 1 )); assertEquals(10, safeCastIntToUnsignedShort( 10 )); <START> assertEquals(Short.MAX_VALUE, safeCastIntToUnsignedShort( Short.MAX_VALUE )); <END> }</code><technical_language>testing largest for unsigned short here</technical_language>

Target:
public void castIntToUnsighedShort() { assertEquals(1, safeCastIntToUnsignedShort( 1 )); assertEquals(10, safeCastIntToUnsignedShort( 10 )); assertEquals( -1, safeCastIntToUnsignedShort( (Short.MAX_VALUE << 1) + 1 ) ); }
Source:
<code>public DimensionSpec toDimensionSpec( final RowSignature rowSignature, final String outputName, <START> final ValueType outputType <END> ) { final ValueType columnType = rowSignature.getColumnType(column); if (columnType == null) { return null; } if (columnType == ValueType.STRING || (column.equals(Column.TIME_COLUMN_NAME) && extractionFn != null)) { return extractionFn == null ? new DefaultDimensionSpec(column, outputName, outputType) : new ExtractionDimensionSpec(column, outputName, outputType, extractionFn); } else if (columnType == ValueType.LONG || columnType == ValueType.FLOAT) { if (extractionFn == null) { return new DefaultDimensionSpec(column, outputName, outputType); } else { return new ExtractionDimensionSpec(column, outputName, outputType, extractionFn); } } else { return null; } }</code><technical_language>This a Preconditions.checkNotNull(outputType, "outputType") prevent bugs due accidentally forgetting pass in outputType. Callers pass in STRING if want</technical_language>

Target:
public DimensionSpec toDimensionSpec( final RowSignature rowSignature, final String outputName, final ValueType outputType ) { Preconditions.checkNotNull(outputType, "outputType"); final ValueType columnType = rowSignature.getColumnType(column); if (columnType == null) { return null; } if (columnType == ValueType.STRING || (column.equals(Column.TIME_COLUMN_NAME) && extractionFn != null)) { return extractionFn == null ? new DefaultDimensionSpec(column, outputName, outputType) : new ExtractionDimensionSpec(column, outputName, outputType, extractionFn); } else if (columnType == ValueType.LONG || columnType == ValueType.FLOAT) { if (extractionFn == null) { return new DefaultDimensionSpec(column, outputName, outputType); } else { return new ExtractionDimensionSpec(column, outputName, outputType, extractionFn); } } else { return null; } }
Source:
<code>private RepresentationDescription getRepDescription(String name) { final Collection<RepresentationDescription> descriptions = DialectManager.INSTANCE.getAvailableRepresentationDescriptions(session.getSelectedViewpoints(false), semanticModel); <START> Iterator<RepresentationDescription> it = descriptions.iterator(); while (it.hasNext()) { RepresentationDescription currentDescription = it.next(); <END> if (currentDescription.getName().equals(name)) { return currentDescription; } } return null; }</code><technical_language>a foreach simplier. line 3</technical_language>

Target:
private RepresentationDescription getRepDescription(String name) { final Collection<RepresentationDescription> descriptions = DialectManager.INSTANCE.getAvailableRepresentationDescriptions(session.getSelectedViewpoints(false), semanticModel); Optional<RepresentationDescription> description = descriptions.stream().filter(d -> d.getName().equals(name)).findFirst(); if (description.isPresent()) { return description.get(); } else { return null; } }
Source:
<code><START> public void testInputOutputArgsWithMoreParameters() throws Exception { <END> try { SpringApplication.run(TestInputOutputArgsWithMoreParameters.class, "--server.port=0"); fail("Declarative StreamListener method should throw IllegalStateException for invalid method parameters"); } catch (Exception e) { assertThat(e.getMessage()).contains("Declarative StreamListener method should only have " + "inbound or outbound targets as method parameters"); } }</code><technical_language>do test methods require throws Exception</technical_language>

Target:
public void testInputOutputArgsWithMoreParameters() { try { SpringApplication.run(TestInputOutputArgsWithMoreParameters.class, "--server.port=0"); fail("Expected exception: "+ INVALID_DECLARATIVE_METHOD_PARAMETERS); } catch (Exception e) { assertThat(e.getMessage()).contains(INVALID_DECLARATIVE_METHOD_PARAMETERS); } }
Source:
<code>public void testProjectNameInAListView() throws Exception { MockFolder myMockFolder = j.createFolder("folder"); FreeStyleProject freeStyleProject = myMockFolder.createProject(FreeStyleProject.class, "myJob"); ListView listView = new ListView("ListView", j.jenkins); listView.setRecurse(true); listView.add(myMockFolder); listView.add(freeStyleProject); j.jenkins.addView(listView); j.jenkins.setPrimaryView(listView); assertEquals(2, j.jenkins.getPrimaryView().getAllItems().size()); WebClient wc = j.createWebClient(); Page result = wc.goTo("search/suggest?query=" + freeStyleProject.getName(), "application/json"); assertNotNull(result); j.assertGoodStatus(result); String content = result.getWebResponse().getContentAsString(); <START> System.out.println(content); <END> JSONObject jsonContent = (JSONObject)JSONSerializer.toJSON(content); assertNotNull(jsonContent); JSONArray jsonArray = jsonContent.getJSONArray("suggestions"); assertNotNull(jsonArray); assertEquals(2, jsonArray.size()); Page searchResult = wc.goTo("search?q=" + myMockFolder.getName() + "%2F" + freeStyleProject.getName()); assertNotNull(searchResult); j.assertGoodStatus(searchResult); URL resultUrl = searchResult.getUrl(); assertTrue(resultUrl.toString().equals(j.getInstance().getRootUrl() + freeStyleProject.getUrl())); }</code><technical_language>leftover debug code</technical_language>

Target:
public void testProjectNameInAListView() throws Exception { MockFolder myMockFolder = j.createFolder("folder"); FreeStyleProject freeStyleProject = myMockFolder.createProject(FreeStyleProject.class, "myJob"); ListView listView = new ListView("ListView", j.jenkins); listView.setRecurse(true); listView.add(myMockFolder); listView.add(freeStyleProject); j.jenkins.addView(listView); j.jenkins.setPrimaryView(listView); assertEquals(2, j.jenkins.getPrimaryView().getAllItems().size()); WebClient wc = j.createWebClient(); Page result = wc.goTo("search/suggest?query=" + freeStyleProject.getName(), "application/json"); assertNotNull(result); j.assertGoodStatus(result); String content = result.getWebResponse().getContentAsString(); JSONObject jsonContent = (JSONObject)JSONSerializer.toJSON(content); assertNotNull(jsonContent); JSONArray jsonArray = jsonContent.getJSONArray("suggestions"); assertNotNull(jsonArray); assertEquals(2, jsonArray.size()); Page searchResult = wc.goTo("search?q=" + myMockFolder.getName() + "%2F" + freeStyleProject.getName()); assertNotNull(searchResult); j.assertGoodStatus(searchResult); URL resultUrl = searchResult.getUrl(); assertTrue(resultUrl.toString().equals(j.getInstance().getRootUrl() + freeStyleProject.getUrl())); }
Source:
<code>public AsyncPrettyPrinter getInstance(final String headerName, final String headerValue) { final MatchResult result = matchAndParseHeader(headerName, headerValue); String uri = result.getSchemaUri(); URL schemaURL = parseURL(uri); if (schemaURL == null) { return getErrorAsyncPrettyPrinter(headerName, headerValue); } else { final Future<String> response = sExecutorService.submit(new Request(schemaURL)); return new AsyncPrettyPrinter() { public void printTo(PrintWriter output, InputStream payload) throws IOException { try { String schema = response.get(); if (schema != null) { doPrint(output, payload, schema); } else { doErrorPrint( output, payload, "http get request for schema url fails to return a valid response"); } } catch (InterruptedException e) { doErrorPrint( output, payload, "Error while downloading schema for pretty printing: " + e.getMessage()); } catch (ExecutionException e) { Throwable cause = e.getCause(); ExceptionUtil.propagateIfInstanceOf(cause, IOException.class); throw ExceptionUtil.propagate(cause); } } <START> public DownloadingAsyncPrettyPrinterFactory.PrettyPrinterDisplayType getPrettifiedType() { <END> return result.getDisplayType(); } }; } }</code><technical_language>style nit: blank line methods..</technical_language>

Target:
public AsyncPrettyPrinter getInstance(final String headerName, final String headerValue) { final MatchResult result = matchAndParseHeader(headerName, headerValue); if (result == null) { return null; } String uri = result.getSchemaUri(); URL schemaURL = parseURL(uri); if (schemaURL == null) { return getErrorAsyncPrettyPrinter(headerName, headerValue); } else { final Future<String> response = sExecutorService.submit(new Request(schemaURL)); return new AsyncPrettyPrinter() { public void printTo(PrintWriter output, InputStream payload) throws IOException { try { String schema; try { schema = response.get(); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (IOException.class.isInstance(cause)) { doErrorPrint( output, payload, "Cannot successfully download schema: " + e.getMessage()); return; } else { throw e; } } doPrint(output, payload, schema); } catch (InterruptedException e) { doErrorPrint( output, payload, "Encountered spurious interrupt while downloading schema for pretty printing: " + e.getMessage()); } catch (ExecutionException e) { Throwable cause = e.getCause(); throw ExceptionUtil.propagate(cause); } } public PrettyPrinterDisplayType getPrettifiedType() { return result.getDisplayType(); } }; } }
Source:
<code>public Response pngButton(@PathParam("rule") final String rule) throws Exception { <START> GraphicsEnvironment.getLocalGraphicsEnvironment() <END> .registerFont( Font.createFont( Font.TRUETYPE_FONT, UriBuilder.fromPath("<LINK_0>") .build().toURL().openStream() ) ); final PNGTranscoder transcoder = new PNGTranscoder(); transcoder.addTranscodingHint( PNGTranscoder.KEY_WIDTH, (float) Tv.HUNDRED ); transcoder.addTranscodingHint( PNGTranscoder.KEY_HEIGHT, (float) Tv.FIFTY ); final ByteArrayOutputStream png = new ByteArrayOutputStream(); transcoder.transcode( new TranscoderInput(IOUtils.toInputStream(this.svg(rule))), new TranscoderOutput(png) ); return Response .ok(png.toByteArray(), MediaType.PNG.toString()) .build(); }</code><technical_language>call this hit page? do this in ctor</technical_language>

Target:
public Response pngButton(@PathParam("rule") final String rule) throws Exception { final PNGTranscoder transcoder = new PNGTranscoder(); transcoder.addTranscodingHint( PNGTranscoder.KEY_WIDTH, (float) Tv.HUNDRED ); transcoder.addTranscodingHint( PNGTranscoder.KEY_HEIGHT, (float) Tv.FIFTY ); final ByteArrayOutputStream png = new ByteArrayOutputStream(); transcoder.transcode( new TranscoderInput(IOUtils.toInputStream(this.svg(rule))), new TranscoderOutput(png) ); return Response .ok(png.toByteArray(), MediaType.PNG.toString()) .build(); }
Source:
<code>public boolean isAnnotationsEnabled(DocumentModel doc) { ConfigurationService cs = Framework.getService(ConfigurationService.class); <START> if (!cs.getBoolean(ConverterBasedHtmlPreviewAdapter.OLD_PREVIEW_PROPERTY, false)) { <END> return false; } BlobHolder blobHolder = doc.getAdapter(BlobHolder.class); Blob blob = blobHolder.getBlob(); if (blob == null || blob.getMimeType() == null) { return false; } return blob.getMimeType().startsWith("image") || isTextAnnotationsEnabled(); }</code><technical_language>If blank return false, returns true</technical_language>

Target:
public boolean isAnnotationsEnabled(DocumentModel doc) { ConfigurationService cs = Framework.getService(ConfigurationService.class); if (cs.isBooleanFalse(ConverterBasedHtmlPreviewAdapter.OLD_PREVIEW_PROPERTY)) { return false; } BlobHolder blobHolder = doc.getAdapter(BlobHolder.class); Blob blob = blobHolder.getBlob(); if (blob == null || blob.getMimeType() == null) { return false; } return blob.getMimeType().startsWith("image") || isTextAnnotationsEnabled(); }
Source:
<code>public void set(Object instance, String propName, Object value) throws IOException { try { if (_setter instanceof AnnotatedMethod) { ((AnnotatedMethod) _setter).getAnnotated().invoke(instance, propName, value); } else if (_setter instanceof AnnotatedField) { AnnotatedField field = ((AnnotatedField) _setter); <START> if (!Map.class.isAssignableFrom(field.getRawType())) { <END> throw new IllegalArgumentException( "Expecting a java.util.Map type in JsonAnySetter field, but got " + field.getRawType()); } Object val = field.getValue(instance); if (val == null) { val = new HashMap(); } ((Map)val).put(propName, value); field.setValue(instance, val); } } catch (Exception e) { _throwAsIOE(e, propName, value); } }</code><technical_language>I this fail earlier, construction (or introspection), point in waiting attempt is set it</technical_language>

Target:
public void set(Object instance, String propName, Object value) throws IOException { try { if (_setter instanceof AnnotatedMethod) { ((AnnotatedMethod) _setter).getAnnotated().invoke(instance, propName, value); } else if (_setter instanceof AnnotatedField) { AnnotatedField field = ((AnnotatedField) _setter); Object val = field.getValue(instance); if (val != null) { ((Map) val).put(propName, value); field.setValue(instance, val); } } } catch (Exception e) { _throwAsIOE(e, propName, value); } }
Source:
<code><START> public org.eclipse.che.plugin.docker.client.json.Actor getActor() { <END> return Actor; }</code><technical_language>explain do fqn here</technical_language>

Target:
public Actor getActor() { return actor; }
Source:
<code>public Map<String, ContextSensitiveTokenType> getAdditionalContextSensitiveKeywords() { <START> return new HashMap<String, ContextSensitiveTokenType>(); <END> }</code><technical_language>Better: Collections.emptyMap();</technical_language>

Target:
public Map<String, ContextSensitiveTokenType> getAdditionalContextSensitiveKeywords() { return Collections.emptyMap(); }
Source:
<code>void configureRequest(final HttpURLConnection conn) throws IOException { final Map<String, String> p = new HashMap<String, String>(params); p.put("username", user); final String realm = p.get("realm"); final String nonce = p.get("nonce"); final String uri = p.get("uri"); final String qop = p.get("qop"); final String method = conn.getRequestMethod(); final String A1 = user + ":" + realm + ":" + pass; final String A2 = method + ":" + uri; final String expect; if ("auth".equals(qop)) { final String c = p.get("cnonce"); <START> final String nc = String.format("%8x", ++requestCount); <END> p.put("nc", nc); expect = KD(H(A1), nonce + ":" + nc + ":" + c + ":" + qop + ":" + H(A2)); } else { expect = KD(H(A1), nonce + ":" + H(A2)); } p.put("response", expect); StringBuilder v = new StringBuilder(); for (Map.Entry<String, String> e : p.entrySet()) { if (v.length() > 0) { v.append(", "); } v.append(e.getKey()); v.append('='); v.append('"'); v.append(e.getValue()); v.append('"'); } conn.setRequestProperty(HDR_AUTHORIZATION, NAME + " " + v); }</code><technical_language>IIRC nc needs 0 padded 8 digits. is I do 8.8x</technical_language>

Target:
void configureRequest(final HttpURLConnection conn) throws IOException { final Map<String, String> p = new HashMap<String, String>(params); p.put("username", user); final String realm = p.get("realm"); final String nonce = p.get("nonce"); final String uri = p.get("uri"); final String qop = p.get("qop"); final String method = conn.getRequestMethod(); final String A1 = user + ":" + realm + ":" + pass; final String A2 = method + ":" + uri; final String expect; if ("auth".equals(qop)) { final String c = p.get("cnonce"); final String nc = String.format("%08x", ++requestCount); p.put("nc", nc); expect = KD(H(A1), nonce + ":" + nc + ":" + c + ":" + qop + ":" + H(A2)); } else { expect = KD(H(A1), nonce + ":" + H(A2)); } p.put("response", expect); StringBuilder v = new StringBuilder(); for (Map.Entry<String, String> e : p.entrySet()) { if (v.length() > 0) { v.append(", "); } v.append(e.getKey()); v.append('='); v.append('"'); v.append(e.getValue()); v.append('"'); } conn.setRequestProperty(HDR_AUTHORIZATION, NAME + " " + v); }
Source:
<code>public void stopScreencast(JsonRpcPeer peer, JSONObject params) { <START> mScreencastDispatcher.stopScreencast(); <END> mScreencastDispatcher = null; }</code><technical_language>call stopScreencast() if mScreencastDistpacher is null</technical_language>

Target:
public void stopScreencast(JsonRpcPeer peer, JSONObject params) { if (mScreencastDispatcher != null) { mScreencastDispatcher.stopScreencast(); mScreencastDispatcher = null; } }
Source:
<code>public Resource build() { if (built) throw new IllegalStateException("Resource already built"); built = true; <START> resource.setCapabilities(getCapabilities()); <END> resource.setRequirements(getRequirements()); return resource; }</code><technical_language>This creates a copy is wrapped another copy unmodifiable. ResourceBuilder is in package ResourceImpl able copy much? I.e. setX method is package private</technical_language>

Target:
public Resource build() { if (built) throw new IllegalStateException("Resource already built"); built = true; resource.setCapabilities(capabilities.values()); resource.setRequirements(requirements.values()); return resource; }