auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void should_balance_requests_across_connections() throws InterruptedException { CqlSession session = SESSION_RULE.session(); int simultaneousRequests = CONNECTIONS * REQUESTS_PER_CONNECTION; ExecutorService requestExecutor = Executors.newFixedThreadPool(simultaneousRequests); AtomicReference<Throwable> unexpectedErrorRef = new AtomicReference<>(); ScheduledExecutorService timeoutExecutor = Executors.newScheduledThreadPool(1); CountDownLatch done = new CountDownLatch(1); for (int i = 0; i < simultaneousRequests; i++) { requestExecutor.submit( () -> { while (!Thread.currentThread().isInterrupted()) { try { session.execute("SELECT release_version FROM system.local"); } catch (Throwable t) { unexpectedErrorRef.compareAndSet(null, t); done.countDown(); } } }); } timeoutExecutor.schedule(done::countDown, 5, SECONDS); done.await(); Throwable unexpectedError = unexpectedErrorRef.get(); if (unexpectedError != null) { fail("At least one request failed unexpectedly", unexpectedError); } requestExecutor.shutdownNow(); timeoutExecutor.shutdownNow(); }

Target:
public void should_balance_requests_across_connections() throws InterruptedException { int simultaneousRequests = POOL_SIZE * REQUESTS_PER_CONNECTION; for (int i = 0; i < simultaneousRequests; i++) { reschedule(null, null); } SECONDS.sleep(1); done.countDown(); Throwable unexpectedError = unexpectedErrorRef.get(); if (unexpectedError != null) { fail("At least one request failed unexpectedly", unexpectedError); } }
Source:
public void allParentObjectShouldBeInChangeSet() { Realm realm = looperThread.realm; realm.beginTransaction(); Owner owner = realm.createObject(Owner.class); Dog dog1 = realm.createObject(Dog.class); dog1.setHasTail(true); dog1.setOwner(owner); owner.getDogs().add(dog1); Dog dog2 = realm.createObject(Dog.class); dog2.setOwner(owner); dog2.setHasTail(true); owner.getDogs().add(dog2); Dog dog3 = realm.createObject(Dog.class); dog3.setOwner(owner); dog3.setHasTail(true); owner.getDogs().add(dog3); realm.commitTransaction(); RealmResults<Dog> dogs = realm.where(Dog.class).equalTo(Dog.FIELD_HAS_TAIL, true).findAll(); looperThread.keepStrongReference.add(dogs); dogs.addChangeListener(new OrderedRealmCollectionChangeListener<RealmResults<Dog>>() { @Override public void onChange(RealmResults<Dog> collection, OrderedCollectionChangeSet changeSet) { assertEquals(1, changeSet.getDeletions().length); assertEquals(0, changeSet.getInsertions().length); assertEquals(1, changeSet.getChangeRanges().length); assertEquals(0, changeSet.getChangeRanges()[0].startIndex); assertEquals(2, changeSet.getChangeRanges()[0].length); looperThread.testComplete(); } }); realm.beginTransaction(); dog3.setHasTail(false); realm.commitTransaction(); looperThread.testComplete(); }

Target:
public void allParentObjectShouldBeInChangeSet() { Realm realm = looperThread.realm; realm.beginTransaction(); Owner owner = realm.createObject(Owner.class); Dog dog1 = realm.createObject(Dog.class); dog1.setOwner(owner); dog1.setHasTail(true); owner.getDogs().add(dog1); Dog dog2 = realm.createObject(Dog.class); dog2.setOwner(owner); dog2.setHasTail(true); owner.getDogs().add(dog2); Dog dog3 = realm.createObject(Dog.class); dog3.setOwner(owner); dog3.setHasTail(true); owner.getDogs().add(dog3); realm.commitTransaction(); RealmResults<Dog> dogs = realm.where(Dog.class).equalTo(Dog.FIELD_HAS_TAIL, true).findAll(); looperThread.keepStrongReference.add(dogs); dogs.addChangeListener(new OrderedRealmCollectionChangeListener<RealmResults<Dog>>() { @Override public void onChange(RealmResults<Dog> collection, OrderedCollectionChangeSet changeSet) { assertEquals(1, changeSet.getDeletions().length); assertEquals(0, changeSet.getInsertions().length); assertEquals(1, changeSet.getChangeRanges().length); assertEquals(0, changeSet.getChangeRanges()[0].startIndex); assertEquals(2, changeSet.getChangeRanges()[0].length); looperThread.testComplete(); } }); realm.beginTransaction(); dog3.setHasTail(false); realm.commitTransaction(); looperThread.testComplete(); }
Source:
public void persistComponent(DistributionSnapshot snapshot, ComponentInfo ci, CoreSession session, String label, DocumentModel parent) { DocumentModel componentDoc = createComponentDoc(snapshot, session, label, ci, parent); for (ExtensionPointInfo epi : ci.getExtensionPoints()) { createExtensionPointDoc(snapshot, session, label, epi, componentDoc); } Map<String, Integer> comps = new HashMap<String, Integer>(); for (ExtensionInfo ei : ci.getExtensions()) { String id = ei.getId(); if (comps.containsKey(id)) { comps.put(id, comps.get(id) + 1); } else { comps.put(id, Integer.valueOf(0)); } createContributionDoc(snapshot, session, label, ei, comps.get(id), componentDoc); } for (ServiceInfo si : ci.getServices()) { createServiceDoc(snapshot, session, label, si, componentDoc); } }

