auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected BasicDataSource getDatasource() { MetadataStorageConnectorConfig connectorConfig = getConfig(); BasicDataSource dataSource = null; try { Properties dbcpProperties = connectorConfig.getProperties(); if (dbcpProperties != null) { dataSource = BasicDataSourceFactory.createDataSource(dbcpProperties); } else { dataSource = new BasicDataSource(); } } catch (Exception e) { log.error(e, "Failed to create data source using dbcp properties file"); throw new RuntimeException(e); } dataSource.setUsername(connectorConfig.getUser()); dataSource.setPassword(connectorConfig.getPassword()); String uri = connectorConfig.getConnectURI(); dataSource.setUrl(uri); dataSource.setValidationQuery(getValidationQuery()); dataSource.setTestOnBorrow(true); return dataSource; }

Target:
protected BasicDataSource getDatasource() { MetadataStorageConnectorConfig connectorConfig = getConfig(); BasicDataSource dataSource = null; try { Properties dbcpProperties = connectorConfig.getDbcpProperties(); if (dbcpProperties != null) { dataSource = BasicDataSourceFactory.createDataSource(dbcpProperties); } else { dataSource = new BasicDataSource(); } } catch (Exception e) { throw new RuntimeException(e); } dataSource.setUsername(connectorConfig.getUser()); dataSource.setPassword(connectorConfig.getPassword()); String uri = connectorConfig.getConnectURI(); dataSource.setUrl(uri); dataSource.setValidationQuery(getValidationQuery()); dataSource.setTestOnBorrow(true); return dataSource; }
Source:
public boolean canBeAdded(IPlayer player) { if (player == null) return false; else if (lightTrail) return false; else if (this.player != null) return false; else return true; }

Target:
public boolean canBeAdded(IPlayer player) { if (player == null) return false; else if (this.hasLightTrail()) return false; else if (this.player != null) return false; else return true; }
Source:
public void testTransformNativeRserveSingleExpressionInPlaceTrue() throws DDFException { Boolean inPlace = Boolean.TRUE; DDF newDdf = ddf.copy(); DDF newDdf2 = newDdf.Transform.transformNativeRserve("newcol = deptime / arrtime", inPlace); List<String> res = newDdf2.VIEWS.head(10); Assert.assertNotNull(newDdf2); Assert.assertNotNull(newDdf); Assert.assertTrue("With inPlace being true, two DDF should have the same UUID", newDdf.getUUID().equals(newDdf2.getUUID())); Assert.assertEquals("newcol", newDdf.getColumnName(8)); Assert.assertEquals(10, res.size()); }

Target:
public void testTransformNativeRserveSingleExpressionInPlaceTrue() throws DDFException { Boolean inPlace = Boolean.TRUE; DDF newDdf = ddf.copy(); DDF newDdf2 = newDdf.Transform.transformNativeRserve("newcol = deptime / arrtime", inPlace); List<String> res = newDdf2.VIEWS.head(10); Assert.assertNotNull(newDdf); Assert.assertNotNull(newDdf2); Assert.assertTrue("With inPlace being true, two DDF should have the same UUID", newDdf.getUUID().equals(newDdf2.getUUID())); Assert.assertEquals("With inPlace being true, original DDF should have newcol added", "newcol", newDdf.getColumnName(8)); Assert.assertEquals("transformed DDF newDdf2 should have newcol added", "newcol", newDdf2.getColumnName(8)); Assert.assertEquals(10, res.size()); }
Source:
public DiscreteRangeCondition<E> subCondition(E from, E to) { if (from.compareTo(to) > 0) { throw new IllegalArgumentException(from.toString() + " is greater than " + to.toString()); } return new DiscreteRangeCondition<>(fSet.subSet(from, true, to, true)); }

Target:
public @Nullable DiscreteRangeCondition<E> subCondition(E from, E to) { if (from.compareTo(to) > 0) { throw new IllegalArgumentException(from.toString() + " is greater than " + to.toString()); } NavigableSet<@NonNull E> subSet = fSet.subSet(from, true, to, true); if (subSet.isEmpty()) { return null; } return new DiscreteRangeCondition<>(subSet); }
Source:
private String getIndexManagementWaitTimeout(Properties properties) { String timeout = properties.getProperty( ElasticsearchEnvironment.INDEX_MANAGEMENT_WAIT_TIMEOUT ); return timeout != null ? Integer.valueOf( timeout ) + "ms" : DEFAULT_INDEX_MANAGEMENT_WAIT_TIMEOUT; }

Target:
private String getIndexManagementWaitTimeout(Properties properties) { int timeout = ConfigurationParseHelper.getIntValue( properties, ElasticsearchEnvironment.INDEX_MANAGEMENT_WAIT_TIMEOUT, ElasticsearchEnvironment.Defaults.INDEX_MANAGEMENT_WAIT_TIMEOUT ); if ( timeout < 0 ) { throw new SearchException( "Positive timeout value expected, but it was: " + timeout ); } return timeout + "ms"; }
Source:
public boolean registerInterceptor(Object theInterceptor) { synchronized (myRegistryMutex) { boolean retVal = false; for (Object next : myGlobalInterceptors) { if (next == theInterceptor) { return false; } } int typeOrder = DEFAULT_ORDER; Order typeOrderAnnotation = AnnotationUtils.findAnnotation(theInterceptor.getClass(), Order.class); if (typeOrderAnnotation != null) { typeOrder = typeOrderAnnotation.value(); } for (Method nextMethod : theInterceptor.getClass().getDeclaredMethods()) { Hook hook = AnnotationUtils.findAnnotation(nextMethod, Hook.class); if (hook != null) { int methodOrder = typeOrder; Order methodOrderAnnotation = AnnotationUtils.findAnnotation(nextMethod, Order.class); if (methodOrderAnnotation != null) { methodOrder = methodOrderAnnotation.value(); } HookInvoker invoker = new HookInvoker(hook, theInterceptor, nextMethod, methodOrder); for (Pointcut nextPointcut : hook.value()) { myInvokers.put(nextPointcut, invoker); } retVal = true; } } myGlobalInterceptors.add(theInterceptor); sortByOrderAnnotation(myGlobalInterceptors); for (Pointcut nextPointcut : myInvokers.keys()) { List<BaseInvoker> nextInvokerList = myInvokers.get(nextPointcut); nextInvokerList.sort(Comparator.naturalOrder()); } return retVal; } }

