auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean hasNoGenericChildren(Content content) { if (!(content instanceof Container)) { return true; } DBObject dbQuery = where().fieldEquals("container", content.getCanonicalUri()).build(); return childrenDb.find(dbQuery).count() < 1; }

Target:
private boolean hasNoGenericChildren(Content content) { if (!(content instanceof Container)) { return true; } DBObject dbQuery = where().fieldEquals(CONTAINER, content.getCanonicalUri()).build(); return childrenDb.find(dbQuery).count() < 1; }
Source:
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) { if (Game.isClient(world)) return; if (!MiscTools.isKillableEntity(entity)) return; ChargeNetwork.ChargeNode node = ChargeManager.getNetwork(world).getNode(pos); if (node.getChargeGraph().getCharge() > 2000) { boolean shock = true; ItemStack overalls = getOveralls(entity); ItemStack boots = getRubberBoots(entity); if ((overalls != null) && (boots != null)) { shock = false; if (MiscTools.RANDOM.nextInt(300) == 0) entity.setItemStackToSlot(EntityEquipmentSlot.LEGS, InvTools.damageItem(overalls, 1)); if (MiscTools.RANDOM.nextInt(300) == 150) entity.setItemStackToSlot(EntityEquipmentSlot.FEET, InvTools.damageItem(boots, 1)); } if ((overalls != null)) { shock = false; if (MiscTools.RANDOM.nextInt(150) == 0) entity.setItemStackToSlot(EntityEquipmentSlot.LEGS, InvTools.damageItem(overalls, 1)); } if ((boots != null)) { shock = false; if (MiscTools.RANDOM.nextInt(150) == 0) entity.setItemStackToSlot(EntityEquipmentSlot.FEET, InvTools.damageItem(boots, 1)); } if (shock && entity.attackEntityFrom(RailcraftDamageSource.TRACK_ELECTRIC, 2)) { node.removeCharge(2000); EffectManager.instance.zapEffectDeath(world, entity); } } }

Target:
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) { if (Game.isClient(world)) return; if (!MiscTools.isKillableEntity(entity)) return; ChargeNetwork.ChargeNode node = ChargeManager.getNetwork(world).getNode(pos); if (node.getChargeGraph().getCharge() > 2000) { boolean shock = true; ItemStack overalls = getOveralls(entity); ItemStack boots = getRubberBoots(entity); if (!InvTools.isEmpty(overalls) && !InvTools.isEmpty(boots)) { shock = false; if (MiscTools.RANDOM.nextInt(300) == 0) entity.setItemStackToSlot(EntityEquipmentSlot.LEGS, InvTools.damageItem(overalls, 1)); else if (MiscTools.RANDOM.nextInt(300) == 150) entity.setItemStackToSlot(EntityEquipmentSlot.FEET, InvTools.damageItem(boots, 1)); } if (!InvTools.isEmpty(overalls)) { shock = false; if (MiscTools.RANDOM.nextInt(150) == 0) entity.setItemStackToSlot(EntityEquipmentSlot.LEGS, InvTools.damageItem(overalls, 1)); } if (!InvTools.isEmpty(boots)) { shock = false; if (MiscTools.RANDOM.nextInt(150) == 0) entity.setItemStackToSlot(EntityEquipmentSlot.FEET, InvTools.damageItem(boots, 1)); } if (shock && entity.attackEntityFrom(RailcraftDamageSource.TRACK_ELECTRIC, 2)) { node.removeCharge(2000); EffectManager.instance.zapEffectDeath(world, entity); } } }
Source:
public ASTNode(HasLocation hasLocation) { this(hasLocation.getLocation()); metadataSet = new HashSet<>(); }

Target:
public ASTNode(HasLocation hasLocation) { this(hasLocation.getLocation()); }
Source:
public Set<Ref> resolveTipSha1(ObjectId id) throws IOException { return getRefs().stream() .filter(r -> id.equals(r.getObjectId()) || id.equals(r.getPeeledObjectId())) .collect(Collectors.toSet()); }

Target:
public Set<Ref> resolveTipSha1(ObjectId id) throws IOException { return getRefs().stream().filter(r -> id.equals(r.getObjectId()) || id.equals(r.getPeeledObjectId())).collect(toSet()); }
Source:
public StoreQueryParams<T> withPartition(final Integer partition) { this.partition = partition; return this; }

Target:
public StoreQueryParams<T> withPartition(final Integer partition) { final StoreQueryParams<T> storeQueryParams = StoreQueryParams.fromNameAndType(this.storeName(), this.queryableStoreType()); storeQueryParams.partition = partition; storeQueryParams.staleStores = this.staleStores; return storeQueryParams; }
Source:
public void analyze_appActivitySameAppWithinConflictIntervalContinuous_activityRecordMergedAndNoNewGoalConflictMessageCreated() { ZonedDateTime now = now(); DayActivity existingDayActivity = mockExistingActivity(gamblingGoal, now.minusMinutes(10), now.minusMinutes(5), "Lotto App"); service.analyze(userAnonId, createSingleAppActivity("Lotto App", now.minusMinutes(5), now.minusMinutes(2))); verifyNoGoalConflictMessagesCreated(); List<Activity> activities = existingDayActivity.getActivities(); assertThat(activities.size(), equalTo(1)); assertThat(activities.get(0).getApp(), equalTo(Optional.of("Lotto App"))); assertThat(activities.get(0).getDurationMinutes(), equalTo(8)); }

