auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void sendSynchronous(final SimpleFieldSet params, final Bucket bucket) throws FCPCallFailedException { final Lock lock = new ReentrantLock(); final Condition condition = lock.newCondition(); lock.lock(); try { class Runner implements Runnable { volatile boolean finished = false; Throwable throwable = null; @Override public void run() { lock.lock(); try { target.onReply(pluginname, identifier, params, bucket); } catch (Throwable t) { throwable = t; } finally { finished = true; condition.signal(); lock.unlock(); } } }; final Runner runner = new Runner(); node.executor.execute(runner, "FCPPlugin reply runner for " + pluginname); while(!runner.finished) <START> condition.awaitUninterruptibly(); END> if(runner.throwable != null) throw new FCPCallFailedException(runner.throwable); } finally { lock.unlock(); } }</code><technical_language>If wake spuriously name Uninterruptibly misleading</technical_language>

Target:
public void sendSynchronous(final SimpleFieldSet params, final Bucket bucket) throws FCPCallFailedException { final Lock lock = new ReentrantLock(); final Condition condition = lock.newCondition(); lock.lock(); try { class Runner implements Runnable { volatile boolean finished = false; Throwable throwable = null; @Override public void run() { lock.lock(); try { target.onReply(pluginname, clientSideIdentifier, params, bucket); } catch (Throwable t) { throwable = t; } finally { finished = true; condition.signal(); lock.unlock(); } } }; final Runner runner = new Runner(); node.executor.execute(runner, "FCPPlugin reply runner for " + pluginname); while(!runner.finished) condition.awaitUninterruptibly(); if(runner.throwable != null) throw new FCPCallFailedException(runner.throwable); } finally { lock.unlock(); } }
Source:
<code>private void checkAuthorisationForResourceAreValid(final Resource resource) throws UnableProcessException, ServiceTemporarilyUnavailableException, ForbiddenOperationException { <START> checkAuthAttributesAreValid(resource.getAuthorization()); <END> try { authorizationService.areAllAuthorizationsForResourceValid(resource); } catch (OperationOnResourceNotPermitedException e) { throw new ForbiddenOperationException(e.getMessage()); } catch (AuthorizationInvalidException e) { throw new UnableProcessException(e.getMessage()); } catch (PluginException e) { throw new ServiceTemporarilyUnavailableException("Error calling authorization plugin", e); } }</code><technical_language>difference checkAuthAttributesAreValid areAllAuthorizationsForResourceValid? I thought plan replace later, right? areAllAuthorizationsForResourceValid perform of work checkAuthAttributesAreValid performs. in fact checkAuthAttributesAreValid a number of calls isAuthorizationAttributeValid. I source of potential security breaches if maintain methods a user ends thinking safe call isAuthorizationAttributeValid in fact, areAllAuthorizationsForResourceValid called. Please, correct if I missed something</technical_language>

Target:
private void checkAuthorisationForResourceAreValid(final Resource resource) throws UnableProcessException, ServiceTemporarilyUnavailableException, ForbiddenOperationException { try { authorizationService.isAuthorizationForResourceValid(resource); } catch (OperationOnResourceNotPermittedException e) { throw new ForbiddenOperationException(e.getMessage()); } catch (AuthorizationInvalidException e) { throw new UnprocessableEntityException(e.getMessage()); } catch (PluginException e) { throw new ServiceTemporarilyUnavailableException("Error calling authorization plugin", e); } }
Source:
<code>public void testDualAlarmState() throws Exception { AlarmPersisterImpl persisterImpl = (AlarmPersisterImpl)m_alarmd.getPersister(); persisterImpl.setLegacyAlarmState(true); final MockNode node = m_mockNetwork.getNode(1); assertEmptyAlarmTable(); String dbname = m_database.getTestDatabase(); System.out.println(dbname); sendNodeDownEvent(node); Callable<Integer> numAlarmsCallable = getNumAlarmsCallable(); await().atMost(10, SECONDS).until(numAlarmsCallable, equalTo(1)); sendNodeUpEvent(node); numAlarmsCallable = getNumAlarmsCallable(); await().atMost(10, SECONDS).until(numAlarmsCallable, equalTo(2)); <START> Thread.sleep(1000); <END> assertThat(m_alarmDao.findAll().stream().filter(a -> !a.isArchived() && OnmsSeverity.CLEARED.equals(a.getSeverity())).count(), equalTo(1L)); assertThat(m_alarmDao.findAll().stream().filter(a -> !a.isArchived() && OnmsSeverity.NORMAL.equals(a.getSeverity())).count(), equalTo(1L)); }</code><technical_language>If waiting for alarm cleared, await().... condition instead of explicit sleep</technical_language>

