auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static ModuleIdentifier forClosure(String name) { String normalizedName = name; if (normalizedName.startsWith("goog:")) { <START> normalizedName = normalizedName.substring(5); <END> } String namespace = normalizedName; String moduleName = normalizedName; int splitPoint = normalizedName.indexOf(':'); if (splitPoint != -1) { moduleName = normalizedName.substring(0, splitPoint); namespace = normalizedName.substring(Math.min(splitPoint + 1, normalizedName.length() - 1)); } return new ModuleIdentifier(normalizedName, namespace, moduleName); }</code><technical_language>nit: "goog:".length()</technical_language>

Target:
public static ModuleIdentifier forClosure(String name) { String normalizedName = name; if (normalizedName.startsWith("goog:")) { normalizedName = normalizedName.substring("goog:".length()); } String namespace = normalizedName; String moduleName = normalizedName; int splitPoint = normalizedName.indexOf(':'); if (splitPoint != -1) { moduleName = normalizedName.substring(0, splitPoint); namespace = normalizedName.substring(Math.min(splitPoint + 1, normalizedName.length() - 1)); } return new ModuleIdentifier(normalizedName, namespace, moduleName); }
Source:
<code>public String getJsId() { <START> return "popover_" + "overlay_" + element.getMarkupId(); <END> }</code><technical_language>need of concatenation</technical_language>

Target:
public String getJsId() { return "popover_overlay_" + element.getMarkupId(); }
Source:
<code>public void testCloneWithNewJarUrlString() { RuntimeSettingProvider properties = createPropsWithDriverName("org.talend.Driver1"); JdbcRuntimeInfo jdbcRuntimeInfo = new JdbcRuntimeInfo(properties, "anyRuntimeClassName"); JdbcRuntimeInfo clone = jdbcRuntimeInfo.cloneWithNewJarUrlString("mvn: new/url"); <START> assertTrue(jdbcRuntimeInfo != clone); <END> }</code><technical_language>test is a new instance. test other rules of clone contract ? assertTrue(jdbcRuntimeInfo.equals(clone)) ? <LINK_0></technical_language>

Target:
public void testCloneWithNewJarUrlString() { RuntimeSettingProvider properties = createPropsWithDriverName("org.talend.Driver1"); JdbcRuntimeInfo jdbcRuntimeInfo = new JdbcRuntimeInfo(properties, "anyRuntimeClassName"); JdbcRuntimeInfo clone = jdbcRuntimeInfo.cloneWithNewJarUrlString("mvn: new/url"); assertTrue(jdbcRuntimeInfo != clone); assertNotEquals(jdbcRuntimeInfo, clone); assertEquals(jdbcRuntimeInfo.getDepTxtPath(), clone.getDepTxtPath()); assertEquals(jdbcRuntimeInfo.getRuntimeClassName(), clone.getRuntimeClassName()); assertNotEquals(jdbcRuntimeInfo.getJarUrl(), clone.getJarUrl()); }
Source:
<code><START> @Override public double estimateRowCount(RelMetadataQuery mq) { <END> double inputRowCount = mq.getRowCount(getInput()); int lim = intFromRex(fetch); int off = intFromRex(offset); if (lim == 0 && off == 0) return inputRowCount; if (lim == 0) return Math.max(0, inputRowCount - off); return Math.min(lim, inputRowCount - off); }</code><technical_language>0.01 is due (probably implemented yet) calculate if DYNAMIC_PARAM CALCULATED here, i need preserve here</technical_language>

Target:
@Override public double estimateRowCount(RelMetadataQuery mq) { double inputRowCount = mq.getRowCount(getInput()); double lim = fetch != null ? doubleFromRex(fetch, inputRowCount * FETCH_IS_PARAM_FACTOR) : inputRowCount; double off = offset != null ? doubleFromRex(offset, inputRowCount * OFFSET_IS_PARAM_FACTOR) : 0; return Math.min(lim, inputRowCount - off); }
Source:
<code>@Test public void nullCipherName() { try { forJavaName(null); fail("Should have thrown"); } catch (NullPointerException expected) { <START> } catch (IllegalArgumentException expected) { <END> } }</code><technical_language>Due IAE happen</technical_language>

Target:
@Test public void nullCipherName() { try { forJavaName(null); fail("Should have thrown"); } catch (NullPointerException expected) { } }
Source:
<code>public static <T> Collection<T> cloneCollection(Collection<T> source, boolean deepCopy) throws InstantiationException, IllegalAccessException { if (source == null) { return null; } Collection<T> copy; try { copy = source.getClass().newInstance(); } catch (InstantiationException e) { <START> copy = new ArrayList<T>(); <END> } if (deepCopy) { for (T object : source) { T objectCopy = clone(object); copy.add(objectCopy); } } else { copy.addAll(source); } return copy; }</code><technical_language>This is I suppose needed, if original collection a Set a Map? class instantiated</technical_language>

Target:
public static <T> Collection<T> cloneCollection(Collection<T> source, boolean deepCopy) throws InstantiationException, IllegalAccessException { if (source == null) { return null; } Collection<T> copy; try { copy = source.getClass().newInstance(); } catch (InstantiationException e) { if (source instanceof Set) { copy = new HashSet<T>(); } else { copy = new ArrayList<T>(); } } if (deepCopy) { for (T object : source) { T objectCopy = clone(object); copy.add(objectCopy); } } else { copy.addAll(source); } return copy; }
Source:
<code>public URL create() { try { return new URL(urlRepresentation); <START> } catch (MalformedURLException e) { <END> throw new DolphinRuntimeException("Can not create url for '" + urlRepresentation + "'"); } }</code><technical_language>Add final keyword</technical_language>

Target:
public URL create() { try { return new URL(urlRepresentation); } catch (final MalformedURLException e) { throw new DolphinRuntimeException("Can not create url for '" + urlRepresentation + "'"); } }
Source:
<code>protected void validate() { <START> assertNonNull(transactionManager, "The TransactionManager is a hard requirement and should be provided"); <END> assertNonNull(messageMonitor, "The MessageMonitor is a hard requirement and should be provided"); assertNonNull(rollbackConfiguration, "The RollbackConfiguration is a hard requirement and should be provided"); }</code><technical_language>This assertion is necessary. TransactionManager null</technical_language>

