auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void entityFieldsShouldBeSerialized() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { JCUser user = ObjectsFactory.getUserWithAllNotInheritedFieldsFilled(); <START> user.setAvatar(new byte[]{1}); <END> user.setVersion(1L); user.setBanReason("Ban Reason"); user.setRole("Role"); Method setLastLogin = User.class.getDeclaredMethod("setLastLogin", DateTime.class); Method setEncodedUsername = User.class.getDeclaredMethod("setEncodedUsername", String.class); setLastLogin.setAccessible(true); setEncodedUsername.setAccessible(true); setLastLogin.invoke(user,new DateTime()); setEncodedUsername.invoke(user,"Encoded Username"); byte[] serialize = SerializationUtils.serialize(user); JCUser serializedUser = (JCUser)SerializationUtils.deserialize(serialize); assertReflectionEquals(user, serializedUser); }</code><technical_language>fill fields in ObjectsFactory</technical_language>

Target:
public void entityFieldsShouldBeSerialized() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { JCUser user = ObjectsFactory.getUserWithAllFieldsFilled(); byte[] serialize = SerializationUtils.serialize(user); JCUser serializedUser = (JCUser)SerializationUtils.deserialize(serialize); assertReflectionEquals(user, serializedUser); }
Source:
<code>private void createAsset(Source source, String assetPath, ResourceResolver r, boolean versioning) throws Exception { try { boolean versioned = false; if (!dryRunMode) { disableWorkflowProcessing(r); AssetManager assetManager = r.adaptTo(AssetManager.class); String type = mimetypeService.getMimeType(source.getName()); if (versioning) { Asset asset = r.getResource(assetPath).adaptTo(Asset.class); versioned = asset != null; assetManager.createRevision(asset, "initial version of asset", asset.getName()); r.commit(); r.refresh(); } Asset asset = assetManager.createAsset(assetPath, source.getStream(), type, false); if (asset == null) { Logger.getLogger(AssetIngestor.class.getName()).log(Level.SEVERE, null, new AssetIngestorException("Cannot create asset: asset is null on path " + assetPath)); <START> } else { <END> saveMigrationInfo(source, asset); } r.commit(); r.refresh(); } if (versioned) { trackDetailedActivity(assetPath, "Revised", "Created new version of asset", source.getLength()); } else { trackDetailedActivity(assetPath, "Create", "Imported asset", source.getLength()); } incrementBytes(importedData, source.getLength()); incrementCount(importedAssets, 1L); } finally { source.close(); } }</code><technical_language>In this case report updated. Error logged</technical_language>

Target:
private void createAsset(Source source, String assetPath, ResourceResolver r, boolean versioning) throws Exception { try { boolean versioned = false; if (!dryRunMode) { disableWorkflowProcessing(r); AssetManager assetManager = r.adaptTo(AssetManager.class); String type = mimetypeService.getMimeType(source.getName()); if (versioning) { Asset asset = r.getResource(assetPath).adaptTo(Asset.class); versioned = asset != null; assetManager.createRevision(asset, "initial version of asset", asset.getName()); r.commit(); r.refresh(); } Asset asset = assetManager.createAsset(assetPath, source.getStream(), type, false); if (asset == null) { AssetIngestorException ex = new AssetIngestorException("Cannot create asset: asset is null on path " + assetPath); Logger.getLogger(AssetIngestor.class.getName()).log(Level.SEVERE, null, ex); throw ex; } saveMigrationInfo(source, asset); r.commit(); r.refresh(); } if (versioned) { trackDetailedActivity(assetPath, "Revised", "Created new version of asset", source.getLength()); } else { trackDetailedActivity(assetPath, "Create", "Imported asset", source.getLength()); } incrementBytes(importedData, source.getLength()); incrementCount(importedAssets, 1L); } finally { source.close(); } }
Source:
<code>public User signup(String name) { control(by.input("username")).set(name); <START> control(by.name("Submit")).clickAndWaitToBecomeStale(); <END> return new User(getJenkins(), name); }</code><technical_language>this submit</technical_language>

Target:
public User signup(String name) { control(by.input("username")).set(name); control(by.name("Submit")).resolve().submit(); return new User(getJenkins(), name); }
Source:
<code>public DSLSentence copy() { final DSLSentence copy = new DSLSentence(); copy.drl = getDrl(); copy.definition = getDefinition(); if (getValues() != null) { <START> copy.values = new ArrayList<>(getValues()); <END> } return copy; }</code><technical_language>cloning DSLVariableValue objects here; cloning list of _original_ references. simply calling copy.getValues() is create a new List of new DSLVariableValue objects</technical_language>

Target:
public DSLSentence copy() { final DSLSentence copy = new DSLSentence(); copy.drl = getDrl(); copy.definition = getDefinition(); copy.values = mapCopy(getValues()); return copy; }
Source:
<code>public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> eventType) throws TmfTraceException { super.initTrace(resource, path, eventType); fLayout = getLayoutFromEnv(); ImmutableSet.Builder<ITmfEventAspect<?>> builder = ImmutableSet.builder(); builder.addAll(LTTNG_UST_ASPECTS); builder.add(new ContextVtidAspect(fLayout)); <START> builder.add(new ContextVpidAspect(fLayout)); <END> builder.addAll(createCounterAspects(this)); fUstTraceAspects = builder.build(); }</code><technical_language>this a builder return a collection emptyset a singleton, if context, column</technical_language>