Target:
public void testDualAlarmState() throws Exception { AlarmPersisterImpl persisterImpl = (AlarmPersisterImpl)m_alarmd.getPersister(); persisterImpl.setLegacyAlarmState(true); final MockNode node = m_mockNetwork.getNode(1); assertEmptyAlarmTable(); sendNodeDownEvent(node); Callable<Integer> numAlarmsCallable = getNumAlarmsCallable(); await().atMost(10, SECONDS).until(numAlarmsCallable, equalTo(1)); sendNodeUpEvent(node); numAlarmsCallable = getNumAlarmsCallable(); await().atMost(10, SECONDS).until(numAlarmsCallable, equalTo(2)); await().atMost(10, SECONDS).until(() -> m_alarmDao.findAll().stream().filter(a -> !a.isArchived() && OnmsSeverity.CLEARED.equals(a.getSeverity())).count(), equalTo(1L)); assertThat(m_alarmDao.findAll().stream().filter(a -> !a.isArchived() && OnmsSeverity.NORMAL.equals(a.getSeverity())).count(), equalTo(1L)); }
Source:
<code>public void deleteRow(EntityId entityId, long upToTimestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete row while KijiTableWriter %s is in state %s.", this, state); final DeleteRequest delete = new DeleteRequest( <START> Bytes.toBytes(mTable.getName()), <END> entityId.getHBaseRowKey(), upToTimestamp); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }</code><technical_language>table name issue</technical_language>

Target:
public void deleteRow(EntityId entityId, long upToTimestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete row while KijiTableWriter %s is in state %s.", this, state); final DeleteRequest delete = new DeleteRequest( mTableName, entityId.getHBaseRowKey(), upToTimestamp); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }
Source:
<code><START> private static int getJVMPort(final ConfigParser parser, final int nodeId) <END> throws ConfigFileException { String[] args; if (nodeId == MyriaConstants.MASTER_ID) { args = getRequired(parser, "master", nodeId + "").split(":"); } else { args = getRequired(parser, "workers", nodeId + "").split(":"); } if (args.length <= 5) { return 0; } return Integer.parseInt(args[5]); }</code><technical_language>JVM port exist in hacked OpenJDK version? if a user specifies a nonzero for this port a standard JVM</technical_language>

Target:
private static int getJVMPort(final ConfigParser parser, final int nodeId) throws ConfigFileException { String[] args; if (nodeId == MyriaConstants.MASTER_ID) { args = getRequired(parser, "master", nodeId + "").split(":"); } else { args = getRequired(parser, "workers", nodeId + "").split(":"); } if (args.length <= 5 || args[5].equals("")) { return 0; } return Integer.parseInt(args[5]); }
Source:
<code><START> public Stream<BytesHandle> getParamValues() { <END> return Stream.of(NodeConverter.copyToBytesHandle(paramValues)); }</code><technical_language>change signature Stream<BufferableHandle> force conversion but, instead, call Stream.of() paramValues array</technical_language>

Target:
public Stream<BufferableHandle> getParamValues() { return Stream.of(paramValues); }
Source:
<code>protected void compile(String scriptSource) { engineBindings.unlock(); engineBindings.clear(); engineBindings.put(ScriptEngine.FILENAME, absolutePath); engineBindings.put(ModuleFunction.NAME, JsFunctionsImpl.getModuleFunction(componentPath, engine)); try { engine.eval(scriptSource); } catch (ScriptException e) { throw new UUFException("An error occurred while evaluating the JavaScript file '" + absolutePath + "'.", e); } Set<String> keySet = ((ScriptObjectMirror) engineBindings.get("nashorn.global")).keySet(); if (keySet.contains(FUNCTION_ON_GET)) { isOnGetFound = true; } if (keySet.contains(FUNCTION_ON_POST)) { isOnPostFound = true; } if (!isOnGetFound && !isOnPostFound) { <START> throw new UUFException("'onGet' and 'onPost' functions not found. Please implement at least on of them."); <END> } engineBindings.remove(ModuleFunction.NAME); engineBindings.put(CallOSGiServiceFunction.NAME, JsFunctionsImpl.getCallOsgiServiceFunction()); engineBindings.put(GetOSGiServicesFunction.NAME, JsFunctionsImpl.getGetOsgiServicesFunction()); engineBindings.put(CallMicroServiceFunction.NAME, JsFunctionsImpl.getCallMicroServiceFunction()); engineBindings.put(SendErrorFunction.NAME, JsFunctionsImpl.getSendErrorFunction()); engineBindings.put(SendRedirectFunction.NAME, JsFunctionsImpl.getSendRedirectFunction()); engineBindings.put(LoggerObject.NAME, JsFunctionsImpl.getLoggerObject(relativePath)); engineBindings.lock(); }</code><technical_language>'FUNCTION_ON_GET' 'FUNCTION_ON_POST' in JavaScript file 'absolutePath'. Please implement of them</technical_language>

Target:
protected void compile(String scriptSource) { engineBindings.unlock(); engineBindings.clear(); engineBindings.put(ScriptEngine.FILENAME, absolutePath); engineBindings.put(ModuleFunction.NAME, JsFunctionsImpl.getModuleFunction(componentPath, engine)); try { engine.eval(scriptSource); } catch (ScriptException e) { throw new UUFException("An error occurred while evaluating the JavaScript file '" + absolutePath + "'.", e); } Set<String> availableFunctions = ((ScriptObjectMirror) engineBindings.get("nashorn.global")).keySet(); if (availableFunctions.contains(FUNCTION_ON_GET)) { hasOnGetFunction = true; } if (availableFunctions.contains(FUNCTION_ON_POST)) { hasOnPostFunction = true; } if (!hasOnGetFunction && !hasOnPostFunction) { throw new UUFException( "Either '" + FUNCTION_ON_GET + "' or '" + FUNCTION_ON_POST + "' cannot be found in " + "JavaScript file '" + absolutePath + "'. Please implement at least one of them."); } engineBindings.remove(ModuleFunction.NAME); engineBindings.put(CallOSGiServiceFunction.NAME, JsFunctionsImpl.getCallOsgiServiceFunction()); engineBindings.put(GetOSGiServicesFunction.NAME, JsFunctionsImpl.getGetOsgiServicesFunction()); engineBindings.put(CallMicroServiceFunction.NAME, JsFunctionsImpl.getCallMicroServiceFunction()); engineBindings.put(SendErrorFunction.NAME, JsFunctionsImpl.getSendErrorFunction()); engineBindings.put(SendRedirectFunction.NAME, JsFunctionsImpl.getSendRedirectFunction()); engineBindings.put(LoggerObject.NAME, JsFunctionsImpl.getLoggerObject(relativePath)); engineBindings.lock(); }
Source:
<code>protected void downloadSingleFile(final CloudFile cloudFile) throws WAStorageException { final DownloadServiceData serviceData = getServiceData(); try { println("Downloading file:" + cloudFile.getUri().toString()); final FilePath destFile = destinationFilePath(cloudFile.getName()); final long startTime = System.currentTimeMillis(); try (OutputStream fos = destFile.write()) { cloudFile.download(fos, null, new FileRequestOptions(), Utils.updateUserAgent()); } final long endTime = System.currentTimeMillis(); println(String.format( "blob %s is downloaded to %s in %s", cloudFile.getName(), destFile.getParent(), getTime(endTime - startTime))); if (serviceData.isDeleteFromAzureAfterDownload()) { cloudFile.deleteIfExists(); println("cloud file " + cloudFile.getName() + " is deleted from Azure."); } } catch (Exception e) { <START> throw new WAStorageException(e.getMessage(), e.getCause()); <END> } }</code><technical_language>lose frame of stack trace if e.getCause(), e here</technical_language>

Target:
protected void downloadSingleFile(final CloudFile cloudFile) throws WAStorageException { final DownloadServiceData serviceData = getServiceData(); try { println("Downloading file:" + cloudFile.getUri().toString()); final FilePath destFile = destinationFilePath(cloudFile.getName()); final long startTime = System.currentTimeMillis(); try (OutputStream fos = destFile.write()) { cloudFile.download(fos, null, new FileRequestOptions(), Utils.updateUserAgent()); } final long endTime = System.currentTimeMillis(); println(String.format( "blob %s is downloaded to %s in %s", cloudFile.getName(), destFile.getParent(), getTime(endTime - startTime))); if (serviceData.isDeleteFromAzureAfterDownload()) { cloudFile.deleteIfExists(); println("cloud file " + cloudFile.getName() + " is deleted from Azure."); } } catch (Exception e) { throw new WAStorageException(e.getMessage(), e); } }
Source:
<code>private Properties loadProperties(String configurationFileName) { final Properties props = new Properties(); final File propertyFile = new File(StringUtils.strip(configurationFileName)); log.info("Loading {}", propertyFile.getAbsolutePath()); <START> try { <END> props.load(new FileInputStream(propertyFile)); } catch (IOException e) { throw new ReviewException("IO exception when reading JSLint configuration file.", e); } return props; }</code><technical_language>please try resources in ConfigurationHolder</technical_language>

Target:
private Properties loadProperties(String configurationFileName) { final Properties props = new Properties(); try (FileReader fileReader = new FileReader(configurationFileName)) { log.info("Loading {}", configurationFileName); props.load(fileReader); } catch (IOException e) { log.error("Load JSLint properties operation failed", e); throw new ReviewException("IO exception when reading JSLint configuration file.", e); } return props; }
Source:
<code>protected boolean connectLunDisks(Guid hostId) { if (getVm().getDiskMap().isEmpty()) { vmHandler.updateDisksFromDb(getVm()); } List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getVm().getDiskMap().values()); Set<String> connections = new HashSet<>(); for (LunDisk lunDisk : lunDisks) { LUNs lun = lunDisk.getLun(); lun.setLunConnections(new ArrayList<>(storageServerConnectionDao.getAllForLun(lun.getLUNId()))); if (connections.containsAll( lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList()))) { <START> continue; <END> } if (lun.getLunConnections().isEmpty()) { return false; } if (!connect(hostId, lun)) { log.info("Failed to connect a lun disk to vdsm '{}' skipping it", hostId); return false; } connections.addAll(lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList())); } return true; }</code><technical_language>Consider add a log in case</technical_language>