Target:
protected void validate() { }
Source:
<code>protected byte[] encryptString(@NonNull final Key key, @NonNull final String value, @Nullable final EncryptStringHandler handler) throws IOException, GeneralSecurityException { final Cipher cipher = Cipher.getInstance(getEncryptionTransformation()); try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) { if (null != handler) { handler.initialize(cipher, key, output); output.flush(); } try (final CipherOutputStream encrypt = new CipherOutputStream(output, cipher)) { encrypt.write(value.getBytes(UTF8)); } return output.toByteArray(); } catch (Throwable fail) { <START> Log.e(LOG_TAG, fail.getMessage(), fail); <END> throw fail; } }</code><technical_language>follow code style in this file: suggestion return SecurityLevel.SECURE_HARDWARE;</technical_language>

Target:
protected byte[] encryptString(@NonNull final Key key, @NonNull final String value, @Nullable final EncryptStringHandler handler) throws IOException, GeneralSecurityException { final Cipher cipher = getCachedInstance(); try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) { if (null != handler) { handler.initialize(cipher, key, output); output.flush(); } try (final CipherOutputStream encrypt = new CipherOutputStream(output, cipher)) { encrypt.write(value.getBytes(UTF8)); } return output.toByteArray(); } catch (Throwable fail) { Log.e(LOG_TAG, fail.getMessage(), fail); throw fail; } }
Source:
<code>public void setErrorsVisibility(boolean givenNameError, boolean familyNameError, boolean dayOfBirthError, boolean addressError, boolean countryError, boolean genderError, boolean countryNull, boolean stateError, boolean cityError, boolean postalError) { if (givenNameError) { fnameerror.setVisibility(View.VISIBLE); } else { fnameerror.setVisibility(View.INVISIBLE); } if (familyNameError) { lnameerror.setVisibility(View.VISIBLE); } else { lnameerror.setVisibility(View.INVISIBLE); } if (dayOfBirthError) { doberror.setVisibility(View.VISIBLE); dateTimeFormatter = DateTimeFormat.forPattern(DateUtils.DEFAULT_DATE_FORMAT); String minimumDate = DateTime.now().minusYears( ApplicationConstants.RegisterPatientRequirements.MAX_PATIENT_AGE) .toString(dateTimeFormatter); String maximumDate = DateTime.now().toString(dateTimeFormatter); doberror.setText(getString(R.string.dob_error, minimumDate, maximumDate)); } else { doberror.setVisibility(View.GONE); } if (addressError) { addrerror.setVisibility(View.VISIBLE); } else { addrerror.setVisibility(View.GONE); } if (countryError) { countryerror.setVisibility(View.VISIBLE); } else { countryerror.setVisibility(View.GONE); } if (genderError) { gendererror.setVisibility(View.VISIBLE); } else { gendererror.setVisibility(View.GONE); } if (countryNull) { countrynull.setVisibility(View.VISIBLE); } else { countrynull.setVisibility(View.GONE); } if (stateError) { stateerror.setVisibility(View.VISIBLE); } else { stateerror.setVisibility(View.GONE); } if (cityError) { cityerror.setVisibility(View.VISIBLE); } else { cityerror.setVisibility(View.GONE); } if (postalError) { postalerror.setVisibility(View.VISIBLE); } else { postalerror.setVisibility(View.GONE); <START> } <END> }</code><technical_language>@Asgardian8740 Turn this a function: sets a view visible if error is true</technical_language>

Target:
public void setErrorsVisibility(boolean givenNameError, boolean familyNameError, boolean dayOfBirthError, boolean addressError, boolean countryError, boolean genderError, boolean countryNull, boolean stateError, boolean cityError, boolean postalError) { setVisibility(fnameerror, givenNameError); setVisibility(lnameerror, familyNameError); setVisibility(addrerror, addressError); setVisibility(countryerror, countryError); setVisibility(gendererror, genderError); setVisibility(countrynull, countryNull); setVisibility(stateerror, stateError); setVisibility(cityerror, cityError); setVisibility(stateerror, stateError); setVisibility(postalerror, postalError); if (dayOfBirthError) { doberror.setVisibility(View.VISIBLE); dateTimeFormatter = DateTimeFormat.forPattern(DateUtils.DEFAULT_DATE_FORMAT); String minimumDate = DateTime.now().minusYears( ApplicationConstants.RegisterPatientRequirements.MAX_PATIENT_AGE) .toString(dateTimeFormatter); String maximumDate = DateTime.now().toString(dateTimeFormatter); doberror.setText(getString(R.string.dob_error, minimumDate, maximumDate)); } else { doberror.setVisibility(View.GONE); } }
Source:
<code><START> void multipleRecords() { <END> EntityRecordStorage<StgProjectId, StgProject> storage = storage(); int count = 10; List<StgProjectId> ids = new ArrayList<>(); @SuppressWarnings("rawtypes") Class<? extends EntityState> stateClass = null; for (int i = 0; i < count; i++) { StgProjectId id = newId(); EntityState<StgProjectId> state = newState(id); if (stateClass == null) { stateClass = state.getClass(); } EntityRecord record = EntityRecordStorageTestEnv.newStorageRecord(id, state); storage.write(id, record); ids.add(id); } int bulkCount = count / 2; FieldMask fieldMask = fromFieldNumbers(stateClass, 2); Iterator<EntityRecord> readRecords = storage.readAll(ids.subList(0, bulkCount), fieldMask); List<EntityRecord> readList = newArrayList(readRecords); assertThat(readList).hasSize(bulkCount); for (EntityRecord record : readList) { Message state = unpack(record.getState()); assertMatchesMask(state, fieldMask); } }</code><technical_language>Please consider refactoring this method a nested class. complicated</technical_language>