Target:
public void persistComponent(DistributionSnapshot snapshot, ComponentInfo ci, CoreSession session, String label, DocumentModel parent) { DocumentModel componentDoc = createComponentDoc(snapshot, session, label, ci, parent); for (ExtensionPointInfo epi : ci.getExtensionPoints()) { createExtensionPointDoc(snapshot, session, label, epi, componentDoc); } Map<String, AtomicInteger> comps = new HashMap<>(); for (ExtensionInfo ei : ci.getExtensions()) { String id = ei.getId(); comps.computeIfAbsent(id, k -> new AtomicInteger(-1)).incrementAndGet(); createContributionDoc(snapshot, session, label, ei, comps.get(id).get(), componentDoc); } for (ServiceInfo si : ci.getServices()) { createServiceDoc(snapshot, session, label, si, componentDoc); } }
Source:
private DhisDataValueStatusResponse importDataValues(Settings settings, String uri, String json) { HttpUriRequest request = generatePostRequest(settings, uri, json); LOGGER.debug(String.format("Initiating request to create resource: %s, request: %s", json, request.toString())); CloseableHttpResponse response = getResponseForRequest(request); DhisDataValueStatusResponse status; try (InputStream content = getContentForResponse(response)) { String contentString = IOUtils.toString(content); LOGGER.debug(String.format("Received response to create resource: %s, request: %s", json, contentString)); status = new ObjectMapper().readValue(contentString, DhisDataValueStatusResponse.class); if (status.getStatus() == DhisStatus.ERROR) { String msg = String.format("Error in DHIS2 status response, error details: %s", contentString); throw new DhisWebException(msg); } } catch (IOException e) { String msg = String.format("Error parsing response from uri: %s, exception: %s", uri, e.toString()); statusMessageService.warn(msg, MODULE_NAME); throw new DhisWebException(msg, e); } finally { closeResponse(response); } return status; }

Target:
private DhisDataValueStatusResponse importDataValues(Settings settings, String uri, String json) { HttpUriRequest request = generatePostRequest(settings, uri, json); LOGGER.debug(String.format("Initiating request to create resource: %s, request: %s", json, request.toString())); CloseableHttpResponse response = getResponseForRequest(request); return (DhisDataValueStatusResponse) getDhisResponseForHttpResponse(json, uri, response, DhisDataValueStatusResponse.class); }
Source:
private void handleResult( AdminResult result, Throwable error, Function<Iterable<AdminRow>, CassandraSchemaRows.Builder> builderUpdater, boolean warnIfMissing) { if (error != null) { if (warnIfMissing || !error.getMessage().contains("does not exist")) { Loggers.warnWithException( LOG, "[{}] Error during schema refresh, new metadata might be incomplete", logPrefix, error); } } else { schemaRowsBuilder = builderUpdater.apply(result); if (result.hasNextPage()) { result .nextPage() .whenCompleteAsync( (nextResult, nextError) -> handleResult(nextResult, nextError, builderUpdater, warnIfMissing), adminExecutor); return; } } pendingQueries -= 1; if (pendingQueries == 0) { LOG.debug("[{}] Schema queries took {}", logPrefix, NanoTime.formatTimeSince(startTimeNs)); schemaRowsFuture.complete(schemaRowsBuilder.build()); } }

Target:
private void handleResult( AdminResult result, Throwable error, Function<Iterable<AdminRow>, CassandraSchemaRows.Builder> builderUpdater, boolean warnIfMissing) { if (error != null) { if (warnIfMissing || !error.getMessage().contains("does not exist")) { Loggers.warnWithException( LOG, "[{}] Error during schema refresh, new metadata might be incomplete", logPrefix, error); } markQueryComplete(); } else { schemaRowsBuilder = builderUpdater.apply(result); if (result.hasNextPage()) { result .nextPage() .whenCompleteAsync( (nextResult, nextError) -> handleResult(nextResult, nextError, builderUpdater, warnIfMissing), adminExecutor); } else { markQueryComplete(); } } }
Source:
public static void main(String[] argv) throws Exception { CommandLineParser parser = new PosixParser(); Options options = new Options(); options.addOption("f", "file", true, "File of new structure information."); options.addOption("e", "eperson", true, "User who is manipulating the repository's structure."); options.addOption("o", "output", true, "File to receive the structure map."); options.addOption("x", "export", false, "Export the current structure as XML."); options.addOption("h", "help", false, "Print this help message."); CommandLine line = parser.parse( options, argv ); if (line.hasOption('h')) { giveHelp(options); System.exit(0); } String file = null; String eperson = null; String output = null; if (line.hasOption('f')) { file = line.getOptionValue('f'); } if (line.hasOption('e')) { eperson = line.getOptionValue('e'); } if (line.hasOption('o')) { output = line.getOptionValue('o'); } if (output == null) { usage(options); System.exit(1); } Context context = new Context(); context.setCurrentUser(ePersonService.findByEmail(context, eperson)); if (line.hasOption('x')) { exportStructure(context, output); } else if (line.hasOption('f')) { if (eperson == null) { usage(options); System.exit(1); } importStructure(context, file, output); } else { usage(options); System.exit(1); } System.exit(0); }

Target:
public static void main(String[] argv) throws Exception { CommandLineParser parser = new PosixParser(); Options options = new Options(); options.addOption("f", "file", true, "File of new structure information."); options.addOption("e", "eperson", true, "User who is manipulating the repository's structure."); options.addOption("o", "output", true, "File to receive the structure map."); options.addOption("x", "export", false, "Export the current structure as XML."); options.addOption("h", "help", false, "Print this help message."); CommandLine line = parser.parse( options, argv ); if (line.hasOption('h')) { giveHelp(options); System.exit(0); } if (!(line.hasOption('f') || line.hasOption('x'))) { giveHelp(options); System.exit(1); } String input = null; String eperson = null; String output = null; if (line.hasOption('f')) { input = line.getOptionValue('f'); } if (line.hasOption('e')) { eperson = line.getOptionValue('e'); } else { usage(options); System.exit(1); } if (line.hasOption('o')) { output = line.getOptionValue('o'); } else { usage(options); System.exit(1); } OutputStream outputStream; if ("-".equals(output)) { outputStream = System.out; } else { outputStream = new FileOutputStream(output); } Context context = new Context(); context.setCurrentUser(ePersonService.findByEmail(context, eperson)); if (line.hasOption('x')) { exportStructure(context, outputStream); } else { InputStream inputStream; if ("-".equals(input)) { inputStream = System.in; } else { inputStream = new FileInputStream(input); } importStructure(context, inputStream, outputStream); } System.exit(0); }
Source:
static void moderateComment(final int accountId, final Comment comment, final CommentStatus newStatus, final CommentActionListener actionListener) { if (newStatus != null && (newStatus.equals(CommentStatus.TRASH) || newStatus.equals(CommentStatus.DELETE))) { deleteComment(accountId, comment, actionListener, newStatus.equals(CommentStatus.DELETE)); return; } final Blog blog = WordPress.getBlog(accountId); if (blog==null || comment==null || newStatus==null || newStatus==CommentStatus.UNKNOWN) { if (actionListener != null) actionListener.onActionResult(new CommentActionResult(CommentActionResult.COMMENT_ID_ON_ERRORS, null)); return; } final Handler handler = new Handler(); new Thread() { @Override public void run() { @SuppressWarnings("UnusedAssignment") XMLRPCClientInterface client = XMLRPCFactory.instantiate(blog.getUri(), blog.getHttpuser(), blog.getHttppassword()); final boolean success = ApiHelper.editComment(blog, comment, newStatus); if (success) { CommentTable.updateCommentStatus(blog.getLocalTableBlogId(), comment.commentID, CommentStatus .toString(newStatus)); } if (actionListener != null) { handler.post(new Runnable() { @Override public void run() { actionListener.onActionResult(new CommentActionResult(comment.commentID, null)); } }); } } }.start(); }

