auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void buildTopicTree(TopicNode topicNode, String[] paths) throws EventBrokerException { String[] children = paths; if (children != null) { List<TopicNode> nodes = new ArrayList<TopicNode>(); for (String childTopic : children) { <START> if (childTopic.endsWith("/")) { <END> childTopic = childTopic.substring(0, childTopic.length() - 2); } String nodeName = childTopic.substring(childTopic.lastIndexOf("/") + 1); if (!nodeName.equals(EventBrokerConstants.EB_CONF_WS_SUBSCRIPTION_COLLECTION_NAME) && !nodeName.equals(EventBrokerConstants.EB_CONF_JMS_SUBSCRIPTION_COLLECTION_NAME)) { childTopic = childTopic.substring(childTopic.indexOf(this.topicStoragePath) + this.topicStoragePath.length() + 1); TopicNode childNode = new TopicNode(nodeName, childTopic); childNode.setLeafNode(false); nodes.add(childNode); } } topicNode.setChildren(nodes.toArray(new TopicNode[nodes.size()])); } }</code><technical_language>I remember path separator defined in reg constants</technical_language>

Target:
private void buildTopicTree(TopicNode topicNode, String[] paths) throws EventBrokerException { String[] children = paths; if (children != null) { List<TopicNode> nodes = new ArrayList<TopicNode>(); for (String childTopic : children) { if (childTopic.endsWith(RegistryConstants.ROOT_PATH)) { childTopic = childTopic.substring(0, childTopic.length() - 2); } String nodeName = childTopic.substring(childTopic.lastIndexOf(RegistryConstants.ROOT_PATH) + 1); if (!nodeName.equals(EventBrokerConstants.EB_CONF_WS_SUBSCRIPTION_COLLECTION_NAME) && !nodeName.equals(EventBrokerConstants.EB_CONF_JMS_SUBSCRIPTION_COLLECTION_NAME)) { childTopic = childTopic.substring(childTopic.indexOf(this.topicStoragePath) + this.topicStoragePath.length() + 1); TopicNode childNode = new TopicNode(nodeName, childTopic); childNode.setLeafNode(false); nodes.add(childNode); } } topicNode.setChildren(nodes.toArray(new TopicNode[nodes.size()])); } }
Source:
<code>public void create() throws IOException { <START> assert indexMap.isEmpty(); <END> }</code><technical_language>I if aware, assertions "turned on" for testing. In production this a no-op. If consider this check mucho importante need do a real throw. Right I a hard time deciding "right thing". do think</technical_language>

Target:
public void create() throws IOException { if ( !indexMap.isEmpty() ) { throw new IOException( "Trying to create a new spatial populator when the index had already been created." ); } }
Source:
<code>public Mono<ServiceMessage> invokeOne( ServiceMessage message, BiFunction<ServiceMessage, Class<?>, ServiceMessage> dataDecoder) { <START> Supplier<Mono<ServiceMessage>> invoke = <END> () -> { Object request = toRequest(message, dataDecoder); return Mono.from(invoke(request)).map(this::toResponse); }; return Mono.defer(invoke) .onErrorResume(throwable -> Mono.just(errorMapper.toMessage(throwable))); }</code><technical_language>is more clean do it</technical_language>

Target:
public Mono<ServiceMessage> invokeOne( ServiceMessage message, BiFunction<ServiceMessage, Class<?>, ServiceMessage> dataDecoder) { return Mono.defer(() -> Mono.from(invoke(toRequest(message, dataDecoder)))) .map(this::toResponse) .onErrorResume(throwable -> Mono.just(errorMapper.toMessage(throwable))); }
Source:
<code>public void testPersistWithEmbeddedList() throws Exception { final Session session = openSession(); Transaction transaction = session.beginTransaction(); <START> User wombatSoftware = new User( "2", "Wombat Software 2" ); <END> wombatSoftware.setList( new EmbeddedList( "New List", Arrays.asList( "1", "2" ))); session.persist( wombatSoftware ); transaction.commit(); session.clear(); transaction = session.beginTransaction(); User loadedUser = (User) session.get( User.class, wombatSoftware.getId() ); assertThat( loadedUser ).as( "Cannot load persisted object with nested embeddedables" ).isNotNull(); assertThat( loadedUser.getList() ).isNotNull(); assertThat( loadedUser.getList().getName() ).isEqualTo( wombatSoftware.getList().getName() ); assertThat( loadedUser.getList().getList() ).containsOnly( "1", "2" ); session.delete( loadedUser ); transaction.commit(); session.clear(); transaction = session.beginTransaction(); assertThat( session.get( User.class, wombatSoftware.getId() ) ).isNull(); transaction.commit(); session.close(); }</code><technical_language>a test case missing? original issue is case embedded list is empty? is "2" btw.? some parts of original PR lost</technical_language>