Target:
void multipleRecords() { EntityRecordStorage<StgProjectId, StgProject> storage = storage(); int recordCount = 10; ImmutableList<StgProjectId> ids = range(0, recordCount).mapToObj(i -> newId()) .collect(toImmutableList()); @SuppressWarnings("rawtypes") Class<? extends EntityState> stateClass = writeRandomRecords(storage, ids); int halfSize = recordCount / 2; List<StgProjectId> halfOfIds = ids.subList(0, halfSize); FieldMask fieldMask = fromFieldNumbers(stateClass, 2); Iterator<EntityRecord> iterator = storage.readAll(halfOfIds, fieldMask); List<EntityRecord> actualRecords = ImmutableList.copyOf(iterator); assertThat(actualRecords).hasSize(halfSize); for (EntityRecord record : actualRecords) { Message state = unpack(record.getState()); assertMatchesMask(state, fieldMask); } }
Source:
<code>public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws SSLException { IoSession session = parent.getSession(); SocketAddress remoteAddress = session.getRemoteAddress(); if(remoteAddress instanceof InetSocketAddress) { <START> log.info("activating TLS SNI support"); <END> session.setAttribute(PEER_ADDRESS, remoteAddress); } super.onPreAdd(parent, name, nextFilter); }</code><technical_language>I log remote peer address set</technical_language>

Target:
public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws SSLException { if (useSNI) { IoSession session = parent.getSession(); SocketAddress remoteAddress = session.getRemoteAddress(); if (remoteAddress instanceof InetSocketAddress) { log.info("Activating TLS SNI support for peer address: {}", remoteAddress); session.setAttribute(PEER_ADDRESS, remoteAddress); } } super.onPreAdd(parent, name, nextFilter); }
Source:
<code>public void vmTypeChanged(VmType vmType) { if (basedOnCustomInstanceType()) { getModel().getIsSoundcardEnabled().setEntity(vmType == VmType.Desktop && !clusterHasPpcArchitecture()); } getModel().getAllowConsoleReconnect().setEntity(vmType == VmType.Server); getModel().getIoThreadsEnabled().setEntity(vmType == VmType.Server || vmType == VmType.HighPerformance); if (vmType == VmType.HighPerformance) { getModel().getIsHeadlessModeEnabled().setEntity(true); getModel().getIsConsoleDeviceEnabled().setEntity(true); getModel().getUsbPolicy().setSelectedItem(UsbPolicy.DISABLED); getModel().getIsSmartcardEnabled().setEntity(false); getModel().getWatchdogModel().setSelectedItem(null); getModel().getWatchdogAction().setSelectedItem(getModel().getWatchdogAction().getItems().iterator().next()); getModel().getIsRngEnabled().setEntity(true); getModel().getMigrationMode().setItems(Arrays.asList(MigrationSupport.IMPLICITLY_NON_MIGRATABLE, MigrationSupport.PINNED_TO_HOST)); getModel().getMigrationMode().setSelectedItem(MigrationSupport.IMPLICITLY_NON_MIGRATABLE); if (!clusterHasPpcArchitecture()) { getModel().getHostCpu().setEntity(true); } getModel().getMemoryBalloonDeviceEnabled().setEntity(false); <START> if (getModel().getMultiQueues().getIsAvailable()) { <END> getModel().getMultiQueues().setEntity(true); } } else { getModel().getMigrationMode().setItems(Arrays.asList(MigrationSupport.values())); } }</code><technical_language>this a part of backport</technical_language>

Target:
public void vmTypeChanged(VmType vmType) { if (basedOnCustomInstanceType()) { getModel().getIsSoundcardEnabled().setEntity(vmType == VmType.Desktop && !clusterHasPpcArchitecture()); } getModel().getAllowConsoleReconnect().setEntity(vmType == VmType.Server); getModel().getIoThreadsEnabled().setEntity(vmType == VmType.Server || vmType == VmType.HighPerformance); if (vmType == VmType.HighPerformance) { getModel().getIsHeadlessModeEnabled().setEntity(true); getModel().getIsConsoleDeviceEnabled().setEntity(true); getModel().getUsbPolicy().setSelectedItem(UsbPolicy.DISABLED); getModel().getIsSmartcardEnabled().setEntity(false); getModel().getWatchdogModel().setSelectedItem(null); getModel().getWatchdogAction().setSelectedItem(getModel().getWatchdogAction().getItems().iterator().next()); getModel().getIsRngEnabled().setEntity(true); getModel().getMigrationMode().setItems(Arrays.asList(MigrationSupport.IMPLICITLY_NON_MIGRATABLE, MigrationSupport.PINNED_TO_HOST)); getModel().getMigrationMode().setSelectedItem(MigrationSupport.IMPLICITLY_NON_MIGRATABLE); if (!clusterHasPpcArchitecture()) { getModel().getHostCpu().setEntity(true); } getModel().getMemoryBalloonDeviceEnabled().setEntity(false); } else { getModel().getMigrationMode().setItems(Arrays.asList(MigrationSupport.values())); } }
Source:
<code>private void assertValue(int nodeIndex, Object key, Object expectedValue) { <START> InternalCacheEntry entry = cache(nodeIndex).getAdvancedCache().getDataContainer().get(key); <END> assertEquals(expectedValue, entry != null ? entry.getValue() : null); }</code><technical_language>data container check this? call cache.get()</technical_language>