Target:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> eventType) throws TmfTraceException { super.initTrace(resource, path, eventType); ILttngUstEventLayout layout = getLayoutFromEnv(); fLayout = layout; ImmutableSet.Builder<ITmfEventAspect<?>> builder = ImmutableSet.builder(); builder.addAll(LTTNG_UST_ASPECTS); if (checkFieldPresent(layout.contextVtid())) { builder.add(new ContextVtidAspect(layout)); } if (checkFieldPresent(layout.contextVpid())) { builder.add(new ContextVpidAspect(layout)); } builder.addAll(createCounterAspects(this)); fUstTraceAspects = builder.build(); }
Source:
<code>public static void unzipFiles(ZipFile zipFile, String targetDirectory, String[] zipEntries, Map<String, String> zipEntryToFilenameMap) throws IOException { byte[] buf = new byte[FILE_COPY_BUFFER_SIZE]; File dir = new File(targetDirectory); if (!dir.exists() && !dir.mkdirs()) { throw new IOException("Failed to create target directory: " + targetDirectory); } if (zipEntryToFilenameMap == null) { zipEntryToFilenameMap = new HashMap<>(); } BufferedInputStream zis = null; BufferedOutputStream bos = null; try { for (String requestedEntry : zipEntries) { ZipEntry ze = zipFile.getEntry(requestedEntry); if (ze != null) { String name = ze.getName(); <START> <END> if (zipEntryToFilenameMap.containsKey(name)) { name = zipEntryToFilenameMap.get(name); } validateFilename(name, dir); File destFile = new File(dir, name); if (!ze.isDirectory()) { Timber.i("uncompress %s", name); zis = new BufferedInputStream(zipFile.getInputStream(ze)); bos = new BufferedOutputStream(new FileOutputStream(destFile), FILE_COPY_BUFFER_SIZE); int n; while ((n = zis.read(buf, 0, FILE_COPY_BUFFER_SIZE)) != -1) { bos.write(buf, 0, n); } bos.flush(); bos.close(); zis.close(); } } } } finally { if (bos != null) { bos.close(); } if (zis != null) { zis.close(); } } }</code><technical_language>Unrelated whitespace change</technical_language>

Target:
public static void unzipFiles(ZipFile zipFile, String targetDirectory, String[] zipEntries, Map<String, String> zipEntryToFilenameMap) throws IOException { byte[] buf = new byte[FILE_COPY_BUFFER_SIZE]; File dir = new File(targetDirectory); if (!dir.exists() && !dir.mkdirs()) { throw new IOException("Failed to create target directory: " + targetDirectory); } if (zipEntryToFilenameMap == null) { zipEntryToFilenameMap = new HashMap<>(); } BufferedInputStream zis = null; BufferedOutputStream bos = null; try { for (String requestedEntry : zipEntries) { ZipEntry ze = zipFile.getEntry(requestedEntry); if (ze != null) { String name = ze.getName(); if (zipEntryToFilenameMap.containsKey(name)) { name = zipEntryToFilenameMap.get(name); } File destFile = new File(dir, name); if (!isInside(destFile, dir)) { Timber.e("Refusing to decompress invalid path: " + destFile.getCanonicalPath()); throw new IOException("File is outside extraction target directory."); } if (!ze.isDirectory()) { Timber.i("uncompress %s", name); zis = new BufferedInputStream(zipFile.getInputStream(ze)); bos = new BufferedOutputStream(new FileOutputStream(destFile), FILE_COPY_BUFFER_SIZE); int n; while ((n = zis.read(buf, 0, FILE_COPY_BUFFER_SIZE)) != -1) { bos.write(buf, 0, n); } bos.flush(); bos.close(); zis.close(); } } } } finally { if (bos != null) { bos.close(); } if (zis != null) { zis.close(); } } }
Source:
<code>private static <E> View<E> load(Configuration conf) { Class<E> type; try { type = (Class<E>)conf.getClass(KITE_TYPE, GenericData.Record.class); } catch (RuntimeException e) { if (e.getCause() instanceof ClassNotFoundException) { <START> throw new RuntimeException(String.format( <END> "The Java class %s for the entity type could not be found", conf.get(KITE_TYPE)), e.getCause()); } else { throw e; } } String inputUri = conf.get(KITE_INPUT_URI); if (inputUri == null) { return Datasets.<E, View<E>>load( new URIBuilder( conf.get(KITE_REPOSITORY_URI), conf.get(KITE_DATASET_NAME)) .build(), type); } return Datasets.<E, View<E>>load(inputUri, type); }</code><technical_language>DatasetException a subtype here</technical_language>

Target:
private static <E> View<E> load(Configuration conf) { Class<E> type; try { type = (Class<E>)conf.getClass(KITE_TYPE, GenericData.Record.class); } catch (RuntimeException e) { if (e.getCause() instanceof ClassNotFoundException) { throw new TypeNotFoundException(String.format( "The Java class %s for the entity type could not be found", conf.get(KITE_TYPE)), e.getCause()); } else { throw e; } } String inputUri = conf.get(KITE_INPUT_URI); if (inputUri == null) { return Datasets.<E, View<E>>load( new URIBuilder( conf.get(KITE_REPOSITORY_URI), conf.get(KITE_DATASET_NAME)) .build(), type); } return Datasets.<E, View<E>>load(inputUri, type); }
Source:
<code>public PercentType[] toRGB() { PercentType red = null; PercentType green = null; PercentType blue = null; BigDecimal h = hue.divide(BigDecimal.valueOf(100), 10, BigDecimal.ROUND_HALF_UP); BigDecimal s = saturation.divide(BigDecimal.valueOf(100)); int hInt = h.multiply(BigDecimal.valueOf(5)).divide(BigDecimal.valueOf(3), 10, BigDecimal.ROUND_HALF_UP) .intValue(); BigDecimal f = h.multiply(BigDecimal.valueOf(5)).divide(BigDecimal.valueOf(3), 10, BigDecimal.ROUND_HALF_UP) .remainder(BigDecimal.ONE); PercentType a = new PercentType(value.multiply(BigDecimal.ONE.subtract(s))); PercentType b = new PercentType(value.multiply(BigDecimal.ONE.subtract(s.multiply(f)))); PercentType c = new PercentType( value.multiply(BigDecimal.ONE.subtract((BigDecimal.ONE.subtract(f)).multiply(s)))); <START> if (hInt == 0 || hInt == 6) { <END> red = getBrightness(); green = c; blue = a; } else if (hInt == 1) { red = b; green = getBrightness(); blue = a; } else if (hInt == 2) { red = a; green = getBrightness(); blue = c; } else if (hInt == 3) { red = a; green = b; blue = getBrightness(); } else if (hInt == 4) { red = c; green = a; blue = getBrightness(); } else if (hInt == 5) { red = getBrightness(); green = a; blue = b; } else { throw new RuntimeException(); } return new PercentType[] { red, green, blue }; }</code><technical_language>a candidate for a switch case (as touched anyway)</technical_language>