Target:
public void testPersistWithEmbeddedList() throws Exception { final Session session = openSession(); Transaction transaction = session.beginTransaction(); List<String> alternativePhones = Arrays.asList( "+1-222-555-0222", "+1-202-555-0333" ); AccountWithPhone account = new AccountWithPhone( "2", "Mobile account 2" ); account.setPhoneNumber( new PhoneNumber( "+1-222-555-0111", alternativePhones ) ); session.persist( account ); transaction.commit(); session.clear(); transaction = session.beginTransaction(); AccountWithPhone loadedUser = (AccountWithPhone) session.get( AccountWithPhone.class, account.getId() ); assertThat( loadedUser ).as( "Cannot load persisted object with nested embeddedables" ).isNotNull(); assertThat( loadedUser.getPhoneNumber() ).isNotNull(); assertThat( loadedUser.getPhoneNumber().getMain() ).isEqualTo( account.getPhoneNumber().getMain() ); assertThat( loadedUser.getPhoneNumber().getAlternatives() ).containsOnly( alternativePhones.toArray( new Object[alternativePhones.size()] ) ); session.delete( loadedUser ); transaction.commit(); session.clear(); transaction = session.beginTransaction(); assertThat( session.get( AccountWithPhone.class, account.getId() ) ).isNull(); transaction.commit(); session.close(); }
Source:
<code>public void begin(RepositorySessionBeginDelegate delegate) throws InvalidSessionTransitionException { Cursor cur; try { Logger.debug(LOG_TAG, "Check and build special GUIDs."); dataAccessor.checkAndBuildSpecialGuids(); cur = dataAccessor.getGuidsIDsForFolders(); Logger.debug(LOG_TAG, "Got GUIDs for folders."); } catch (android.database.sqlite.SQLiteConstraintException e) { Logger.error(LOG_TAG, "Got sqlite constraint exception working with Fennec bookmark DB.", e); delegate.onBeginFailed(e); return; } catch (NullCursorException e) { delegate.onBeginFailed(e); return; } catch (Exception e) { delegate.onBeginFailed(e); return; } Logger.debug(LOG_TAG, "Preparing folder ID mappings."); Logger.debug(LOG_TAG, "Tracking places root as ID 0."); parentIDToGuidMap.put(0L, "places"); parentGuidToIDMap.put("places", 0L); try { cur.moveToFirst(); while (!cur.isAfterLast()) { String guid = getGUID(cur); long id = RepoUtils.getLongFromCursor(cur, BrowserContract.Bookmarks._ID); parentGuidToIDMap.put(guid, id); parentIDToGuidMap.put(id, guid); Logger.debug(LOG_TAG, "GUID " + guid + " maps to " + id); cur.moveToNext(); } } finally { cur.close(); } deletionManager = new BookmarksDeletionManager(dataAccessor, DEFAULT_DELETION_FLUSH_THRESHOLD); <START> Set<String> guidsKnownBeforeInsertions = new HashSet<String>(parentGuidToIDMap.keySet()); <END> insertionManager = new AndroidBrowserBookmarksInsertionManager(DEFAULT_INSERTION_FLUSH_THRESHOLD, guidsKnownBeforeInsertions); Logger.debug(LOG_TAG, "Done with initial setup of bookmarks session."); super.begin(delegate); }</code><technical_language>need allocate a new set here: BookmarksInsertionManager copies contents</technical_language>

Target:
public void begin(RepositorySessionBeginDelegate delegate) throws InvalidSessionTransitionException { Cursor cur; try { Logger.debug(LOG_TAG, "Check and build special GUIDs."); dataAccessor.checkAndBuildSpecialGuids(); cur = dataAccessor.getGuidsIDsForFolders(); Logger.debug(LOG_TAG, "Got GUIDs for folders."); } catch (android.database.sqlite.SQLiteConstraintException e) { Logger.error(LOG_TAG, "Got sqlite constraint exception working with Fennec bookmark DB.", e); delegate.onBeginFailed(e); return; } catch (NullCursorException e) { delegate.onBeginFailed(e); return; } catch (Exception e) { delegate.onBeginFailed(e); return; } Logger.debug(LOG_TAG, "Preparing folder ID mappings."); Logger.debug(LOG_TAG, "Tracking places root as ID 0."); parentIDToGuidMap.put(0L, "places"); parentGuidToIDMap.put("places", 0L); try { cur.moveToFirst(); while (!cur.isAfterLast()) { String guid = getGUID(cur); long id = RepoUtils.getLongFromCursor(cur, BrowserContract.Bookmarks._ID); parentGuidToIDMap.put(guid, id); parentIDToGuidMap.put(id, guid); Logger.debug(LOG_TAG, "GUID " + guid + " maps to " + id); cur.moveToNext(); } } finally { cur.close(); } deletionManager = new BookmarksDeletionManager(dataAccessor, DEFAULT_DELETION_FLUSH_THRESHOLD); insertionManager = new BookmarksInsertionManager(DEFAULT_INSERTION_FLUSH_THRESHOLD, parentGuidToIDMap.keySet(), this); Logger.debug(LOG_TAG, "Done with initial setup of bookmarks session."); super.begin(delegate); }
Source:
<code>private synchronized void deleteFailedCommand(Command command) { int indexOfCommand = mCommandList.indexOf(command); <START> mCommandList.remove(indexOfCommand); <END> mCommandCounter--; mCommandIndex--; if (mCommandCounter == 1) { UndoRedoManager.getInstance().update( UndoRedoManager.StatusMode.DISABLE_UNDO); } }</code><technical_language>suggestion: ((BaseCommand) mCommandList.remove(indexOfCommand)).freeResources();</technical_language>

Target:
private synchronized void deleteFailedCommand(Command command) { int indexOfCommand = mCommandList.indexOf(command); ((BaseCommand) mCommandList.remove(indexOfCommand)).freeResources(); mCommandCounter--; mCommandIndex--; if (mCommandCounter == 1) { UndoRedoManager.getInstance().update( UndoRedoManager.StatusMode.DISABLE_UNDO); } }
Source:
<code>public EventResult onImpulse(ImpulseEvent event, EntityRef entity) { float mass = entity.getComponent(BodyLinked.class).get().getMass(); <START> float damage = event.getMagnitude() / mass; <END> if (entity.hasComponent(Durability.class)) { entity.getComponent(Durability.class).get().getDurability(); } entitySystemManager.sendEvent(new DamageEvent((int) damage), entity); return EventResult.CONTINUE; }</code><technical_language>Division zero if mass is zero. want put a constraint + log in component</technical_language>

Target:
public EventResult onImpulse(ImpulseEvent event, EntityRef entity) { float mass = entity.getComponent(BodyLinked.class).get().getMass(); float damage = event.getMagnitude() / mass; if (entity.hasComponent(Durability.class)) { float durability = entity.getComponent(Durability.class).get().getDurability(); damage /= durability; } entitySystemManager.sendEvent(new DamageEvent(damage), entity); return EventResult.CONTINUE; }
Source:
<code>public void testProcessSingle() { Trace trace = new Trace(); trace.setId("btxnId"); trace.setBusinessTransaction("btxnName"); trace.setStartTime(100); Consumer c = new Consumer(); c.setUri("uri"); c.setBaseTime(1); c.setDuration(200000000); c.getProperties().add(new Property(Constants.PROP_FAULT, "myFault")); c.setEndpointType("HTTP"); trace.getNodes().add(c); FragmentCompletionTimeDeriver deriver = new FragmentCompletionTimeDeriver(); CompletionTime ct = null; try { ct = deriver.processOneToOne(null, trace); } catch (Exception e) { fail("Failed: " + e); } assertNotNull(ct); assertEquals(trace.getId(), ct.getId()); assertEquals(trace.getBusinessTransaction(), ct.getBusinessTransaction()); assertEquals(c.getEndpointType(), ct.getEndpointType()); assertFalse(ct.isInternal()); assertEquals(trace.getStartTime(), ct.getTimestamp()); assertEquals(c.getUri(), ct.getUri()); <START> assertEquals(200000000, ct.getDuration()); <END> assertEquals(c.getProperties(Constants.PROP_FAULT), ct.getProperties(Constants.PROP_FAULT)); }</code><technical_language>expect 200000 - possibly source data needs converting microseconds</technical_language>