Target:
private void assertValue(int nodeIndex, Object key, Object expectedValue) { assertEquals(expectedValue, cache(nodeIndex).get(key)); }
Source:
<code>public StandardSlackService(String baseUrl, String teamDomain, boolean botUser, String roomId, boolean replyBroadcast, String populatedToken) { <START> this(new StandardSlackServiceBuilder() <END> .withBaseUrl(baseUrl) .withTeamDomain(teamDomain) .withBotUser(botUser) .withRoomId(roomId) .withReplyBroadcast(replyBroadcast) .withPopulatedToken(populatedToken) ); if (populatedToken == null) { throw new IllegalArgumentException("No slack token found, setup a secret text credential and configure it to be used"); } this.populatedToken = populatedToken; }</code><technical_language>I missed this suggestion this(builder()</technical_language>

Target:
public StandardSlackService(String baseUrl, String teamDomain, boolean botUser, String roomId, boolean replyBroadcast, String populatedToken) { this(builder() .withBaseUrl(baseUrl) .withTeamDomain(teamDomain) .withBotUser(botUser) .withRoomId(roomId) .withReplyBroadcast(replyBroadcast) .withPopulatedToken(populatedToken) ); if (populatedToken == null) { throw new IllegalArgumentException("No slack token found, setup a secret text credential and configure it to be used"); } this.populatedToken = populatedToken; }
Source:
<code>public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } String userName = (String) config.get("userName"); if(StringUtils.isNotBlank(userName)) { this.userName = userName; } else { throw new ConfigurationException("userName", "The userName to connect to myStrom must be specified in config file"); } String password = (String) config.get("password"); if(StringUtils.isNotBlank(password)) { this.password = password; } else { throw new ConfigurationException("password", "The password to connect to myStrom must be specified in config file"); } if(this.devMode){ this.mystromClient = new MockMystromClient(); } else { this.mystromClient = new MystromClient(this.userName, this.password, logger); } if(ChangeStateJob.MystromClient == null){ ChangeStateJob.MystromClient = this.mystromClient; } setProperlyConfigured(true); try { this.mystromDiscovery(); } catch (IOException e) { <START> e.printStackTrace(); <END> } } }</code><technical_language>Please SLF4J logging instead of e.printStackTrace()</technical_language>

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } String userName = (String) config.get("userName"); if (StringUtils.isNotBlank(userName)) { this.userName = userName; } else { throw new ConfigurationException("userName", "The userName to connect to myStrom must be specified in config file"); } String password = (String) config.get("password"); if (StringUtils.isNotBlank(password)) { this.password = password; } else { throw new ConfigurationException("password", "The password to connect to myStrom must be specified in config file"); } if (this.devMode) { this.mystromClient = new MockMystromClient(); } else { this.mystromClient = new MystromClient(this.userName, this.password, logger); } if (ChangeStateJob.MystromClient == null) { ChangeStateJob.MystromClient = this.mystromClient; } setProperlyConfigured(true); try { this.mystromDiscovery(); } catch (IOException e) { logger.error("Error doing discovery of your devices", e); } } }
Source:
<code>private List<DiskImage> manualAggregateSnapshots() { <START> DiskImage diskWithSnaps = diskWithSnapshots; <END> diskWithSnaps.getSnapshots().addAll(snapshotsList); return Arrays.asList(diskWithSnapshots, diskWithoutSnapshots, ovfImage, cinderDisk); }</code><technical_language>Do need this</technical_language>

Target:
private List<DiskImage> manualAggregateSnapshots() { diskWithSnapshots.getSnapshots().addAll(snapshotsList); return Arrays.asList(diskWithSnapshots, diskWithoutSnapshots, ovfImage, cinderDisk); }
Source:
<code>public void init() throws Exception { VerifiableProperties vProps = new VerifiableProperties(getNonBlockingRouterProperties()); operationCompleteLatch = new CountDownLatch(1); mockTime = new MockTime(); mockSelectorState = new AtomicReference<MockSelectorState>(MockSelectorState.Good); clusterMap = new MockClusterMap(); serverLayout = new MockServerLayout(clusterMap); <START> setServerResponse(true); <END> router = new NonBlockingRouter(new RouterConfig(vProps), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(vProps, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, serverLayout, mockTime), new LoggingNotificationSystem(), clusterMap, mockTime); List<PartitionId> mockPartitions = clusterMap.getWritablePartitionIds(); partition = mockPartitions.get(ThreadLocalRandom.current().nextInt(mockPartitions.size())); blobId = new BlobId(partition); blobIdString = blobId.getID(); }</code><technical_language>set this true in constructor(of MockServer) set everytime. set for exceptional cases i.e for failure cases</technical_language>

Target:
public void init() throws Exception { VerifiableProperties vProps = new VerifiableProperties(getNonBlockingRouterProperties()); operationCompleteLatch = new CountDownLatch(1); mockTime = new MockTime(); mockSelectorState = new AtomicReference<MockSelectorState>(MockSelectorState.Good); clusterMap = new MockClusterMap(); serverLayout = new MockServerLayout(clusterMap); router = new NonBlockingRouter(new RouterConfig(vProps), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(vProps, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, serverLayout, mockTime), new LoggingNotificationSystem(), clusterMap, mockTime); List<PartitionId> mockPartitions = clusterMap.getWritablePartitionIds(); partition = mockPartitions.get(ThreadLocalRandom.current().nextInt(mockPartitions.size())); blobId = new BlobId(partition); blobIdString = blobId.getID(); }
Source:
<code>public String getCurrentSignatureForPackage(final String packagename) { try { PackageInfo info = mContext.getPackageManager().getPackageInfo(packagename, PackageManager.GET_SIGNATURES); if (info != null && info.signatures != null && info.signatures.length > 0) { Signature signature = info.signatures[0]; MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); <START> String tag = Base64.encodeToString(md.digest(), Base64.DEFAULT); <END> return tag; } } catch (NameNotFoundException e) { Logger.e(TAG, "Calling App's package does not exist in PackageManager", "", ADALError.APP_PACKAGE_NAME_NOT_FOUND); } catch (NoSuchAlgorithmException e) { Logger.e(TAG, "Digest SHA algorithm does not exists", "", ADALError.DEVICE_NO_SUCH_ALGORITHM); } return null; }</code><technical_language>Is 'return Base64.encodeToString(...);' legal? remove variable String tag</technical_language>

Target:
public String getCurrentSignatureForPackage(final String packagename) { try { PackageInfo info = mContext.getPackageManager().getPackageInfo(packagename, PackageManager.GET_SIGNATURES); if (info != null && info.signatures != null && info.signatures.length > 0) { Signature signature = info.signatures[0]; MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); return Base64.encodeToString(md.digest(), Base64.DEFAULT); } } catch (NameNotFoundException e) { Logger.e(TAG, "Calling App's package does not exist in PackageManager", "", ADALError.APP_PACKAGE_NAME_NOT_FOUND); } catch (NoSuchAlgorithmException e) { Logger.e(TAG, "Digest SHA algorithm does not exists", "", ADALError.DEVICE_NO_SUCH_ALGORITHM); } return null; }
Source:
<code>public void onTrimMemory(int level) { if (level < TRIM_MEMORY_COMPLETE) { return; } Context context = getContext(); if (context == null) { return; } <START> deleteOldTemporaryFiles(context); <END> if (receiverRegistered != null) { context.unregisterReceiver(receiverRegistered); receiverRegistered = null; } }</code><technical_language>cleanup done in a background thread</technical_language>