Target:
protected boolean connectLunDisks(Guid hostId) { if (getVm().getDiskMap().isEmpty()) { vmHandler.updateDisksFromDb(getVm()); } List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getVm().getDiskMap().values()); Set<String> connections = new HashSet<>(); for (LunDisk lunDisk : lunDisks) { LUNs lun = lunDisk.getLun(); lun.setLunConnections(new ArrayList<>(storageServerConnectionDao.getAllForLun(lun.getLUNId()))); if (connections.containsAll( lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList()))) { continue; } if (lun.getLunConnections().isEmpty()) { return false; } if (!connect(hostId, lun)) { log.error("Failed to connect a lun disk '{}' to vdsm '{}' skipping it", lun, hostId); return false; } connections.addAll(lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList())); } return true; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); <START> <END> setContentView(R.layout.activity_extrusion_rotation); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; setupBuildings(); setupLocationPlugin(); } }); sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); gyro = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); magnetic = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); sensorManager.registerListener(this, gyro , 200); sensorManager.registerListener(this, magnetic , 200); }</code><technical_language>Please add // This contains MapView in XML needs called access token is configured. setContentView(R.layout.activity_extrusion_rotation); line</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_extrusion_rotation); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; setupBuildingExtrusionPlugin(); } }); }
Source:
<code>public static InputStream openInputStream(final String uri, final Function<SeekableByteChannel, SeekableByteChannel> wrapper) throws IOException { final String scheme = Optional.ofNullable(IOUtil.getScheme(uri)).orElse(""); final InputStream inputStream; <START> final Set<String> URL_SCHEMES = new HashSet<>(Arrays.asList("http","ftp","https")); <END> if (URL_SCHEMES.contains(scheme)) { inputStream = getURLHelper(new URL(uri)).openInputStream(); } else if (scheme.isEmpty()) { File file = new File(uri); inputStream = new FileInputStream(file); } else { inputStream = new SeekablePathStream(IOUtil.getPath(uri), wrapper); } return inputStream; }</code><technical_language>this a private static avoid creating time method is called</technical_language>

Target:
public static InputStream openInputStream(final String uri, final Function<SeekableByteChannel, SeekableByteChannel> wrapper) throws IOException { final InputStream inputStream; if (URL_SCHEMES.stream().anyMatch(uri::startsWith)) { inputStream = getURLHelper(new URL(uri)).openInputStream(); } else if (!IOUtil.hasScheme(uri)) { File file = new File(uri); inputStream = Files.newInputStream(file.toPath()); } else { inputStream = new SeekablePathStream(IOUtil.getPath(uri), wrapper); } return inputStream; }
Source:
<code>public @ResponseBody List<AffiliationForm> getAffiliationsJson(HttpServletRequest request, @PathVariable("orcid") String orcid, @RequestParam(value = "affiliationIds") String workIdsStr) { List<AffiliationForm> affs = new ArrayList<AffiliationForm>(); Map<Long, Affiliation> affMap = affiliationMap(orcid, profileEntManager.getLastModified(orcid)); String[] affIds = workIdsStr.split(","); for (String id : affIds) { Affiliation aff = affMap.get(Long.valueOf(id)); validateVisibility(aff.getVisibility()); AffiliationForm form = AffiliationForm.valueOf(aff); form.setCountryForDisplay(getMessage(buildInternationalizationKey(CountryIsoEntity.class, aff.getOrganization().getAddress().getCountry().name()))); <START> if(form.getDisambiguatedAffiliationSourceId() != null){ <END> OrgDisambiguated orgDisambiguated = orgDisambiguatedManager.findInDB(Long.parseLong(form.getOrgDisambiguatedId().getValue())); form.setOrgDisambiguatedName(orgDisambiguated.getValue()); form.setOrgDisambiguatedUrl(orgDisambiguated.getUrl()); form.setOrgDisambiguatedCity(orgDisambiguated.getCity()); form.setOrgDisambiguatedRegion(orgDisambiguated.getRegion()); form.setOrgDisambiguatedCountry(orgDisambiguated.getCountry()); } affs.add(form); } return affs; }</code><technical_language>affiliationsController if condition</technical_language>