Target:
public void testProcessSingle() { Trace trace = new Trace(); trace.setId("btxnId"); trace.setBusinessTransaction("btxnName"); trace.setStartTime(100000); Consumer c = new Consumer(); c.setUri("uri"); c.setBaseTime(1); c.setDuration(200000); c.getProperties().add(new Property(Constants.PROP_FAULT, "myFault")); c.setEndpointType("HTTP"); trace.getNodes().add(c); FragmentCompletionTimeDeriver deriver = new FragmentCompletionTimeDeriver(); CompletionTime ct = null; try { ct = deriver.processOneToOne(null, trace); } catch (Exception e) { fail("Failed: " + e); } assertNotNull(ct); assertEquals(trace.getId(), ct.getId()); assertEquals(trace.getBusinessTransaction(), ct.getBusinessTransaction()); assertEquals(c.getEndpointType(), ct.getEndpointType()); assertFalse(ct.isInternal()); assertEquals(trace.getStartTime(), ct.getTimestamp()); assertEquals(c.getUri(), ct.getUri()); assertEquals(200000, ct.getDuration()); assertEquals(c.getProperties(Constants.PROP_FAULT), ct.getProperties(Constants.PROP_FAULT)); }
Source:
<code>public void setRetentionTimeout(int retentionTimeout) { <START> if (retentionTimeout < DEFAULT_RETENTION_TIMEOUT_MINUTES) { this.retentionTimeout = DEFAULT_RETENTION_TIMEOUT_MINUTES; } else { this.retentionTimeout = retentionTimeout; } <END> }</code><technical_language>Math.max</technical_language>

Target:
public void setRetentionTimeout(int retentionTimeout) { this.retentionTimeout = Math.max(DEFAULT_RETENTION_TIMEOUT_MINUTES, retentionTimeout); }
Source:
<code>public Future<BlobInfo> getBlobInfo(String blobId) { FutureResult<BlobInfo> futureResult = new FutureResult<BlobInfo>(); OperationController oc = getOperationController(); if (oc == null) { completeOperation(futureResult, null, null, ROUTER_CLOSED_EXCEPTION); } else { oc.getBlobInfo(blobId, futureResult, null); } <START> return futureResult; <END> }</code><technical_language>reason do getBlobInfo(blobId, null) directly? completeOperation() handles null callbacks anyway. Similar question for similar functions</technical_language>

Target:
public Future<BlobInfo> getBlobInfo(String blobId) { return getBlobInfo(blobId, null); }
Source:
<code><START> void remove(DfsPackFile pack) { packCache.remove(pack.getPackDescription()); removeRef(pack.key); <END> }</code><technical_language>Removing blocks this pack a bad idea. system calls remove(DsfPackFile) a pretty good notion pack file is longer part of repository, memory sitting is useless. I bother this "optimization", cache eviction algorithm eventually kill blocks anyway, accessed. If is pressure cache evict (because at/under target size), is pressure spend CPU time evict this dead pack's blocks. cache "up to" target size of memory promised it, rest of system hands part of heap</technical_language>

Target:
void remove(DfsPackFile pack) { packCache.remove(pack.getPackDescription()); }
Source:
<code>public DatabaseInfo getDatabaseInfo() throws IOException { <START> LOG.info("Geting database information from database: " + mGlueDbName + "."); <END> try { GetDatabaseRequest dbRequest = new GetDatabaseRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withName(mGlueDbName); GetDatabaseResult dbResult = mGlueClient.getDatabase(dbRequest); Database glueDatabase = dbResult.getDatabase(); String glueDbLocation = glueDatabase.getLocationUri(); String glueDbDescription = glueDatabase.getDescription(); Map<String, String> glueParameters = new HashMap<>(); if (glueDatabase.getParameters() != null) { glueParameters = glueDatabase.getParameters(); } return new DatabaseInfo( glueDbLocation, mOwnerName, mOwnerType, glueDbDescription, glueParameters); } catch (EntityNotFoundException e) { throw new IOException("Cannot find glue database" + mGlueDbName + "." + e.getMessage(), e); } }</code><technical_language>this log message specific glue? error messages ideally unique in class</technical_language>

Target:
public DatabaseInfo getDatabaseInfo() throws IOException { try { GetDatabaseRequest dbRequest = new GetDatabaseRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withName(mGlueDbName); GetDatabaseResult dbResult = mGlueClient.getDatabase(dbRequest); Database glueDatabase = dbResult.getDatabase(); String glueDbLocation = glueDatabase.getLocationUri(); String glueDbDescription = glueDatabase.getDescription(); Map<String, String> glueParameters = new HashMap<>(); Map<String, String> parameters = glueDatabase.getParameters(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { glueParameters.put(parameter.getKey().toString(), parameter.getValue().toString()); } } return new DatabaseInfo( glueDbLocation, mOwnerName, mOwnerType, glueDbDescription, glueParameters); } catch (EntityNotFoundException e) { throw new IOException("Cannot find glue database: " + mGlueDbName + "Catalog ID: " + mGlueConfiguration.get(Property.CATALOG_ID) + ". " + e.getMessage(), e); } }
Source:
<code>private void segmentInsert(final int index, final SequenceSegment segment) { for (int height = 0; height < segment.getSources().size(); height++) { if (index + height < lanes.size()) { <START> lanes.set(index + height, segment.getUnifiedEnd()); <END> } else { lanes.add(index + height, segment.getUnifiedEnd()); } } }</code><technical_language>Double code, index + height, segment.getUnifiedEnd() a variable condition scope</technical_language>