Target:
public void onTrimMemory(int level) { if (level < TRIM_MEMORY_COMPLETE) { return; } final Context context = getContext(); if (context == null) { return; } new AsyncTask<Void,Void,Void>() { @Override protected Void doInBackground(Void... voids) { deleteOldTemporaryFiles(context); return null; } }.execute(); unregisterFileCleanupReceiver(context); }
Source:
<code>public HdfsToTeradataJobRunnerMain() throws FileNotFoundException, IOException { _logger = JobUtils.initJobLogger(); _jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); _jobProps.put(HadoopSecurityManager.ENABLE_PROXYING, "true"); Props props = new Props(null, _jobProps); HadoopConfigurationInjector.injectResources(props); UserGroupInformation.setConfiguration(new Configuration()); <START> props.getString(HadoopSecurityManager.USER_TO_PROXY); END> _params = TdchParameters.builder() .mrParams(TdchConstants.MAP_REDUCE_PARAMS) .libJars(props.getString(TdchConstants.LIB_JARS_KEY)) .tdJdbcClassName(TdchConstants.TERADATA_JDBCDRIVER_CLASSNAME) .teradataHostname(props.getString(TdchConstants.TD_HOSTNAME_KEY)) .fileFormat(_jobProps.getProperty(TdchConstants.HDFS_FILE_FORMAT_KEY)) .fieldSeparator(_jobProps.getProperty(TdchConstants.HDFS_FIELD_SEPARATOR_KEY)) .jobType(TdchConstants.TDCH_JOB_TYPE) .userName(props.getString(TdchConstants.TD_USERID_KEY)) .tdPassword(String.format(TdchConstants.TD_WALLET_FORMAT, props.getString(TdchConstants.TD_USERID_KEY))) .avroSchemaPath(_jobProps.getProperty(TdchConstants.AVRO_SCHEMA_PATH_KEY)) .sourceHdfsPath(props.getString(TdchConstants.SOURCE_HDFS_PATH_KEY)) .targetTdTableName(props.getString(TdchConstants.TARGET_TD_TABLE_NAME_KEY)) .tdInsertMethod(_jobProps.getProperty(TdchConstants.TD_INSERT_METHOD_KEY)) .numMapper(DEFAULT_NO_MAPPERS) .build(); }</code><technical_language>off. consuming returned of props.getString(HadoopSecurityManager.USER_TO_PROXY)</technical_language>

Target:
public HdfsToTeradataJobRunnerMain() throws FileNotFoundException, IOException { _logger = JobUtils.initJobLogger(); _jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); Props props = new Props(null, _jobProps); HadoopConfigurationInjector.injectResources(props); UserGroupInformation.setConfiguration(new Configuration()); _params = TdchParameters.builder() .mrParams(_jobProps.getProperty(TdchConstants.HADOOP_CONFIG_KEY)) .libJars(props.getString(TdchConstants.LIB_JARS_KEY)) .tdJdbcClassName(TdchConstants.TERADATA_JDBCDRIVER_CLASSNAME) .teradataHostname(props.getString(TdchConstants.TD_HOSTNAME_KEY)) .fileFormat(_jobProps.getProperty(TdchConstants.HDFS_FILE_FORMAT_KEY)) .fieldSeparator(_jobProps.getProperty(TdchConstants.HDFS_FIELD_SEPARATOR_KEY)) .jobType(TdchConstants.TDCH_JOB_TYPE) .userName(props.getString(TdchConstants.TD_USERID_KEY)) .tdPassword(String.format(TdchConstants.TD_WALLET_FORMAT, props.getString(TdchConstants.TD_USERID_KEY))) .avroSchemaPath(_jobProps.getProperty(TdchConstants.AVRO_SCHEMA_PATH_KEY)) .sourceHdfsPath(props.getString(TdchConstants.SOURCE_HDFS_PATH_KEY)) .targetTdTableName(props.getString(TdchConstants.TARGET_TD_TABLE_NAME_KEY)) .tdInsertMethod(_jobProps.getProperty(TdchConstants.TD_INSERT_METHOD_KEY)) .numMapper(DEFAULT_NO_MAPPERS) .build(); }
Source:
<code>public static CompositeBlobInfo deserializeMetadataContentRecord(DataInputStream stream, StoreKeyFactory storeKeyFactory) throws IOException { List<Pair<StoreKey, Long>> keysAndContentSizes = new ArrayList<>(); <START> stream.readLong(); END> int numberOfKeys = stream.readInt(); for (int i = 0; i < numberOfKeys; i++) { long contentSize = stream.readLong(); StoreKey storeKey = storeKeyFactory.getStoreKey(stream); keysAndContentSizes.add(new Pair<>(storeKey, contentSize)); } return new CompositeBlobInfo(keysAndContentSizes); }</code><technical_language>I suggest passing total size CompositeBlobInfo constructor compare calculated total size (which is in code). If match, throw exception</technical_language>

Target:
public static CompositeBlobInfo deserializeMetadataContentRecord(DataInputStream stream, StoreKeyFactory storeKeyFactory) throws IOException { List<Pair<StoreKey, Long>> keysAndContentSizes = new ArrayList<>(); long totalSize = stream.readLong(); long sum = 0; int numberOfKeys = stream.readInt(); for (int i = 0; i < numberOfKeys; i++) { long contentSize = stream.readLong(); StoreKey storeKey = storeKeyFactory.getStoreKey(stream); keysAndContentSizes.add(new Pair<>(storeKey, contentSize)); sum += contentSize; } if (sum != totalSize) { throw new IllegalArgumentException("Key content sizes do not equal total size"); } return new CompositeBlobInfo(keysAndContentSizes); }
Source:
<code>static File getLastExecVersionFile() { <START> return new File(Jenkins.getInstance().getRootDir(), "last_run_version"); <END> }</code><technical_language>convention, files in Jenkins home based class names. jenkins.install.InstallUtil.lastExecVersion</technical_language>