Target:
public boolean registerInterceptor(Object theInterceptor) { synchronized (myRegistryMutex) { if (isInterceptorAlreadyRegistered(theInterceptor)) { return false; } Class<?> interceptorClass = theInterceptor.getClass(); int typeOrder = determineOrder(interceptorClass); if (!scanInterceptorForHookMethodsAndAddThem(theInterceptor, typeOrder)) { return false; } myInterceptors.add(theInterceptor); sortByOrderAnnotation(myInterceptors); for (Pointcut nextPointcut : myInvokers.keys()) { List<BaseInvoker> nextInvokerList = myInvokers.get(nextPointcut); nextInvokerList.sort(Comparator.naturalOrder()); } return true; } }
Source:
public StatementsMatcher(List<Statement> statements) { Collections.copy(statements, unmatched); }

Target:
public StatementsMatcher(List<Statement> statements) { unmatched = new ArrayList<>(); Collections.copy(statements, unmatched); }
Source:
private void removeOldJobs(final Path prefixDirectory) throws ExecutionException, InterruptedException, IOException { final File[] files = prefixDirectory.toFile().listFiles(); if (files == null || files.length == 0) { return; } log.info("Removing old temporary jobs"); final Map<JobId, Job> jobs = client.jobs().get(); for (File file : files) { if (file.getName().endsWith(".tmp") || file.isDirectory()) { continue; } try ( JobPrefixFile prefixFile = JobPrefixFile.tryFromExistingFile(file.toPath()) ) { if (prefixFile == null) { log.debug("Unable to create JobPrefixFile for {}", file.getPath()); continue; } boolean jobRemovalFailed = false; for (Map.Entry<JobId, Job> entry : jobs.entrySet()) { final JobId jobId = entry.getKey(); if (!jobId.getName().startsWith(prefixFile.prefix())) { continue; } final JobStatus status = client.jobStatus(entry.getKey()).get(); final List<String> hosts = ImmutableList.copyOf(status.getDeployments().keySet()); final List<AssertionError> errors = undeploy(client, entry.getValue(), hosts, new ArrayList<AssertionError>()); if (!errors.isEmpty()) { jobRemovalFailed = true; } } if (!jobRemovalFailed) { prefixFile.delete(); } } catch (NoSuchFileException e) { log.info("File already gone. Cool", file.getPath()); } catch (Exception e) { log.warn("Exception processing file {}", file.getPath(), e); } } }

Target:
private void removeOldJobs(final Path prefixDirectory) throws ExecutionException, InterruptedException, IOException { final File[] files = prefixDirectory.toFile().listFiles(); if (files == null || files.length == 0) { return; } log.info("Removing old temporary jobs"); final Map<JobId, Job> jobs = client.jobs().get(); for (File file : files) { if (file.getName().endsWith(".tmp") || file.isDirectory()) { continue; } try ( JobPrefixFile prefixFile = JobPrefixFile.tryFromExistingFile(file.toPath()) ) { if (prefixFile == null) { log.debug("Unable to create JobPrefixFile for {}", file.getPath()); continue; } boolean jobRemovalFailed = false; for (Map.Entry<JobId, Job> entry : jobs.entrySet()) { final JobId jobId = entry.getKey(); if (!jobId.getName().startsWith(prefixFile.prefix())) { continue; } final JobStatus status = client.jobStatus(entry.getKey()).get(); final List<String> hosts = ImmutableList.copyOf(status.getDeployments().keySet()); final List<AssertionError> errors = undeploy(client, entry.getValue(), hosts, new ArrayList<AssertionError>()); if (!errors.isEmpty()) { jobRemovalFailed = true; } } if (!jobRemovalFailed) { prefixFile.delete(); } } catch (NoSuchFileException e) { log.debug("File already processed by somebody else.", file.getPath()); } catch (Exception e) { log.warn("Exception processing file {}", file.getPath(), e); } } }
Source:
public void testAddValue() { final HTMLOptionElement optionElement = mock(HTMLOptionElement.class); final KieAssetsDropdownItem entry = new KieAssetsDropdownItem("text", "value", new HashMap<String, String>() {{ put("foo", "bar"); }}); doReturn(optionElement).when(view).makeHTMLOptionElement(); view.addValue(entry); assertEquals("text", optionElement.text); assertEquals("value", optionElement.value); verify(optionElement).setAttribute("data-foo", "bar"); verify(nativeSelect).appendChild(optionElement); }

Target:
public void testAddValue() { final HTMLOptionElement optionElement = mock(HTMLOptionElement.class); final KieAssetsDropdownItem entry = new KieAssetsDropdownItem("text", "subtext", "value", getMetaData()); doReturn(optionElement).when(view).makeHTMLOptionElement(); view.addValue(entry); assertEquals("text", optionElement.text); assertEquals("value", optionElement.value); verify(optionElement).setAttribute(SELECT_PICKER_SUBTEXT_ATTRIBUTE, "subtext"); verify(nativeSelect).appendChild(optionElement); }
Source:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) { Stopwatch stopwatch = Stopwatch.createStarted(); HttpServletRequest httpRequest = (HttpServletRequest)servletRequest; String requestURL = httpRequest.getRequestURI(); String requestMethod = httpRequest.getMethod(); String requestIdHeader = httpRequest.getHeader(HEADER_REQUEST_ID); String requestId = requestIdHeader == null ? "" : requestIdHeader; MDC.put(HEADER_REQUEST_ID, requestId); logger.info("[{}] - to began", requestId, requestMethod, requestURL); try { filterChain.doFilter(servletRequest, servletResponse); } catch (Throwable throwable) { logger.error("[{}] - Exception - {}", requestId, throwable.getMessage(), throwable); } finally { logger.info("[{}] - to ended - total time {}ms", requestId, requestMethod, requestURL, stopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); } }

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) { Stopwatch stopwatch = Stopwatch.createStarted(); HttpServletRequest httpRequest = (HttpServletRequest) servletRequest; String requestURL = httpRequest.getRequestURI(); String requestMethod = httpRequest.getMethod(); String requestIdHeader = httpRequest.getHeader(HEADER_REQUEST_ID); String requestId = requestIdHeader == null ? "" : requestIdHeader; MDC.put(HEADER_REQUEST_ID, requestId); logger.info("[{}] - to began", requestId, requestMethod, requestURL); try { filterChain.doFilter(servletRequest, servletResponse); } catch (Throwable throwable) { logger.error("[{}] - Exception - {}", requestId, throwable.getMessage(), throwable); } finally { stopwatch.stop(); logger.info("[{}] - to ended - total time {}ms", requestId, requestMethod, requestURL, stopwatch.elapsed(TimeUnit.MILLISECONDS)); } }
Source:
public InputStream getStream() { if (objects == null || objects.isEmpty()) { return null; } final Ds3ObjectList objects = new Ds3ObjectList(); objects.setObjects(this.objects); final String xmlOutput = XmlOutput.toXml(objects, false); final byte[] stringBytes = xmlOutput.getBytes(); this.size = stringBytes.length; return new ByteArrayInputStream(stringBytes); }