Target:
static void moderateComment(final int accountId, final Comment comment, final CommentStatus newStatus, final CommentActionListener actionListener) { if (newStatus != null && (newStatus.equals(CommentStatus.TRASH) || newStatus.equals(CommentStatus.DELETE))) { deleteComment(accountId, comment, actionListener, newStatus.equals(CommentStatus.DELETE)); return; } final Blog blog = WordPress.getBlog(accountId); if (blog==null || comment==null || newStatus==null || newStatus==CommentStatus.UNKNOWN) { if (actionListener != null) actionListener.onActionResult(new CommentActionResult(CommentActionResult.COMMENT_ID_ON_ERRORS, null)); return; } final Handler handler = new Handler(); new Thread() { @Override public void run() { final boolean success = ApiHelper.editComment(blog, comment, newStatus); if (success) { CommentTable.updateCommentStatus(blog.getLocalTableBlogId(), comment.commentID, CommentStatus .toString(newStatus)); } if (actionListener != null) { handler.post(new Runnable() { @Override public void run() { actionListener.onActionResult(new CommentActionResult(comment.commentID, null)); } }); } } }.start(); }
Source:
static List<String> annotationKeys(QueryRequest request) { if (request.annotations.isEmpty() && request.binaryAnnotations.isEmpty()) { return Collections.emptyList(); } checkArgument(request.serviceName != null, "serviceName needed with annotation query"); List<String> annotationKeys = new ArrayList<>(); annotationKeys.add(request.serviceName); for (String a : request.annotations) { if (!annotationKeys.contains(a)) annotationKeys.add(a); } for (Map.Entry<String, String> b : request.binaryAnnotations.entrySet()) { if (!annotationKeys.contains(b.getKey() + ":" + b.getValue())) annotationKeys.add(b.getKey() + ":" + b.getValue()); } return annotationKeys; }

Target:
static List<String> annotationKeys(QueryRequest request) { if (request.annotations.isEmpty() && request.binaryAnnotations.isEmpty()) { return Collections.emptyList(); } checkArgument(request.serviceName != null, "serviceName needed with annotation query"); Set<String> annotationKeys = new HashSet<>(); annotationKeys.add(request.serviceName); for (String a : request.annotations) { annotationKeys.add(a); } for (Map.Entry<String, String> b : request.binaryAnnotations.entrySet()) { annotationKeys.add(b.getKey() + ":" + b.getValue()); } return sortedList(annotationKeys); }
Source:
public static File makeTimeFile(File dir, ByteOrder order) { return new File(dir, StringUtils.safeFormat("time_%s.drd", order)); }

Target:
public static File makeTimeFile(File dir, ByteOrder order) { return new File(dir, StringUtils.format("time_%s.drd", order)); }
Source:
public void sortInput(InputStream inputStream) throws IOException { InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader reader = new BufferedReader(inputStreamReader); String line; while ((line = reader.readLine()) != null) { if (line.trim().length() == 0) { continue; } inputStrings.add(line.trim()); } reader.close(); Collections.sort(inputStrings); }

Target:
public void sortInput(InputStream inputStream) throws IOException { InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); BufferedReader reader = new BufferedReader(inputStreamReader); String line; while ((line = reader.readLine()) != null) { if (line.trim().length() == 0) { continue; } inputStrings.add(line.trim()); } reader.close(); Collections.sort(inputStrings); }
Source:
private void nextReference() { if (!hasMoreReferences) { throw new RuntimeException("Cannot get next reference - already at last one"); } try { hasMoreReferences = referencesChunksIterator.hasNext(); if (!hasMoreReferences) { hasMoreAlignments = false; return; } currentReference++; Chunk refChunk = referencesChunksIterator.next(); if (refChunk == null) { hasMoreAlignments = false; return; } Reference reference = cachedReferences.get(currentReference); if (reference == null) { synchronized (cachedReferences) { reference = cachedReferences.get(currentReference); if (reference == null) { reference = run.getReference(header.getSequence(currentReference).getSequenceName()); cachedReferences.set(currentReference, reference); } } } alignedIterator = reference.getFilteredAlignmentSlice( refChunk.getChunkStart(), refChunk.getChunkEnd() - refChunk.getChunkStart(), Alignment.all, Alignment.startWithinSlice, 0); hasMoreAlignments = alignedIterator.nextAlignment(); } catch (ErrorMsg e) { throw new RuntimeException(e); } }

Target:
private void nextReference() { if (!hasMoreReferences) { throw new NoSuchElementException("Cannot get next reference - already at last one"); } try { hasMoreReferences = referencesChunksIterator.hasNext(); if (!hasMoreReferences) { hasMoreAlignments = false; return; } currentReference++; Chunk refChunk = referencesChunksIterator.next(); if (refChunk == null) { hasMoreAlignments = false; return; } Reference reference = cachedReferences.get(currentReference); alignedIterator = reference.getFilteredAlignmentSlice( refChunk.getChunkStart(), refChunk.getChunkEnd() - refChunk.getChunkStart(), Alignment.all, Alignment.startWithinSlice | Alignment.passDuplicates | Alignment.passFailed, 0); hasMoreAlignments = alignedIterator.nextAlignment(); } catch (ErrorMsg e) { throw new RuntimeException(e); } }
Source:
public Node alloc(String label) { Node b = map.get(label); if ( b == null ) { b = create(); map.put(label, b); } return b; }