Target:
static File getLastExecVersionFile() { return new File(Jenkins.getInstance().getRootDir(), "jenkins.install.InstallUtil.lastExecVersion"); }
Source:
<code>public void hasActiveIDs() throws Exception { <START> TransformerFactory factory = TransformerFactory.newInstance(); <END> File xslt_file = new File(getClass().getClassLoader().getResource("library_patron.xsl").getFile()); Source xslt = new StreamSource(xslt_file); Transformer transformer = factory.newTransformer(xslt); File patron_file = new File(this.getClass().getResource("/patron_one.xml").getFile()); Source text = new StreamSource(patron_file); StringWriter outWriter = new StringWriter(); transformer.transform(text, new StreamResult(outWriter)); StringBuffer sb = outWriter.getBuffer(); String symphony_user_rec = sb.toString(); File fixture_record = new File(this.getClass().getResource("/symph_user_one").getFile()); System.out.println(fixture_record.getAbsolutePath()); String filePath = fixture_record.getPath(); assertEquals(symphony_user_rec, fileToString(filePath)); }</code><technical_language>If need another test this, abstracted a method returns a Transformer based a file</technical_language>

Target:
public void hasActiveIDs() throws Exception { String symphony_user_rec = symphonyUserRecord(new File(this.getClass().getResource("/patron_one.xml").getFile())); File fixture_record = new File(this.getClass().getResource("/symph_user_one").getFile()); String filePath = fixture_record.getPath(); assertEquals(symphony_user_rec, fileToString(filePath)); }
Source:
<code>public HttpWebResponse send() throws IOException { Logger.v(TAG, "HttpWebRequest send thread:" + Process.myTid()); final HttpURLConnection connection = setupConnection(); if (connection == null) { <START> return null; <END> } final HttpWebResponse response; try { InputStream responseStream = null; try { responseStream = connection.getInputStream(); } catch (IOException ex) { Logger.e(TAG, "IOException:" + ex.getMessage(), "", ADALError.SERVER_ERROR); responseStream = connection.getErrorStream(); if (responseStream == null) { throw ex; } } final int statusCode = getStatusCode(connection); byte[] responseBody = null; if (responseStream != null) { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); byte[] buffer = new byte[4096]; int bytesRead = -1; while ((bytesRead = responseStream.read(buffer)) > 0) { byteStream.write(buffer, 0, bytesRead); } responseBody = byteStream.toByteArray(); } if (Debug.isDebuggerConnected() && sDebugSimulateDelay > 0) { Logger.v(TAG, "Sleeping to simulate slow network response"); try { Thread.sleep(sDebugSimulateDelay); } catch (InterruptedException e) { Logger.v(TAG, "Thread.sleep got interrupted exception " + e); } } Logger.v(TAG, "Response is received"); response = new HttpWebResponse(statusCode, responseBody, connection.getHeaderFields()); } finally { connection.disconnect(); } return response; }</code><technical_language>Hm. this is a throw IOException</technical_language>

Target:
public HttpWebResponse send() throws IOException { Logger.v(TAG, "HttpWebRequest send thread:" + Process.myTid()); final HttpURLConnection connection = setupConnection(); final HttpWebResponse response; InputStream responseStream = null; try { try { responseStream = connection.getInputStream(); } catch (IOException ex) { Logger.e(TAG, "IOException:" + ex.getMessage(), "", ADALError.SERVER_ERROR); responseStream = connection.getErrorStream(); if (responseStream == null) { throw ex; } } final int statusCode = getStatusCode(connection); final String responseBody = convertStreamToString(responseStream); if (Debug.isDebuggerConnected() && sDebugSimulateDelay > 0) { Logger.v(TAG, "Sleeping to simulate slow network response"); try { Thread.sleep(sDebugSimulateDelay); } catch (InterruptedException e) { Logger.v(TAG, "Thread.sleep got interrupted exception " + e); } } Logger.v(TAG, "Response is received"); response = new HttpWebResponse(statusCode, responseBody, connection.getHeaderFields()); } finally { safeCloseStream(responseStream); connection.disconnect(); } return response; }
Source:
<code><START> public ObservableList<File> getAuxclasspathFiles() { <END> return auxclasspathFiles; }</code><technical_language>persistence framework throws exception return a string here, convert a list easily. this for example: <LINK_0></technical_language>

Target:
public String getAuxclasspathFiles() { return auxclasspathFiles.getValue().stream().map(p -> p.getAbsolutePath()).collect(Collectors.joining(File.pathSeparator)); }
Source:
<code>public synchronized <T extends HasMetadata> SharedIndexInformer<T> sharedIndexInformerForCustomResource(Class<T> apiTypeClass, OperationContext operationContext, long resyncPeriodInMillis) { <START> return sharedIndexInformerFor(apiTypeClass, CustomResourceOperationsImpl.inferListType(apiTypeClass), operationContext.withPlural(CustomResourceDefinitionContext.fromCustomResourceType(apiTypeClass).getPlural()), resyncPeriodInMillis); <END> }</code><technical_language>is plural set in other instances</technical_language>

Target:
public synchronized <T extends CustomResource> SharedIndexInformer<T> sharedIndexInformerForCustomResource(Class<T> apiTypeClass, OperationContext operationContext, long resyncPeriodInMillis) { return sharedIndexInformerFor(apiTypeClass, CustomResourceOperationsImpl.inferListType(apiTypeClass), operationContext, resyncPeriodInMillis); }
Source:
<code>HllSketchAggregatorFactory(final String name, final String fieldName, @Nullable final Integer lgK, @Nullable final String tgtHllType) { <START> if (name == null) { <END> throw new IAE("Aggregator name must be specified"); } this.name = name; if (fieldName == null) { throw new IAE("Parameter fieldName must be specified"); } this.fieldName = fieldName; this.lgK = lgK == null ? DEFAULT_LG_K : lgK; this.tgtHllType = tgtHllType == null ? DEFAULT_TGT_HLL_TYPE : TgtHllType.valueOf(tgtHllType); }</code><technical_language>Objects.requireNonNull is shorter</technical_language>