Target:
public InputStream getStream() { if (Guard.isNullOrEmpty(objects)) { return null; } final Ds3ObjectList objects = new Ds3ObjectList(); objects.setObjects(this.objects); final String xmlOutput = XmlOutput.toXml(objects, false); final byte[] stringBytes = xmlOutput.getBytes(); this.size = stringBytes.length; return new ByteArrayInputStream(stringBytes); }
Source:
void isoOffsetTimeFormat() { WebConversionService conversionService = new WebConversionService(new DateTimeFormatters().timeFormat("isooffset")); OffsetDateTime offsetdate =OffsetDateTime.of(LocalDate.of(2020, 4, 26), LocalTime.of(12, 45, 23), ZoneOffset.ofHoursMinutes(1, 30)); assertThat(conversionService.convert(offsetdate, String.class)) .isEqualTo(DateTimeFormatter.ISO_OFFSET_TIME.format(offsetdate)); }

Target:
void isoOffsetTimeFormat() { WebConversionService conversionService = new WebConversionService(new DateTimeFormatters().timeFormat("isooffset")); OffsetTime offsetTime =OffsetTime.of(LocalTime.of(12, 45, 23), ZoneOffset.ofHoursMinutes(1, 30)); assertThat(conversionService.convert(offsetTime, String.class)) .isEqualTo(DateTimeFormatter.ISO_OFFSET_TIME.format(offsetTime)); }
Source:
public void testRenamedFiles() throws Exception { String[][] tests = new String[][]{ {"moved/renamed2.c", "67dfbe26", "moved/renamed2.c"}, {"moved/renamed2.c", "1086eaf5", "moved/renamed.c"}, {"moved/renamed2.c", "b6413947", "moved/renamed.c"}, {"moved/renamed2.c", "ce4c98ec", "renamed.c"}, {"moved/renamed2.c", "bb74b7e8", "renamed.c"},}; setUpTestRepository(); File root = new File(repository.getSourceRoot(), "git"); GitRepository gitrepo = (GitRepository) RepositoryFactory.getRepository(root); int i = 0; for (String[] test : tests) { String file = root.getAbsolutePath() + File.separator + test[0]; String changeset = test[1]; String expected = root.getAbsolutePath() + File.separator + test[2]; try { Assert.assertEquals(expected, gitrepo.findOriginalName(file, changeset)); } catch (IOException ex) { Assert.fail(String.format("Looking for original name of in shouldn't fail", file, changeset)); } i++; } }

Target:
public void testRenamedFiles() throws Exception { String[][] tests = new String[][]{ {"moved2/renamed2.c", "84599b3c", "moved2/renamed2.c"}, {"moved2/renamed2.c", "67dfbe26", "moved/renamed2.c"}, {"moved2/renamed2.c", "67dfbe26", "moved/renamed2.c"}, {"moved2/renamed2.c", "1086eaf5", "moved/renamed.c"}, {"moved2/renamed2.c", "b6413947", "moved/renamed.c"}, {"moved2/renamed2.c", "ce4c98ec", "renamed.c"}, {"moved2/renamed2.c", "bb74b7e8", "renamed.c"} }; setUpTestRepository(); File root = new File(repository.getSourceRoot(), "git"); GitRepository gitrepo = (GitRepository) RepositoryFactory.getRepository(root); int i = 0; for (String[] test : tests) { String file = root.getAbsolutePath() + File.separator + test[0]; String changeset = test[1]; String expected = root.getAbsolutePath() + File.separator + test[2]; try { Assert.assertEquals(expected, gitrepo.findOriginalName(file, changeset)); } catch (IOException ex) { Assert.fail(String.format("Looking for original name of in shouldn't fail", file, changeset)); } i++; } }
Source:
public boolean configure() throws TargetException { try { if( this.vmwareServiceInstance == null ) this.vmwareServiceInstance = VmwareIaasHandler.getServiceInstance( this.targetProperties ); VirtualMachine vm = VmwareIaasHandler.getVirtualMachine( this.vmwareServiceInstance, this.rootInstanceName ); if( vm == null ) { this.logger.warning( "No VM named '" + this.rootInstanceName + "' could be found. The VM might not yet be ready." ); return false; } GuestOperationsManager gom = this.vmwareServiceInstance.getGuestOperationsManager(); NamePasswordAuthentication npa = new NamePasswordAuthentication(); npa.username = this.targetProperties.get( VmwareIaasHandler.VM_USER ); npa.password = this.targetProperties.get( VmwareIaasHandler.VM_PASSWORD ); GuestProgramSpec spec = new GuestProgramSpec(); spec.programPath = "/bin/echo"; spec.arguments = "$\'" + this.userData + "\' > /tmp/roboconf.properties"; this.logger.fine(spec.programPath + " " + spec.arguments); GuestProcessManager gpm = gom.getProcessManager( vm ); gpm.startProgramInGuest(npa, spec); return true; } catch( Exception e ) { if(++ this.vmwareToolsCheckCount < 20) { this.logger.fine("VMWare tools not yet started... check #" + this.vmwareToolsCheckCount + " failed"); return false; } else throw new TargetException( e ); } }