Target:
private void segmentInsert(final int index, final SequenceSegment segment) { for (int height = 0; height < segment.getSources().size(); height++) { int position = index + height; if (position < lanes.size()) { lanes.set(position, segment.getUnifiedEnd()); } else { lanes.add(position, segment.getUnifiedEnd()); } } }
Source:
<code>private ResponseEntity<Object> listStudySubjects(String studyOid, String siteOid, HttpServletRequest request) throws Exception { ResponseEntity<Object> response = null; try { StudyBean study = null; try { study = this.getRestfulServiceHelper().setSchema(studyOid, request); study = participantService.validateRequestAndReturnStudy(studyOid, siteOid,request); } catch (OpenClinicaSystemException e) { String errorMsg = e.getErrorCode(); HashMap<String, String> map = new HashMap<>(); map.put("studyOid", studyOid); map.put("siteOid", siteOid); ParameterizedErrorVM responseDTO =new ParameterizedErrorVM(errorMsg, map); response = new ResponseEntity(responseDTO, HttpStatus.BAD_REQUEST); return response; } if(study != null) { ResponseSuccessListAllParticipantsByStudyDTO responseSuccess = new ResponseSuccessListAllParticipantsByStudyDTO(); ArrayList<StudyParticipantDTO> studyParticipantDTOs = getStudyParticipantDTOs(studyOid, siteOid,study); responseSuccess.setStudyParticipants(studyParticipantDTOs); responseSuccess.setSiteOID(siteOid); if (siteOid != null) { StudyBean site = this.getStudyDAO().findByOid(siteOid); responseSuccess.setSiteID(site.getId()); responseSuccess.setSiteName(site.getName()); <START> } else { <END> responseSuccess.setSiteID(0); responseSuccess.setSiteName(null); } response = new ResponseEntity(responseSuccess, org.springframework.http.HttpStatus.OK); } } catch (Exception eee) { eee.printStackTrace(); throw eee; } return response; }</code><technical_language>If siteOid is null, set values all. Leave nulls</technical_language>

Target:
private ResponseEntity<Object> listStudySubjects(String studyOid, String siteOid, HttpServletRequest request) throws Exception { ResponseEntity<Object> response = null; try { StudyBean study = null; try { study = this.getRestfulServiceHelper().setSchema(studyOid, request); study = participantService.validateRequestAndReturnStudy(studyOid, siteOid,request); } catch (OpenClinicaSystemException e) { String errorMsg = e.getErrorCode(); HashMap<String, String> map = new HashMap<>(); map.put("studyOid", studyOid); map.put("siteOid", siteOid); ParameterizedErrorVM responseDTO =new ParameterizedErrorVM(errorMsg, map); response = new ResponseEntity(responseDTO, HttpStatus.BAD_REQUEST); return response; } if(study != null) { ResponseSuccessListAllParticipantsByStudyDTO responseSuccess = new ResponseSuccessListAllParticipantsByStudyDTO(); ArrayList<StudyParticipantDTO> studyParticipantDTOs = getStudyParticipantDTOs(studyOid, siteOid,study); responseSuccess.setStudyParticipants(studyParticipantDTOs); responseSuccess.setSiteOID(siteOid); if (siteOid != null) { StudyBean site = this.getStudyDAO().findByOid(siteOid); responseSuccess.setSiteID(site.getId()); responseSuccess.setSiteName(site.getName()); } response = new ResponseEntity(responseSuccess, org.springframework.http.HttpStatus.OK); } } catch (Exception eee) { eee.printStackTrace(); throw eee; } return response; }
Source:
<code>public Frame clone() { Frame newFrame = new Frame(); newFrame.imageWidth = imageWidth; newFrame.imageHeight = imageHeight; newFrame.imageDepth = imageDepth; newFrame.imageChannels = imageChannels; newFrame.imageStride = imageStride; newFrame.keyFrame = keyFrame; newFrame.streamIndex = streamIndex; newFrame.opaque = new Pointer[3]; if (image != null) { newFrame.image = new Buffer[image.length]; ((Pointer[])newFrame.opaque)[0] = cloneBufferArray(image, newFrame.image); } newFrame.audioChannels = audioChannels; newFrame.sampleRate = sampleRate; if (samples != null) { newFrame.samples = new Buffer[samples.length]; ((Pointer[])newFrame.opaque)[1] = cloneBufferArray(samples, newFrame.samples); } if (data != null) { <START> newFrame.data = ByteBuffer.allocate(data.capacity()); <END> BytePointer pointer = new BytePointer(data.capacity()); newFrame.data = pointer.limit(pointer.position() + data.limit()) .asByteBuffer().put((ByteBuffer)data); pointer.position(pointer.limit()); data.rewind(); newFrame.data.rewind(); ((Pointer[])newFrame.opaque)[2] = pointer; } newFrame.timestamp = timestamp; return newFrame; }</code><technical_language>allocate a new ByfeBuffer that. cloneBufferArray() for consistency</technical_language>

Target:
public Frame clone() { Frame newFrame = new Frame(); newFrame.imageWidth = imageWidth; newFrame.imageHeight = imageHeight; newFrame.imageDepth = imageDepth; newFrame.imageChannels = imageChannels; newFrame.imageStride = imageStride; newFrame.keyFrame = keyFrame; newFrame.streamIndex = streamIndex; newFrame.opaque = new Pointer[3]; if (image != null) { newFrame.image = new Buffer[image.length]; ((Pointer[])newFrame.opaque)[0] = cloneBufferArray(image, newFrame.image); } newFrame.audioChannels = audioChannels; newFrame.sampleRate = sampleRate; if (samples != null) { newFrame.samples = new Buffer[samples.length]; ((Pointer[])newFrame.opaque)[1] = cloneBufferArray(samples, newFrame.samples); } if (data != null) { ByteBuffer[] dst = new ByteBuffer[1]; ((Pointer[])newFrame.opaque)[2] = cloneBufferArray(new ByteBuffer[]{data}, dst); newFrame.data = dst[0]; } newFrame.timestamp = timestamp; return newFrame; }
Source:
<code>public Optional<TokenCredentials> extract(WebContext context) { <START> final String header = context.getRequestHeader(this.headerName); <END> if (header == null) { return Optional.empty(); } if (!header.startsWith(this.prefixHeader)) { throw new CredentialsException("Wrong prefix for header: " + this.headerName); } final String headerWithoutPrefix = header.substring(this.prefixHeader.length()); return Optional.of(new TokenCredentials(headerWithoutPrefix)); }</code><technical_language>surprised getRequestHeader return optional :)</technical_language>