Target:
HllSketchAggregatorFactory( final String name, final String fieldName, @Nullable final Integer lgK, @Nullable final String tgtHllType ) { this.name = Objects.requireNonNull(name); this.fieldName = Objects.requireNonNull(fieldName); this.lgK = lgK == null ? DEFAULT_LG_K : lgK; this.tgtHllType = tgtHllType == null ? DEFAULT_TGT_HLL_TYPE : TgtHllType.valueOf(tgtHllType); }
Source:
<code>public V3X509CertificateGenerator(Date startDate, X509Principal issuerDn, X509Principal subjectDn, PublicKey publicKey, BigInteger serialNumber) { X509V3CertificateGenerator gen = new X509V3CertificateGenerator(); gen.reset(); <START> gen.setSignatureAlgorithm("SHA256WithRSAEncryption"); <END> gen.setNotBefore(startDate); DateTime now = new DateTime(new Date()); gen.setNotAfter(now.plusYears(YEARS).toDate()); gen.setIssuerDN(issuerDn); gen.setSubjectDN(subjectDn); gen.setPublicKey(publicKey); gen.setSerialNumber(serialNumber); this.v3CertGen = gen; }</code><technical_language>put a toggle a system property default SHA256WithRSAEncryption</technical_language>

Target:
public V3X509CertificateGenerator(Date startDate, X509Principal issuerDn, X509Principal subjectDn, PublicKey publicKey, BigInteger serialNumber) { X509V3CertificateGenerator gen = new X509V3CertificateGenerator(); gen.reset(); gen.setSignatureAlgorithm(new SystemEnvironment().get(GO_SSL_CERTS_PUBLIC_KEY_ALGORITHM)); gen.setNotBefore(startDate); DateTime now = new DateTime(new Date()); gen.setNotAfter(now.plusYears(YEARS).toDate()); gen.setIssuerDN(issuerDn); gen.setSubjectDN(subjectDn); gen.setPublicKey(publicKey); gen.setSerialNumber(serialNumber); this.v3CertGen = gen; }
Source:
<code>private SimpleTableDef detectSchema(String url, String indexName) { SimpleTableDef tableDef = null; url += "/schema"; try { HttpClient httpclient = new DefaultHttpClient(); HttpGet request = new HttpGet(url); HttpResponse response = httpclient.execute(request); InputStreamReader inputStream = new InputStreamReader(response .getEntity().getContent()); <START> ObjectReader reader = new ObjectMapper().reader(HashMap.class); <END> Map<String, Object> outerMap = reader.readValue(inputStream); Map<String, Object> schemaMap = (Map) outerMap.get("schema"); if (outerMap != null) { List<Map<String, String>> fieldMapList = (List) schemaMap .get("fields"); List<String> columnNames = new ArrayList<String>(); List<ColumnType> columnTypes = new ArrayList<ColumnType>(); for (int i = 0; i < fieldMapList.size(); i++) { Map<String, String> fieldMap = fieldMapList.get(i); columnNames.add(fieldMap.get("name")); columnTypes.add(ColumnType.VARCHAR); } String[] columnNamesArr = new String[columnNames.size()]; columnNamesArr = columnNames.toArray(columnNamesArr); ColumnType[] columnTypesArr = new ColumnType[columnTypes.size()]; columnTypesArr = columnTypes.toArray(columnTypesArr); tableDef = new SimpleTableDef(indexName, columnNamesArr, columnTypesArr); } } catch (IOException e) { logger.error("Failed to parse schema", "", e); } return tableDef; }</code><technical_language>Is a Solr client API for things? If not, OK, a lot of work do JSON parsing manually - I imagine wrong this if response is expect it</technical_language>

Target:
private SimpleTableDef detectSchema(String url, String indexName) { SimpleTableDef tableDef = null; url += "/schema"; try { HttpClient httpclient = new DefaultHttpClient(); HttpGet request = new HttpGet(url); HttpResponse response = httpclient.execute(request); InputStreamReader inputStream = new InputStreamReader(response .getEntity().getContent()); ObjectReader reader = new ObjectMapper().reader(HashMap.class); Map<String, Object> outerMap = reader.readValue(inputStream); Map<String, Object> schemaMap = null; if (outerMap != null) { schemaMap = (Map) outerMap.get("schema"); } if (schemaMap != null) { List<Map<String, String>> fieldMapList = (List) schemaMap .get("fields"); List<String> columnNames = new ArrayList<String>(); List<ColumnType> columnTypes = new ArrayList<ColumnType>(); for (int i = 0; i < fieldMapList.size(); i++) { Map<String, String> fieldMap = fieldMapList.get(i); columnNames.add(fieldMap.get("name")); columnTypes.add(ColumnType.STRING); } String[] columnNamesArr = new String[columnNames.size()]; columnNamesArr = columnNames.toArray(columnNamesArr); ColumnType[] columnTypesArr = new ColumnType[columnTypes.size()]; columnTypesArr = columnTypes.toArray(columnTypesArr); tableDef = new SimpleTableDef(indexName, columnNamesArr, columnTypesArr); } } catch (IOException e) { logger.error("Failed to parse schema", "", e); } return tableDef; }
Source:
<code>public void stop() { cacheNotifier.getListenerCollectionForAnnotation(CacheEntryActivated.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryCreated.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryInvalidated.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryLoaded.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryModified.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryPassivated.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryRemoved.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryVisited.class).removeAll(filteringInvocations.values()); <START> cacheNotifier.getListenerCollectionForAnnotation(CacheEntryEvicted.class).removeAll(filteringInvocations.values()); <END> filteringInvocations.clear(); }</code><technical_language>I this CacheEntriesEvicted instead? I hoping finally remove this event in 8.0 I redo expiration well</technical_language>

Target:
public void stop() { cacheNotifier.getListenerCollectionForAnnotation(CacheEntryActivated.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryCreated.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryInvalidated.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryLoaded.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryModified.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryPassivated.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryRemoved.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryVisited.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntriesEvicted.class).removeAll(filteringInvocations.values()); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryEvicted.class).removeAll(filteringInvocations.values()); filteringInvocations.clear(); }
Source:
<code>public void reset() { this.currentKey = null; <START> this.cells = new TreeMap<>(); <END> this.family = null; this.qualifier = null; this.labels = null; this.timestamp = 0L; this.value = null; this.previousFamily = null; this.totalCellCount = 0; }</code><technical_language>Please this.cell related fields (previousFamily & cell count)</technical_language>