Target:
public Node alloc(String label) { return map.computeIfAbsent(label, x->create()); }
Source:
public List<CategoryDTO> fetchInstallableApplications() { final Map<ApplicationsSource, List<CategoryDTO>> categoriesMap = this.applicationsSources.parallelStream() .collect( Collectors.toConcurrentMap(source -> source, ApplicationsSource::fetchInstallableApplications)); if (applicationsSources.isEmpty()) return Collections.emptyList(); final List<ApplicationsSource> tmpApplicationsSources = new ArrayList<>(applicationsSources); Collections.reverse(tmpApplicationsSources); final Map<String, CategoryDTO> mergedCategories = createSortedMap( categoriesMap.get(tmpApplicationsSources.remove(0)), CategoryDTO::getName); for (ApplicationsSource otherApplicationsSource : tmpApplicationsSources) { final List<CategoryDTO> otherCategories = categoriesMap.get(otherApplicationsSource); final Map<String, CategoryDTO> otherCategoriesMap = createSortedMap(otherCategories, CategoryDTO::getName); for (String categoryName : otherCategoriesMap.keySet()) { final CategoryDTO category = otherCategoriesMap.get(categoryName); if (mergedCategories.containsKey(categoryName)) { mergedCategories.put(categoryName, mergeCategories(mergedCategories.get(categoryName), category)); } else { mergedCategories.put(categoryName, category); } } } return new ArrayList<>(mergedCategories.values()); }

Target:
public List<CategoryDTO> fetchInstallableApplications() { final Map<ApplicationsSource, List<CategoryDTO>> categoriesMap = Arrays.stream(this.applicationsSources) .parallel().collect( Collectors.toConcurrentMap(source -> source, ApplicationsSource::fetchInstallableApplications)); return mergeApplicationsSources(categoriesMap, applicationsSources); }
Source:
SMTPConnectionPool(Vertx vertx, MailConfig config) { this.config = config; maxSockets = config.getMaxPoolSize(); keepAlive = config.isKeepAlive(); this.authOperationFactory = new AuthOperationFactory(new PRNG(vertx)); NetClientOptions netClientOptions = new NetClientOptions() .setSsl(config.isSsl()) .setTrustAll(config.isTrustAll()) .setEnabledSecureTransportProtocols(config.getEnabledSecureTransportProtocols()); if ((config.isSsl() || config.getStarttls() != StartTLSOptions.DISABLED) && !config.isTrustAll()) { netClientOptions.setHostnameVerificationAlgorithm("HTTPS"); } if (config.getKeyStore() != null) { netClientOptions.setTrustStoreOptions(new JksOptions().setPath(config.getKeyStore()) .setPassword(config.getKeyStorePassword())); } netClient = vertx.createNetClient(netClientOptions); }

Target:
SMTPConnectionPool(Vertx vertx, MailConfig config) { this.config = config; maxSockets = config.getMaxPoolSize(); keepAlive = config.isKeepAlive(); this.prng = new PRNG(vertx); this.authOperationFactory = new AuthOperationFactory(prng); NetClientOptions netClientOptions = new NetClientOptions() .setSsl(config.isSsl()) .setTrustAll(config.isTrustAll()) .setEnabledSecureTransportProtocols(config.getEnabledSecureTransportProtocols()); if ((config.isSsl() || config.getStarttls() != StartTLSOptions.DISABLED) && !config.isTrustAll()) { netClientOptions.setHostnameVerificationAlgorithm("HTTPS"); } if (config.getKeyStore() != null) { netClientOptions.setTrustStoreOptions(new JksOptions().setPath(config.getKeyStore()) .setPassword(config.getKeyStorePassword())); } netClient = vertx.createNetClient(netClientOptions); }
Source:
public void testHighFreqStatsSwapping() { List<Metric> finalList = new ArrayList<>(); for (int y = 0; y < 5; y++) { for (int x = 0; x < 3; x++) { List<Metric> list = new ArrayList<>(); for (int i = 0; i < 20; i++) { list.add( new Metric( "KEY" + y, 42.0 + i, new Date(), ImmutableSet.of(), Map.of("tag1", "value1", "what", "fun"), ImmutableMap.of(), null)); } finalList.addAll(shortSwapDetector.detect(list)); sleep(300); } } assertEquals(280, finalList.size()); }

Target:
public void testHighFreqStatsSwapping() { List<Metric> finalList = new ArrayList<>(); for (int y = 0; y < 5; y++) { for (int x = 0; x < 3; x++) { List<Metric> list = new ArrayList<>(); for (int i = 0; i < 20; i++) { list.add( new Metric( "KEY" + y, 42.0 + i, new Date(), ImmutableSet.of(), Map.of("tag1", "value1", "what", "fun"), ImmutableMap.of(), null)); } finalList.addAll(shortSwapDetector.detect(list)); try { Thread.sleep(300); } catch (InterruptedException e) { } } } assertEquals(280, finalList.size()); }
Source:
private int nextBuf(byte[] buffer, int bufOffset) { int ret; if (len - off < buffer.length - bufOffset) { ret = (int) (len - off); } else { ret = buffer.length - bufOffset; } int i; for (i = 0; i < ret; i += 6) { fillBytesImpl(buffer, i + bufOffset); } off += ret; return ret + bufOffset; }

Target:
public int nextBuf(byte[] buffer, int bufOffset) { int ret; if (len - off < buffer.length - bufOffset) { ret = (int) (len - off); } else { ret = buffer.length - bufOffset; } int i; for (i = 0; i < ret; i += 6) { fillBytesImpl(buffer, i + bufOffset); } off += ret; return ret + bufOffset; }
Source:
protected void drawEventRectangle(Canvas canvas, int day) { mBoundaries.setRectangle(mFormat.getDaySpan(day), mFormat.getEventLines()); mEventSquarePaint.setStyle(getRectanglePaintStyle()); mEventSquarePaint.setColor(getRectangleColor()); if(!mEvent.allDay){ r.left+=EVENT_RECT_MARGIN_LEFT; r.right+=EVENT_RECT_MARGIN_LEFT; r.top+=EVENT_RECT_MARGIN_TOP; canvas.drawRoundRect(new RectF(r), EVENT_RECT_ROUNDING, EVENT_RECT_ROUNDING, mEventSquarePaint); }else{ r.left+=EVENT_RECT_MARGIN_LEFT; r.right-=EVENT_RECT_MARGIN_RIGHT; r.top+=EVENT_RECT_MARGIN_TOP; r.bottom-=EVENT_RECT_MARGIN_BOTTOM; canvas.drawRoundRect(new RectF(r), EVENT_RECT_ALLDAY_ROUNDING, EVENT_RECT_ALLDAY_ROUNDING, mEventSquarePaint); } }