Target:
public boolean configure() throws TargetException { try { if( this.vmwareServiceInstance == null ) this.vmwareServiceInstance = VmwareIaasHandler.getServiceInstance( this.targetProperties ); VirtualMachine vm = VmwareIaasHandler.getVirtualMachine( this.vmwareServiceInstance, this.rootInstanceName ); if( vm == null ) { this.logger.warning( "No VM named '" + this.rootInstanceName + "' could be found. The VM might not yet be ready." ); return false; } GuestOperationsManager gom = this.vmwareServiceInstance.getGuestOperationsManager(); NamePasswordAuthentication npa = new NamePasswordAuthentication(); npa.username = this.targetProperties.get( VmwareIaasHandler.VM_USER ); npa.password = this.targetProperties.get( VmwareIaasHandler.VM_PASSWORD ); GuestProgramSpec spec = new GuestProgramSpec(); spec.programPath = "/bin/echo"; spec.arguments = "$\'" + this.userData + "\' > /tmp/roboconf.properties"; this.logger.fine(spec.programPath + " " + spec.arguments); GuestProcessManager gpm = gom.getProcessManager( vm ); gpm.startProgramInGuest(npa, spec); return true; } catch( Exception e ) { if(++ this.vmwareToolsCheckCount < 20) { this.logger.fine("VMWare tools not yet started... check #" + this.vmwareToolsCheckCount + " failed"); return false; } throw new TargetException( e ); } }
Source:
public void setContentType(String contentType) { Assert.notNull(contentType, "'contentType' cannot be null"); this.contentType = contentType; }

Target:
public void setContentType(String contentType) { Assert.notNull(contentType, "'contentType' cannot be null"); try { MimeType.valueOf(contentType); } catch (InvalidMimeTypeException e) { throw new IllegalArgumentException("'contentType' could not be parsed", e); } this.contentType = contentType; }
Source:
public static String removeHTMLTags(@NonNull String text) { return Jsoup.parse(text).text(); }

Target:
public static String removeHTMLTags(@NonNull String text) { return fromHtml(text).toString(); }
Source:
public QResyncParameter(final long uidValidity, final long modSeq, @Nullable final MessageNumberSet[] knownUids, @Nullable final QResyncSeqMatchData seqMatchData) { this.uidValidity = uidValidity; this.modSeq = modSeq; if (knownUids != null) { this.knownUids = knownUids; } this.seqMatchData = seqMatchData; }

Target:
public QResyncParameter(final long uidValidity, final long modSeq, @Nullable final MessageNumberSet[] knownUids, @Nullable final QResyncSeqMatchData seqMatchData) { this.uidValidity = uidValidity; this.modSeq = modSeq; this.knownUids = knownUids; this.seqMatchData = seqMatchData; }
Source:
private ByteBuffer parsePayLoad(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); int capturedLen = pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); long includedPacketLength = ConversionHelper.unsignedIntToLong(capturedLen); SeekableByteChannel fFileChannel = getFileChannel(); if (fFileChannel.size() - fFileChannel.position() < includedPacketLength) { throw new BadPcapFileException(String.format("%04x", includedPacketLength) + " is causing buffer overrun."); } if (capturedLen > Integer.MAX_VALUE) { throw new BadPcapFileException(String.format("%04x", capturedLen) + " packet length is bigger than 2^31-1 bytes are not supported."); } pcapPacketData = ByteBuffer.allocate((int) includedPacketLength); pcapPacketData.clear(); ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); int payLoad = fFileChannel.read(pcapPacketData); if (payLoad == 0) { throw new BadPcapFileException(String.format("%04x", payLoad) + " is a bad payload."); } pcapPacketData.flip(); fFileChannel.position(fFileChannel.position() + blockLength - capturedLen - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); return pcapPacketData; }

Target:
private ByteBuffer parsePayLoad(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); int capturedLen = pcapPacketHeader.getInt(); pcapPacketHeader.getInt(); long includedPacketLength = ConversionHelper.unsignedIntToLong(capturedLen); SeekableByteChannel fileChannel = getFileChannel(); if (fileChannel.size() - fileChannel.position() < includedPacketLength) { throw new BadPcapFileException(String.format("%04x", includedPacketLength) + " is causing buffer overrun."); } if (capturedLen > Integer.MAX_VALUE) { throw new BadPcapFileException(String.format("%04x", capturedLen) + " packet length is bigger than 2^31-1 bytes are not supported."); } pcapPacketData = ByteBuffer.allocate((int) includedPacketLength); pcapPacketData.clear(); ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); int payLoad = fileChannel.read(pcapPacketData); if (payLoad == 0) { throw new BadPcapFileException(String.format("%04x", payLoad) + " is a bad payload."); } pcapPacketData.flip(); fileChannel.position(fileChannel.position() + blockLength - capturedLen - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); return pcapPacketData; }
Source:
void errorOutReadKey(final CompletionKey key, final int rc) { LOG.info("Removing completion key: {}", key); final ReadCompletion readCompletion = (ReadCompletion)completionObjects.remove(key); if (null == readCompletion) { return; } executor.submitOrdered(readCompletion.ledgerId, new SafeRunnable() { @Override public void safeRun() { String bAddress = "null"; Channel c = channel; if (c != null && c.getRemoteAddress() != null) { bAddress = c.getRemoteAddress().toString(); } LOG.debug("Could not write request for reading entry: ledger-id: bookie: rc: {}", new Object[]{ readCompletion.entryId, readCompletion.ledgerId, bAddress, rc }); readCompletion.cb.readEntryComplete(rc, readCompletion.ledgerId, readCompletion.entryId, null, readCompletion.ctx); } @Override public String toString() { return String.format("ErrorOutReadKey(%s)", key); } }); }

Target:
void errorOutReadKey(final CompletionKey key, final int rc) { LOG.debug("Removing completion key: {}", key); final ReadCompletion readCompletion = (ReadCompletion)completionObjects.remove(key); if (null == readCompletion) { return; } executor.submitOrdered(readCompletion.ledgerId, new SafeRunnable() { @Override public void safeRun() { String bAddress = "null"; Channel c = channel; if (c != null && c.getRemoteAddress() != null) { bAddress = c.getRemoteAddress().toString(); } LOG.debug("Could not write request for reading entry: ledger-id: bookie: rc: {}", new Object[]{ readCompletion.entryId, readCompletion.ledgerId, bAddress, rc }); readCompletion.cb.readEntryComplete(rc, readCompletion.ledgerId, readCompletion.entryId, null, readCompletion.ctx); } @Override public String toString() { return String.format("ErrorOutReadKey(%s)", key); } }); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.d(TAG, "Entering Appium settings"); registerLocaleSettingReceiver(); registerAnimationSettingReceiver(); registerDataConnectionSettingReceiver(); registerLocationInfoReceiver(); if (Build.VERSION.SDK_INT >= 26) { Log.d(TAG, "Initializing the foreground service"); Intent intent = new Intent(Settings.this, ForegroundService.class); intent.setAction(ForegroundService.ACTION_START); startService(intent); } Log.d(TAG, "Closing settings app"); Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { Settings.this.finish(); } }, 1000); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.d(TAG, "Entering Appium settings"); registerLocaleSettingReceiver(); registerAnimationSettingReceiver(); registerDataConnectionSettingReceiver(); registerLocationInfoReceiver(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Log.d(TAG, "Initializing the foreground service"); Intent intent = new Intent(Settings.this, ForegroundService.class); intent.setAction(ForegroundService.ACTION_START); startService(intent); } Log.d(TAG, "Closing settings app"); Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { Settings.this.finish(); } }, 1000); }
Source:
private int[] getDimVals(final DimDim dimLookup, final List<String> dimValues) { if (dimValues.size() == 0) { dimLookup.add(""); return null; } if (dimValues.size() == 1) { return new int[]{dimLookup.add(dimValues.get(0))}; } String[] dimArray = dimValues.toArray(new String[dimValues.size()]); Arrays.sort(dimArray); final int[] retVal = new int[dimArray.length]; int count = 0; for (String dimValue : dimArray) { retVal[count++] = dimLookup.add(dimValue); } return retVal; }