Target:
public Optional<TokenCredentials> extract(WebContext context) { final Optional<String> header = context.getRequestHeader(this.headerName); if (!header.isPresent()) { return Optional.empty(); } if (!header.get().startsWith(this.prefixHeader)) { throw new CredentialsException("Wrong prefix for header: " + this.headerName); } final String headerWithoutPrefix = header.get().substring(this.prefixHeader.length()); return Optional.of(new TokenCredentials(headerWithoutPrefix)); }
Source:
<code>public void testToJSONWithRawJSONData() throws IOException { long timestampMillis = 1496712943487L; Position position = new Position(new BinlogPosition(1L, "binlog-0001"), 0L); RowMap rowMap = new RowMap("insert", "MyDatabase", "MyTable", timestampMillis, null, position); rowMap.putData("id", "9001"); rowMap.putData("first_name", "foo"); rowMap.putData("middle_name", "buzz"); rowMap.putData("last_name", "bar"); rowMap.putData("salary", "4000"); rowMap.putData("department", "science"); <START> rowMap.putData("rawJSON", new RawJSONString("{\"database\":\"MyDatabase\",\"table\":\"User\",\"type\":\"insert\",\"ts\":1486439516,\"xid\":5694,\"commit\":true,\"data\":{\"UserID\":20,\"FirstName\":\"Fiz\",\"MiddleName\":null,\"LastName\":\"Buz\",\"Version\":1486703131000}}\n")); <END> MaxwellOutputConfig outputConfig = getMaxwellOutputConfig(); Assert.assertEquals("{\"database\":\"MyDatabase\",\"table\":\"MyTable\",\"type\":\"insert\",\"ts\":1496712943,\"position\":\"binlog-0001:1\",\"gtid\":null,\"data\":{\"id\":\"9001\",\"salary\":\"4000\",\"department\":\"science\",\"rawJSON\":{\"database\":\"MyDatabase\",\"table\":\"User\",\"type\":\"insert\",\"ts\":1486439516,\"xid\":5694,\"commit\":true,\"data\":{\"UserID\":20,\"FirstName\":\"Fiz\",\"MiddleName\":null,\"LastName\":\"Buz\",\"Version\":1486703131000}}\n" + "}}", rowMap.toJSON(outputConfig)); }</code><technical_language>this shorter - effectively string concat, right? pulled out a variable reused, too</technical_language>

Target:
public void testToJSONWithRawJSONData() throws IOException { RowMap rowMap = new RowMap("insert", "MyDatabase", "MyTable", TIMESTAMP_MILLISECONDS, new ArrayList<String>(), POSITION); rowMap.setServerId(7653213L); rowMap.setThreadId(6532312L); rowMap.putData("id", "9001"); rowMap.putData("first_name", "foo"); rowMap.putData("last_name", "bar"); rowMap.putData("rawJSON", new RawJSONString("{\"UserID\":20}")); MaxwellOutputConfig outputConfig = getMaxwellOutputConfig(); Assert.assertEquals("{\"database\":\"MyDatabase\",\"table\":\"MyTable\",\"type\":\"insert\"," + "\"ts\":1496712943,\"position\":\"binlog-0001:1\",\"gtid\":null,\"server_id\":7653213,\"thread_id\":6532312," + "\"data\":{\"id\":\"9001\",\"first_name\":\"foo\",\"last_name\":\"bar\",\"rawJSON\":{\"UserID\":20}}}", rowMap.toJSON(outputConfig)); }
Source:
<code>private void assertCounts(int totalConnectionsCount, int availableCount) { Assert.assertEquals(totalConnectionsCount, connectionTracker.getTotalConnectionsCount()); <START> Assert.assertEquals(availableCount, connectionTracker.getAvailableConnectionsCount()); <END> }</code><technical_language>messages here? "Total connections match", "Total connections match"</technical_language>

Target:
private void assertCounts(int totalConnectionsCount, int availableCount) { Assert.assertEquals("total connections should match", totalConnectionsCount, connectionTracker.getTotalConnectionsCount()); Assert.assertEquals("available connections should match", availableCount, connectionTracker.getAvailableConnectionsCount()); }
Source:
<code>public void testNaughtyClassFieldOfDescription() throws Exception { Description description = mock(Description.class); String className = "Illegal Class Name!"; when(description.getClassName()).thenReturn(className); Map<String, String> fakeSuites = mock(Map.class); when(fakeSuites.containsKey(anyString())).thenReturn(false); when(runListener.getSuites()).thenReturn(fakeSuites); ArgumentCaptor<Description> generatedDescription = ArgumentCaptor.forClass(Description.class); doNothing().when(runListener).testSuiteStarted(any(Description.class)); runListener.getSuiteUid(description); verify(runListener).testSuiteStarted(generatedDescription.capture()); <START> Assert.assertEquals(className, generatedDescription.getValue().getClassName()); <END> }</code><technical_language>please assertThat hamcrest instead</technical_language>

Target:
public void testNaughtyClassFieldOfDescription() throws Exception { Description description = mock(Description.class); String className = "Illegal Class Name!"; when(description.getClassName()).thenReturn(className); Map<String, String> fakeSuites = mock(Map.class); when(fakeSuites.containsKey(anyString())).thenReturn(false); when(runListener.getSuites()).thenReturn(fakeSuites); ArgumentCaptor<Description> generatedDescription = ArgumentCaptor.forClass(Description.class); doNothing().when(runListener).testSuiteStarted(any(Description.class)); runListener.getSuiteUid(description); verify(runListener).testSuiteStarted(generatedDescription.capture()); assertThat(generatedDescription.getValue().getClassName(), equalTo(className)); }
Source:
<code>public void claimTaskTest() { final TaskSummary task = TaskSummary.builder().id(TASK_ID).deploymentId(TASK_DEPLOYMENT_ID).status("Ready").build(); getPresenter().claimTask(task); <START> verify(taskService).claimTask("", <END> TASK_DEPLOYMENT_ID, TASK_ID); }</code><technical_language>check is executed in callback well</technical_language>

Target:
public void claimTaskTest() { final TaskSummary task = TaskSummary.builder().id(TASK_ID).deploymentId(TASK_DEPLOYMENT_ID).build(); getPresenter().claimTask(task); verify(taskService).claimTask("", TASK_DEPLOYMENT_ID, TASK_ID); verify(viewMock).displayNotification(any()); }
Source:
<code>public void setPriority(int priority) { int new_nice = <START> NICE_VALUES[priority - 1]; <END> Process.setThreadPriority(new_nice); }</code><technical_language>need check priority-1 is 0 NICE_VALUES.length - 1</technical_language>

Target:
public void setPriority(int priority) { if (priority < 1) { priority = 1; } else if (priority > 10) { priority = 10; } Process.setThreadPriority(NICE_VALUES[priority - 1]); }
Source:
<code><START> public Object getMsgHandlerInstance(ForkliftMessage msg) throws InvocationTargetException, IOException, InstantiationException, IllegalAccessException { <END> Object instance = this.constructMessageHandlerInstance(msg, new ArrayList<>()); inject(msg, instance); return instance; }</code><technical_language>Is this method public for internal testing, what</technical_language>