Target:
public void analyze_appActivitySameAppWithinConflictIntervalContinuous_activityRecordMergedAndNoNewGoalConflictMessageCreated() { ZonedDateTime now = now(); ZonedDateTime existingActivityEndTime = now.minusMinutes(5); DayActivity existingDayActivity = mockExistingActivity(gamblingGoal, now.minusMinutes(10), existingActivityEndTime, "Lotto App"); service.analyze(userAnonId, createSingleAppActivity("Lotto App", existingActivityEndTime, now.minusMinutes(2))); verifyNoGoalConflictMessagesCreated(); List<Activity> activities = existingDayActivity.getActivities(); assertThat(activities.size(), equalTo(1)); assertThat(activities.get(0).getApp(), equalTo(Optional.of("Lotto App"))); assertThat(activities.get(0).getDurationMinutes(), equalTo(8)); }
Source:
public int isPreferred(Node node) { if (node == null) { return 0; } AbstractFile file = node.getLookup().lookup(AbstractFile.class); if (file == null) { return 0; } String mimeType = file.getMIMEType(); if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); try { FileTypeDetector fileTypeDetector = new FileTypeDetector(); mimeType = fileTypeDetector.detectFileType(file); } catch (FileTypeDetector.FileTypeDetectorInitException ex) { LOGGER.log(Level.SEVERE, "Failed to initialize FileTypeDetector.", ex); return 0; } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, String.format("Could not detect format using fileTypeDetector for file: %s", file), ex); return 0; } } if (mimeType.equalsIgnoreCase("application/octet-stream")) { return 0; } else { if (null != getSupportingViewer(mimeType)) { return CONFIDENCE_LEVEL; } } return 0; }

Target:
public int isPreferred(Node node) { AbstractFile file = node.getLookup().lookup(AbstractFile.class); String mimeType = file.getMIMEType(); if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); try { FileTypeDetector fileTypeDetector = new FileTypeDetector(); mimeType = fileTypeDetector.detectMIMEType(file); }catch (FileTypeDetector.FileTypeDetectorInitException ex) { LOGGER.log(Level.SEVERE, "Failed to initialize FileTypeDetector.", ex); return 0; } } if (mimeType.equalsIgnoreCase("application/octet-stream")) { return 0; } else { if (null != getSupportingViewer(mimeType)) { return CONFIDENCE_LEVEL; } } return 0; }
Source:
File getActiveFile() { IWorkbenchPage workbenchPage = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getService(IWorkbenchPage.class); IEditorPart activeEditor = workbenchPage.getActiveEditor(); if (activeEditor == null) return null; IEditorInput editorInput = activeEditor.getEditorInput(); return Adapters.adapt(editorInput, File.class); }

Target:
File getActiveFile() { IWorkbenchPage workbenchPage = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getService(IWorkbenchPage.class); IEditorPart activeEditor = workbenchPage.getActiveEditor(); if (activeEditor == null) { return null; } IEditorInput editorInput = activeEditor.getEditorInput(); return Adapters.adapt(editorInput, File.class); }
Source:
public void testServiceException() throws Exception { ServiceException originalException = new ServiceException(ErrorType.FAILED_PRECONDITION, SafeArg.of("key", "value")); SerializableError error = SerializableError.forException(originalException); String json = OBJECT_MAPPER.writeValueAsString(error); RemoteException exception = (RemoteException) decode(MediaType.APPLICATION_JSON, json, 400); assertThat(exception.getCause()).isNull(); assertThat(exception.getStatus()).isEqualTo(400); assertThat(exception.getError().errorCode()).isEqualTo(ErrorType.FAILED_PRECONDITION.code().name()); assertThat(exception.getError().errorName()).isEqualTo(ErrorType.FAILED_PRECONDITION.code().name()); assertThat(exception.getMessage()) .isEqualTo("RemoteException: " + ErrorType.FAILED_PRECONDITION.code().name()); }

Target:
public void testServiceException() throws Exception { ServiceException originalException = new ServiceException(ErrorType.FAILED_PRECONDITION, SafeArg.of("key", "value")); SerializableError error = SerializableError.forException(originalException); String json = SERVER_MAPPER.writeValueAsString(error); RemoteException exception = (RemoteException) decode(MediaType.APPLICATION_JSON, json, 400); assertThat(exception.getCause()).isNull(); assertThat(exception.getStatus()).isEqualTo(400); assertThat(exception.getError().errorCode()).isEqualTo(ErrorType.FAILED_PRECONDITION.code().name()); assertThat(exception.getError().errorName()).isEqualTo(ErrorType.FAILED_PRECONDITION.name()); assertThat(exception.getMessage()).isEqualTo("RemoteException: " + ErrorType.FAILED_PRECONDITION.code().name() + " (" + ErrorType.FAILED_PRECONDITION.name() + ")"); }
Source:
public static void copyStreamAndClose(@Nonnull InputStream in, @Nonnull OutputStream out) throws IOException { try { copyStream(in,out); } finally { in.close(); out.close(); } }

Target:
public static void copyStreamAndClose(@Nonnull InputStream in, @Nonnull OutputStream out) throws IOException { try (InputStream _in = in; OutputStream _out = out) { copyStream(in,out); } }
Source:
public RecordCursor getCursor(SqlExecutionContext executionContext) { final RecordCursor baseCursor = base.getCursor(executionContext); try { map.clear(); long maxInMemoryRows = executionContext.getCairoSecurityContext().getMaxInMemoryRows(); if (maxInMemoryRows > baseCursor.size() || baseCursor.size() < 0) { map.setMaxSize(maxInMemoryRows); int n = groupByFunctions.size(); final Record baseCursorRecord = baseCursor.getRecord(); while (baseCursor.hasNext()) { MapKey key = map.withKey(); mapSink.copy(baseCursorRecord, key); MapValue value = key.createValue(); if (value.isNew()) { value.putLong(0, Numbers.LONG_NaN); for (int i = 0; i < n; i++) { groupByFunctions.getQuick(i).setNull(value); } } } if (map.size() == 0) { baseCursor.close(); return EmptyTableRecordCursor.INSTANCE; } baseCursor.toTop(); boolean next = baseCursor.hasNext(); assert next; return initFunctionsAndCursor(executionContext, baseCursor); } else { throw LimitOverflowException.instance(maxInMemoryRows); } } catch (CairoException ex) { baseCursor.close(); throw ex; } }