Target:
protected void drawEventRectangle(Canvas canvas, int day) { mBoundaries.setRectangle(mFormat.getDaySpan(day), mFormat.getEventLines()); mEventSquarePaint.setStyle(getRectanglePaintStyle()); mEventSquarePaint.setColor(getRectangleColor()); if(mEvent.allDay){ r.left += EVENT_RECT_MARGIN_LEFT; r.right -= EVENT_RECT_MARGIN_RIGHT; r.top += EVENT_RECT_MARGIN_TOP; r.bottom -= EVENT_RECT_MARGIN_BOTTOM; canvas.drawRoundRect(new RectF(r), EVENT_RECT_ALLDAY_ROUNDING, EVENT_RECT_ALLDAY_ROUNDING, mEventSquarePaint); } else { r.left += EVENT_RECT_MARGIN_LEFT; r.right += EVENT_RECT_MARGIN_RIGHT; r.top += EVENT_RECT_MARGIN_TOP; r.bottom += EVENT_RECT_MARGIN_BOTTOM; canvas.drawRoundRect(new RectF(r), EVENT_RECT_ROUNDING, EVENT_RECT_ROUNDING, mEventSquarePaint); } }
Source:
protected boolean importDefinition() { if (!getFromField().getText().isEmpty()) { showWarningDialog(Constant.messages.getString("graphql.importfromdialog.message")); return false; } else Introspection.sendIntrospectionQuery(getEndpointUri()); return true; }

Target:
protected boolean importDefinition() { showWarningDialog(Constant.messages.getString("graphql.importfromdialog.message")); return false; }
Source:
public void testNegativeStartCoordinateInConstructor() throws IllegalArgumentException { exception.expect(IllegalArgumentException.class); exception.expectMessage(CoreMatchers.equalTo("Variant start coordinate cannot be negative")); new Variant("1", -1, 1, "C", "T"); }

Target:
public void testNegativeStartCoordinateInConstructor() throws IllegalArgumentException { exception.expect(IllegalArgumentException.class); exception.expectMessage(CoreMatchers.equalTo(AbstractVariant.VARIANT_START_COORDINATE_CANNOT_BE_NEGATIVE)); new Variant("1", -1, 1, "C", "T"); }
Source:
public void stoppedApplicationsAreNotStartedWhenDomainIsRedeployed() throws Exception { DeploymentListener mockDeploymentListener = spy(new DeploymentStatusTracker()); deploymentService.addDeploymentListener(mockDeploymentListener); addExplodedDomainFromBuilder(emptyDomain100FileBuilder, emptyDomain100FileBuilder.getId()); addExplodedAppFromBuilder(appDependingOnDomain100FileBuilder); startDeployment(); assertApplicationDeploymentSuccess(applicationDeploymentListener, appDependingOnDomain100FileBuilder.getId()); assertApplicationStatus(appDependingOnDomain100FileBuilder.getId(), STARTED); deploymentService.findApplication(appDependingOnDomain100FileBuilder.getId()).stop(); assertApplicationStatus(appDependingOnDomain100FileBuilder.getId(), STOPPED); deploymentService.redeployDomain(emptyDomain100FileBuilder.getId()); verify(mockDeploymentListener, times(1)).onRedeploymentSuccess(appDependingOnDomain100FileBuilder.getId()); assertApplicationStatus(appDependingOnDomain100FileBuilder.getId(), CREATED); deploymentService.redeployDomain(emptyDomain100FileBuilder.getId()); verify(mockDeploymentListener, times(2)).onRedeploymentSuccess(appDependingOnDomain100FileBuilder.getId()); assertApplicationStatus(appDependingOnDomain100FileBuilder.getId(), CREATED); }

Target:
public void stoppedApplicationsAreNotStartedWhenDomainIsRedeployed() throws Exception { DeploymentListener mockDeploymentListener = spy(new DeploymentStatusTracker()); deploymentService.addDeploymentListener(mockDeploymentListener); deployDomainAndApplication(emptyDomain100FileBuilder, appDependingOnDomain100FileBuilder); assertApplicationStatus(appDependingOnDomain100FileBuilder.getId(), STARTED); deploymentService.findApplication(appDependingOnDomain100FileBuilder.getId()).stop(); assertApplicationStatus(appDependingOnDomain100FileBuilder.getId(), STOPPED); deploymentService.redeployDomain(emptyDomain100FileBuilder.getId()); verify(mockDeploymentListener, times(1)).onRedeploymentSuccess(appDependingOnDomain100FileBuilder.getId()); assertApplicationStatus(appDependingOnDomain100FileBuilder.getId(), CREATED); deploymentService.redeployDomain(emptyDomain100FileBuilder.getId()); verify(mockDeploymentListener, times(2)).onRedeploymentSuccess(appDependingOnDomain100FileBuilder.getId()); assertApplicationStatus(appDependingOnDomain100FileBuilder.getId(), CREATED); }
Source:
public Long read(ByteBuffer binary) throws IOException, ClassNotFoundException { long l = binary.getLong(); LOG.info("deserialized {}", l); return l; }

Target:
public Long read(ByteBuffer binary) throws IOException, ClassNotFoundException { return binary.getLong(); }
Source:
synchronized public void decrementFileOpCount(String appUser) { if (!appUserToLocalUser.containsKey(appUser)) { String errMsg = "decrementFileOpCount: No local user allocation for appUser " + appUser; LOG.warn(errMsg); return; } LocalUserInfo localUserInfo = appUserToLocalUser.get(appUser); localUserInfo.fileOpCount--; LOG.info("Decremented fileOpCount for appUser " + appUser + " to " + localUserInfo.fileOpCount); checkAndDeallocateAppUser(appUser, localUserInfo); }