Target:
public @ResponseBody List<AffiliationForm> getAffiliationsJson(HttpServletRequest request, @PathVariable("orcid") String orcid, @RequestParam(value = "affiliationIds") String workIdsStr) { List<AffiliationForm> affs = new ArrayList<AffiliationForm>(); Map<Long, Affiliation> affMap = affiliationMap(orcid, profileEntManager.getLastModified(orcid)); String[] affIds = workIdsStr.split(","); for (String id : affIds) { Affiliation aff = affMap.get(Long.valueOf(id)); validateVisibility(aff.getVisibility()); AffiliationForm form = AffiliationForm.valueOf(aff); form.setCountryForDisplay(getMessage(buildInternationalizationKey(CountryIsoEntity.class, aff.getOrganization().getAddress().getCountry().name()))); if(form.getOrgDisambiguatedId() != null){ OrgDisambiguated orgDisambiguated = orgDisambiguatedManager.findInDB(Long.parseLong(form.getOrgDisambiguatedId().getValue())); form.setOrgDisambiguatedName(orgDisambiguated.getValue()); form.setOrgDisambiguatedUrl(orgDisambiguated.getUrl()); form.setOrgDisambiguatedCity(orgDisambiguated.getCity()); form.setOrgDisambiguatedRegion(orgDisambiguated.getRegion()); form.setOrgDisambiguatedCountry(orgDisambiguated.getCountry()); } affs.add(form); } return affs; }
Source:
<code>public void receiveFile( String file1, String file2 ) throws Exception { log.debug(String.format("Receiving: '%1$s' '%2$s", file1, file2)); _remoteFileName(file1); MessageDigest localDigest = MessageDigest.getInstance("MD5"); PipedOutputStream pout = new PipedOutputStream(); final PipedInputStream pin = new PipedInputStream(pout); final OutputStream out = new DigestOutputStream( new FileOutputStream(file2), localDigest ); Thread t = new Thread( new Runnable() { public void run() { InputStream in = null; try { in = new GZIPInputStream(pin); byte b = new byte[8196]; int n; while ((n = in.read(b)) != -1) { out.write(b, 0, n); } } catch (IOException e) { log.debug(e); } finally { if (in != null) { try { in.close(); } catch(IOException e) { log.error(e); } } } } }, "SSHClient.decompress " + file2 ); try { t.start(); ByteArrayOutputStream remoteDigest = new ConstraintByteArrayOutputStream(1024); executeCommand( String.format(COMMAND_FILE_RECEIVE, "gzip -q", file1), new ByteArrayInputStream(new byte[0]), pout, remoteDigest ); <START> t.join(1000); END> _validateDigest(localDigest, new String(remoteDigest.toByteArray(), "UTF-8").trim()); } catch(Exception e) { log.debug(e); throw e; } finally { t.interrupt(); try { out.close(); } catch(IOException e) { log.error(e); } } }</code><technical_language>in send file method</technical_language>

Target:
public void receiveFile( String file1, String file2 ) throws Exception { log.debug(String.format("Receiving: '%1$s' '%2$s", file1, file2)); _remoteFileName(file1); MessageDigest localDigest = MessageDigest.getInstance("MD5"); PipedOutputStream pout = new PipedOutputStream(); final InputStream pin = new PipedInputStream(pout, STREAM_BUFFER_SIZE); final OutputStream out = new DigestOutputStream( new FileOutputStream(file2), localDigest ); Thread t = new Thread( new Runnable() { public void run() { InputStream in = null; try { in = new GZIPInputStream(pin); byte b = new byte[STREAM_BUFFER_SIZE]; int n; while ((n = in.read(b)) != -1) { out.write(b, 0, n); } } catch (IOException e) { log.debug("Exceution during stream processing", e); } finally { if (in != null) { try { in.close(); } catch(IOException e) { log.error("Cannot close stream", e); } } } } }, "SSHClient.decompress " + file2 ); try { t.start(); ByteArrayOutputStream remoteDigest = new ConstraintByteArrayOutputStream(CONSTRAINT_BUFFER_SIZE); executeCommand( String.format(COMMAND_FILE_RECEIVE, "gzip -q", file1), new ByteArrayInputStream(new byte[0]), pout, remoteDigest ); t.join(THREAD_JOIN_WAIT_TIME); if (t.getState() != Thread.State.TERMINATED) { throw new IllegalStateException("Cannot stop SSH stream thead"); } _validateDigest(localDigest, new String(remoteDigest.toByteArray(), "UTF-8").trim()); } catch(Exception e) { log.debug("Receive failed", e); throw e; } finally { t.interrupt(); try { out.close(); } catch(IOException e) { log.error("Cannot close stream", e); } } log.debug(String.format("Received: '%1$s' '%2$s", file1, file2)); }
Source:
<code>public boolean validate(byte[] key, byte[] auth) { try { String keyStr = new String(key, "UTF-8"); String authStr = new String(auth, "UTF-8"); int keyVal = Integer.parseInt(keyStr); int authVal = Integer.parseInt(authStr); if (keyVal!=0 && ((authVal % keyVal) != 0)) { return false; } <START> } catch (NumberFormatException nfe) { <END> return false; } catch (UnsupportedEncodingException e) { return false; } return true; }</code><technical_language>nit: ZK support Java 7, rewrite this line (i.e., multi-catch), right? } catch (NumberFormatException|UnsupportedEncodingException ex) { return false; }</technical_language>