Target:
private int[] getDimVals(final DimDim dimLookup, final List<String> dimValues) { if (dimValues.size() == 0) { dimLookup.add(null); return null; } if (dimValues.size() == 1) { return new int[]{dimLookup.add(dimValues.get(0))}; } String[] dimArray = dimValues.toArray(new String[dimValues.size()]); Arrays.sort(dimArray); final int[] retVal = new int[dimArray.length]; for (int i = 0; i < dimArray.length; i++) { retVal[i] = dimLookup.add(dimArray[i]); } return retVal; }
Source:
protected String[] getCommandArgs() { return new String[]{ "--no-color", "--except=lower-camel-case", "--", inputFile.getPath() }; }

Target:
protected String[] getCommandArgs() { return new String[]{ "--only=constant-naming,constant-k-prefix" }; }
Source:
public void testBuilderFromProperties() throws FileNotFoundException, IOException { String prefix = "rya_"; String auth = "U"; String visibility = "U"; String user = "user"; String password = "password"; String instance = "instance"; String zookeeper = "zookeeper"; boolean useMock = false; boolean useComposite = true; boolean usePrefixHash = true; boolean useInference = true; boolean displayPlan = false; Properties props = new Properties(); props.load(new FileInputStream("src/test/resources/properties/rya.properties")); AccumuloRdfConfiguration conf = AccumuloRdfConfiguration.fromProperties(props); org.junit.Assert.assertEquals(conf.getTablePrefix(), prefix); org.junit.Assert.assertEquals(conf.getCv(), visibility); org.junit.Assert.assertEquals(conf.getAuthorizations(), new Authorizations(auth)); org.junit.Assert.assertEquals(conf.isInfer(), useInference); org.junit.Assert.assertEquals(conf.isUseCompositeCardinality(), useComposite); org.junit.Assert.assertEquals(conf.isDisplayQueryPlan(), displayPlan); org.junit.Assert.assertEquals(conf.getAccumuloInstance(), instance); org.junit.Assert.assertEquals(conf.getAccumuloPassword(), password); org.junit.Assert.assertEquals(conf.getAccumuloUser(), user); org.junit.Assert.assertEquals(conf.getAccumuloZookeepers(), zookeeper); org.junit.Assert.assertEquals(conf.getUseMockAccumulo(), useMock); org.junit.Assert.assertEquals(conf.isPrefixRowsWithHash(), usePrefixHash); }

Target:
public void testBuilderFromProperties() throws FileNotFoundException, IOException { String prefix = "rya_"; String auth = "U"; String visibility = "U"; String user = "user"; String password = "password"; String instance = "instance"; String zookeeper = "zookeeper"; boolean useMock = false; boolean useComposite = true; boolean usePrefixHash = true; boolean useInference = true; boolean displayPlan = false; Properties props = new Properties(); props.load(new FileInputStream("src/test/resources/properties/rya.properties")); AccumuloRdfConfiguration conf = AccumuloRdfConfiguration.fromProperties(props); assertEquals(conf.getTablePrefix(), prefix); assertEquals(conf.getCv(), visibility); assertEquals(conf.getAuthorizations(), new Authorizations(auth)); assertEquals(conf.isInfer(), useInference); assertEquals(conf.isUseCompositeCardinality(), useComposite); assertEquals(conf.isDisplayQueryPlan(), displayPlan); assertEquals(conf.getAccumuloInstance(), instance); assertEquals(conf.getAccumuloPassword(), password); assertEquals(conf.getAccumuloUser(), user); assertEquals(conf.getAccumuloZookeepers(), zookeeper); assertEquals(conf.getUseMockAccumulo(), useMock); assertEquals(conf.isPrefixRowsWithHash(), usePrefixHash); }
Source:
public void sequencerPerformanceTest() { long start = System.currentTimeMillis(); while (true) { if ((System.currentTimeMillis() - start) / milliToSecond > time) { break; } tokenQuery(runtime, random.nextInt(randomBoundary)); tokenTx(runtime, random.nextInt(randomBoundary)); } }

Target:
public void sequencerPerformanceTest() throws IOException, InterruptedException { setMetricsReportFlags("sequencer"); Process server = runServer(); runtime = initRuntime(); long start = System.currentTimeMillis(); while (true) { if ((System.currentTimeMillis() - start) / MILLI_TO_SECOND > time) { break; } tokenQuery(runtime, random.nextInt(randomBoundary)); tokenTx(runtime, random.nextInt(randomBoundary)); } killServer(server); }
Source:
public Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements) { try { if (!init()) { return Collections.emptyMap(); } } catch (RuntimeException re) { throw re; } catch (Exception e) { throw Exceptions.duck(e); } return repoImpl.findProviders(requirements); }

Target:
public Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements) { if (!init()) { return Collections.emptyMap(); } return repoImpl.findProviders(requirements); }
Source:
void setChecks(List<GitHubBranchCommitCheck> checks) { this.checks = checks; }