Target:
public PercentType[] toRGB() { PercentType red = null; PercentType green = null; PercentType blue = null; BigDecimal h = hue.divide(BigDecimal.valueOf(100), 10, BigDecimal.ROUND_HALF_UP); BigDecimal s = saturation.divide(BigDecimal.valueOf(100)); int hInt = h.multiply(BigDecimal.valueOf(5)).divide(BigDecimal.valueOf(3), 10, BigDecimal.ROUND_HALF_UP) .intValue(); BigDecimal f = h.multiply(BigDecimal.valueOf(5)).divide(BigDecimal.valueOf(3), 10, BigDecimal.ROUND_HALF_UP) .remainder(BigDecimal.ONE); PercentType a = new PercentType(value.multiply(BigDecimal.ONE.subtract(s))); PercentType b = new PercentType(value.multiply(BigDecimal.ONE.subtract(s.multiply(f)))); PercentType c = new PercentType( value.multiply(BigDecimal.ONE.subtract((BigDecimal.ONE.subtract(f)).multiply(s)))); switch (hInt) { case 0: case 6: red = getBrightness(); green = c; blue = a; break; case 1: red = b; green = getBrightness(); blue = a; break; case 2: red = a; green = getBrightness(); blue = c; break; case 3: red = a; green = b; blue = getBrightness(); break; case 4: red = c; green = a; blue = getBrightness(); break; case 5: red = getBrightness(); green = a; blue = b; break; default: throw new RuntimeException(); } return new PercentType[] { red, green, blue }; }
Source:
<code>public SimpleGarbageCollector(Opts opts, VolumeManager fs, ServerConfigurationFactory confFactory) { super(confFactory); this.opts = opts; this.fs = fs; final AccumuloConfiguration conf = getConfiguration(); GcMetrics2 gcMetrics2 = null; <START> MetricsSystemHelper.configure("acc_gc"); <END> gcMetrics2 = GcMetrics2.init(this, MetricsSystemHelper.getInstance()); gcMetrics2.register(); final long gcDelay = conf.getTimeInMillis(Property.GC_CYCLE_DELAY); final String useFullCompaction = conf.get(Property.GC_USE_FULL_COMPACTION); log.info("start delay: milliseconds", getStartDelay()); log.info("time delay: milliseconds", gcDelay); log.info("safemode: {}", opts.safeMode); log.info("verbose: {}", opts.verbose); log.info("memory threshold: of bytes", CANDIDATE_MEMORY_PERCENTAGE, Runtime.getRuntime().maxMemory()); log.info("delete threads: {}", getNumDeleteThreads()); log.info("gc post metadata action: {}", useFullCompaction); }</code><technical_language>a more descriptive name here</technical_language>

Target:
public SimpleGarbageCollector(Opts opts, VolumeManager fs, ServerConfigurationFactory confFactory) { super(confFactory); this.opts = opts; this.fs = fs; final AccumuloConfiguration conf = getConfiguration(); if (conf.getBoolean(Property.GC_ENABLE_METRICS2)) { MetricsSystemHelper.configure("acc_gc"); GcHadoopMetrics2 gcHadoopMetrics2 = GcHadoopMetrics2.init(this, MetricsSystemHelper.getInstance()); gcHadoopMetrics2.register(); } else { MetricsSystemHelper.configure(SimpleGarbageCollector.class.getSimpleName()); } final long gcDelay = conf.getTimeInMillis(Property.GC_CYCLE_DELAY); final String useFullCompaction = conf.get(Property.GC_USE_FULL_COMPACTION); log.info("start delay: milliseconds", getStartDelay()); log.info("time delay: milliseconds", gcDelay); log.info("safemode: {}", opts.safeMode); log.info("verbose: {}", opts.verbose); log.info("memory threshold: of bytes", CANDIDATE_MEMORY_PERCENTAGE, Runtime.getRuntime().maxMemory()); log.info("delete threads: {}", getNumDeleteThreads()); log.info("gc post metadata action: {}", useFullCompaction); }
Source:
<code>public static <A, B, C, D> Equal<P4<A, B, C, D>> p4Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed) { return new Equal<P4<A, B, C, D>>(p1 -> p2 -> ea.eq(p1._1(), p2._1()) && eb.eq(p1._2(), p2._2()) && ec.eq(p1._3(), p2._3()) && <START> ed.eq(p1._4(), p2._4())); <END> }</code><technical_language>of Equal.equal advantage of type inference</technical_language>

Target:
public static <A, B, C, D> Equal<P4<A, B, C, D>> p4Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed) { return equal(p1 -> p2 -> ea.eq(p1._1(), p2._1()) && eb.eq(p1._2(), p2._2()) && ec.eq(p1._3(), p2._3()) && ed.eq(p1._4(), p2._4())); }
Source:
<code>protected void buildVmWatchdog() { <START> throw new NotImplementedException("not implemented"); <END> }</code><technical_language>throwing exception</technical_language>