Target:
public RecordCursor getCursor(SqlExecutionContext executionContext) { final RecordCursor baseCursor = base.getCursor(executionContext); try { map.clear(); long maxInMemoryRows = executionContext.getCairoSecurityContext().getMaxInMemoryRows(); if (maxInMemoryRows > baseCursor.size()) { map.setMaxSize(maxInMemoryRows); int n = groupByFunctions.size(); final Record baseCursorRecord = baseCursor.getRecord(); while (baseCursor.hasNext()) { MapKey key = map.withKey(); mapSink.copy(baseCursorRecord, key); MapValue value = key.createValue(); if (value.isNew()) { value.putLong(0, Numbers.LONG_NaN); for (int i = 0; i < n; i++) { groupByFunctions.getQuick(i).setNull(value); } } } if (map.size() == 0) { baseCursor.close(); return EmptyTableRecordCursor.INSTANCE; } baseCursor.toTop(); boolean next = baseCursor.hasNext(); assert next; return initFunctionsAndCursor(executionContext, baseCursor); } throw LimitOverflowException.instance(maxInMemoryRows); } catch (CairoException ex) { baseCursor.close(); throw ex; } }
Source:
public static String getName(OsmandApplication app, SearchResult searchResult) { switch (searchResult.objectType) { case STREET: if (searchResult.localeName.endsWith(")")) { int i = searchResult.localeName.indexOf('('); if (i > 0) { return searchResult.localeName.substring(0, i).trim(); } } break; case STREET_INTERSECTION: if (!Algorithms.isEmpty(searchResult.localeRelatedObjectName)) { return searchResult.localeName + " - " + searchResult.localeRelatedObjectName; } break; case RECENT_OBJ: HistoryEntry historyEntry = (HistoryEntry) searchResult.object; PointDescription pd = historyEntry.getName(); return pd.getSimpleName(app, false); case LOCATION: LatLon latLon = searchResult.location; return PointDescription.getLocationNamePlain(app, latLon.getLatitude(), latLon.getLongitude()); case POI: if (((Amenity)searchResult.object).isClosed()) { return searchResult.localeName + " (Closed)"; } } return searchResult.localeName; }

Target:
public static String getName(OsmandApplication app, SearchResult searchResult) { switch (searchResult.objectType) { case STREET: if (searchResult.localeName.endsWith(")")) { int i = searchResult.localeName.indexOf('('); if (i > 0) { return searchResult.localeName.substring(0, i).trim(); } } break; case STREET_INTERSECTION: if (!Algorithms.isEmpty(searchResult.localeRelatedObjectName)) { return searchResult.localeName + " - " + searchResult.localeRelatedObjectName; } break; case RECENT_OBJ: HistoryEntry historyEntry = (HistoryEntry) searchResult.object; PointDescription pd = historyEntry.getName(); return pd.getSimpleName(app, false); case LOCATION: LatLon latLon = searchResult.location; return PointDescription.getLocationNamePlain(app, latLon.getLatitude(), latLon.getLongitude()); } return searchResult.localeName; }
Source:
public void createContext() { stateDirectory = TestUtils.tempDirectory(); final StreamsMetricsImpl streamsMetrics = niceMock(StreamsMetricsImpl.class); replay(streamsMetrics); context = new InternalMockProcessorContext( stateDirectory, Serdes.String(), Serdes.Long(), new NoOpRecordCollector(), new ThreadCache(new LogContext("testCache "), 0, streamsMetrics) ); segments = new TimestampedSegments(storeName, METRICS_SCOPE, RETENTION_PERIOD, SEGMENT_INTERVAL); }

Target:
public void createContext() { stateDirectory = TestUtils.tempDirectory(); context = new InternalMockProcessorContext( stateDirectory, Serdes.String(), Serdes.Long(), new NoOpRecordCollector(), new ThreadCache( new LogContext("testCache "), 0, new StreamsMetricsImpl(new Metrics(), "test", StreamsConfig.METRICS_LATEST)) ); segments = new TimestampedSegments(storeName, METRICS_SCOPE, RETENTION_PERIOD, SEGMENT_INTERVAL); }
Source:
public boolean shouldSuspend(ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument) { if (shouldValidateOnBudgetTotal()) { LOG.debug("shouldSuspend, validating based on award budget total"); CuAward cuAward = (CuAward) contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getAward(); AwardExtendedAttribute awardExtension = (AwardExtendedAttribute) cuAward.getExtension(); return contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getTotalAmountBilledToDate().isGreaterThan(awardExtension.getBudgetTotalAmount()); } else { LOG.debug("shouldSuspend, validating based on ward total"); return super.shouldSuspend(contractsGrantsInvoiceDocument); } }

Target:
public boolean shouldSuspend(ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument) { if (shouldValidateOnBudgetTotal()) { LOG.debug("shouldSuspend, validating based on award budget total"); CuAward cuAward = (CuAward) contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getAward(); AwardExtendedAttribute awardExtension = (AwardExtendedAttribute) cuAward.getExtension(); return contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getTotalAmountBilledToDate().isGreaterThan(awardExtension.getBudgetTotalAmount()); } else { LOG.debug("shouldSuspend, validating based on award total"); return super.shouldSuspend(contractsGrantsInvoiceDocument); } }
Source:
private void removeWorkspaceQuietly(String workspaceId) { try { workspaceDao.remove(workspaceId); } catch (ServerException x) { LOG.error("Unable to remove temporary workspace '{}'", workspaceId); } }

Target:
private void removeWorkspaceQuietly(String workspaceId) { try { workspaceDao.remove(workspaceId); } catch (ServerException x) { LOG.error( "Unable to remove temporary workspace '{}'. Error message was: {}", workspaceId, x.getMessage()); } }
Source:
private boolean resolveConflictsOnMerge(Configuration config, CacheMode cacheMode) { if (config == null || cacheMode.isScattered() || cacheMode.isInvalidation()) return false; ClusteringConfiguration cc = config.clustering(); return cc.partitionHandling().resolveConflictsOnMerge() && cc.hash().numOwners() > 1; }

Target:
private boolean resolveConflictsOnMerge(Configuration config, CacheMode cacheMode) { if (config == null || cacheMode.isScattered() || cacheMode.isInvalidation()) return false; return config.clustering().partitionHandling().resolveConflictsOnMerge(); }
Source:
public void receive(Event event) { if (ruleEngineCallback != null) { logger.trace("Received Event: Source: Topic: Type: Payload: {}", event.getSource(), event.getTopic(), event.getType(), event.getPayload()); if (!event.getTopic().contains(source)) { return; } if (eventOnChannel != null && !eventOnChannel.equals("")) { if (event instanceof ChannelTriggeredEvent) { if (!this.eventOnChannel.equals(((ChannelTriggeredEvent) event).getEvent())) { return; } } } Map<String, Object> values = Maps.newHashMap(); values.put("event", event); ruleEngineCallback.triggered(this.module, values); } }