Target:
private boolean validate(byte[] key, byte[] auth) { try { String keyStr = new String(key, "UTF-8"); String authStr = new String(auth, "UTF-8"); int keyVal = Integer.parseInt(keyStr); int authVal = Integer.parseInt(authStr); if (keyVal!=0 && ((authVal % keyVal) != 0)) { return false; } } catch (NumberFormatException | UnsupportedEncodingException nfe) { LOG.error("bad formatting", nfe); return false; } return true; }
Source:
<code>public static Replicas singleton(Replica replica) { <START> return of(Collections.singleton(replica)); <END> }</code><technical_language>This allocation if skip Collections.singleton</technical_language>

Target:
public static ReplicaCollection singleton(Replica replica) { return of(replica); }
Source:
<code>public UsageEventType(Plugin plugin, String categoryName, String actionName, String labelDescription, String valueDescription) { <START> if(plugin == null) { <END> throw new IllegalArgumentException("Plugin may not be null"); } if(actionName == null) { throw new IllegalArgumentException("Action name may not be null"); } actionName = actionName.replaceAll("\\s", "-"); String id = plugin.getBundle().getSymbolicName(); String[] segments = id.split("\\."); if(segments.length<4) { throw new IllegalArgumentException("Plugin ID (\"" + id + "\") must have at least 4 segments. For example: \"org.jboss.tools.common\""); } String componentName = segments[3]; Version version = plugin.getBundle().getVersion(); String componentVersion = "" + version.getMajor() + "." + version.getMinor() + "." + version.getMicro(); this.componentName = componentName; this.componentVersion = componentVersion; if(categoryName==null) { categoryName = componentName; } this.categoryName = categoryName; this.actionName = actionName; this.labelDescription = labelDescription; this.valueDescription = valueDescription; }</code><technical_language>done more easily: org.eclipse.core.runtime.Assert.isLegal(condition)</technical_language>

Target:
public UsageEventType(Plugin plugin, String categoryName, String actionName, String labelDescription, String valueDescription) { this(getComponentName(plugin), getVersion(plugin), categoryName, actionName, labelDescription, valueDescription); }
Source:
<code>private void deleteAce(Sid sid, MutableAcl acl) { int nrEntries = acl.getEntries().size(); for (int i = nrEntries - 1; i >= 0; i--) { AccessControlEntry accessControlEntry = acl.getEntries().get(i); if (accessControlEntry.getSid().equals(sid)) { acl.deleteAce(i); <START> mutableAclService.updateAcl(acl); <END> } } }</code><technical_language>performance: update ACL updating ACE list instead of for ACE</technical_language>

Target:
private void deleteAce(Sid sid, MutableAcl acl) { int nrEntries = acl.getEntries().size(); boolean updated = false; for (int i = nrEntries - 1; i >= 0; i--) { AccessControlEntry accessControlEntry = acl.getEntries().get(i); if (accessControlEntry.getSid().equals(sid)) { acl.deleteAce(i); updated = true; } } if (updated) { mutableAclService.updateAcl(acl); } }
Source:
<code>public CloseableIterable<RyaStatement> query(final RyaQuery ryaQuery) throws RyaDAOException { <START> return query(new BatchRyaQuery(Collections.singleton(ryaQuery.getQuery()))); <END> }</code><technical_language>Null check</technical_language>

Target:
public CloseableIterable<RyaStatement> query(final RyaQuery ryaQuery) throws RyaDAOException { Preconditions.checkNotNull(ryaQuery); return query(new BatchRyaQuery(Collections.singleton(ryaQuery.getQuery()))); }
Source:
<code>public void testCompressionSkip() { EmbeddedChannel encoderChannel = new EmbeddedChannel(new PerFrameDeflateEncoder(9, 15, false, ALWAYS_SKIP)); EmbeddedChannel decoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame binaryFrame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV3, Unpooled.wrappedBuffer(payload)); <START> encoderChannel.writeOutbound(binaryFrame.copy()); <END> BinaryWebSocketFrame outboundFrame = encoderChannel.readOutbound(); assertNotNull(outboundFrame); assertNotNull(outboundFrame.content()); assertArrayEquals(payload, ByteBufUtil.getBytes(outboundFrame.content())); assertEquals(WebSocketExtension.RSV3, outboundFrame.rsv()); assertTrue(outboundFrame.release()); decoderChannel.writeInbound(binaryFrame); BinaryWebSocketFrame inboundBinaryFrame = decoderChannel.readInbound(); assertNotNull(inboundBinaryFrame); assertNotNull(inboundBinaryFrame.content()); assertArrayEquals(payload, ByteBufUtil.getBytes(inboundBinaryFrame.content())); assertEquals(WebSocketExtension.RSV3, inboundBinaryFrame.rsv()); assertTrue(inboundBinaryFrame.release()); assertEquals(0, binaryFrame.refCnt()); }</code><technical_language>assert return</technical_language>