Target:
public Object getMsgHandlerInstance(ForkliftMessage msg) { Object instance = null; try { instance = this.constructMessageHandlerInstance(msg, new ArrayList<>()); inject(msg, instance); } catch (JsonMappingException | JsonParseException e) { log.warn("Unable to parse json for injection.", e); } catch (Exception e) { log.error("Error injecting data into Msg Handler", e); e.printStackTrace(); throw new RuntimeException("Error injecting data into Msg Handler Constructor"); } return instance; }
Source:
<code>private void printHeadlines( GenericMessageEvent event, String category ) { SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = null; try { feed = input.build( new XmlReader( newsFeedsByCategory.get( category ) ) ); } catch ( FeedException | IOException e ) { logger.error( e.getMessage() ); <START> logger.error( "Error opening RSS feed" ); <END> } List<SyndEntry> entries = feed.getEntries(); for ( int i = 0; i < NUM_HEADLINES; i++ ) { event.respondWith( entries.get( i ).getTitle() + " -> " + entries.get( i ).getLink() ); } }</code><technical_language>consider responding event this error message user receiving headlines</technical_language>

Target:
private void printHeadlines( GenericMessageEvent event, String category ) { SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = null; try { feed = input.build( new XmlReader( newsFeedsByCategory.get( category ) ) ); } catch ( FeedException | IOException e ) { String errorMsg = "Error opening RSS feed"; logger.error( e.getMessage() ); logger.error( errorMsg ); event.respondWith( errorMsg ); } List<SyndEntry> entries = feed.getEntries(); for ( int i = 0; i < NUM_HEADLINES; i++ ) { event.respondWith( entries.get( i ).getTitle() + " -> " + entries.get( i ).getLink() ); } }
Source:
<code>public void define(NewController context) { WebService.NewAction action = context.createAction(ACTION_DELETE) .setSince("6.6") <START> .setDescription("Delete a non-main branch of a project") <END> .setResponseExample(Resources.getResource(getClass(), "list-example.json")) .setInternal(true) .setPost(true) .setHandler(this); action .createParam(PARAM_PROJECT) .setDescription("Project key") .setExampleValue(KEY_PROJECT_EXAMPLE_001) .setRequired(true); action .createParam(PARAM_BRANCH) .setDescription("Name of the branch to delete. Can't be the main branch of the project.") .setExampleValue("branch1") .setRequired(true); }</code><technical_language>Please precise permission required : "Delete a non-main branch of a project.<br/>" + "Requires project administration permission"</technical_language>

Target:
public void define(NewController context) { WebService.NewAction action = context.createAction(ACTION_DELETE) .setSince("6.6") .setDescription("Delete a non-main branch of a project. Requires permission to administer the project.") .setResponseExample(Resources.getResource(getClass(), "list-example.json")) .setInternal(true) .setPost(true) .setHandler(this); action .createParam(PARAM_PROJECT) .setDescription("Project key") .setExampleValue(KEY_PROJECT_EXAMPLE_001) .setRequired(true); action .createParam(PARAM_BRANCH) .setDescription("Name of the branch to delete. Can't be the main branch of the project.") .setExampleValue("branch1") .setRequired(true); }
Source:
<code>public void cherryPick() throws Exception { PushOneCommit.Result r = pushTo("refs/for/master%topic=someTopic"); CherryPickInput in = new CherryPickInput(); in.destination = "foo"; in.message = "it goes to stable branch"; gApi.projects() .name(project.get()) .branch(in.destination) .create(new BranchInput()); ChangeApi orig = gApi.changes() .id("p~master~" + r.getChangeId()); assertThat((Iterable<?>)orig.get().messages).hasSize(1); ChangeApi cherry = orig.revision(r.getCommit().name()) .cherryPick(in); assertThat((Iterable<?>)orig.get().messages).hasSize(2); Iterator<ChangeMessageInfo> origIt = orig.get().messages.iterator(); origIt.next(); <START> assertThat(origIt.next().message) .startsWith("Patch Set 1: Cherry Picked\n\nThis patchset was cherry picked to branch foo as commit "); <END> assertThat(cherry.get().subject).contains(in.message); assertThat(cherry.get().topic).isEqualTo("someTopic"); cherry.current().review(ReviewInput.approve()); cherry.current().submit(); }</code><technical_language>This test check commit revision mentioned in message is expected</technical_language>

Target:
public void cherryPick() throws Exception { PushOneCommit.Result r = pushTo("refs/for/master%topic=someTopic"); CherryPickInput in = new CherryPickInput(); in.destination = "foo"; in.message = "it goes to stable branch"; gApi.projects() .name(project.get()) .branch(in.destination) .create(new BranchInput()); ChangeApi orig = gApi.changes() .id("p~master~" + r.getChangeId()); assertThat((Iterable<?>)orig.get().messages).hasSize(1); ChangeApi cherry = orig.revision(r.getCommit().name()) .cherryPick(in); assertThat((Iterable<?>)orig.get().messages).hasSize(2); String cherryPickedRevision = cherry.get().currentRevision; String expectedMessage = String.format( "Patch Set 1: Cherry Picked\n\n" + "This patchset was cherry picked to branch %s as commit %s", in.destination, cherryPickedRevision); Iterator<ChangeMessageInfo> origIt = orig.get().messages.iterator(); origIt.next(); assertThat(origIt.next().message).isEqualTo(expectedMessage); assertThat(cherry.get().subject).contains(in.message); assertThat(cherry.get().topic).isEqualTo("someTopic"); cherry.current().review(ReviewInput.approve()); cherry.current().submit(); }
Source:
<code>public void checkStoreSchema(ResourceSchema.ResourceFieldSchema schema) throws IOException { switch (schema.getType()) { case DataType.CHARARRAY: case DataType.INTEGER: case DataType.LONG: case DataType.FLOAT: case DataType.DOUBLE: <START> return; <END> } throw new IOException("Pig type '" + DataType.findTypeName(schema.getType()) + "' unsupported"); }</code><technical_language>support string "true" "false" conversion</technical_language>