Target:
synchronized public void decrementFileOpCount(String appUser) { if (!appUserToLocalUser.containsKey(appUser)) { String errMsg = "decrementFileOpCount: No local user allocation for appUser " + appUser; LOG.error(errMsg); return; } LocalUserInfo localUserInfo = appUserToLocalUser.get(appUser); localUserInfo.fileOpCount--; LOG.info("Decremented fileOpCount for appUser " + appUser + " to " + localUserInfo.fileOpCount); checkAndDeallocateAppUser(appUser, localUserInfo); }
Source:
protected void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); AppLog.i(T.MAIN, "main activity > new intent"); if (FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) { if (intent.hasExtra(ARG_NOTIFICATION_TYPE)) { NotificationType notificationType = (NotificationType) intent.getSerializableExtra(ARG_NOTIFICATION_TYPE); if (notificationType != null) { mSystemNotificationsTracker.trackTappedNotification(notificationType); } } } if (intent.hasExtra(NotificationsListFragment.NOTE_ID_EXTRA)) { launchWithNoteId(); } if (intent.hasExtra(ARG_OPEN_PAGE)) { handleOpenPageIntent(intent); } }

Target:
protected void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); AppLog.i(T.MAIN, "main activity > new intent"); if (intent.hasExtra(NotificationsListFragment.NOTE_ID_EXTRA)) { launchWithNoteId(); } if (intent.hasExtra(ARG_OPEN_PAGE)) { handleOpenPageIntent(intent); } }
Source:
public String asString() throws IOException { return new TextOf(this.bytes.value()).asString(); }

Target:
public String asString() throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); this.print(baos); return new TextOf(baos.toByteArray()).asString(); }
Source:
public <T> T serializeAndDeserialize(T obj) throws IOException, ClassNotFoundException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); ObjectOutputStream output = null; ObjectInputStream input = null; try { output = new ObjectOutputStream(bytes); output.writeObject(obj); input = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray())); return (T) input.readObject(); } finally { if (output != null) { output.close(); } if (input != null) { input.close(); } } }

Target:
public <T> T serializeAndDeserialize(T obj) throws IOException, ClassNotFoundException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try (ObjectOutputStream output = new ObjectOutputStream(bytes)) { output.writeObject(obj); } try (ObjectInputStream input = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()))) { return (T) input.readObject(); } }
Source:
public static String u(String value) { if (value == null || value.isEmpty()) { return ""; } try { return UriUtils.encodeQueryParam(value, "UTF-8"); } catch (UnsupportedEncodingException ignored) { logger.warn("UnsupportedEncodingException",ignored); return value; } }

Target:
public static String u(String value) { if (value == null || value.isEmpty()) { return ""; } try { return UriUtils.encodeQueryParam(value, "UTF-8"); } catch (UnsupportedEncodingException ignored) { logger.warn("the given encoding parameter is not supported", ignored); return value; } }
Source:
public void replaceNodeShouldNotRemoveIdenticalOldNode() throws Exception { Node oldNode = r.createSlave("foo", "", null); Node newNode = r.createSlave("foo", "", null); r.jenkins.addNode(oldNode); r.jenkins.getNodesObject().replaceNode(oldNode, newNode); r.jenkins.getNodesObject().load(); assertNotNull(r.jenkins.getNode(oldNode.getNodeName())); }

Target:
public void replaceNodeShouldNotRemoveIdenticalOldNode() throws Exception { Node oldNode = r.createSlave("foo", "", null); Node newNode = r.createSlave("foo", "", null); r.jenkins.addNode(oldNode); r.jenkins.getNodesObject().replaceNode(oldNode, newNode); r.jenkins.getNodesObject().load(); assertNotNull(r.jenkins.getNode("foo")); }
Source:
public String getFullPath(Object element) { return stripPath(new Path(((ZipEntry) element).getName()).toString()); }

Target:
public String getFullPath(Object element) { IPath path = new Path(((ZipEntry) element).getName()); if (path.segmentCount() >= stripLevel) path = path.removeFirstSegments(stripLevel); return path.toString(); }
Source:
private void refactorReferencesInOtherClasses(File[] files, String oldFieldType, String newFieldType) throws IOException { final String fieldTypeFQN = DO_PACKAGE + oldFieldType; for (File file : files) { if (isCandidateForRefactoring(oldFieldType, newFieldType, file)) { String fileContent = FileUtils.readFileToString(file, Charset.defaultCharset()); if (needsRefactoring(fieldTypeFQN, fileContent)) { fileContent = refactorFields(oldFieldType, newFieldType, fileContent); FileUtils.write(file, fileContent, Charset.defaultCharset()); } } } }

Target:
private void refactorReferencesInOtherClasses(File[] files, String oldFieldType, String newFieldType) throws IOException { final String fieldTypeFQN = DO_PACKAGE + oldFieldType; for (File file : files) { if (!isCandidateForRefactoring(oldFieldType, newFieldType, file)) { continue; } String fileContent = FileUtils.readFileToString(file, Charset.defaultCharset()); if (needsRefactoring(fieldTypeFQN, fileContent)) { fileContent = refactorFields(oldFieldType, newFieldType, fileContent); FileUtils.write(file, fileContent, Charset.defaultCharset()); } } }
Source:
public static ObjectId computeChangeId(final ObjectId firstParentId, final ObjectId treeId, final PersonIdent author, final PersonIdent committer, final String message) throws IOException { StringBuilder b = new StringBuilder(); b.append("tree "); b.append(ObjectId.toString(treeId)); b.append("\n"); if (firstParentId != null) { b.append("parent "); b.append(ObjectId.toString(firstParentId)); b.append("\n"); } b.append("author "); b.append(author.toExternalString()); b.append("\n"); b.append("committer "); b.append(committer.toExternalString()); b.append("\n\n"); b.append(clean(message)); File f = File.createTempFile("test", ".git"); f.delete(); f.deleteOnExit(); ObjectWriter w = new ObjectWriter(null); ByteArrayInputStream is = new ByteArrayInputStream(b.toString() .getBytes(Constants.CHARSET)); ObjectId sha1 = w.computeObjectSha1(Constants.OBJ_COMMIT, b.length(), is); return sha1; }