Target:
public void reset() { this.currentKey = null; this.family = null; this.qualifier = null; this.labels = null; this.timestamp = 0L; this.value = null; this.cells = new TreeMap<>(); this.currentFamilyCells = null; this.previousFamily = null; this.totalCellCount = 0; }
Source:
<code>protected void executeCommand() { CopyHostNetworksHelper helper = getCopyHostNetworksHelper(); <START> helper.clearDestinationHost(); helper.prepareBondsAndCopyNicAttachments(); helper.createDestinationBondDefinitionsAndCopyAttachments(); helper.resuseAttachmentsOnDestination(); <END> var setupNetworksParameters = new HostSetupNetworksParameters(getParameters().getVdsId()); setupNetworksParameters.setRemovedBonds(helper.getBondsToRemove()); setupNetworksParameters.setRemovedNetworkAttachments(helper.getAttachmentsToRemove()); setupNetworksParameters.setNetworkAttachments(helper.getAttachmentsToApply()); setupNetworksParameters.setCreateOrUpdateBonds(helper.getBondsToApply()); setupNetworksParameters.setCommitOnSuccess(true); ActionReturnValue returnValue = runInternalAction(ActionType.HostSetupNetworks, setupNetworksParameters, cloneContextAndDetachFromParent()); if (!returnValue.getSucceeded()) { propagateFailure(returnValue); } setSucceeded(returnValue.getSucceeded()); }</code><technical_language>know-how of helper methods call in sequence belongs in helper. also, a technical point of view this is canibalization of helper's work (all lines start "helper."). thirdly helper get input command in lines. lastly, this sequence is duplicated in tests. i move this sequence helper a single "control-flow" method. named for example buildDestinationConfig()</technical_language>

Target:
protected void executeCommand() { CopyHostNetworksHelper helper = getCopyHostNetworksHelper(); helper.buildDestinationConfig(); var setupNetworksParameters = new HostSetupNetworksParameters(getParameters().getVdsId()); setupNetworksParameters.setRemovedBonds(helper.getBondsToRemove()); setupNetworksParameters.setRemovedNetworkAttachments(helper.getAttachmentsToRemove()); setupNetworksParameters.setNetworkAttachments(helper.getAttachmentsToApply()); setupNetworksParameters.setCreateOrUpdateBonds(helper.getBondsToApply()); setupNetworksParameters.setCommitOnSuccess(true); ActionReturnValue returnValue = runInternalAction(ActionType.HostSetupNetworks, setupNetworksParameters, cloneContextAndDetachFromParent()); if (!returnValue.getSucceeded()) { propagateFailure(returnValue); } setSucceeded(returnValue.getSucceeded()); }
Source:
<code>public void testParameterIsNull() throws SQLException{ long now = System.currentTimeMillis(); PreparedStatement insertStmt = con.prepareStatement("INSERT INTO " + TEST_TABLE + " VALUES (?, ?)"); insertStmt.setTimestamp(1, new java.sql.Timestamp(now++)); insertStmt.setTimestamp(2, new java.sql.Timestamp(now++)); assertEquals(1, insertStmt.executeUpdate()); insertStmt.setTimestamp(1, new java.sql.Timestamp(now++)); insertStmt.setTimestamp(2, new java.sql.Timestamp(now++)); assertEquals(1, insertStmt.executeUpdate()); insertStmt.setTimestamp(1, new java.sql.Timestamp(now++)); insertStmt.setTimestamp(2, new java.sql.Timestamp(now++)); assertEquals(1, insertStmt.executeUpdate()); insertStmt.close(); PreparedStatement selectStmt = con.prepareStatement("Select * from " + TEST_TABLE + " Where ts = ? or ? is null"); selectStmt.setTimestamp(1, new java.sql.Timestamp(now++)); selectStmt.setTimestamp(2, new java.sql.Timestamp(now++)); ResultSet rs1 = selectStmt.executeQuery(); assertFalse(rs1.next()); rs1.close(); selectStmt.setTimestamp(1, new java.sql.Timestamp(now++)); selectStmt.setTimestamp(2, null); ResultSet rs2 = selectStmt.executeQuery(); <START> assertTrue(rs2.next()); <END> assertTrue(rs2.next()); assertTrue(rs2.next()); assertFalse(rs2.next()); rs2.close(); selectStmt.close(); }</code><technical_language>avoid assertTrue in important cases, ensure descriptive messages: <LINK_0></technical_language>

Target:
public void testParameterIsNull() throws SQLException{ long moment = 1450276739098L; PreparedStatement insertStmt = con.prepareStatement("INSERT INTO " + TEST_TABLE + " VALUES (?, ?)"); int testRows = 3; for(int i = 0; i < testRows; i++){ insertStmt.setTimestamp(1, new java.sql.Timestamp(moment++)); insertStmt.setTimestamp(2, new java.sql.Timestamp(moment++)); assertEquals("insert in " + TEST_TABLE + " failed", 1, insertStmt.executeUpdate()); } insertStmt.close(); PreparedStatement selectStmt = con.prepareStatement("Select * from " + TEST_TABLE + " Where ts = ? or ? is null"); selectStmt.setTimestamp(1, new java.sql.Timestamp(moment++)); selectStmt.setTimestamp(2, new java.sql.Timestamp(moment++)); ResultSet rs1 = selectStmt.executeQuery(); int rows1 = 0; while(rs1.next()){ ++rows1; } rs1.close(); assertEquals("Particular moment is found in " + TEST_TABLE, 0, rows1); selectStmt.setTimestamp(1, new java.sql.Timestamp(moment++)); selectStmt.setTimestamp(2, null); ResultSet rs2 = selectStmt.executeQuery(); int rows2 = 0; while(rs2.next()){ ++rows2; } rs2.close(); assertEquals("Not all records are fetched from " + TEST_TABLE, testRows, rows2); selectStmt.close(); }