Target:
protected void buildVmWatchdog() { }
Source:
<code>public void cleanup() { if (sharedTestEnv.isBigtable() && !enableTestForBigtable()) { return; } try (Admin admin = getConnection().getAdmin()) { delete(admin, tableName); delete(admin, anotherTableName); delete(admin, clonedTableName); for (SnapshotDescription snapDesc : admin.listSnapshots(snapshotName + ".*")) { <START> admin.deleteSnapshot(snapDesc.getName()); <END> } for (SnapshotDescription snapDesc : admin.listSnapshots(anotherSnapshotName + ".*")) { admin.deleteSnapshot(snapDesc.getName()); } } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>snapshot related methods need abstract, test of variations. listSnapshots deleteSnapshots examples. Please find of methods 'admin..*Snapshot replace abstract</technical_language>

Target:
public void cleanup() { if (sharedTestEnv.isBigtable() && !enableTestForBigtable()) { return; } try (Admin admin = getConnection().getAdmin()) { delete(admin, tableName); delete(admin, anotherTableName); delete(admin, clonedTableName); for (SnapshotDescription snapDesc : admin.listSnapshots(snapshotName + ".*")) { deleteSnapshot(snapDesc.getName()); } for (SnapshotDescription snapDesc : admin.listSnapshots(anotherSnapshotName + ".*")) { deleteSnapshot(snapDesc.getName()); } } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>public boolean test(MessageInfo messageInfo) { if (accountService != null) { Account account = accountService.getAccountById(messageInfo.getAccountId()); if (account == null) { logger.info("Can't get account through accountService : {}", accountService); return false; } Container container = account.getContainerById(messageInfo.getContainerId()); if (container == null) { logger.info("Can't get container through account : {}", account); return false; } Container.ContainerStatus status = container.getStatus(); if (status == Container.ContainerStatus.DELETE_IN_PROGRESS && container.getDeleteTriggerTime() + TimeUnit.DAYS.toMillis( replicationConfig.replicationContainerDeletionRetentionDays) < System.currentTimeMillis()) { logger.trace("Container is not qualified with retention time yet", container); return false; } if (status == Container.ContainerStatus.DELETE_IN_PROGRESS || status == Container.ContainerStatus.INACTIVE) { logger.trace("Container will be skipped during replication", container); return true; } else { logger.trace("Container is Active", container); return false; } } else { <START> logger.trace("Current accountService : {}", accountService); <END> return false; } }</code><technical_language>changing trace logger.debug</technical_language>

Target:
public boolean test(MessageInfo messageInfo) { if (accountService != null) { Account account = accountService.getAccountById(messageInfo.getAccountId()); if (account == null) { logger.info("Can't get account through accountService : {}", accountService); return false; } Container container = account.getContainerById(messageInfo.getContainerId()); if (container == null) { logger.info("Can't get container through account : {}", account); return false; } Container.ContainerStatus status = container.getStatus(); if (status == Container.ContainerStatus.DELETE_IN_PROGRESS && container.getDeleteTriggerTime() + TimeUnit.DAYS.toMillis( replicationConfig.replicationContainerDeletionRetentionDays) > System.currentTimeMillis()) { logger.debug("Container is not qualified as it’s still within retention time", container); return false; } if (status == Container.ContainerStatus.DELETE_IN_PROGRESS || status == Container.ContainerStatus.INACTIVE) { logger.info("Container will be skipped during replication", container); return true; } else { logger.debug("Container is Active", container); return false; } } else { logger.debug("Current accountService : {}", accountService); return false; } }
Source:
<code><START> public boolean canReadFile(File file) { <END> return file.canRead(); }</code><technical_language>static</technical_language>

Target:
public static boolean canReadFile(File file) { return file.canRead(); }
Source:
<code>void normalizeLinks(CheServiceImpl serviceToNormalizeLinks, Map<String, CheServiceImpl> services) { final List<String> containerLinks = serviceToNormalizeLinks.getLinks(); for (int i = 0; i < containerLinks.size(); i++) { <START> String serviceNameAndAliasToLink[] = containerLinks.get(i).split(":"); END> String serviceName = serviceNameAndAliasToLink[0]; String serviceAlias = (serviceNameAndAliasToLink.length > 1) ? serviceNameAndAliasToLink[1] : null; CheServiceImpl serviceLinkTo = services.get(serviceName); if (serviceLinkTo != null) { String containerNameLinkTo = serviceLinkTo.getContainerName(); containerLinks.set(i, (serviceAlias == null) ? containerNameLinkTo + ':' + serviceName : containerNameLinkTo + ':' + serviceAlias); } else { LOG.error("Attempt to link non existing service to service.", serviceName, serviceToNormalizeLinks); } } }</code><technical_language>Pass argument split</technical_language>

Target:
void normalizeLinks(CheServiceImpl serviceToNormalizeLinks, Map<String, CheServiceImpl> services) { serviceToNormalizeLinks.setLinks( serviceToNormalizeLinks.getLinks() .stream() .map(link -> { String serviceNameAndAliasToLink[] = link.split(":", 2); String serviceName = serviceNameAndAliasToLink[0]; String serviceAlias = (serviceNameAndAliasToLink.length > 1) ? serviceNameAndAliasToLink[1] : null; CheServiceImpl serviceLinkTo = services.get(serviceName); if (serviceLinkTo != null) { String containerNameLinkTo = serviceLinkTo.getContainerName(); return (serviceAlias == null) ? containerNameLinkTo : containerNameLinkTo + ':' + serviceAlias; } else { throw new IllegalArgumentException("Attempt to link non existing service " + serviceName + " to " + serviceToNormalizeLinks + " service."); } }).collect(toList())); }
Source:
<code><START> public Optional<String> getPrimaryTypeName() { <END> return getStorage() .map(Storage::getFileName) .map(filename -> filename.replace(".java", "")) .map(filename -> filename.replace(".jav", "")); }</code><technical_language>this? java CompilationUnit compU = JavaParser.parse(file); ClassOrInterfaceDeclaration = compU.getClassByName(compU.getPrimaryTypeName.get());</technical_language>

Target:
public Optional<String> getPrimaryTypeName() { return getStorage() .map(Storage::getFileName) .map(Utils::removeFileExtension); }
Source:
<code><START> public JacksonTraverseCallback(JsonGenerator generator) <END> { this(generator, false); }</code><technical_language>this public</technical_language>

Target:
protected JacksonTraverseCallback(JsonGenerator generator) { this(generator, false); }
Source:
<code>public Response listNotifiers(@Context UriInfo uriInfo) { List<CatalogService.QueryParam> queryParams = new ArrayList<CatalogService.QueryParam>(); try { MultivaluedMap<String, String> params = uriInfo.getQueryParameters(); Collection<NotifierInfo> notifierInfos; if (params.isEmpty()) { notifierInfos = catalogService.listNotifierInfos(); } else { for (String param : params.keySet()) { queryParams.add(new CatalogService.QueryParam(param, params.getFirst(param))); } notifierInfos = catalogService.listNotifierInfos(queryParams); } if(notifierInfos != null && ! notifierInfos.isEmpty()) { return WSUtils.respond(OK, SUCCESS, notifierInfos); } } catch (Exception ex) { <START> return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); <END> } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND_FOR_FILTER, queryParams.toString()); }</code><technical_language>If catch respond, lets log.error here. dropwizard is some magic</technical_language>