Target:
public static ObjectId computeChangeId(final ObjectId firstParentId, final ObjectId treeId, final PersonIdent author, final PersonIdent committer, final String message) throws IOException { StringBuilder b = new StringBuilder(); b.append("tree "); b.append(ObjectId.toString(treeId)); b.append("\n"); if (firstParentId != null) { b.append("parent "); b.append(ObjectId.toString(firstParentId)); b.append("\n"); } b.append("author "); b.append(author.toExternalString()); b.append("\n"); b.append("committer "); b.append(committer.toExternalString()); b.append("\n\n"); b.append(clean(message)); ObjectWriter w = new ObjectWriter(null); byte[] bytes = b.toString().getBytes(Constants.CHARACTER_ENCODING); ByteArrayInputStream is = new ByteArrayInputStream(bytes); ObjectId sha1 = w.computeObjectSha1(Constants.OBJ_COMMIT, bytes.length, is); return sha1; }
Source:
public static void clearTestFolder() { try { if (Files.exists(Paths.get(RepoStore.TEST_DIRECTORY))) { Files.walk(Paths.get(RepoStore.TEST_DIRECTORY), 1) .filter(Files::isRegularFile) .filter(p -> getFileExtension(String.valueOf(p.getFileName())).equalsIgnoreCase("json") || getFileExtension(String.valueOf(p.getFileName())).equalsIgnoreCase("json-err") ) .forEach(p -> new File(p.toAbsolutePath().toString()).delete()); } } catch (IOException e) { e.printStackTrace(); } }

Target:
public static void clearTestFolder() { Path testDirectory = Paths.get(RepoStore.TEST_DIRECTORY); try { if (!Files.exists(testDirectory)) { throw new FileNotFoundException(testDirectory.toString()); } Files.walk(Paths.get(RepoStore.TEST_DIRECTORY), 1) .filter(Files::isRegularFile) .filter(p -> getFileExtension(String.valueOf(p.getFileName())).equalsIgnoreCase("json") || getFileExtension(String.valueOf(p.getFileName())).equalsIgnoreCase("json-err") ) .forEach(p -> new File(p.toAbsolutePath().toString()).delete()); } catch (IOException e) { e.printStackTrace(); } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractPermission other = (AbstractPermission) obj; if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractPermission other = (AbstractPermission) obj; if (context == null) { if (other.context != null) { return false; } } else if (!context.equals(other.context)) { return false; } if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { return false; } return true; }
Source:
public void onNeutral(String callerTag) { ComponentsGetter cg = (ComponentsGetter)getSherlockActivity(); cg.getFileOperationsHelper() .removeFile(mTargetFile, true); FileDataStorageManager storageManager = cg.getStorageManager(); boolean containsKeepInSync = false; if (mTargetFile.isFolder()) { Vector<OCFile> files = storageManager.getFolderContent(mTargetFile); for(OCFile file: files) { containsKeepInSync = file.keepInSync() || containsKeepInSync; if (containsKeepInSync) break; } } if (mTargetFile.keepInSync() || containsKeepInSync) { OCFile folder = null; if (mTargetFile.isFolder()) { folder = mTargetFile; } else { folder = storageManager.getFileById(mTargetFile.getParentId()); } folder.setEtag(""); storageManager.saveFile(folder); Log_OC.d("RemoveFileDialogFragment", "Parent etag= |" + folder.getEtag() + "|"); } }

Target:
public void onNeutral(String callerTag) { ComponentsGetter cg = (ComponentsGetter)getSherlockActivity(); cg.getFileOperationsHelper() .removeFile(mTargetFile, true); FileDataStorageManager storageManager = cg.getStorageManager(); boolean containsKeepInSync = false; if (mTargetFile.isFolder()) { Vector<OCFile> files = storageManager.getFolderContent(mTargetFile); for(OCFile file: files) { containsKeepInSync = file.keepInSync() || containsKeepInSync; if (containsKeepInSync) break; } } if (mTargetFile.keepInSync() || containsKeepInSync) { OCFile folder = null; if (mTargetFile.isFolder()) { folder = mTargetFile; } else { folder = storageManager.getFileById(mTargetFile.getParentId()); } folder.setEtag(""); storageManager.saveFile(folder); } }
Source:
public void fetchCurrentTheme() { WordPress.getRestClientUtilsV1_1().getCurrentTheme(mSite.getSiteId(), new Listener() { @Override public void onResponse(JSONObject response) { try { mCurrentTheme = Theme.fromJSONV1_1(response, mSite.getSiteId()); if (mCurrentTheme == null) { return; } mCurrentTheme.setIsCurrent(true); WordPress.wpDB.saveTheme(mCurrentTheme); WordPress.wpDB.setCurrentTheme(String.valueOf(mSite.getSiteId()), mCurrentTheme.getId()); if (mThemeBrowserFragment != null) { mThemeBrowserFragment.setRefreshing(false); if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getId()); } } if (mThemeSearchFragment != null && mThemeSearchFragment.isVisible()) { mThemeSearchFragment.setRefreshing(false); } } catch (JSONException e) { AppLog.e(T.THEMES, e); } } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError response) { String themeId = WordPress.wpDB.getCurrentThemeId(String.valueOf(mSite.getSiteId())); mCurrentTheme = WordPress.wpDB.getTheme(String.valueOf(mSite.getSiteId()), themeId); if (mCurrentTheme != null && mThemeBrowserFragment != null) { if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getId()); } } } } ); }

Target:
public void fetchCurrentTheme() { WordPress.getRestClientUtilsV1_1().getCurrentTheme(mSite.getSiteId(), new Listener() { @Override public void onResponse(JSONObject response) { try { mCurrentTheme = Theme.fromJSONV1_1(response, mSite); if (mCurrentTheme == null) { return; } mCurrentTheme.setIsCurrent(true); ThemeTable.saveTheme(WordPress.wpDB.getDatabase(), mCurrentTheme); ThemeTable.setCurrentTheme(WordPress.wpDB.getDatabase(), String.valueOf(mSite.getSiteId()), mCurrentTheme.getId()); if (mThemeBrowserFragment != null) { mThemeBrowserFragment.setRefreshing(false); if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getId()); } } if (mThemeSearchFragment != null && mThemeSearchFragment.isVisible()) { mThemeSearchFragment.setRefreshing(false); } } catch (JSONException e) { AppLog.e(T.THEMES, e); } } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError response) { String themeId = ThemeTable.getCurrentThemeId(WordPress.wpDB.getDatabase(), String.valueOf(mSite.getSiteId())); mCurrentTheme = ThemeTable.getTheme(WordPress.wpDB.getDatabase(), String.valueOf(mSite.getSiteId()), themeId); if (mCurrentTheme != null && mThemeBrowserFragment != null) { if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getId()); } } } } ); }
Source:
private ExprAnalysis analyzeExprs(List<Expr> exprs, Expr.ObjectBinding bindings) { Set<ExprType> presentTypes = EnumSet.noneOf(ExprType.class); List<ExprEval<?>> exprEvals = new ArrayList<>(); for (Expr expr : exprs) { ExprEval<?> exprEval = expr.eval(bindings); ExprType exprType = exprEval.type(); if (isValidType(exprType)) { presentTypes.add(exprType); } if (exprEval.asString() == null) { return null; } exprEvals.add(exprEval); } ExprType comparisonType = getComparisionType(presentTypes); return new ExprAnalysis(comparisonType, exprEvals); }