Target:
public void receive(Event event) { if (ruleEngineCallback != null) { logger.trace("Received Event: Source: Topic: Type: Payload: {}", event.getSource(), event.getTopic(), event.getType(), event.getPayload()); if (!event.getTopic().contains(source)) { return; } Map<String, Object> values = Maps.newHashMap(); values.put("event", event); ruleEngineCallback.triggered(this.module, values); } }
Source:
public Object evaluate(Object feature) { Object arg0; Object arg1; try { arg0 = (Object) getExpression(0).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function equalTo argument #0 - expected type Object"); } try { arg1 = (Object) getExpression(1).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function equalTo argument #1 - expected type Object"); } return MBFunctionUtil.argsEqual(arg0, arg1); }

Target:
public Object evaluate(Object feature) { Object arg0; Object arg1; try { arg0 = (Object) getExpression(0).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function \"mbEqualTo\" argument #0 - expected type Object"); } try { arg1 = (Object) getExpression(1).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function \"mbEqualTo\" argument #1 - expected type Object"); } return MBFunctionUtil.argsEqual(arg0, arg1); }
Source:
private void parseTabbarURI(String tabbarURI) throws URISyntaxException { if (tabbarId != null) { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_OnlyOneLocationURIPerScheme, TABBAR_SCHEME)); } if (tabbarURI.substring(TABBAR_SCHEME.length()).startsWith(SEPARATOR)) { String id = tabbarURI.substring(TABBAR_SCHEME.length() + SEPARATOR.length()).trim(); if (id.length() == 0) { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_NoId, TABBAR_SCHEME + SEPARATOR)); } tabbarId = id; } else { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_WrongFormat, TABBAR_SCHEME + SEPARATOR + "tabbarId", tabbarURI)); } }

Target:
private void parseTabbarURI(String tabbarURI) throws URISyntaxException { if (tabbarId != null) { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_OnlyOneLocationURIPerScheme, TABBAR_SCHEME)); } if (tabbarURI.substring(TABBAR_SCHEME.length()).trim().startsWith(SEPARATOR)) { String id = tabbarURI.substring(TABBAR_SCHEME.length()).trim().substring(SEPARATOR.length()).trim(); if (id.length() == 0) { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_NoId, TABBAR_SCHEME + SEPARATOR)); } tabbarId = id; } else { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_WrongFormat, TABBAR_SCHEME + SEPARATOR + "tabbarId", tabbarURI)); } }
Source:
private static final XWikiContext getContext() { return getModelContext().getXWikiContext(); }

Target:
private final XWikiContext getContext() { return getModelContext().getXWikiContext(); }
Source:
public String getScript(String inMoovServiceName) { return String.format((Locale)null,"%s.moveEyelids(%.2f,%.2f)\n", inMoovServiceName, eyelidleft.getPos(), eyelidright.getPos()); }

Target:
public String getScript(String inMoovServiceName) { return String.format(Locale.ENGLISH,"%s.moveEyelids(%.2f,%.2f)\n", inMoovServiceName, eyelidleft.getPos(), eyelidright.getPos()); }
Source:
public SnomedConceptDocument getComponent(final IBranchPath branchPath, final String id) { try { return SnomedRequests.prepareGetConcept(id) .setExpand("referenceSet()") .build(SnomedDatastoreActivator.REPOSITORY_UUID, branchPath.getPath()) .execute(ApplicationContext.getServiceForClass(IEventBus.class)) .then(concept -> { final SnomedDescription pt = concept.getPt(); final String preferredTerm = pt == null ? concept.getId() : pt.getTerm(); return SnomedConceptDocument.builder(concept) .label(preferredTerm) .build(); }) .getSync(); } catch (NotFoundException e) { return null; } }

Target:
public SnomedConceptDocument getComponent(final IBranchPath branchPath, final String id) { try { return SnomedRequests.prepareGetConcept(id) .setExpand("referenceSet()") .build(SnomedDatastoreActivator.REPOSITORY_UUID, branchPath.getPath()) .execute(ApplicationContext.getServiceForClass(IEventBus.class)) .then(concept -> { if (concept.getReferenceSet() == null) { return null; } final SnomedDescription pt = concept.getPt(); final String preferredTerm = pt == null ? concept.getId() : pt.getTerm(); return SnomedConceptDocument.builder(concept) .label(preferredTerm) .build(); }) .getSync(); } catch (NotFoundException e) { return null; } }
Source:
public Request(String value) { super(); this.value = value; }

Target:
public Request(String value) { this.value = value; }
Source:
public DistributedLoadCommand(FileSystemContext fsContext) { super(fsContext); mSubmittedJobAttempts = Lists.newArrayList(); InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults()); final ClientContext clientContext = ClientContext.create(conf); mClient = JobMasterClient.Factory.create( JobMasterClientContext.newBuilder(clientContext).build()); }

Target:
public DistributedLoadCommand(FileSystemContext fsContext) { super(fsContext); mSubmittedJobAttempts = Lists.newArrayList(); final ClientContext clientContext = mFsContext.getClientContext(); mClient = JobMasterClient.Factory.create( JobMasterClientContext.newBuilder(clientContext).build()); }
Source:
private TProtocol getProtocol(ThriftField field, ColumnIO columnIO, Events returnClause) { TProtocol p; final ThriftType type = field.getType(); switch (type.getType()) { case STOP: case VOID: default: throw new UnsupportedOperationException("can't convert type of " + field); case BOOL: case BYTE: case DOUBLE: case I16: case I32: case I64: case STRING: p = new PrimitiveWriteProtocol((PrimitiveColumnIO)columnIO, returnClause); break; case STRUCT: p = new StructWriteProtocol((GroupColumnIO)columnIO, (StructType)type, returnClause); break; case MAP: p = new MapWriteProtocol((GroupColumnIO)columnIO, (MapType)type, returnClause); break; case SET: if (writeThreeLevelList) { p = new ThreeLevelListWriteProtocol( (GroupColumnIO) columnIO, ((SetType) type).getValues(), returnClause); } else { p = new TwoLevelListWriteProtocol( (GroupColumnIO) columnIO, ((SetType) type).getValues(), returnClause); } break; case LIST: if (writeThreeLevelList) { p = new ThreeLevelListWriteProtocol( (GroupColumnIO) columnIO, ((ListType) type).getValues(), returnClause); } else { p = new TwoLevelListWriteProtocol( (GroupColumnIO) columnIO, ((ListType) type).getValues(), returnClause); } break; case ENUM: p = new EnumWriteProtocol((PrimitiveColumnIO)columnIO, (EnumType)type, returnClause); break; } return p; }