Target:
public void setChecks(List<GitHubBranchCommitCheck> checks) { this.checks = checks; }
Source:
public PoolDTO populate(ModelTranslator modelTranslator, Pool source, PoolDTO dest) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (dest == null) { throw new IllegalArgumentException("destination is null"); } dest.setId(source.getId()); dest.setQuantity(source.getQuantity()); dest.setStartDate(source.getStartDate()); dest.setEndDate(source.getEndDate()); dest.setAttributes(source.getAttributes()); dest.setRestrictedToUsername(source.getRestrictedToUsername()); dest.setConsumed(source.getConsumed()); dest.setProductId(source.getProductId()); dest.setProductAttributes(source.getProductAttributes()); dest.setDerivedProductId(source.getDerivedProductId()); if (modelTranslator != null) { Collection<Product> products = source.getProduct() == null ? null : source.getProduct().getProvidedProducts(); if (products != null && !products.isEmpty()) { for (Product prod : products) { if (prod != null) { dest.addProvidedProduct( new PoolDTO.ProvidedProductDTO(prod.getId(), prod.getName())); } } } else { dest.setProvidedProducts(Collections.<PoolDTO.ProvidedProductDTO>emptySet()); } Collection<Product> derivedProducts = source.getDerivedProduct() == null ? null : source.getDerivedProduct().getProvidedProducts(); if (derivedProducts != null && !derivedProducts.isEmpty()) { for (Product derivedProd : derivedProducts) { if (derivedProd != null) { dest.addDerivedProvidedProduct( new PoolDTO.ProvidedProductDTO(derivedProd.getId(), derivedProd.getName())); } } } else { dest.setDerivedProvidedProducts(Collections.<PoolDTO.ProvidedProductDTO>emptySet()); } } return dest; }

Target:
public PoolDTO populate(ModelTranslator modelTranslator, Pool source, PoolDTO dest) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (dest == null) { throw new IllegalArgumentException("destination is null"); } dest.setId(source.getId()); dest.setQuantity(source.getQuantity()); dest.setStartDate(source.getStartDate()); dest.setEndDate(source.getEndDate()); dest.setAttributes(source.getAttributes()); dest.setRestrictedToUsername(source.getRestrictedToUsername()); dest.setConsumed(source.getConsumed()); dest.setProductId(source.getProductId()); dest.setProductAttributes(source.getProductAttributes()); dest.setDerivedProductId(source.getDerivedProductId()); if (modelTranslator != null) { Collection<Product> products = source.getProduct() == null ? null : source.getProduct().getProvidedProducts(); Set<PoolDTO.ProvidedProductDTO> providedProductDTOs = new HashSet<>(); addProvidedProducts(products, providedProductDTOs); dest.setProvidedProducts(providedProductDTOs); Collection<Product> derivedProducts = source.getDerivedProduct() == null ? null : source.getDerivedProduct().getProvidedProducts(); Set<PoolDTO.ProvidedProductDTO> derivedProvidedProductDTOs = new HashSet<>(); addProvidedProducts(derivedProducts, derivedProvidedProductDTOs); dest.setDerivedProvidedProducts(derivedProvidedProductDTOs); } return dest; }
Source:
public static AsyncTimeLockUnlocker create(TimelockService timelockService) { return new AsyncTimeLockUnlocker( Autobatchers.<Set<LockToken>, Void>independent(batch -> { Set<LockToken> allTokensToUnlock = batch.stream() .map(BatchElement::argument) .flatMap(Collection::stream) .collect(Collectors.toSet()); try { timelockService.tryUnlock(allTokensToUnlock); } catch (Throwable t) { log.info("Failed to unlock lock tokens from timelock. They will eventually expire on their " + "own, but if this message recurs frequently, it may be worth investigation.", SafeArg.of("numFailed", allTokensToUnlock.size()), SafeArg.of("firstFailures", Iterables.transform(Iterables.limit(allTokensToUnlock, 20), LockToken::getRequestId)), t); } batch.stream().map(BatchElement::result).forEach(f -> f.set(null)); }) .safeLoggablePurpose("async-timelock-unlocker") .build()); }

Target:
public static AsyncTimeLockUnlocker create(TimelockService timelockService) { return new AsyncTimeLockUnlocker( Autobatchers.<Set<LockToken>, Void>independent(batch -> { Set<LockToken> allTokensToUnlock = batch.stream() .map(BatchElement::argument) .flatMap(Collection::stream) .collect(Collectors.toSet()); try { timelockService.tryUnlock(allTokensToUnlock); } catch (Throwable t) { log.info("Failed to unlock lock tokens from timelock. They will eventually expire on their " + "own, but if this message recurs frequently, it may be worth investigation.", SafeArg.of("numFailed", allTokensToUnlock.size()), t); } batch.stream().map(BatchElement::result).forEach(f -> f.set(null)); }) .safeLoggablePurpose("async-timelock-unlocker") .build()); }
Source:
public Optional execute() throws InvalidRemoteException { try { final List<Ref> branches = git._branchList().setListMode(ListBranchCommand.ListMode.ALL).call(); final Set<String> remoteBranches = new HashSet<>(); final Set<String> localBranches = new HashSet<>(); for (final Ref branch : branches) { final String branchName = branch.getName().substring(branch.getName().lastIndexOf("/") + 1); if (branch.getName().startsWith("refs/remotes/" + remote.getK1())) { remoteBranches.add(branchName); } else { localBranches.add(branchName); } } for (final String localBranch : localBranches) { if (localBranch.equals("HEAD")) { continue; } if (remoteBranches.contains(localBranch)) { try { git._branchCreate() .setName(localBranch) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint(remote.getK1() + "/" + localBranch) .setForce(true) .call(); } catch (Throwable t) { throw new RuntimeException("Error creating branch [" + localBranch + "]."); } } } remoteBranches.removeAll(localBranches); for (final String branch : remoteBranches) { if (branch.equals("HEAD")) { continue; } try { git._branchCreate() .setName(branch) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint(remote.getK1() + "/" + branch) .setForce(true) .call(); } catch (Throwable t) { throw new RuntimeException("Error creating branch [" + branch + "]."); } } return null; } catch (final InvalidRemoteException e) { throw e; } catch (final RuntimeException re) { throw re; } catch (final Exception ex) { throw new RuntimeException(ex); } }