Target:
public Response listNotifiers(@Context UriInfo uriInfo) { List<CatalogService.QueryParam> queryParams = new ArrayList<CatalogService.QueryParam>(); try { MultivaluedMap<String, String> params = uriInfo.getQueryParameters(); Collection<NotifierInfo> notifierInfos; if (params.isEmpty()) { notifierInfos = catalogService.listNotifierInfos(); } else { for (String param : params.keySet()) { queryParams.add(new CatalogService.QueryParam(param, params.getFirst(param))); } notifierInfos = catalogService.listNotifierInfos(queryParams); } if(notifierInfos != null && ! notifierInfos.isEmpty()) { return WSUtils.respond(OK, SUCCESS, notifierInfos); } } catch (Exception ex) { LOG.error("Got exception", ex); return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND_FOR_FILTER, queryParams.toString()); }
Source:
<code>public Coordinator(CachedDatastreamReader datastreamCache, CoordinatorConfig config) throws DatastreamException { _datastreamCache = datastreamCache; _config = config; _clusterName = _config.getCluster(); _heartbeatPeriod = Duration.ofMillis(config.getHeartbeatPeriodMs()); _adapter = new ZkAdapter(_config.getZkAddress(), _clusterName, _config.getDefaultTransportProviderName(), _config.getZkSessionTimeout(), _config.getZkConnectionTimeout(), this); _eventQueue = new CoordinatorEventBlockingQueue(); _eventThread = new CoordinatorEventProcessor(); _eventThread.setDaemon(true); _dynamicMetricsManager = DynamicMetricsManager.getInstance(); _dynamicMetricsManager.registerGauge(MODULE, NUM_PAUSED_DATASTREAMS_GROUPS, PAUSED_DATASTREAMS_GROUPS::get); _dynamicMetricsManager.registerGauge(MODULE, IS_LEADER, () -> getIsLeader().getAsBoolean() ? 1 : 0); _dynamicMetricsManager.registerGauge(MODULE, MAX_PARTITION_COUNT_IN_TASK, MAX_PARTITION_COUNT::get); VerifiableProperties coordinatorProperties = new VerifiableProperties(_config.getConfigProperties()); _eventProducerConfig = coordinatorProperties.getDomainProperties(EVENT_PRODUCER_CONFIG_DOMAIN); _cpProvider = new ZookeeperCheckpointProvider(_adapter); Optional.ofNullable(_cpProvider.getMetricInfos()).ifPresent(_metrics::addAll); _metrics.addAll(EventProducer.getMetricInfos()); <START> _shutdown = false; <END> }</code><technical_language>This is redundant now</technical_language>

Target:
public Coordinator(CachedDatastreamReader datastreamCache, CoordinatorConfig config) throws DatastreamException { _datastreamCache = datastreamCache; _config = config; _clusterName = _config.getCluster(); _heartbeatPeriod = Duration.ofMillis(config.getHeartbeatPeriodMs()); _adapter = new ZkAdapter(_config.getZkAddress(), _clusterName, _config.getDefaultTransportProviderName(), _config.getZkSessionTimeout(), _config.getZkConnectionTimeout(), this); _eventQueue = new CoordinatorEventBlockingQueue(); _eventThread = new CoordinatorEventProcessor(); _eventThread.setDaemon(true); _dynamicMetricsManager = DynamicMetricsManager.getInstance(); _dynamicMetricsManager.registerGauge(MODULE, NUM_PAUSED_DATASTREAMS_GROUPS, PAUSED_DATASTREAMS_GROUPS::get); _dynamicMetricsManager.registerGauge(MODULE, IS_LEADER, () -> getIsLeader().getAsBoolean() ? 1 : 0); _dynamicMetricsManager.registerGauge(MODULE, MAX_PARTITION_COUNT_IN_TASK, MAX_PARTITION_COUNT::get); VerifiableProperties coordinatorProperties = new VerifiableProperties(_config.getConfigProperties()); _eventProducerConfig = coordinatorProperties.getDomainProperties(EVENT_PRODUCER_CONFIG_DOMAIN); _cpProvider = new ZookeeperCheckpointProvider(_adapter); Optional.ofNullable(_cpProvider.getMetricInfos()).ifPresent(_metrics::addAll); _metrics.addAll(EventProducer.getMetricInfos()); }
Source:
<code>protected List<Tree> getClauses(IfStatementTree ifStatement) { Preconditions.checkArgument(ifStatement.is(Kind.IF_STATEMENT)); List<Tree> clauses = new ArrayList<>(); clauses.add(ifStatement); clauses.addAll(ifStatement.elseifClauses()); <START> if (ifStatement.elseClause() != null) { <END> ElseClauseTree currentElseClause = ifStatement.elseClause(); while (currentElseClause != null) { StatementTree statement = currentElseClause.statements().get(0); if (statement.is(Kind.IF_STATEMENT)) { IfStatementTree nestedIfStatement = (IfStatementTree) statement; clauses.add(nestedIfStatement); checkedIfStatements.add(nestedIfStatement); currentElseClause = nestedIfStatement.elseClause(); } else { clauses.add(currentElseClause); currentElseClause = null; } } } return clauses; }</code><technical_language>@vilchik-elena I this condition is redundant next whilestatement</technical_language>

Target:
protected List<Tree> getClauses(IfStatementTree ifStatement) { Preconditions.checkArgument(ifStatement.is(Kind.IF_STATEMENT)); List<Tree> clauses = new ArrayList<>(); clauses.add(ifStatement); clauses.addAll(ifStatement.elseifClauses()); ElseClauseTree currentElseClause = ifStatement.elseClause(); while (currentElseClause != null) { StatementTree statement = currentElseClause.statements().get(0); if (statement.is(Kind.IF_STATEMENT)) { IfStatementTree nestedIfStatement = (IfStatementTree) statement; clauses.add(nestedIfStatement); checkedIfStatements.add(nestedIfStatement); currentElseClause = nestedIfStatement.elseClause(); } else { clauses.add(currentElseClause); currentElseClause = null; } } return clauses; }
Source:
<code>public static Configuration newMetastoreConf() { Configuration conf = new Configuration(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader == null) { classLoader = MetastoreConf.class.getClassLoader(); } <START> hiveDefaultURL = classLoader.getResource("hive-default.xml"); <END> hiveSiteURL = findConfigFile(classLoader, "hive-site.xml"); if (hiveSiteURL != null) conf.addResource(hiveSiteURL); URL hivemetastoreSiteUrl = findConfigFile(classLoader, "hivemetastore-site.xml"); if (hivemetastoreSiteUrl != null) conf.addResource(hivemetastoreSiteUrl); URL metastoreSiteURL = findConfigFile(classLoader, "metastore-site.xml"); if (metastoreSiteURL != null) conf.addResource(metastoreSiteURL); for (ConfVars var : ConfVars.values()) { if (System.getProperty(var.varname) != null) { LOG.debug("Setting conf value " + var.varname + " using value " + System.getProperty(var.varname)); conf.set(var.varname, System.getProperty(var.varname)); } else if (System.getProperty(var.hiveName) != null) { conf.set(var.hiveName, System.getProperty(var.hiveName)); } } if (getBoolVar(conf, ConfVars.SCHEMA_VERIFICATION)) { setBoolVar(conf, ConfVars.AUTO_CREATE_ALL, false); } return conf; }</code><technical_language>Do need add this Configuration, other ones</technical_language>