Target:
private TProtocol getProtocol(ThriftField field, ColumnIO columnIO, Events returnClause) { TProtocol p; final ThriftType type = field.getType(); switch (type.getType()) { case STOP: case VOID: default: throw new UnsupportedOperationException("can't convert type of " + field); case BOOL: case BYTE: case DOUBLE: case I16: case I32: case I64: case STRING: p = new PrimitiveWriteProtocol((PrimitiveColumnIO)columnIO, returnClause); break; case STRUCT: p = new StructWriteProtocol((GroupColumnIO)columnIO, (StructType)type, returnClause); break; case MAP: p = new MapWriteProtocol((GroupColumnIO)columnIO, (MapType)type, returnClause); break; case SET: p = getListWriteProtocol((GroupColumnIO) columnIO, ((SetType) type).getValues(), returnClause); break; case LIST: p = getListWriteProtocol((GroupColumnIO) columnIO, ((ListType) type).getValues(), returnClause); break; case ENUM: p = new EnumWriteProtocol((PrimitiveColumnIO)columnIO, (EnumType)type, returnClause); break; } return p; }
Source:
public <L, I extends IntegerType<I>> ImgLabeling<L, I> merge( final ImgLabeling<L, I> in1, final ImgLabeling<L, I> in2) { @SuppressWarnings("unchecked") final ImgLabeling<L, I> result = (ImgLabeling<L, I>) ops().run( net.imagej.ops.labeling.MergeLabeling.class, in1, in2); return result; }

Target:
public <L, I extends IntegerType<I>> ImgLabeling<L, I> merge( final ImgLabeling<L, I> in1, final ImgLabeling<L, I> in2) { @SuppressWarnings("unchecked") final ImgLabeling<L, I> result = (ImgLabeling<L, I>) ops().run( net.imagej.ops.Ops.Labeling.Merge.class, in1, in2); return result; }
Source:
protected IncomingMessageEnvelope handleNewRecord(ConsumerRecord<K, V> consumerRecord, SystemStreamPartition systemStreamPartition) { return new IncomingMessageEnvelope(systemStreamPartition, String.valueOf(consumerRecord.offset()), consumerRecord.key(), consumerRecord.value(), KafkaUtilJava.getRecordSize(consumerRecord), consumerRecord.timestamp(), Instant.now().toEpochMilli()); }

Target:
protected IncomingMessageEnvelope handleNewRecord(ConsumerRecord<K, V> consumerRecord, SystemStreamPartition systemStreamPartition) { return new IncomingMessageEnvelope(systemStreamPartition, String.valueOf(consumerRecord.offset()), consumerRecord.key(), consumerRecord.value(), getRecordSize(consumerRecord), consumerRecord.timestamp(), Instant.now().toEpochMilli()); }
Source:
boolean timeToResize() { return numberOfEntries == resizeLimit; }

Target:
boolean timeToResize() { return numberOfEntries >= resizeLimit; }
Source:
public User getUserByArtId(int userArtifactId) throws OseeCoreException { User toReturn = null; if (userArtifactId <= 0) { toReturn = getUser(SystemUser.OseeSystem); } else { for (User tempUser : getUsersAll()) { if (userArtifactId == tempUser.getArtId()) { toReturn = tempUser; } } } return toReturn; }

Target:
public User getUserByArtId(int userArtifactId) throws OseeCoreException { User toReturn = null; if (userArtifactId <= 0) { toReturn = getUser(SystemUser.OseeSystem); } else { for (User tempUser : getUsersAll()) { if (userArtifactId == tempUser.getArtId()) { toReturn = tempUser; break; } } } return toReturn; }
Source:
public void testSummaryOutputWithQuantiles() throws IOException { Summary labelsAndQuantiles = Summary.build() .quantile(0.5, 0.05).quantile(0.9, 0.01).quantile(0.99, 0.001) .labelNames("l").name("labelsAndQuantiles").help("help").register(registry); labelsAndQuantiles.labels("a").observe(2); writer = new StringWriter(); TextFormat.write004(writer, registry.metricFamilySamples()); assertEquals("# HELP labelsAndQuantiles help\n" + "# TYPE labelsAndQuantiles summary\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.5\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.9\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.99\",} 2.0\n" + "labelsAndQuantiles_min{l=\"a\",} 2.0\n" + "labelsAndQuantiles_max{l=\"a\",} 2.0\n" + "labelsAndQuantiles_count{l=\"a\",} 1.0\n" + "labelsAndQuantiles_sum{l=\"a\",} 2.0\n", writer.toString()); }