Target:
public void testCompressionSkip() { EmbeddedChannel encoderChannel = new EmbeddedChannel( new PerFrameDeflateEncoder(9, 15, false, ALWAYS_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame binaryFrame = new BinaryWebSocketFrame(true, 0, Unpooled.wrappedBuffer(payload)); assertTrue(encoderChannel.writeOutbound(binaryFrame.copy())); BinaryWebSocketFrame outboundFrame = encoderChannel.readOutbound(); assertNotNull(outboundFrame); assertNotNull(outboundFrame.content()); assertArrayEquals(payload, ByteBufUtil.getBytes(outboundFrame.content())); assertEquals(0, outboundFrame.rsv()); assertTrue(outboundFrame.release()); assertFalse(encoderChannel.finish()); }
Source:
<code><START> public static Long getLogTail(Layout layout, CorfuRuntime runtime) { <END> Set<Long> luResponses = new HashSet<>(); Layout.LayoutSegment segment = layout.getLatestSegment(); if (segment.getReplicationMode().equals(Layout.ReplicationMode.CHAIN_REPLICATION)) { for (Layout.LayoutStripe stripe : segment.getStripes()) { Long tail = CFUtils.getUninterruptibly( runtime.getLayoutView().getRuntimeLayout(layout) .getLogUnitClient(stripe.getLogServers().get(0)) .getLogTail()); luResponses.add(tail); } } else if (segment.getReplicationMode() .equals(Layout.ReplicationMode.QUORUM_REPLICATION)) { throw new UnsupportedOperationException(); } return Collections.max(luResponses); }</code><technical_language>please long</technical_language>

Target:
public static long getLogTail(Layout layout, CorfuRuntime runtime) { long globalLogTail = Address.NON_EXIST; Layout.LayoutSegment segment = layout.getLatestSegment(); if (segment.getReplicationMode() == Layout.ReplicationMode.CHAIN_REPLICATION) { for (Layout.LayoutStripe stripe : segment.getStripes()) { TailsResponse response = CFUtils.getUninterruptibly( runtime.getLayoutView().getRuntimeLayout(layout) .getLogUnitClient(stripe.getLogServers().get(DEFAULT_LOGUNIT)) .getLogTail()); globalLogTail = Long.max(globalLogTail, response.getLogTail()); } } else if (segment.getReplicationMode() == Layout.ReplicationMode.QUORUM_REPLICATION) { throw new UnsupportedOperationException(); } return globalLogTail; }
Source:
<code>private static void logAuthSuccess(String user, String fromAddress) { <START> if (fromAddress == null) <END> fromAddress = ""; else fromAddress = " from " + fromAddress; String format = "Authenticated user " + user + "%s. This message is rate limited to once every 60 seconds."; RateLimitedLogger.tryLogForMessage(System.currentTimeMillis(), 60, TimeUnit.SECONDS, authLogger, Level.INFO, format, fromAddress); }</code><technical_language>braces for if statements. Alternatively one-liners, braces typically preferred</technical_language>

Target:
private static void logAuthSuccess(String user, String fromAddress) { if (fromAddress == null) { fromAddress = "NULL"; } String authenticationLogMessage = String.format( "Authenticated user %s from %s. This message is rate limited to once every 60 seconds.", user, fromAddress); RateLimitedLogger.tryLogForMessage(System.currentTimeMillis(), 60, TimeUnit.SECONDS, authLogger, Level.INFO, authenticationLogMessage); }
Source:
<code>public static void setApplicationIconBadgeNumber(Context context, int badgeCount) { if (badgeCount > 0) { ShortcutBadger.applyCount(context, badgeCount); SharedPreferences.Editor editor = context.getSharedPreferences("badge", Context.MODE_PRIVATE).edit(); editor.putInt("badge", badgeCount); editor.apply(); } else { ShortcutBadger.removeCount(context); SharedPreferences.Editor editor = context.getSharedPreferences("badge", Context.MODE_PRIVATE).edit(); editor.putInt("badge", 0); <START> editor.apply(); <END> } }</code><technical_language>is some duplicate code in if/else block. move setting of badge number if/else do like: SharedPreferences.Editor editor = context.getSharedPreferences("badge", Context.MODE_PRIVATE).edit(); editor.putInt("badge", badge > 0 ? badge : 0); editor.apply();</technical_language>

Target:
public static void setApplicationIconBadgeNumber(Context context, int badgeCount) { if (badgeCount > 0) { ShortcutBadger.applyCount(context, badgeCount); }else{ ShortcutBadger.removeCount(context); } SharedPreferences.Editor editor = context.getSharedPreferences(BADGE, Context.MODE_PRIVATE).edit(); editor.putInt(BADGE, Math.max(badgeCount, 0)); editor.apply(); }
Source:
<code>public static void tearDown() throws IOException, OperationException, TimeoutException, InterruptedException { try { operations.removeIfExists(endpointConfigurationAddress); administration.reloadIfRequired(); <START> administration.restartIfRequired(); <END> } finally { client.close(); } }</code><technical_language>Is restart necessary here? check takes some time in test run..</technical_language>

Target:
public static void tearDown() throws IOException, OperationException, TimeoutException, InterruptedException { try { operations.removeIfExists(endpointConfigurationAddress); administration.reloadIfRequired(); } finally { client.close(); } }
Source:
<code>public String getMetricTypeId() { <START> return idIfTypeCorrect(CanonicalPath.this, Resource.class); <END> }</code><technical_language>s/Resource/Metric(Type)/</technical_language>

Target:
public String getMetricTypeId() { return idIfTypeCorrect(CanonicalPath.this, MetricType.class); }
Source:
<code>public static RuntimeException propagate(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException) throwable); <START> if (throwable instanceof ExecutionException) <END> return Throwables.propagate(throwable.getCause()); return Throwables.propagate(throwable); }</code><technical_language>Yikes. I this before. Is in master?! unwrap ExecutionException this. exception happened in this thread, in other thread. For example, if other thread interrupted ExecutionException.getCause() return InterruptedException. Rethrowing _this_ thread is interrupted (and interrupt is handled incorrectly, is caught wrapped marking this thread Thread.interrupt()</technical_language>

Target:
public static RuntimeException propagate(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException) throwable); return Throwables.propagate(throwable); }
Source:
<code><START> private UserAndRoleMap loadUserAndRoleMapFromDisk(String prefix) throws Exception <END> { File userAndRoleMapFile = new File(commonCacheConfig.getCacheDirectory(), getUserRoleMapFilename(prefix)); if (!userAndRoleMapFile.exists()) { return null; } return objectMapper.readValue( userAndRoleMapFile, BasicAuthUtils.AUTHORIZER_USER_AND_ROLE_MAP_TYPE_REFERENCE ); }</code><technical_language>reduced throws IOException</technical_language>

Target:
private UserAndRoleMap loadUserAndRoleMapFromDisk(String prefix) throws IOException { File userAndRoleMapFile = new File(commonCacheConfig.getCacheDirectory(), getUserRoleMapFilename(prefix)); if (!userAndRoleMapFile.exists()) { return null; } return objectMapper.readValue( userAndRoleMapFile, BasicAuthUtils.AUTHORIZER_USER_AND_ROLE_MAP_TYPE_REFERENCE ); }
Source:
<code>public void save() throws SQLException, IOException { createStoreDatabase(); if (this.schema == null) throw new RuntimeException("Uninitialized schema!"); Integer schemaId = executeInsert(schemaInsert, position.getFile(), position.getOffset(), 1); <START> for (Database d : schema.getDatabases()) { <END> Integer dbId = executeInsert(databaseInsert, schemaId, d.getName(), d.getEncoding()); for (Table t : d.getTableList()) { Integer tableId = executeInsert(tableInsert, schemaId, dbId, t.getName(), t.getEncoding()); for (ColumnDef c : t.getColumnList()) { executeInsert(columnInsert, schemaId, tableId, c.getName(), c.getEncoding(), c.getType(), c.getSigned() ? 1 : 0); } } } }</code><technical_language>Is this fine? this a transaction, maybe</technical_language>