Target:
public static Configuration newMetastoreConf() { Configuration conf = new Configuration(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader == null) { classLoader = MetastoreConf.class.getClassLoader(); } hiveDefaultURL = classLoader.getResource("hive-default.xml"); hiveSiteURL = findConfigFile(classLoader, "hive-site.xml"); if (hiveSiteURL != null) conf.addResource(hiveSiteURL); hiveMetastoreSiteURL = findConfigFile(classLoader, "hivemetastore-site.xml"); if (hiveMetastoreSiteURL != null) conf.addResource(hiveMetastoreSiteURL); metastoreSiteURL = findConfigFile(classLoader, "metastore-site.xml"); if (metastoreSiteURL != null) conf.addResource(metastoreSiteURL); for (ConfVars var : ConfVars.values()) { if (System.getProperty(var.varname) != null) { LOG.debug("Setting conf value " + var.varname + " using value " + System.getProperty(var.varname)); conf.set(var.varname, System.getProperty(var.varname)); } else if (System.getProperty(var.hiveName) != null) { conf.set(var.hiveName, System.getProperty(var.hiveName)); } } if (getBoolVar(conf, ConfVars.SCHEMA_VERIFICATION)) { setBoolVar(conf, ConfVars.AUTO_CREATE_ALL, false); } return conf; }
Source:
<code>private void registerStatistic(Object context, String name, String observerName, String tag, String propertyKey, ValueStatistic<Number> source) { <START> Set<String> tags = new HashSet<>(Arrays.asList(tag, "tier")); <END> Map<String, Object> properties = new HashMap<>(); properties.put("discriminator", tag); properties.put(propertyKey, name); StatisticsManager.createPassThroughStatistic(context, observerName, tags, properties, source); }</code><technical_language>Replace Collections.singleton</technical_language>

Target:
private void registerStatistic(Object context, String name, String observerName, String tag, String propertyKey, ValueStatistic<Number> source) { Map<String, Object> properties = new HashMap<>(); properties.put("discriminator", tag); properties.put(propertyKey, name); StatisticsManager.createPassThroughStatistic(context, observerName, tags(tag, "tier"), properties, source); }
Source:
<code>public void changeMinimumTime(long change) { <START> synchronized (scoreBoardModel) { <END> setMinimumTime(minimumTime + change); } }</code><technical_language>coreLock</technical_language>

Target:
public void changeMinimumTime(long change) { synchronized (coreLock) { setMinimumTime(minimumTime + change); } }
Source:
<code>public LibraryContextSwitchEvent( EventType eventType, String uri ) { <START> this.eventType = eventType; <END> this.uri = uri; }</code><technical_language>Is worth null checks</technical_language>

Target:
public LibraryContextSwitchEvent( EventType eventType, String uri ) { checkNotNull( "eventType", eventType ); checkNotNull( "uri", uri ); this.eventType = eventType; this.uri = uri; }
Source:
<code>public GridData.Range onSelectHeaderCell(final int headerRowIndex, final int headerColumnIndex) { selectHeaderMerged(headerRowIndex, headerColumnIndex); <START> return new GridData.Range(headerRowIndex); <END> }</code><technical_language>@manstis I understand Range details, suspicious do return result of selectHeaderMerged</technical_language>

Target:
public GridData.Range onSelectHeaderCell(final int headerRowIndex, final int headerColumnIndex) { return selectHeaderCell(headerRowIndex, headerColumnIndex); }
Source:
<code>public void indexerTest() throws Exception { sparqlIndexer.update(uri, createDefaultModel().read( new StringReader(fooRDF), "", "N3")); waitForTriples(3); assertEquals("Triples should be present!", 3, countDescribeTriples(uri)); final String sparqlQuery = "PREFIX fcrepo: <<LINK_0>> \n" + "SELECT ?p \n" + "WHERE \n" + "{ ?p fcrepo:hasParent ?c }"; <START> assertEquals("Triple should return from search!", 3, countQueryTriples(sparqlQuery)); <END> sparqlIndexer.remove(uri); waitForTriples(0); assertTrue("Triples should not be present!", countDescribeTriples(uri) == 0); }</code><technical_language>This update build fail</technical_language>

Target:
public void indexerTest() throws Exception { sparqlIndexer.update(uri, createDefaultModel().read( new StringReader(fooRDF), "", "N3")); waitForTriples(3); assertEquals("Triples should be present!", 3, countDescribeTriples(uri)); final String sparqlQuery = "PREFIX fcrepo: <<LINK_0>> \n" + "SELECT ?p \n" + "WHERE \n" + "{ ?p fcrepo:hasParent ?c }"; assertTrue("Triple should return from search!", countQueryTriples(sparqlQuery) > 0 ); sparqlIndexer.remove(uri); waitForTriples(0); assertTrue("Triples should not be present!", countDescribeTriples(uri) == 0); }
Source:
<code>public void canRetrieveOwnNumber() throws Exception { final Repo repo = this.repo(); final RtEvent event = new RtEvent(new FakeRequest(), repo, 2); MatcherAssert.assertThat( event.number(), <START> Matchers.sameInstance(2) <END> ); }</code><technical_language>equalTo()</technical_language>