Target:
public void testSummaryOutputWithQuantiles() throws IOException { Summary labelsAndQuantiles = Summary.build() .quantile(0.5, 0.05).quantile(0.9, 0.01).quantile(0.99, 0.001) .labelNames("l").name("labelsAndQuantiles").help("help").register(registry); labelsAndQuantiles.labels("a").observe(2); writer = new StringWriter(); TextFormat.write004(writer, registry.metricFamilySamples()); assertEquals("# HELP labelsAndQuantiles help\n" + "# TYPE labelsAndQuantiles summary\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.5\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.9\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.99\",} 2.0\n" + "labelsAndQuantiles_count{l=\"a\",} 1.0\n" + "labelsAndQuantiles_sum{l=\"a\",} 2.0\n", writer.toString()); }
Source:
private boolean executeSshSoftFencingCommand(String version) { boolean result = true; EngineSSHClient sshClient = null; ByteArrayOutputStream cmdOut = null, cmdErr = null; try { sshClient = new EngineSSHClient(); sshClient.setVds(getVds()); sshClient.useDefaultKeyPair(); sshClient.connect(); sshClient.authenticate(); cmdOut = new ByteArrayOutputStream(); cmdErr = new ByteArrayOutputStream(); sshClient.executeCommand(Config.<String> GetValue(ConfigValues.SshSoftFencingCommand, version), null, cmdOut, cmdErr); log.infoFormat("SSH Soft Fencing command executed on host {0}", getVds().getHostName()); } catch (Exception ex) { log.errorFormat("SSH Soft Fencing command failed on host {0}: {1}", getVds().getHostName(), ex); logCommandOutput(cmdOut, "SSH Soft Fencing command standard output: {0}"); logCommandOutput(cmdErr, "SSH Soft Fencing command error output: {0}"); result = false; } finally { closeSshConnection(sshClient); } return result; }

Target:
private boolean executeSshSoftFencingCommand(String version) { boolean result = true; EngineSSHClient sshClient = null; ByteArrayOutputStream cmdOut = null, cmdErr = null; try { sshClient = new EngineSSHClient(); sshClient.setVds(getVds()); sshClient.useDefaultKeyPair(); sshClient.connect(); sshClient.authenticate(); cmdOut = new ByteArrayOutputStream(); cmdErr = new ByteArrayOutputStream(); sshClient.executeCommand(Config.<String> GetValue(ConfigValues.SshSoftFencingCommand, version), null, cmdOut, cmdErr); log.infoFormat("SSH Soft Fencing command executed on host {0}", getVds().getHostName()); } catch (Exception ex) { log.errorFormat("SSH Soft Fencing command failed on host {0}: {1}\nStdout: {2}\nStderr: {3}\nStacktrace: {4}", getVds().getHostName(), ex.getMessage(), getCommandOutput(cmdOut), getCommandOutput(cmdErr), ex); result = false; } finally { closeSshConnection(sshClient); } return result; }
Source:
public SqlStatements defineMap(final Map<String, ?> values) { if (values != null) { synchronized (this) { attributes.putAll(values); } } return this; }

Target:
public SqlStatements defineMap(final Map<String, ?> values) { if (values != null) { attributes.putAll(values); } return this; }
Source:
public void matchesIdenticalTypes() throws IOException { MatcherAssert.assertThat( new FkContentType( FkContentTypeTest.CTYPE, FkContentTypeTest.createTakeWithEmptyResponse() ).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, FkContentTypeTest.CTYPE ) ).has(), Matchers.is(true) ); }

Target:
public void matchesIdenticalTypes() throws IOException { MatcherAssert.assertThat( new FkContentType( FkContentTypeTest.CTYPE, FkContentTypeTest.emptyResponse() ).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, FkContentTypeTest.CTYPE ) ).has(), Matchers.is(true) ); }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } String qualifiedName = ((AnnotationTree) tree).annotationType().symbolType().fullyQualifiedName(); if (OLD_NEW_ANNOTATIONS_MAP.containsKey(qualifiedName)) { reportIssue(tree, String.format("Change this JUnit4 %s to the equivalent JUnit5 %s annotation.", qualifiedName, OLD_NEW_ANNOTATIONS_MAP.get(qualifiedName))); } }

Target:
public void visitNode(Tree tree) { String qualifiedName = ((AnnotationTree) tree).annotationType().symbolType().fullyQualifiedName(); if (OLD_NEW_ANNOTATIONS_MAP.containsKey(qualifiedName)) { reportIssue(tree, String.format("Change this JUnit4 %s to the equivalent JUnit5 %s annotation.", qualifiedName, OLD_NEW_ANNOTATIONS_MAP.get(qualifiedName))); } }
Source:
static List<Arguments> testWhatIsValid() { return List.of( Arguments.of( "Defender has air units and no destroyers vs Attacker subs", givenBattleState() .attackingUnits(List.of(givenUnitCanNotBeTargetedBy(mock(UnitType.class)))) .defendingUnits(List.of(givenUnit(), givenUnitIsAir())) .build(), true), Arguments.of( "Defender has air units and destroyers", givenBattleState() .attackingUnits(List.of(mock(Unit.class))) .defendingUnits(List.of(givenUnitDestroyer(), givenUnitIsAir())) .build(), false), Arguments.of( "Defender has air units but no destroyers vs Attacker with no subs", givenBattleState() .attackingUnits(List.of(givenUnit())) .defendingUnits(List.of(givenUnit(), givenUnitIsAir())) .build(), false)); }