Target:
public void checkStoreSchema(ResourceSchema.ResourceFieldSchema schema) throws IOException { switch (schema.getType()) { case DataType.CHARARRAY: case DataType.INTEGER: case DataType.LONG: case DataType.FLOAT: case DataType.DOUBLE: case DataType.BOOLEAN: return; } throw new IOException("Pig type '" + DataType.findTypeName(schema.getType()) + "' unsupported"); }
Source:
<code>public Map<String, String> devfileFileLocations() { <START> return singletonMap(null, devfileFileLocation); <END> }</code><technical_language>please explain this null? strange put null key in map afraid bite later</technical_language>

Target:
public List<DevfileLocation> devfileFileLocations() { return singletonList( new DevfileLocation() { @Override public Optional<String> filename() { return Optional.empty(); } @Override public String location() { return devfileFileLocation; } }); }
Source:
<code>public Component getFilter(final String componentId, FilterForm<?> form) { final IModel<OProperty> propertyModel = getCriteryModel(); UIVisualizersRegistry registry = OrienteerWebApplication.lookupApplication().getUIVisualizersRegistry(); <START> IVisualizer visualizer = registry.getComponentFactory(propertyModel.getObject().getType(), "default"); <END> IFilterStateLocator<IODataFilter<ODocument, String>> stateLocator = (IFilterStateLocator<IODataFilter<ODocument, String>>) form.getStateLocator(); IODataFilter<ODocument, String> filterState = stateLocator.getFilterState(); IModel<?> valueModel = filterState.getFilteredValueByProperty(propertyModel.getObject().getName()); return visualizer.createComponentForFiltering(componentId, propertyModel, valueModel); }</code><technical_language>default visualizer. Technically good: visualizer defined property if returning null for filter - get filter default visualizer</technical_language>

Target:
public Component getFilter(final String componentId, FilterForm<?> form) { IModel<OProperty> propertyModel = getCriteryModel(); OProperty property = propertyModel.getObject(); Component component = null; if (property != null) { IFilterStateLocator<IODataFilter<ODocument, String>> stateLocator = (IFilterStateLocator<IODataFilter<ODocument, String>>) form.getStateLocator(); IODataFilter<ODocument, String> filterState = stateLocator.getFilterState(); IModel<?> valueModel = filterState.getFilteredValueByProperty(propertyModel.getObject().getName()); component = getComponentForFiltering(componentId, propertyModel, valueModel); } return component; }
Source:
<code>public void executeCommand(Command command, ExecutionHandlerContext context) { byte[] channelName = command.getProcessedCommand().get(1); byte[] message = command.getProcessedCommand().get(2); <START> long publishCount = context.getPubSub().publish(new String(channelName), new String(message)); <END> writeResponse(command, context, publishCount); }</code><technical_language>a good point. realize context is overloaded right planning refactoring in future</technical_language>

Target:
public void executeCommand(Command command, ExecutionHandlerContext context) { List<byte[]> args = command.getProcessedCommand(); if (args.size() != 3) { command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.PUBLISH)); return; } String channelName = new String(args.get(1)); String message = new String(args.get(2)); long publishCount = context.getPubSub().publish(channelName, message); writeResponse(command, context, publishCount); }
Source:
<code>public boolean deployContainer(String deployConf) { String deploymentURI = String.format( <START> "%s/api/v1/namespaces/default/pods", <END> this.kubernetesURI); HttpURLConnection conn = NetworkUtils.getHttpConnection(deploymentURI); if (conn == null) { LOG.log(Level.SEVERE, "Failed to find k8s deployment API"); return false; } try { if (!NetworkUtils.sendHttpPostRequest(conn, NetworkUtils.JSON_TYPE, deployConf.getBytes())) { LOG.log(Level.SEVERE, "Failed to send post to k8s deployment api"); return false; } boolean success = NetworkUtils.checkHttpResponseCode(conn, HttpURLConnection.HTTP_CREATED); if (success) { LOG.log(Level.INFO, "Topology Deployment submitted to k8s deployment API successfully"); } else { LOG.log(Level.SEVERE, "Failed to submit Deployment to k8s"); byte[] bytes = NetworkUtils.readHttpResponse(conn); LOG.log(Level.INFO, Arrays.toString(bytes)); return false; } } finally { conn.disconnect(); } return true; }</code><technical_language>variants of this uri building repeated in this class. centralize this logic a shared method member? initialization of this class replace set kubernetesURI "[kubernetesURI]/api/v1/namespaces/default/pods" help</technical_language>

Target:
protected void deployContainer(String deployConf) throws IOException { HttpJsonClient jsonAPIClient = new HttpJsonClient(this.baseUriPath); try { jsonAPIClient.post(deployConf, HttpURLConnection.HTTP_CREATED); } catch (IOException ioe) { throw ioe; } }
Source:
<code>static List<FolderSelectedStateCommand> splitCommand(FolderSelectedStateCommand command, int lengthLimit) { List<FolderSelectedStateCommand> commands = new ArrayList<>(); <START> if (command.getIdSet() != null || command.getIdGroups() != null) { <END> command = optimizeGroupings(command); Set<Long> idSet = command.getIdSet(); List<ContiguousIdGroup> idGroups = command.getIdGroups(); while ((idSet != null && !idSet.isEmpty()) || (idGroups != null && !idGroups.isEmpty())) { Builder builder = command.newBuilder() .idSet(null) .idRanges(null); int length = builder.build().createCommandString().length(); while (length < lengthLimit) { if (idSet != null && !idSet.isEmpty()) { Long first = idSet.iterator().next(); length += (String.valueOf(first).length() + 1); if (length < lengthLimit) { builder.addId(first); idSet.remove(first); } else { break; } } else if (idGroups != null && !idGroups.isEmpty()) { ContiguousIdGroup first = command.idGroups.iterator().next(); length += (first.toString().length() + 1); if (length < lengthLimit) { builder.addIdGroup(first.getStart(), first.getEnd()); idGroups.remove(first); } else { break; } } else { break; } } commands.add(builder.build()); } } else { throw new IllegalStateException("The constructed command is too long but does not contain ids"); } return commands; }</code><technical_language>if invert this if throw, save indentation level for rest of method</technical_language>