Target:
public void save() throws SQLException, IOException { createStoreDatabase(); if (this.schema == null) throw new RuntimeException("Uninitialized schema!"); try { connection.setAutoCommit(false); saveSchema(); connection.commit(); } finally { connection.setAutoCommit(true); } }
Source:
<code>public void fetchThemes() { if (mFetchingThemes) { return; } mFetchingThemes = true; int page = 1; if (mThemeBrowserFragment != null) { page = mThemeBrowserFragment.getPage(); } WordPress.getRestClientUtilsV1_2().getFreeThemes(mSite.getSiteId(), THEME_FETCH_MAX, page, new Listener() { @Override public void onResponse(JSONObject response) { new FetchThemesTask().execute(response); } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError response) { if (response.toString().equals(AuthFailureError.class.getName())) { String errorTitle = getString(R.string.theme_auth_error_title); String errorMsg = getString(R.string.theme_auth_error_message); if (mIsRunning) { FragmentTransaction ft = getFragmentManager().beginTransaction(); WPAlertDialogFragment fragment = WPAlertDialogFragment.newAlertDialog(errorMsg, errorTitle); ft.add(fragment, ALERT_TAB); ft.commitAllowingStateLoss(); } AppLog.d(T.THEMES, getString(R.string.theme_auth_error_authenticate)); } else { ToastUtils.showToast(ThemeBrowserActivity.this, R.string.theme_fetch_failed, ToastUtils.Duration.LONG) <START> .show(); <END> AppLog.d(T.THEMES, getString(R.string.theme_fetch_failed) + ": " + response.toString()); } mFetchingThemes = false; } } ); }</code><technical_language>This .show() call removed ;)</technical_language>

Target:
public void fetchThemes() { if (mFetchingThemes) { return; } mFetchingThemes = true; int page = 1; if (mThemeBrowserFragment != null) { page = mThemeBrowserFragment.getPage(); } WordPress.getRestClientUtilsV1_2().getFreeThemes(mSite.getSiteId(), THEME_FETCH_MAX, page, new Listener() { @Override public void onResponse(JSONObject response) { new FetchThemesTask().execute(response); } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError response) { if (response.toString().equals(AuthFailureError.class.getName())) { String errorTitle = getString(R.string.theme_auth_error_title); String errorMsg = getString(R.string.theme_auth_error_message); if (mIsRunning) { FragmentTransaction ft = getFragmentManager().beginTransaction(); WPAlertDialogFragment fragment = WPAlertDialogFragment.newAlertDialog(errorMsg, errorTitle); ft.add(fragment, ALERT_TAB); ft.commitAllowingStateLoss(); } AppLog.d(T.THEMES, getString(R.string.theme_auth_error_authenticate)); } else { ToastUtils.showToast(ThemeBrowserActivity.this, R.string.theme_fetch_failed, ToastUtils.Duration.LONG); AppLog.d(T.THEMES, getString(R.string.theme_fetch_failed) + ": " + response.toString()); } mFetchingThemes = false; } } ); }
Source:
<code>public int size() { <START> int s = size; <END> if (s == -1) { s = (int) validIndices().count(); size = s; } return s; }</code><technical_language>True. a case -1 default. 0 special meaning in JVM, stick 0 default adjust size cope (add size 0 -> -1)</technical_language>

Target:
public int size() { int s = size; if (s == 0) { s = (int) validIndices().count() + 1; size = s; } return s - 1; }
Source:
<code>public static DataFetchingFieldSelectionSet newCollector(ExecutionContext executionContext, GraphQLType fieldType, List<Field> fields) { GraphQLType unwrappedType = ExecutionTypeInfo.unwrapBaseType(fieldType); <START> if (unwrappedType instanceof GraphQLFieldsContainer) { <END> return new DataFetchingFieldSelectionSetImpl(executionContext, (GraphQLFieldsContainer) unwrappedType, fields); } else { return NOOP; } }</code><technical_language>unwrapping is real fix I understand it: do check fro GraphQLFieldsContainer instead of GraphQLObject</technical_language>

Target:
public static DataFetchingFieldSelectionSet newCollector(ExecutionContext executionContext, GraphQLType fieldType, List<Field> fields) { GraphQLType unwrappedType = ExecutionTypeInfo.unwrapBaseType(fieldType); if (unwrappedType instanceof GraphQLFieldsContainer) { return new DataFetchingFieldSelectionSetImpl(executionContext, asObjectTypeOrNull(unwrappedType), fields); } else { return NOOP; } }
Source:
<code>private void selectColorsAndFontsTheme(String colorAndFontThemeId) { if (colorAndFontThemeId == null) { colorAndFontThemeId = currentColorsAndFontsTheme.getId(); } for (ColorsAndFontsTheme <START> colorsAndFontsTheme : <END> (List<ColorsAndFontsTheme>) colorsAndFontsThemeCombo .getInput()) { if (colorsAndFontsTheme.getId().equals(colorAndFontThemeId)) { ISelection selection = new StructuredSelection(colorsAndFontsTheme); colorsAndFontsThemeCombo.setSelection(selection); break; } } }</code><technical_language>rename theme</technical_language>