Target:
private ExprAnalysis analyzeExprs(List<Expr> exprs, Expr.ObjectBinding bindings) { Set<ExprType> presentTypes = EnumSet.noneOf(ExprType.class); List<ExprEval<?>> exprEvals = new ArrayList<>(); for (Expr expr : exprs) { ExprEval<?> exprEval = expr.eval(bindings); ExprType exprType = exprEval.type(); if (isValidType(exprType)) { presentTypes.add(exprType); } if (exprEval.value() != null) { exprEvals.add(exprEval); } } ExprType comparisonType = getComparisionType(presentTypes); return new ExprAnalysis(comparisonType, exprEvals); }
Source:
@Override public void lock() { if (hasLocked.get()) return; threadCount.incrementAndGet(); lock.lock(); if (!onGlobalLock) { globalSync.acquire(); onGlobalLock = true; nextFinish = MAX_TIME + System.nanoTime(); } hasLocked.set(true); }

Target:
@Override public void lock() { if (reentrantCnt.get() > 0) { reentrantCnt.increment(); return; } threadCnt.incrementAndGet(); lock.lock(); if (closed) { reentrantCnt.decrement(); lock.unlock(); throw new IllegalStateException("Can't acquire a lock after a close operation."); } if (!isGloballyLocked) { globalSync.acquire(); isGloballyLocked = true; nextFinish = MAX_TIME + System.nanoTime(); } reentrantCnt.increment(); }
Source:
private void validateDirsAndRegex() { if (topicDirGroupsMaxIndex > 0 && topixRegexCaptureGroup == null) { throw new ConfigException( TOPICS_DIR_CONFIG + " cannot contain ${} without a valid " + TOPIC_REGEX_CAPTURE_GROUP_CONFIG + " being configured." ); } if (logDirGroupsMaxIndex > 0 && topixRegexCaptureGroup == null) { throw new ConfigException( LOGS_DIR_CONFIG + " cannot contain ${} without a valid " + TOPIC_REGEX_CAPTURE_GROUP_CONFIG + " being configured." ); } validateReplacements(TOPICS_DIR_CONFIG); validateReplacements(LOGS_DIR_CONFIG); }

Target:
private void validateDirsAndRegex() { if (topicDirGroupsMaxIndex >= 0 && topicRegexCaptureGroup == null) { throw new ConfigException( TOPICS_DIR_CONFIG + " cannot contain ${} without a valid " + TOPIC_CAPTURE_GROUPS_REGEX_CONFIG + " being configured." ); } if (logDirGroupsMaxIndex >= 0 && topicRegexCaptureGroup == null) { throw new ConfigException( LOGS_DIR_CONFIG + " cannot contain ${} without a valid " + TOPIC_CAPTURE_GROUPS_REGEX_CONFIG + " being configured." ); } validateReplacements(TOPICS_DIR_CONFIG); validateReplacements(LOGS_DIR_CONFIG); }
Source:
public TaskExecution createTaskExecution() { initialize(); TaskExecution taskExecution = taskExecutionDao.createTaskExecution(null, null, new ArrayList<String>(0), null); logger.debug("Creating: " + taskExecution.toString()); return taskExecution; }

Target:
public TaskExecution createTaskExecution() { initialize(); TaskExecution taskExecution = taskExecutionDao.createTaskExecution(null, null, Collections.<String>emptyList(), null); logger.debug("Creating: " + taskExecution.toString()); return taskExecution; }
Source:
protected boolean doBind(CommandMetaData meta) { if (CommandMetaData.Mode.MASTER_OR_SLAVE == meta.runsAt()) { return true; } boolean runswithMasterOnly = meta.runsAt() == CommandMetaData.Mode.MASTER ? true : false; if (slaveMode ^ runswithMasterOnly) { return false; } return true; }

Target:
protected boolean doBind(CommandMetaData meta) { if (CommandMetaData.Mode.MASTER_OR_SLAVE == meta.runsAt()) { return true; } boolean runsWithMasterOnly = meta.runsAt() == CommandMetaData.Mode.MASTER ? true : false; if (slaveMode ^ runsWithMasterOnly) { return true; } return false; }
Source:
private int integerLiteral() { int i = 0; char c = fValue[i++]; if (c == '0' && i < fValue.length) { c = fValue[i]; switch ((c | 0x20)) { case 'x': return probablyHex(i); case 'b': return probablyBinary(i); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': while (isOctal(c) && i < fValue.length) { c = fValue[++i]; } break; case '.': return afterDecimalPoint(i); } if (c == '8' || c == '9') { c = fValue[i]; while (Character.isDigit(c) && i < fValue.length) { c = fValue[++i]; } return i; } if (c == '.') { return afterDecimalPoint(i); } } else if (Character.isDigit(c)) { c = fValue[i]; while (Character.isDigit(c) && i < fValue.length) { c = fValue[++i]; } if (c == '.') { return afterDecimalPoint(i); } else if ((c | 0x20) == 'e') { return exponentPart(i); } } else { assert false; } return i; }

Target:
private int integerLiteral() { int i = 0; char c = fValue[i++]; if (c == '0' && i < fValue.length) { c = fValue[i]; switch ((c | 0x20)) { case 'x': return probablyHex(i); case 'b': return probablyBinary(i); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': while (isOctal(c) && i < fValue.length) { c = fValue[++i]; } break; case '.': return afterDecimalPoint(i); } if (c == '8' || c == '9') { c = fValue[i]; while (Character.isDigit(c) && i < fValue.length) { c = fValue[++i]; } } return handleDecimalOrExponent(c, i); } else if (Character.isDigit(c)) { c = fValue[i]; while (Character.isDigit(c) && i < fValue.length) { c = fValue[++i]; } return handleDecimalOrExponent(c, i); } else { assert false; } return i; }