Target:
public Optional execute() throws InvalidRemoteException { try { final List<Ref> branches = git._branchList().setListMode(ListBranchCommand.ListMode.ALL).call(); final Set<String> remoteBranches = new HashSet<>(); final Set<String> localBranches = new HashSet<>(); for (final Ref branch : branches) { final String branchName = branch.getName().substring(branch.getName().lastIndexOf("/") + 1); if (branch.getName().startsWith("refs/remotes/" + remote.getK1())) { remoteBranches.add(branchName); } else { localBranches.add(branchName); } } for (final String localBranch : localBranches) { if (localBranch.equals(Constants.HEAD)) { continue; } if (remoteBranches.contains(localBranch)) { try { git._branchCreate() .setName(localBranch) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint(remote.getK1() + "/" + localBranch) .setForce(true) .call(); } catch (Throwable t) { throw new RuntimeException("Error creating branch [" + localBranch + "]."); } } } remoteBranches.removeAll(localBranches); for (final String branch : remoteBranches) { if (branch.equals(Constants.HEAD)) { continue; } try { git._branchCreate() .setName(branch) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint(remote.getK1() + "/" + branch) .setForce(true) .call(); } catch (Throwable t) { throw new RuntimeException("Error creating branch [" + branch + "]."); } } return null; } catch (final InvalidRemoteException e) { throw e; } catch (final RuntimeException re) { throw re; } catch (final Exception ex) { throw new RuntimeException(ex); } }
Source:
private List<RefContentProposal> createContentProposals( final Collection<Ref> refs, final Ref HEAD) { final TreeSet<Ref> set = new TreeSet<>(new Comparator<Ref>() { @Override public int compare(Ref o1, Ref o2) { return o1.getName().compareTo(o2.getName()); } }); set.addAll(refs); if (HEAD != null) set.add(HEAD); final List<RefContentProposal> result = new ArrayList<>( set.size()); for (final Ref r : set) result.add(new RefContentProposal(localDb, r, HEAD == null)); return result; }

Target:
private List<RefContentProposal> createContentProposals( final Collection<Ref> refs, final Ref HEAD) { final TreeSet<Ref> set = new TreeSet<>(new Comparator<Ref>() { @Override public int compare(Ref o1, Ref o2) { return o1.getName().compareTo(o2.getName()); } }); set.addAll(refs); if (HEAD != null) { set.add(HEAD); } final List<RefContentProposal> result = new ArrayList<>( set.size()); for (final Ref r : set) { result.add(new RefContentProposal(localDb, r, HEAD == null)); } return result; }
Source:
void avoidArtifactDuplicates( Set<Artifact> providerArtifacts ) { for ( Artifact artifact : artifacts ) { Iterator<Artifact> it = providerArtifacts.iterator(); while ( it.hasNext() ) { Artifact providerArtifact = it.next(); String classifier1 = providerArtifact.getClassifier(); String classifier2 = artifact.getClassifier(); if ( providerArtifact.getGroupId().equals( artifact.getGroupId() ) && providerArtifact.getArtifactId().equals( artifact.getArtifactId() ) && providerArtifact.getType().equals( artifact.getType() ) && ( classifier1 == null ? classifier2 == null : classifier1.equals( classifier2 ) ) ) { it.remove(); if ( mojo != null && mojo.getLog().isDebugEnabled() ) { mojo.getLog().debug( "Removed artifact " + providerArtifact + " from provider. " + "Already appears in test classpath." ); } } } } addMissingArtifacts( providerArtifacts ); adoptArtifactVersions( providerArtifacts ); }

Target:
void avoidArtifactDuplicates( Set<Artifact> providerArtifacts ) { for ( Artifact artifact : artifacts ) { Iterator<Artifact> it = providerArtifacts.iterator(); while ( it.hasNext() ) { Artifact providerArtifact = it.next(); String classifier1 = providerArtifact.getClassifier(); String classifier2 = artifact.getClassifier(); if ( providerArtifact.getGroupId().equals( artifact.getGroupId() ) && providerArtifact.getArtifactId().equals( artifact.getArtifactId() ) && providerArtifact.getType().equals( artifact.getType() ) && ( classifier1 == null ? classifier2 == null : classifier1.equals( classifier2 ) ) ) { it.remove(); if ( logger.isDebugEnabled() ) { logger.debug( "Removed artifact " + providerArtifact + " from provider. " + "Already appears in test classpath." ); } } } } }
Source:
private void publishFailureEvent(String message, String error, String configName, String formTitle, String body) { Map<String, Object> params = new HashMap<>(); params.put(EventParameters.CONFIGURATION_NAME, configName); params.put(EventParameters.FORM_TITLE, formTitle); params.put(EventParameters.MESSAGE, message); params.put(EventParameters.EXCEPTION, error); params.put(EventParameters.JSON_CONTENT, body); eventRelay.sendEventMessage(new MotechEvent(EventSubjects.FORM_FAIL, params)); }

Target:
private void publishFailureEvent(String message, String error, String configName, String formTitle, String body) { FailureEventBuilder builder = new FailureEventBuilder(); builder.setMessage(message) .setError(error) .setConfigName(configName) .setFormTitle(formTitle) .setBody(body); MotechEvent event = builder.createFailureEvent(); eventRelay.sendEventMessage(event); }
Source:
public static void setupXStreamSecurityPolicy(XStream xstream) { xstream.addPermission(NoTypePermission.NONE); for (TypePermission perm : Arrays.asList(NullPermission.NULL, ArrayTypePermission.ARRAYS, PrimitiveTypePermission.PRIMITIVES)) { xstream.addPermission(perm); } for (Class<?> allowHierarchy : Arrays.asList(java.util.Collection.class, org.apache.jmeter.testelement.TestElement.class, org.apache.jorphan.collections.HashTree.class, org.apache.jmeter.samplers.SampleSaveConfiguration.class)) { xstream.allowTypeHierarchy(allowHierarchy); } xstream.allowTypes(new String[] { "org.apache.jmeter.save.ScriptWrapper", "org.apache.jmeter.testelement.property.JMeterProperty" }); xstream.allowTypesByRegExp(new String[] { "^org\\.apache\\.jmeter\\.(testelement|protocol|gui\\.action\\.template)\\..*" }); String[] regexps = getPropDefault("jmeter.xstream.regex_whitelists", "").split("\\s*,\\s*"); if (regexps.length > 0) { xstream.allowTypesByRegExp(regexps); } String[] wildcards = getPropDefault("jmeter.xstream.wildcard_whitelists", "").split("\\s*,\\s*"); if (wildcards.length > 0) { xstream.allowTypesByWildcard(wildcards); } if (getPropDefault("jmeter.xstream.permissive", false)) { xstream.addPermission(AnyTypePermission.ANY); } }