Target:
public void canRetrieveOwnNumber() throws Exception { final Repo repo = this.repo(); final RtEvent event = new RtEvent(new FakeRequest(), repo, 2); MatcherAssert.assertThat( event.number(), Matchers.equalTo(2) ); }
Source:
<code>private RollingUpdateOp rollingUpdateMarkUndeployed(final ZooKeeperClient client, final RollingUpdateOpFactory opFactory, final DeploymentGroup deploymentGroup, final String host) { try { final Node node = client.getNode( Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName())); final int version = node.getStat().getVersion(); final List<String> hostsToUndeploy = Json.read(node.getBytes(), STRING_LIST_TYPE); if (!hostsToUndeploy.removeAll(ImmutableList.of(host))) { return opFactory.nextTask(); } return opFactory.nextTask(ImmutableList.of( check(Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()), version), set(Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()), <START> Json.asBytes(hostsToUndeploy)))); <END> } catch (KeeperException | IOException e) { log.error("unable to mark host undeployed after removal from deployment group: " + "deployment-group={}, host={}", deploymentGroup.getName(), host, e); return opFactory.nextTask(); } }</code><technical_language>this check-then-set is done in a transaction, right? I catches races if in a transaction</technical_language>

Target:
private RollingUpdateOp rollingUpdateMarkUndeployed(final ZooKeeperClient client, final RollingUpdateOpFactory opFactory, final DeploymentGroup deploymentGroup, final String host) { try { final Node node = client.getNode( Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName())); final int version = node.getStat().getVersion(); final List<String> hostsToUndeploy = Json.read(node.getBytes(), STRING_LIST_TYPE); if (!hostsToUndeploy.removeAll(ImmutableList.of(host))) { return opFactory.nextTask(); } return opFactory.nextTask(ImmutableList.of( check(Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()), version), set(Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()), Json.asBytes(hostsToUndeploy)))); } catch (KeeperException | IOException e) { return opFactory.error("unable to mark host undeployed after removal from deployment group", host, RollingUpdateError.UNABLE_TO_MARK_HOST_UNDEPLOYED); } }
Source:
<code>public boolean equals(Object o) { <START> if (this == o) { <END> return true; } if (o == null || getClass() != o.getClass()) { return false; } TaskModel taskModel = (TaskModel) o; if (!changelogPartition.equals(taskModel.changelogPartition)) { return false; } if (!systemStreamPartitions.equals(taskModel.systemStreamPartitions)) { return false; } if (!taskName.equals(taskModel.taskName)) { return false; } return true; }</code><technical_language>Need update equals hashcode</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TaskModel taskModel = (TaskModel) o; if (!changelogPartition.equals(taskModel.changelogPartition)) { return false; } if (!systemStreamPartitions.equals(taskModel.systemStreamPartitions)) { return false; } if (!taskName.equals(taskModel.taskName)) { return false; } if (!taskMode.equals(taskModel.taskMode)) { return false; } return true; }
Source:
<code>private HashSet<String> determineStatusTags(IndexDocumentBean idb) throws IndexingException { <START> HashSet<String> statusTags = new HashSet<String>(); <END> List<String> contentStatus = idb.getContentStatus(); List<String> accessStatus = idb.getStatus(); if (contentStatus.contains(FacetConstants.UNPUBLISHED)) { statusTags.add(FacetConstants.UNPUBLISHED); } if (contentStatus.contains(FacetConstants.CONTENT_DESCRIBED)) { statusTags.add(FacetConstants.CONTENT_DESCRIBED); } else { statusTags.add(FacetConstants.CONTENT_NOT_DESCRIBED); } if (contentStatus.contains(FacetConstants.IS_PRIMARY_OBJECT)) { statusTags.add(FacetConstants.IS_PRIMARY_OBJECT); } if (accessStatus.contains(FacetConstants.EMBARGOED)) { statusTags.add(FacetConstants.EMBARGOED); } if (accessStatus.contains(FacetConstants.EMBARGOED_PARENT)) { statusTags.add(FacetConstants.EMBARGOED_PARENT); } return statusTags; }</code><technical_language>While pedantic, need <String></technical_language>

Target:
private HashSet<String> determineStatusTags(IndexDocumentBean idb) throws IndexingException { HashSet<String> statusTags = new HashSet<>(); List<String> contentStatus = idb.getContentStatus(); List<String> accessStatus = idb.getStatus(); if (contentStatus.contains(FacetConstants.UNPUBLISHED)) { statusTags.add(FacetConstants.UNPUBLISHED); } if (contentStatus.contains(FacetConstants.CONTENT_DESCRIBED)) { statusTags.add(FacetConstants.CONTENT_DESCRIBED); } else { statusTags.add(FacetConstants.CONTENT_NOT_DESCRIBED); } if (contentStatus.contains(FacetConstants.IS_PRIMARY_OBJECT)) { statusTags.add(FacetConstants.IS_PRIMARY_OBJECT); } if (accessStatus.contains(FacetConstants.EMBARGOED)) { statusTags.add(FacetConstants.EMBARGOED); } return statusTags; }
Source:
<code>public SpongeFlyingData() { <START> return new SpongeFlyingData(false); <END> }</code><technical_language>.... construct a new one, call this(false);</technical_language>

Target:
public SpongeFlyingData() { this(false); }
Source:
<code>private void createGroup() { if ( createGroupeIfNotExist ) { <START> Assert.hasText( consumerGroupName, "'consumerGroupName' must be set" ); <END> Assert.hasText( consumerName, "'consumerName' must be set" ); try { template.execute( (RedisCallback<Object>) connection -> connection.execute( "XGROUP", "CREATE".getBytes(), streamName.getBytes(), consumerGroupName.getBytes(), ReadOffset.latest().getOffset().getBytes(), "MKSTREAM".getBytes() ) ); } catch ( Exception e ) { e.printStackTrace(); } } }</code><technical_language>I a "hard" operation done in start(), init(): block main configuration thread for network interaction</technical_language>

Target:
private void createGroup() { if ( createGroupIfNotExist ) { Assert.notNull( template, "'template' should not be null" ); Assert.hasText( consumerGroupName, "'consumerGroupName' must be set" ); Assert.hasText( consumerName, "'consumerName' must be set" ); try { this.template.execute( ( RedisCallback<Object> ) connection -> connection.execute( "XGROUP", "CREATE".getBytes(), streamKey.getBytes(), consumerGroupName.getBytes(), ReadOffset.latest().getOffset().getBytes(), "MKSTREAM".getBytes() ) ); } catch ( Exception e ) { e.printStackTrace(); } } }
Source:
<code>protected VmDevice createVmDevice() { return new VmDevice(new VmDeviceId(disk.getId(), getVmId()), VmDeviceType.DISK.getName(), VmDeviceType.DISK.getName(), "", 0, null, true, getParameters().isPlugUnPlug(), false, "", <START> null); <END> }</code><technical_language>assuming this is null for future for able pass disk custom properties UI</technical_language>