Target:
static List<Arguments> testWhatIsValid() { return List.of( Arguments.of( "Defender has air units and no destroyers vs Attacker subs", givenBattleStateBuilder() .attackingUnits(List.of(givenUnitCanNotBeTargetedBy(mock(UnitType.class)))) .defendingUnits(List.of(givenAnyUnit(), givenUnitIsAir())) .build(), true), Arguments.of( "Defender has air units and destroyers", givenBattleStateBuilder() .attackingUnits(List.of(mock(Unit.class))) .defendingUnits(List.of(givenUnitDestroyer(), givenUnitIsAir())) .build(), false), Arguments.of( "Defender has air units but no destroyers vs Attacker with no subs", givenBattleStateBuilder() .attackingUnits(List.of(givenAnyUnit())) .defendingUnits(List.of(givenAnyUnit(), givenUnitIsAir())) .build(), false)); }
Source:
public RowFilter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { if (filter.getOperator() != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException(String.format("Cannot adapt operator %s", filter .getOperator().getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); Builder builder = RowFilter.newBuilder(); if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { ByteString rawValue = ByteString.copyFrom(comparator.getValue()); builder.setRowKeyRegexFilter(rawValue); } else if (comparator instanceof BinaryComparator) { byte[] quotedRegularExpression = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); builder.setRowKeyRegexFilter(ByteString.copyFrom(quotedRegularExpression)); } else { throw new IllegalStateException(String.format("Cannot adapt comparator %s", comparator .getClass().getCanonicalName())); } return builder.build(); }

Target:
public RowFilter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { CompareOp compareOp = filter.getOperator(); if (compareOp != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException(String.format("Cannot adapt operator %s", compareOp == null ? null : compareOp.getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); Builder builder = RowFilter.newBuilder(); if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { ByteString rawValue = ByteString.copyFrom(comparator.getValue()); builder.setRowKeyRegexFilter(rawValue); } else if (comparator instanceof BinaryComparator) { byte[] quotedRegularExpression = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); builder.setRowKeyRegexFilter(ByteString.copyFrom(quotedRegularExpression)); } else { throw new IllegalStateException(String.format("Cannot adapt comparator %s", comparator .getClass().getCanonicalName())); } return builder.build(); }
Source:
public WSClaimManager(String serverUrl, String cookie, ConfigurationContext configCtxt) throws UserStoreException { try { stub = new RemoteClaimManagerServiceStub(configCtxt, serverUrl + SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault e) { if (log.isDebugEnabled()) { log.debug(CONNECTION_ERROR_MESSAGE, e); } throw new UserStoreException(); } }

Target:
public WSClaimManager(String serverUrl, String cookie, ConfigurationContext configCtxt) throws UserStoreException { try { stub = new RemoteClaimManagerServiceStub(configCtxt, serverUrl + SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault e) { throw new UserStoreException("Axis error occurred while creating service client stub", e); } }
Source:
private static boolean isTable(TagNode node) { return "TABLE".equalsIgnoreCase(node.getNodeName()); }

Target:
private static boolean isTable(TagNode node) { return node.equalsElementName("TABLE"); }
Source:
private void populateResultFromRemote(int currentSize, List<Object> resultingKeyValuePairs, Map<Object, Long> reservations, Map<Data, Object> reverseKeyMap) { for (int i = currentSize; i < resultingKeyValuePairs.size(); i += 2) { Data keyData = (Data) resultingKeyValuePairs.get(i); Data valueData = (Data) resultingKeyValuePairs.get(i + 1); Object ncKey = useObjectKey ? (K) reverseKeyMap.get(keyData) : keyData; if (useObjectKey) { resultingKeyValuePairs.set(i, ncKey); } Long reservationId = reservations.get(ncKey); if (reservationId != null) { Object cachedValue = tryPublishReserved(ncKey, valueData, reservationId); resultingKeyValuePairs.set(i + 1, cachedValue); reservations.remove(ncKey); } } }

Target:
private void populateResultFromRemote(int currentSize, List<Object> resultingKeyValuePairs, Map<Object, Long> reservations, Map<Data, Object> reverseKeyMap) { for (int i = currentSize; i < resultingKeyValuePairs.size(); i += 2) { Data keyData = (Data) resultingKeyValuePairs.get(i); Data valueData = (Data) resultingKeyValuePairs.get(i + 1); Object ncKey = useObjectKey ? reverseKeyMap.get(keyData) : keyData; if (useObjectKey) { resultingKeyValuePairs.set(i, ncKey); } Long reservationId = reservations.get(ncKey); if (reservationId != null) { Object cachedValue = tryPublishReserved(ncKey, valueData, reservationId); resultingKeyValuePairs.set(i + 1, cachedValue); reservations.remove(ncKey); } } }
Source:
public void start() { BenchmarkSuite benchmarkSuite = benchmarkSuiteSupplier.get(); BenchmarkSuiteInfo benchmarkSuiteInfo = benchmarkSuite.getSuiteInfo(); List<PhaseSpecification> phases = benchmarkSuiteInfo.getPhases(); int successfulPhases = 0; try { for (PhaseSpecification phase : phases) { PhaseExecutor phaseExecutor = phaseExecutorFactory.get(phase, benchmarkSuite); try { phaseExecutor.run(proceedWithFailures); postEvent(BenchmarkPhaseEvent.succeeded(phase.getName())); successfulPhases++; } catch (PhaseExecutionException e) { postEvent(BenchmarkPhaseEvent.failed(phase.getName(), e.toString())); if (!proceedWithFailures) { throw new SuiteExecutionException(); } } } if (successfulPhases < phases.size()) { postEvent(BenchmarkSuiteEvent.completedWithFailures(benchmarkSuite.getName(), format("%s Phases out of %s succeeded", successfulPhases, phases.size()))); } else { postEvent(BenchmarkSuiteEvent.succeeded(benchmarkSuite.getName())); } } catch (SuiteExecutionException e) { postEvent(BenchmarkSuiteEvent.failed(benchmarkSuite.getName(), e.toString())); } }

Target:
public void start() { BenchmarkSuite benchmarkSuite = benchmarkSuiteSupplier.get(); BenchmarkSuiteInfo benchmarkSuiteInfo = benchmarkSuite.getSuiteInfo(); List<PhaseSpecification> phases = benchmarkSuiteInfo.getPhases(); int successfulPhases = 0; for (PhaseSpecification phase : phases) { PhaseExecutor phaseExecutor = phaseExecutorFactory.get(phase, benchmarkSuite); BenchmarkPhaseEvent phaseEvent = phaseExecutor.run(continueOnFailure); if (phaseEvent.getEventStatus() == SUCCEEDED) { successfulPhases++; } else if (phaseEvent.getEventStatus() == FAILED && !continueOnFailure) { postEvent(BenchmarkSuiteEvent.failed(benchmarkSuite.getName())); break; } } if (successfulPhases < phases.size()) { postEvent(BenchmarkSuiteEvent.completedWithFailures(benchmarkSuite.getName())); } else { postEvent(BenchmarkSuiteEvent.succeeded(benchmarkSuite.getName())); } }
Source:
public JavaType getParametrizedTypeType(JavaSymbol.TypeJavaSymbol symbol, TypeSubstitution typeSubstitution) { if (symbol.getType().isUnknown()) { return symbol.getType(); } if (typeCache.get(symbol) == null) { Map<TypeSubstitution, ParametrizedTypeJavaType> map = Maps.newHashMap(); typeCache.put(symbol, map); } TypeSubstitution newSubstitution = typeSubstitution; if (newSubstitution.size() == 0) { newSubstitution = symbol.identitySubstitution(); } if (typeCache.get(symbol).get(newSubstitution) == null) { typeCache.get(symbol).put(newSubstitution, new ParametrizedTypeJavaType(symbol, newSubstitution)); } return typeCache.get(symbol).get(newSubstitution); }

Target:
public JavaType getParametrizedTypeType(JavaSymbol.TypeJavaSymbol symbol, TypeSubstitution typeSubstitution) { if (symbol.getType().isUnknown()) { return symbol.getType(); } if (typeCache.get(symbol) == null) { Map<TypeSubstitution, ParametrizedTypeJavaType> map = Maps.newHashMap(); typeCache.put(symbol, map); } TypeSubstitution newSubstitution = typeSubstitution; if (newSubstitution.size() == 0) { newSubstitution = identitySubstitution(symbol.typeVariableTypes); } if (typeCache.get(symbol).get(newSubstitution) == null) { typeCache.get(symbol).put(newSubstitution, new ParametrizedTypeJavaType(symbol, newSubstitution)); } return typeCache.get(symbol).get(newSubstitution); }
Source:
public static void main(String[] args) { TemptoRunnerCommandLineParser parser = TemptoRunnerCommandLineParser .builder("presto product tests") .setTestsPackage("com.facebook.presto.tests.*", false) .setExcludedGroups("quarantine", true) .build(); TemptoRunner.runTempto(parser, args); }

Target:
public static void main(String[] args) { TemptoRunnerCommandLineParser parser = TemptoRunnerCommandLineParser.builder("Presto product tests") .setTestsPackage("com.facebook.presto.tests.*", false) .setExcludedGroups("quarantine", true) .build(); TemptoRunner.runTempto(parser, args); }
Source:
public DescriptorImpl getDescriptor() { Jenkins jenkins = Jenkins.getInstance(); if(jenkins != null){ return (DescriptorImpl)jenkins.getDescriptorOrDie(getClass()); } return null; }

Target:
public DescriptorImpl getDescriptor() { return (DescriptorImpl)Jenkins.getInstance().getDescriptorOrDie(getClass()); }
Source:
public void t(Object o1, Object o2) { if (!(o1 instanceof String STRING) && (o2 instanceof Integer INTEGER)) ArrayList<Integer> arrayList = new ArrayList<Integer>(); if (arrayList instanceof ArrayList<Integer> aXML) { System.out.println("Blah"); } boolean result = (o1 instanceof String a1) ? (o1 instanceof String aTXT) : (!(o1 instanceof String ssSTRING)); String formatted; if (o1 instanceof Integer XMLHTTP) formatted = String.format("int %d", XMLHTTP); else if (o1 instanceof Byte bYT) formatted = String.format("byte %d", bYT); else formatted = String.format("Something else "+ o1.toString()); }

Target:
public void t(Object o1, Object o2) { if (!(o1 instanceof String STRING) && (o2 instanceof Integer INTEGER)) ArrayList<Integer> arrayList = new ArrayList<Integer>(); if (arrayList instanceof ArrayList<Integer> aXML) { System.out.println("BlahBlah"); } boolean result = (o1 instanceof String a1) ? (o1 instanceof String aTXT) : (!(o1 instanceof String ssSTRING)); String formatted; if (o1 instanceof Integer XMLHTTP) formatted = String.format("int %d", XMLHTTP); else if (o1 instanceof Byte bYT) formatted = String.format("byte %d", bYT); else formatted = String.format("Something else "+ o1.toString()); }
Source:
private void add(SuiteResult suiteResultToAdd) { for (SuiteResult suiteResult : suites) { if(suiteResult.getName().equals(suiteResultToAdd.getName()) && nullSafeEq(suiteResult.getId(), suiteResultToAdd.getId())) { for (CaseResult caseResult: suiteResultToAdd.getCases()) { if (!suiteResult.caseAlreadyExists(caseResult)) { suiteResult.addCase(caseResult); caseResult.replaceParent(suiteResult); duration += caseResult.getDuration(); } } return; } } suites.add(suiteResultToAdd); duration += suiteResultToAdd.getDuration(); }

Target:
private void add(SuiteResult suiteResultToAdd) { for (SuiteResult suiteResult : suites) { if(suiteResult.getName().equals(suiteResultToAdd.getName()) && nullSafeEq(suiteResult.getId(), suiteResultToAdd.getId())) { for (CaseResult caseResult: suiteResultToAdd.getCases()) { if (suiteResult.addCase(caseResult)) { caseResult.replaceParent(suiteResult); duration += caseResult.getDuration(); } } return; } } suites.add(suiteResultToAdd); duration += suiteResultToAdd.getDuration(); }
Source:
private void validateArgs() { if (!SUPPORTED_REQUEST_TYPES.contains(requestType)) { throw new IllegalArgumentException("Unsupported request type: " + requestType); } else if (requestType.equals(POST)) { if (postBlobTotalSize == null || postBlobTotalSize <= 0 || postBlobChunkSize == null || postBlobChunkSize <= 0) { throw new IllegalArgumentException( "Total size to be posted and size of each chunk need to be specified with POST and have to be > 0"); } else if (targerAccountName == null || targetContainerName == null) { throw new IllegalArgumentException( "TargetAccountName and TargetContainerName need to be specified with POST"); } } }

Target:
private void validateArgs() { if (!SUPPORTED_REQUEST_TYPES.contains(requestType)) { throw new IllegalArgumentException("Unsupported request type: " + requestType); } else if (requestType.equals(POST)) { if (postBlobTotalSize == null || postBlobTotalSize <= 0 || postBlobChunkSize == null || postBlobChunkSize <= 0) { throw new IllegalArgumentException( "Total size to be posted and size of each chunk need to be specified with POST and have to be > 0"); } else if (targetAccountName == null || targetAccountName.isEmpty() || targetContainerName == null || targetContainerName.isEmpty()) { throw new IllegalArgumentException("TargetAccountName and TargetContainerName cannot be empty with POST"); } } if (serviceId == null || serviceId.isEmpty()) { throw new IllegalArgumentException("serviceId cannot be empty"); } }