Target:
public static void setupXStreamSecurityPolicy(XStream xstream) { xstream.addPermission(NoTypePermission.NONE); xstream.addPermission(new LoggingPermissiveTypePermission()); for (TypePermission perm : Arrays.asList(NullPermission.NULL, ArrayTypePermission.ARRAYS, PrimitiveTypePermission.PRIMITIVES)) { xstream.addPermission(perm); } for (Class<?> allowHierarchy : Arrays.asList(java.util.Collection.class, org.apache.jmeter.testelement.TestElement.class, org.apache.jorphan.collections.HashTree.class, org.apache.jmeter.samplers.SampleSaveConfiguration.class, org.apache.jmeter.samplers.SampleResult.class)) { xstream.allowTypeHierarchy(allowHierarchy); } xstream.allowTypes(new String[] { "org.apache.jmeter.save.ScriptWrapper", "org.apache.jmeter.testelement.property.JMeterProperty" }); xstream.allowTypesByRegExp(new String[] { "^org\\.apache\\.jmeter\\.(testelement|protocol|gui\\.action\\.template)\\..*" }); String[] regexps = getPropDefault("jmeter.xstream.regex_whitelists", "").split("\\s*,\\s*"); if (regexps.length > 0) { xstream.allowTypesByRegExp(regexps); } String[] wildcards = getPropDefault("jmeter.xstream.wildcard_whitelists", "").split("\\s*,\\s*"); if (wildcards.length > 0) { xstream.allowTypesByWildcard(wildcards); } if (getPropDefault("jmeter.xstream.permissive", false)) { xstream.addPermission(AnyTypePermission.ANY); } }
Source:
public MesosCloud( String mesosMasterUrl, String frameworkName, String frameworkId, String role, String agentUser, String jenkinsURL, List<? extends MesosAgentSpecTemplate> mesosAgentSpecTemplates) throws InterruptedException, ExecutionException, IOException { super("MesosCloud", null); try { this.master = mesosMasterUrl; this.jenkinsURL = new URL(jenkinsURL); } catch (MalformedURLException e) { throw new RuntimeException( String.format("Mesos Cloud URL validation failed for Jenkins %s", jenkinsURL), e); } if (selfIsMesosTask()) { String mesosSandbox = System.getenv("MESOS_SANDBOX"); this.sslCert = Optional.ofNullable(loadDcosCert(mesosSandbox)); this.dcosAuthorization = Optional.ofNullable(loadDcosAuthorization()); } else { this.sslCert = Optional.empty(); this.dcosAuthorization = Optional.empty(); } this.agentUser = agentUser; this.role = role; this.mesosAgentSpecTemplates = mesosAgentSpecTemplates != null ? mesosAgentSpecTemplates : Collections.emptyList(); this.frameworkName = frameworkName; this.frameworkId = frameworkId; if (StringUtils.isEmpty(this.frameworkId)) { this.frameworkId = UUID.randomUUID().toString(); } logger.info( "Created Mesos cloud instance for framework and endpoint {}", this.frameworkId, this.master); }

Target:
public MesosCloud( String mesosMasterUrl, String frameworkName, String frameworkId, String role, String agentUser, String jenkinsURL, List<? extends MesosAgentSpecTemplate> mesosAgentSpecTemplates) throws InterruptedException, ExecutionException, IOException { super("MesosCloud", null); try { this.master = mesosMasterUrl; this.jenkinsURL = new URL(jenkinsURL); } catch (MalformedURLException e) { throw new RuntimeException( String.format("Mesos Cloud URL validation failed for Jenkins %s", jenkinsURL), e); } if (selfIsMesosTask()) { String mesosSandbox = System.getenv("MESOS_SANDBOX"); this.sslCert = Optional.ofNullable(loadDcosCert(mesosSandbox)); this.dcosAuthorization = Optional.ofNullable(loadDcosAuthorization()); } else { this.sslCert = Optional.empty(); this.dcosAuthorization = Optional.empty(); } this.agentUser = agentUser; this.role = role; this.mesosAgentSpecTemplates = Util.fixNull(mesosAgentSpecTemplates); this.frameworkName = frameworkName; this.frameworkId = frameworkId; if (StringUtils.isEmpty(this.frameworkId)) { this.frameworkId = UUID.randomUUID().toString(); } logger.info( "Created Mesos cloud instance for framework and endpoint {}", this.frameworkId, this.master); }
Source:
public void manualAbortProcess() throws Exception { ProcessTree.enabled = true; FreeStyleProject project = j.createFreeStyleProject(); project.setScm(new ExtractResourceSCM(getClass().getResource( "ProcessTreeKiller-test-project.jar"))); project.getBuildersList().add(new Maven("install", "maven")); final QueueTaskFuture<FreeStyleBuild> f = project.scheduleBuild2(0); final FreeStyleBuild b = f.waitForStart(); boolean sleepTestStarted = false; while (b.isBuilding()) { final String log = readFully(b.getLogReader()); sleepTestStarted = log != null && log.contains("Running SleepingTest"); if (sleepTestStarted) { break; } Thread.sleep(1000); } assertTrue(sleepTestStarted); b.doStop(); j.assertBuildStatus(Result.ABORTED, f.get()); b.getWorkspace().deleteRecursive(); }

Target:
public void manualAbortProcess() throws Exception { ProcessTree.enabled = true; FreeStyleProject project = j.createFreeStyleProject(); project.setScm(new ExtractResourceSCM(getClass().getResource( "ProcessTreeKiller-test-project.jar"))); project.getBuildersList().add(new Maven("install", "maven")); final QueueTaskFuture<FreeStyleBuild> f = project.scheduleBuild2(0); final FreeStyleBuild b = f.waitForStart(); String buildLog = null; boolean sleepTestStarted = false; while (b.isBuilding()) { buildLog = readFully(b.getLogReader()); sleepTestStarted = buildLog != null && buildLog.contains("SleepingTest"); if (sleepTestStarted) { break; } TimeUnit.SECONDS.sleep(1); } assertTrue(buildLog, sleepTestStarted); b.doStop(); j.assertBuildStatus(Result.ABORTED, f.get()); b.getWorkspace().deleteRecursive(); }
Source:
private static boolean unpacked(Any any) { checkNotNull(any); final BoolValue unpacked = unpack(any, BoolValue.class); return unpacked.getValue(); }

Target:
private static boolean unpacked(Any any) { final BoolValue unpacked = unpack(any, BoolValue.class); return unpacked.getValue(); }