Target:
private void selectColorsAndFontsTheme(String colorAndFontThemeId) { if (colorAndFontThemeId == null) { colorAndFontThemeId = currentColorsAndFontsTheme.getId(); } for (ColorsAndFontsTheme theme : (List<ColorsAndFontsTheme>) colorsAndFontsThemeCombo .getInput()) { if (theme.getId().equals(colorAndFontThemeId)) { ISelection selection = new StructuredSelection(theme); colorsAndFontsThemeCombo.setSelection(selection); break; } } }
Source:
<code>void close(String user, Map<URI, AbstractLock> locks) { synchronized (this) { canClose(locks.keySet()); <START> locks.entrySet().parallelStream().map(entry -> entry.getKey()) <END> .peek(uri -> removePermission(user, locks.get(uri), uri)) .forEach(uri -> immutableReadFileManagement.maybeRemoveReadFile(uri, user)); } }</code><technical_language>Lambda replaced method reference</technical_language>

Target:
void close(String user, Map<URI, AbstractLock> locks) { synchronized (this) { canClose(locks.keySet()); locks.entrySet().parallelStream().map(Entry::getKey) .peek(uri -> removePermission(user, locks.get(uri), uri)) .forEach(uri -> immutableReadFileManagement.maybeRemoveReadFile(uri, user)); } }
Source:
<code>public void afterPropertiesSet() { fafService.addOnMessageListener(UpdatedAchievementsMessage.class, updatedAchievementsMessage -> reloadAchievements()); <START> playerAchievements = FXCollections.observableArrayList(); <END> readOnlyPlayerAchievements = FXCollections.unmodifiableObservableList(playerAchievements); }</code><technical_language>move declaration</technical_language>

Target:
public void afterPropertiesSet() { fafService.addOnMessageListener(UpdatedAchievementsMessage.class, updatedAchievementsMessage -> reloadAchievements()); }
Source:
<code>public void accept(final Socket socket) throws IOException { this.origin.accept(socket); final Thread callerThread = Thread.currentThread(); <START> final Thread monitor = new Thread( <END> new Runnable() { @Override public void run() { try { Thread.sleep(BkTimeable.this.latency); callerThread.interrupt(); } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); throw new IllegalStateException(ex); } } } ); monitor.start(); }</code><technical_language>@eg04lt3r talked this approach in #123. a thread pool</technical_language>

Target:
public void accept(final Socket socket) throws IOException { this.threads.put(Thread.currentThread(), System.currentTimeMillis()); this.origin.accept(socket); }
Source:
<code>private void updateSmtDisabledOnHosts() { for (VDS vds : allForCluster) { vds.setKernelCmdlineSmtDisabled(getCluster().getSmtDisabled()); if (getCluster().getSmtDisabled()) { vds.setCurrentKernelCmdline(vds.getCurrentKernelCmdline() + "nosmt "); } else if (vds.getCurrentKernelCmdline().contains("nosmt")) { String cmdLine = vds.getCurrentKernelCmdline(); cmdLine = cmdLine.replace("nosmt", ""); vds.setCurrentKernelCmdline(cmdLine); } <START> vdsStaticDao.update(vds.getStaticData()); <END> } }</code><technical_language>mark host "required reinstall"? If add: vdsStatic.setReinstallRequired(true);</technical_language>

Target:
private void updateSmtDisabledOnHosts() { for (VDS vds : allForCluster) { if (vds.isKernelCmdlineSmtDisabled() != getCluster().getSmtDisabled()) { vdsStaticDao.updateReinstallRequired(vds.getId(), true); } vds.setKernelCmdlineSmtDisabled(getCluster().getSmtDisabled()); if (getCluster().getSmtDisabled()) { vds.setCurrentKernelCmdline(vds.getCurrentKernelCmdline() + "nosmt "); } else if (vds.getCurrentKernelCmdline().contains("nosmt")) { String cmdLine = vds.getCurrentKernelCmdline(); cmdLine = cmdLine.replace("nosmt", "").trim(); vds.setCurrentKernelCmdline(cmdLine); } vdsStaticDao.update(vds.getStaticData()); } }
Source:
<code>public Iterable<ServerInfo> listNodesByIds(final Iterable<String> ids) { return Iterables.filter(listNodes(), new Predicate<ServerInfo>() { @Override public boolean apply(ServerInfo server) { <START> return Iterables.contains(ids, server.getUuid()); <END> } }); }</code><technical_language>Static imports again</technical_language>

Target:
public Iterable<ServerInfo> listNodesByIds(final Iterable<String> ids) { return filter(listNodes(), new Predicate<ServerInfo>() { @Override public boolean apply(ServerInfo server) { return contains(ids, server.getUuid()); } }); }
Source:
<code>public TaskExecution mapRow(ResultSet rs, int rowNum) throws SQLException { long id = rs.getLong("TASK_EXECUTION_ID"); int exitCode = rs.getInt("EXIT_CODE"); return new TaskExecution(id, <START> !rs.wasNull() ? exitCode : null, <END> rs.getString("TASK_NAME"), rs.getTimestamp("START_TIME"), rs.getTimestamp("END_TIME"), rs.getString("EXIT_MESSAGE"), getTaskParameters(id)); }</code><technical_language>is explicit coupling lines 371 373 (if reorder 370 371, break), factor a method returns value</technical_language>

Target:
public TaskExecution mapRow(ResultSet rs, int rowNum) throws SQLException { long id = rs.getLong("TASK_EXECUTION_ID"); return new TaskExecution(id, getNullableExitCode(rs), rs.getString("TASK_NAME"), rs.getTimestamp("START_TIME"), rs.getTimestamp("END_TIME"), rs.getString("EXIT_MESSAGE"), getTaskParameters(id)); }
Source:
<code>public boolean subscribe(PropertyChangeListener listener) { if (listener == null) { <START> logWarning("A null subscriber cannot be added."); <END> return false; } if (subscribers.contains(listener)) { logWarning("The listener has already been subscribed."); return false; } subscribers.add(listener); return true; }</code><technical_language>Please revert this next below: I understand "avoid duplicate code" guideline, this application of generated more lines of code removed. sense if another two-three usages</technical_language>

Target:
public boolean subscribe(PropertyChangeListener listener) { if (subscribers == null) { subscribers = Sets.newHashSet(); } if (listener == null) { LOGGER.warn(formatWarning("A null subscriber cannot be added.")); return false; } if (subscribers.contains(listener)) { LOGGER.warn(formatWarning("The listener has already been subscribed.")); return false; } subscribers.add(listener); return true; }