Target:
protected VmDevice createVmDevice() { return new VmDevice(new VmDeviceId(disk.getId(), getVmId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", 0, null, true, getParameters().isPlugUnPlug(), false, "", null); }
Source:
<code>public Response taskPost( final Task task, @Context final HttpServletRequest req ) { final String dataSource = task.getDataSource(); final ResourceAction resourceAction = new ResourceAction( new Resource(dataSource, ResourceType.DATASOURCE), Action.WRITE ); Access authResult = AuthorizationUtils.authorizeResourceAction( req, resourceAction, authorizerMapper ); if (!authResult.isAllowed()) { return Response.status(Response.Status.FORBIDDEN) <START> .header("Access-Check-Result", authResult) <END> .entity(ImmutableMap.of("error", "Not authorized.")) .build(); } return asLeaderWith( taskMaster.getTaskQueue(), new Function<TaskQueue, Response>() { @Override public Response apply(TaskQueue taskQueue) { try { taskQueue.add(task); return Response.ok(ImmutableMap.of("task", task.getId())).build(); } catch (EntryExistsException e) { return Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.of("error", StringUtils.format("Task[%s] already exists!", task.getId()))) .build(); } } } ); }</code><technical_language>access check result is set place send a forbidden response e.g KafkaIndexTask start/stop. Suggest moving response creation utility method</technical_language>

Target:
public Response taskPost( final Task task, @Context final HttpServletRequest req ) { final String dataSource = task.getDataSource(); final ResourceAction resourceAction = new ResourceAction( new Resource(dataSource, ResourceType.DATASOURCE), Action.WRITE ); Access authResult = AuthorizationUtils.authorizeResourceAction( req, resourceAction, authorizerMapper ); if (!authResult.isAllowed()) { throw new ForbiddenException(authResult.toString()); } return asLeaderWith( taskMaster.getTaskQueue(), new Function<TaskQueue, Response>() { @Override public Response apply(TaskQueue taskQueue) { try { taskQueue.add(task); return Response.ok(ImmutableMap.of("task", task.getId())).build(); } catch (EntryExistsException e) { return Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.of("error", StringUtils.format("Task[%s] already exists!", task.getId()))) .build(); } } } ); }
Source:
<code>private long checkInternal(MesosComputer c) { if (c.getNode() == null) { return 1; } if ((System.currentTimeMillis() - c.getConnectTime()) < MINUTES.toMillis(idleTerminationMinutes)) { return 1; } if (c.isIdle()) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleTerminationMinutes)) { LOGGER.info("Disconnecting idle computer " + c.getName()); <START> c.getNode().setPendingDelete(true); <END> if (!c.isOffline()) { c.setTemporarilyOffline(true, OfflineCause.create(Messages._DeletedCause())); } } } return 1; }</code><technical_language>change mark for deletion instead of terminate it</technical_language>

Target:
private long checkInternal(MesosComputer c) { if (c.getNode() == null) { return 1; } if ((DateTimeUtils.currentTimeMillis() - c.getConnectTime()) < MINUTES.toMillis(idleTerminationMinutes < 1 ? 1 : idleTerminationMinutes)) { return 1; } if (isTerminable() && c.isIdle()) { final long idleMilliseconds = DateTimeUtils.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleTerminationMinutes)) { LOGGER.info("Disconnecting idle computer " + c.getName()); c.getNode().setPendingDelete(true); if (!c.isOffline()) { c.setTemporarilyOffline(true, OfflineCause.create(Messages._DeletedCause())); } } } return 1; }
Source:
<code>private SampleNumberPerProject createSampleNumberPerProject(Project project, User user) { SampleNumberPerProject sampleNumberPerProject; sampleNumberPerProject = new SampleNumberPerProjectImpl(); sampleNumberPerProject.setProject(project); sampleNumberPerProject.setHighestSampleNumber(0); sampleNumberPerProject.setPadding(DEFAULT_PADDING); sampleNumberPerProject.setCreatedBy(user); sampleNumberPerProject.setUpdatedBy(user); sampleNumberPerProject.setLastUpdated(new Date()); <START> sampleNumberPerProject.setCreationDate(new Date()); <END> addSampleNumberPerProject(sampleNumberPerProject); return sampleNumberPerProject; }</code><technical_language>Setting dates is handled addSampleNumberPerProject method, is required here</technical_language>

Target:
private SampleNumberPerProject createSampleNumberPerProject(Project project, User user) { SampleNumberPerProject sampleNumberPerProject; sampleNumberPerProject = new SampleNumberPerProjectImpl(); sampleNumberPerProject.setProject(project); sampleNumberPerProject.setHighestSampleNumber(0); sampleNumberPerProject.setPadding(DEFAULT_PADDING); sampleNumberPerProject.setCreatedBy(user); sampleNumberPerProject.setUpdatedBy(user); addSampleNumberPerProject(sampleNumberPerProject); return sampleNumberPerProject; }
Source:
<code>void connect(final Socket s, final String host, final int port) throws IOException { try { s.connect(new InetSocketAddress(host, port)); final DataOutputStream writer = new DataOutputStream(s.getOutputStream()); final BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream())); writer.writeBytes("HELO\n"); writer.flush(); final String line = reader.readLine(); if (line.startsWith("HELO")) { log.info("Connected to helios-solo watchdog"); } else { throw new IOException("We didn't get back the HELO we sent to the watchdog process."); } } catch (IOException e) { <START> log.debug("Failed to connect to helios-solo watchdog"); <END> throw e; } }</code><technical_language>catch log exception is rethrown, handling call-site</technical_language>

Target:
void connect(final Socket s, final String host, final int port) throws IOException { s.connect(new InetSocketAddress(host, port)); final DataOutputStream writer = new DataOutputStream(s.getOutputStream()); final BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream())); writer.writeBytes("HELO\n"); writer.flush(); final String line = reader.readLine(); if (line.startsWith("HELO")) { log.info("Connected to helios-solo watchdog"); } else { throw new IOException("We didn't get back the HELO we sent to the watchdog process."); } }