Target:
static List<String> splitCommand(FolderSelectedStateCommand command, int lengthLimit) { if (command.getIdSet().isEmpty() && command.getIdGroups().isEmpty()) { throw new IllegalStateException("The constructed command is too long but does not contain ids"); } List<String> commands = new ArrayList<>(); Set<Long> idSet = new TreeSet<>(command.getIdSet()); List<ContiguousIdGroup> idGroups = new ArrayList<>(command.getIdGroups()); while (!idSet.isEmpty() || !idGroups.isEmpty()) { command.clearIds(); int length = command.createCommandString().length(); while (length < lengthLimit) { if (!idSet.isEmpty()) { Long first = idSet.iterator().next(); length += (String.valueOf(first).length() + 1); if (length < lengthLimit) { command.addId(first); idSet.remove(first); } else { break; } } else if (!idGroups.isEmpty()) { ContiguousIdGroup first = idGroups.iterator().next(); length += (first.toString().length() + 1); if (length < lengthLimit) { command.addIdGroup(first.getStart(), first.getEnd()); idGroups.remove(first); } else { break; } } else { break; } } commands.add(command.createCommandString()); } return commands; }
Source:
<code>protected void configure() { optionallyMapResourceParameterAsVolume(MY_CNF_CONFIG_OVERRIDE_PARAM_NAME, "/etc/mysql/conf.d", "mysql-default-conf"); addExposedPort(MYSQL_PORT); addEnv("MYSQL_DATABASE", databaseName); addEnv("MYSQL_USER", username); if(password != null && !password.isEmpty()){ addEnv("MYSQL_PASSWORD", password); addEnv("MYSQL_ROOT_PASSWORD", password); } else { <START> if("root".equalsIgnoreCase(username)){ <END> addEnv("MYSQL_ALLOW_EMPTY_PASSWORD", "yes"); } else { throw new RuntimeException("Empty password can be used only with the root user"); } } setStartupAttempts(3); }</code><technical_language>Please username object for method invocation</technical_language>

Target:
protected void configure() { optionallyMapResourceParameterAsVolume(MY_CNF_CONFIG_OVERRIDE_PARAM_NAME, "/etc/mysql/conf.d", "mysql-default-conf"); addExposedPort(MYSQL_PORT); addEnv("MYSQL_DATABASE", databaseName); addEnv("MYSQL_USER", username); if (password != null && !password.isEmpty()) { addEnv("MYSQL_PASSWORD", password); addEnv("MYSQL_ROOT_PASSWORD", password); } else if (MYSQL_ROOT_USER.equalsIgnoreCase(username)) { addEnv("MYSQL_ALLOW_EMPTY_PASSWORD", "yes"); } else { throw new ContainerLaunchException("Empty password can be used only with the root user"); } setStartupAttempts(3); }
Source:
<code>public HDFSFileOutputOperator() { setExpireStreamAfterAccessMillis(24 * 60 * 60 * 1000L); setMaxOpenFiles(1000); setRotationWindows(2 * 60 * 60 * 20); <START> } <END></code><technical_language>Assign values constant variable</technical_language>

Target:
public HDFSFileOutputOperator() { setExpireStreamAfterAccessMillis(STREAM_EXPIRY_ACCESS_MILL); setMaxOpenFiles(1000); setRotationWindows(ROTATION_WINDOWS); }
Source:
<code>public void updateShouldUpdateEmailMeStateToFalse() throws Exception { User user = new User("user-1"); user.enable(); user.setEmailMe(true); addUser(user); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); userService.save(user, TriState.UNSET, TriState.FALSE, null, null, result); assertThat(result.isSuccessful(), is(true)); assertThat(user.isEmailMe(), is(false)); <START> ; <END> }</code><technical_language>Remove this</technical_language>

Target:
public void updateShouldUpdateEmailMeStateToFalse() throws Exception { User user = new User("user-1"); user.enable(); user.setEmailMe(true); addUser(user); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); userService.save(user, TriState.UNSET, TriState.FALSE, null, null, result); assertThat(result.isSuccessful(), is(true)); assertThat(user.isEmailMe(), is(false)); }
Source:
<code>public static void setUp() { <START> MetricsTestUtility.initServiceProvider(); <END> testUtil = new MetricsTestUtility( SERVICE_PROVIDER.getInstance(MetricsManager.class).getRegistry()); metrics = SERVICE_PROVIDER.getInstance(CommonMetrics.class); }</code><technical_language>is alternative: CommonMetrics constructor takes instance of MetricRegistry. In production code, is constructed Guice. In test code, simply new instances need Guice</technical_language>

Target:
public void setUp() { final MetricRegistry metricRegistry = new MetricRegistry(); this.testUtil = new MetricsTestUtility(metricRegistry); this.metrics = new CommonMetrics(metricRegistry); }
Source:
<code>public BasicIssue createIssue(String projectKey, String description, String assignee, Iterable<String> components, String summary, @Nonnull Long issueTypeId, @Nullable Long priorityId) { IssueInputBuilder builder = new IssueInputBuilder(); builder.setProjectKey(projectKey) .setDescription(description) .setIssueTypeId(issueTypeId) .setSummary(summary); if (priorityId != null) { builder.setPriorityId(priorityId); } <START> if (!assignee.equals("")) { <END> builder.setFieldInput(new FieldInput(IssueFieldId.ASSIGNEE_FIELD, ComplexIssueInputFieldValue.with("id", assignee))); } if (Iterators.size(components.iterator()) > 0){ builder.setComponentsNames(components); } final IssueInput issueInput = builder.build(); try { return jiraRestClient.getIssueClient().createIssue(issueInput).get(timeout, TimeUnit.SECONDS); } catch (Exception e) { LOGGER.log(WARNING, "JIRA REST createIssue error: " + e.getMessage(), e); return null; } }</code><technical_language>please StringUtils.isBlank avoid NPE</technical_language>

Target:
public BasicIssue createIssue(String projectKey, String description, String assignee, Iterable<String> components, String summary, @Nonnull Long issueTypeId, @Nullable Long priorityId) { IssueInputBuilder builder = new IssueInputBuilder(); builder.setProjectKey(projectKey) .setDescription(description) .setIssueTypeId(issueTypeId) .setSummary(summary); if (priorityId != null) { builder.setPriorityId(priorityId); } if (StringUtils.isNotBlank(assignee)) { builder.setFieldInput(new FieldInput(IssueFieldId.ASSIGNEE_FIELD, ComplexIssueInputFieldValue.with("accountId", assignee))); } if (Iterators.size(components.iterator()) > 0){ builder.setComponentsNames(components); } final IssueInput issueInput = builder.build(); try { return jiraRestClient.getIssueClient().createIssue(issueInput).get(timeout, TimeUnit.SECONDS); } catch (Exception e) { LOGGER.log(WARNING, "JIRA REST createIssue error: " + e.getMessage(), e); return null; } }