auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void moveWater() { if (this.sourceBlock != null) { if (this.sourceBlock.getWorld().equals(this.player.getWorld())) { this.targetDestination = getTargetLocation(this.player, this.range); if (this.targetDestination.distanceSquared(this.location) <= 1) { this.progressing = false; this.targetDestination = null; this.remove(); return; } else { this.progressing = true; this.settingUp = true; this.firstDestination = this.getToEyeLevel(); this.firstDirection = GeneralMethods.getDirection(this.sourceBlock.getLocation(), this.firstDestination).normalize(); this.targetDestination = GeneralMethods.getPointOnLine(this.firstDestination, this.targetDestination, this.range); this.targetDirection = GeneralMethods.getDirection(this.firstDestination, this.targetDestination).normalize(); if (isPlant(this.sourceBlock) || isSnow(this.sourceBlock)) { new PlantRegrowth(this.player, this.sourceBlock); } else if (!isIce(this.sourceBlock)) { addWater(this.sourceBlock); } } } this.bPlayer.addCooldown(this); } }

Target:
public void moveWater() { if (this.sourceBlock != null) { if (this.sourceBlock.getWorld().equals(this.player.getWorld())) { this.targetDestination = getTargetLocation(this.player, this.range); if (this.targetDestination.distanceSquared(this.location) <= 1) { this.progressing = false; this.targetDestination = null; this.remove(); return; } else { this.progressing = true; this.settingUp = true; this.firstDestination = this.getToEyeLevel(); this.firstDirection = GeneralMethods.getDirection(this.sourceBlock.getLocation(), this.firstDestination).normalize(); this.targetDestination = GeneralMethods.getPointOnLine(this.firstDestination, this.targetDestination, this.range); this.targetDirection = GeneralMethods.getDirection(this.firstDestination, this.targetDestination).normalize(); if (isPlant(this.sourceBlock) || isSnow(this.sourceBlock)) { new PlantRegrowth(this.player, this.sourceBlock); this.sourceBlock.setType(Material.AIR); } else if (!isIce(this.sourceBlock)) { addWater(this.sourceBlock); } } } this.bPlayer.addCooldown(this); } }
Source:
public void initialise( Properties userProps ) { final VersioningState vState = session.getState( VersioningState.class ); restURL = userProps.getProperty( "restURL" ); String repositoryGroup = userProps.getProperty( "restRepositoryGroup", "" ); int restMaxSize = Integer.parseInt( userProps.getProperty( "restMaxSize", "-1" ) ); int restMinSize = Integer.parseInt( userProps.getProperty( "restMinSize", String.valueOf( DefaultTranslator.CHUNK_SPLIT_COUNT ) ) ); restSuffixAlign = Boolean.parseBoolean( userProps.getProperty( "restSuffixAlign", "true" ) ); restEndpoint = new DefaultTranslator( restURL, restMaxSize, restMinSize, repositoryGroup, vState.getIncrementalSerialSuffix(), session.getHeaders() ); }

Target:
public void initialise( Properties userProps ) { final VersioningState vState = session.getState( VersioningState.class ); restURL = userProps.getProperty( "restURL" ); String repositoryGroup = userProps.getProperty( "restRepositoryGroup", "" ); int restMaxSize = Integer.parseInt( userProps.getProperty( "restMaxSize", "-1" ) ); int restMinSize = Integer.parseInt( userProps.getProperty( "restMinSize", String.valueOf( DefaultTranslator.CHUNK_SPLIT_COUNT ) ) ); restSuffixAlign = Boolean.parseBoolean( userProps.getProperty( "restSuffixAlign", "true" ) ); String restHeadersProperty = userProps.getProperty( "restHeaders", "" ); if ( !StringUtils.isEmpty( restHeadersProperty ) ) { restHeaders = Arrays.stream( restHeadersProperty.split( "," ) ) .map( h -> h.split( ":", 2 ) ) .filter( h -> h.length > 0 && StringUtils.isNotEmpty( h[0] ) ) .collect( Collectors.toMap( h -> h[0], h -> h.length > 1 ? h[1] : "", ( x, y ) -> y, LinkedHashMap::new ) ); } restEndpoint = new DefaultTranslator( restURL, restMaxSize, restMinSize, repositoryGroup, vState.getIncrementalSerialSuffix(), restHeaders ); }
Source:
private void writeTarget() throws TransferException { OutputStream out = null; if ( response != null ) { InputStream in = null; try { final HttpEntity entity = response.getEntity(); Header[] headers = response.getHeaders( "Content-Length" ); Collection<Integer> successStatuses = Collections.singleton( HttpStatus.SC_OK ); if ( headers[0] !=null && !headers[0].getValue().equals( "" )) { long contentLength = Long.parseLong( headers[0].getValue().toString() ); long targetLength = target.length(); if ( contentLength != targetLength && successStatuses.contains( response.getStatusLine().getStatusCode() ) ) { target.delete(); throw new TransferContentException( target.getResource(), "Target: %s's Content-Length mismatch (expected: %s, got: %s)", target.getFullPath(), contentLength, targetLength ); } } in = entity.getContent(); out = target.openOutputStream( TransferOperation.DOWNLOAD, true, eventMetadata, deleteFilesOnPath ); copy( in, out ); logger.info( "Ensuring all HTTP data is consumed..." ); EntityUtils.consume( entity ); logger.info( "All HTTP data was consumed." ); } catch ( final IOException e ) { throw new TransferException( "Failed to write to local proxy store: {}\nOriginal URL: {}. Reason: {}", e, target, url, e.getMessage() ); } finally { closeQuietly( in ); logger.info( "Closing output stream: {}", out ); closeQuietly( out ); } } }

Target:
private void writeTarget() throws TransferException { OutputStream out = null; if ( response != null ) { InputStream in = null; try { final HttpEntity entity = response.getEntity(); in = entity.getContent(); out = target.openOutputStream( TransferOperation.DOWNLOAD, true, eventMetadata, deleteFilesOnPath ); copy( in, out ); logger.info( "Ensuring all HTTP data is consumed..." ); EntityUtils.consume( entity ); logger.info( "All HTTP data was consumed." ); closeQuietly( in ); closeQuietly( out ); long contentLength = transferSizes.get( target ); if ( contentLength > 0 ) { if ( contentLength != target.length() ) { target.delete(); throw new TransferContentException( target.getResource(), "Target: %s's Content-Length mismatch (expected: %s, got: %s)", target.getFullPath(), contentLength, target.length() ); } } } catch ( final IOException e ) { throw new TransferException( "Failed to write to local proxy store: {}\nOriginal URL: {}. Reason: {}", e, target, url, e.getMessage() ); } finally { closeQuietly( in ); logger.info( "Closing output stream: {}", out ); closeQuietly( out ); } } }
Source:
private void checkCompletionContent(final Table completionProposalList) { new DisplayHelper() { @Override protected boolean condition() { return completionProposalList.getItemCount() == 1; } }.waitForCondition(completionProposalList.getDisplay(), 200); final TableItem computingItem = completionProposalList.getItem(0); assertTrue("Missing computing info entry", computingItem.getText().contains("Computing")); assertEquals(1, completionProposalList.getItemCount()); final TableItem quickAssistItem = completionProposalList.getItem(0); assertTrue("Missing quick assist proposal", quickAssistItem.getText().contains("fixme")); }

Target:
private void checkCompletionContent(final Table completionProposalList) { assertTrue("No item found", new DisplayHelper() { @Override protected boolean condition() { return completionProposalList.getItemCount() == 1; } }.waitForCondition(completionProposalList.getDisplay(), 100)); assertEquals(1, completionProposalList.getItemCount()); final TableItem quickAssistItem = completionProposalList.getItem(0); assertTrue("Missing quick assist proposal", quickAssistItem.getText().contains("fixme")); }
Source:
private DownloadError convertError(FilePersistenceResult status) { switch (status) { case ERROR_UNKNOWN_TOTAL_FILE_SIZE: return DownloadErrorFactory.createTotalSizeRequestFailedError(downloadFileId, url); case ERROR_INSUFFICIENT_SPACE: return DownloadErrorFactory.createInsufficientFreeSpaceError(downloadFileStatus); case ERROR_EXTERNAL_STORAGE_NON_WRITABLE: return DownloadErrorFactory.createStorageNotAvailableError(filePersistence); case ERROR_OPENING_FILE: return DownloadErrorFactory.createCannotWriteToFileError(downloadFileStatus); default: Logger.e("Status " + status + " missing to be processed"); break; } return DownloadErrorFactory.createUnknownError(); }

Target:
private DownloadError convertError(FilePersistenceResult status) { switch (status) { case ERROR_UNKNOWN_TOTAL_FILE_SIZE: return DownloadErrorFactory.createTotalSizeRequestFailedError(downloadFileId, url); case ERROR_INSUFFICIENT_SPACE: return DownloadErrorFactory.createInsufficientFreeSpaceError(downloadFileStatus); case ERROR_EXTERNAL_STORAGE_NON_WRITABLE: return DownloadErrorFactory.createStorageNotAvailableError(filePersistence); case ERROR_OPENING_FILE: return DownloadErrorFactory.createCannotWriteToFileError(downloadFileStatus); default: Logger.e("Status " + status + " missing to be processed"); return DownloadErrorFactory.createUnknownErrorFor(status); } }
Source:
public MachineSet claim(int count, ReusableMachineTemplate t) { init(); synchronized (this) { MachineSet mm = ensureUnclaimed(count, t); Set<NodeMetadata> claiming = new LinkedHashSet<NodeMetadata>(); Iterator<NodeMetadata> mmi = mm.iterator(); for (int i=0; i<count; i++) claiming.add(mmi.next()); MachineSet result = new MachineSet(claiming); claimedMachines = claimedMachines.added(result); return result; } }

Target:
public MachineSet claim(int count, ReusableMachineTemplate t) { init(); Set<NodeMetadata> claiming = new LinkedHashSet<NodeMetadata>(); while (claiming.size() < count) { MachineSet mm = ensureUnclaimed(count - claiming.size(), t); for (NodeMetadata m : mm) { synchronized (this) { if (!claimedMachines.contains(m)) { claiming.add(m); claimedMachines = claimedMachines.added(new MachineSet(m)); } } } } MachineSet result = new MachineSet(claiming); return result; }
Source:
public void openDrawer(Side side) { if (side==Side.RIGHT) { rightDrawer.openDrawer(Gravity.END); } else if (side==Side.LEFT&&leftDrawer!=null) { if (isDrawerVisible(Side.RIGHT)) closeDrawer(Side.RIGHT); leftDrawer.openDrawer(Gravity.START); } openDrawer = side; }

Target:
public void openDrawer(Side side) { if (side==Side.RIGHT) { rightDrawer.openDrawer(Gravity.END); } else if (side==Side.LEFT&&leftDrawer!=null) { if (rightDrawer.isDrawerVisible(Gravity.END)) rightDrawer.closeDrawers(); leftDrawer.openDrawer(Gravity.START); } }
Source:
public Cursor getImageAuthenticationCursor(final String imageUrl) { String downloadUrl = DatabaseUtils.sqlEscapeString(imageUrl); final String query = "" + "SELECT " + KEY_USERNAME + "," + KEY_PASSWORD + " FROM " + TABLE_NAME_FEED_ITEMS + " INNER JOIN " + TABLE_NAME_FEEDS + " ON " + TABLE_NAME_FEED_ITEMS + "." + KEY_FEED + " = " + TABLE_NAME_FEEDS + "." + KEY_ID + " WHERE " + TABLE_NAME_FEED_ITEMS + "." + KEY_IMAGE_URL + "=" + downloadUrl; return db.rawQuery(query, null); }

Target:
public Cursor getImageAuthenticationCursor(final String imageUrl) { String downloadUrl = DatabaseUtils.sqlEscapeString(imageUrl); final String query = "" + "SELECT " + KEY_USERNAME + "," + KEY_PASSWORD + " FROM " + TABLE_NAME_FEED_ITEMS + " INNER JOIN " + TABLE_NAME_FEEDS + " ON " + TABLE_NAME_FEED_ITEMS + "." + KEY_FEED + " = " + TABLE_NAME_FEEDS + "." + KEY_ID + " WHERE " + TABLE_NAME_FEED_ITEMS + "." + KEY_IMAGE_URL + "=" + downloadUrl + " UNION SELECT " + KEY_USERNAME + "," + KEY_PASSWORD + " FROM " + TABLE_NAME_FEEDS + " WHERE " + TABLE_NAME_FEEDS + "." + KEY_IMAGE_URL + "=" + downloadUrl; return db.rawQuery(query, null); }
Source:
public void testSetscopedInstance_nonRoot() throws InterruptedException { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); app.getTomcat().getComponent().installerName( Constants.TARGET_INSTALLER ); Assert.assertNull( processor.scopedInstance ); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcat())); Assert.assertEquals( app.getTomcat(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( "Expected a message for Tomcat and the WAR.", 1, this.client.messagesForAgents.size()); }

Target:
public void testSetscopedInstance_nonRoot() { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); app.getTomcat().getComponent().installerName( Constants.TARGET_INSTALLER ); Assert.assertNull( processor.scopedInstance ); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcat())); Assert.assertEquals( app.getTomcat(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( "Expected a message for Tomcat and the WAR.", 1, this.client.messagesForAgents.size()); }
Source:
public void testTypeTypo() { Map<String, Object> greaterMap = ImmutableMap.<String, Object>of( "type", "greaterThn", "aggregation", "agg", "value", 1.3 ); ObjectMapper mapper = new DefaultObjectMapper(); HavingSpec spec = mapper.convertValue (greaterMap, HavingSpec.class); }

Target:
public void testTypeTypo() { Map<String, Object> greaterMap = ImmutableMap.<String, Object>of( "type", "nonExistingType", "aggregation", "agg", "value", 1.3 ); ObjectMapper mapper = new DefaultObjectMapper(); HavingSpec spec = mapper.convertValue (greaterMap, HavingSpec.class); }
Source:
public String getAttributeValue(String property) { switch (property) { case UserStoreConfigConstants.groupIDAttribute: return getUniqueGroupID(); case UserStoreConfigConstants.groupCreatedDateAttribute: case UserStoreConfigConstants.groupModifiedDateAttribute: Date createdTime = Calendar.getInstance().getTime(); return createdTime.toString(); default: return null; } }

Target:
public static String getAttributeValue(String property) { switch (property) { case UserStoreConfigConstants.GROUP_ID_ATTRIBUTE: return getUniqueGroupID(); case UserStoreConfigConstants.GROUP_CREATED_DATE_ATTRIBUTE: case UserStoreConfigConstants.GROUP_MODIFIED_DATE_ATTRIBUTE: Date createdTime = Calendar.getInstance().getTime(); return createdTime.toString(); default: return null; } }
Source:
private static String ssh(String keystore, String password, String alias) { String bReturn = null; FileInputStream input = null; try { KeyStore ks = KeyStore.getInstance("jks"); input = new FileInputStream(keystore); ks.load(input, password.toCharArray()); Key key = ks.getKey(alias, password.toCharArray()); if (key instanceof PrivateKey) { Certificate cert = ks.getCertificate(alias); key = cert.getPublicKey(); } RSAPublicKey publicKey = (RSAPublicKey) key; byte[] exponentBytes = publicKey.getPublicExponent().toByteArray(); byte[] modulusBytes = publicKey.getModulus().toByteArray(); ByteArrayOutputStream binaryOut = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(binaryOut); dataOut.write(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x73, (byte) 0x73, (byte) 0x68, (byte) 0x2D, (byte) 0x72, (byte) 0x73, (byte) 0x61, }); int exponentLength = exponentBytes.length; boolean exponentPad = (exponentBytes[0] & 0x80) != 0; if (exponentPad) { exponentLength++; } dataOut.writeInt(exponentLength); if (exponentPad) { dataOut.write(0); } dataOut.write(exponentBytes); int modulusLength = modulusBytes.length; boolean modulusPad = (modulusBytes[0] & 0x80) != 0; if (modulusPad) { modulusLength++; } dataOut.writeInt(modulusLength); if (modulusPad) { dataOut.write(0); } dataOut.write(modulusBytes); binaryOut.close(); byte[] resultBytes = binaryOut.toByteArray(); Base64 encoder = new Base64(0); String encoding = encoder.encodeToString(resultBytes); bReturn = "ssh-rsa " + encoding + " " + alias; } catch (Exception e) { e.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } return bReturn; }

Target:
private static String ssh(String keystore, String password, String alias) { String bReturn = null; FileInputStream input = null; try { KeyStore ks = KeyStore.getInstance("jks"); input = new FileInputStream(keystore); ks.load(input, password.toCharArray()); Key key = ks.getKey(alias, password.toCharArray()); if (key instanceof PrivateKey) { Certificate cert = ks.getCertificate(alias); key = cert.getPublicKey(); } return OpenSSHUtils.getKeyString((PublicKey) key, alias); } catch (Exception e) { e.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } return bReturn; }
Source:
public JSONObject printPoolBarcodes(HttpSession session, JSONObject json) { return ControllerHelperServiceUtils.printBarcodes(securityManager, printManager, json, new BarcodePrintAssister<Pool>() { @Override public Pool fetch(long id) throws IOException { return requestManager.getPoolById(id); } @Override public void store(Pool item, User user) throws IOException { item.setLastModifier(user); requestManager.savePool(item); } @Override public String groupName() { return "pools"; } @Override public String idName() { return "poolId"; } @Override public Iterable<Pool> fetchAll(long projectId) throws IOException { return Collections.emptyList(); } }); }

Target:
public JSONObject printPoolBarcodes(HttpSession session, JSONObject json) { return ControllerHelperServiceUtils.printBarcodes(printerService, json, new BarcodePrintAssister<Pool>() { @Override public Pool fetch(long id) throws IOException { return requestManager.getPoolById(id); } @Override public void store(Pool item) throws IOException { requestManager.savePool(item); } @Override public String getGroupName() { return "pools"; } @Override public String getIdName() { return "poolId"; } @Override public Iterable<Pool> fetchAll(long projectId) throws IOException { return Collections.emptyList(); } }); }
Source:
public static void rename(final File src, final File dst) throws IOException { int attempts = FS.DETECTED.retryFailedLockFileCommit() ? 10 : 1; while (--attempts >= 0) { if (src.renameTo(dst)) return; try { if (dst.isDirectory()) delete(dst, EMPTY_DIRECTORIES_ONLY | RECURSIVE); else delete(dst, 0); if (src.renameTo(dst)) return; } catch (IOException e) { } try { Thread.sleep(100); } catch (InterruptedException e) { throw new IOException(MessageFormat.format( JGitText.get().renameFileFailed, src.getAbsolutePath(), dst.getAbsolutePath())); } } throw new IOException(MessageFormat.format( JGitText.get().renameFileFailed, src.getAbsolutePath(), dst.getAbsolutePath())); }

Target:
public static void rename(final File src, final File dst) throws IOException { int attempts = FS.DETECTED.retryFailedLockFileCommit() ? 10 : 1; while (--attempts >= 0) { if (src.renameTo(dst)) return; try { if (!dst.delete()) delete(dst, EMPTY_DIRECTORIES_ONLY | RECURSIVE); if (src.renameTo(dst)) return; } catch (IOException e) { } try { Thread.sleep(100); } catch (InterruptedException e) { throw new IOException(MessageFormat.format( JGitText.get().renameFileFailed, src.getAbsolutePath(), dst.getAbsolutePath())); } } throw new IOException(MessageFormat.format( JGitText.get().renameFileFailed, src.getAbsolutePath(), dst.getAbsolutePath())); }
Source:
public boolean hasTitleArt() { return hasTitleArt; }

Target:
public Boolean hasTitleArt() { return hasTitleArt; }
Source:
public void syncCloudIdentites(Stack stack, UmsUsersState umsUsersState, BiConsumer<String, String> warnings) { if (CloudPlatform.AZURE.equalsIgnoreCase(stack.getCloudPlatform())) { syncAzureObjectIds(stack, umsUsersState, warnings); } }

Target:
public void syncCloudIdentites(Stack stack, UmsUsersState umsUsersState, BiConsumer<String, String> warnings) { LOGGER.info("Syncing cloud identities for stack = {}", stack); if (CloudPlatform.AZURE.equalsIgnoreCase(stack.getCloudPlatform())) { LOGGER.info("Syncing Azure Object IDs for stack = {}", stack); syncAzureObjectIds(stack, umsUsersState, warnings); } }
Source:
public void testDeleteMaxMutationSize() throws SQLException { String tableName = generateUniqueName(); int NUMBER_OF_ROWS = 20; String ddl = "CREATE TABLE " + tableName + " (V BIGINT PRIMARY KEY, K BIGINT)"; PhoenixConnection conn = (PhoenixConnection) DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); for(int i = 0; i < NUMBER_OF_ROWS; i++) { conn.createStatement().execute( "UPSERT INTO " + tableName + " VALUES (" + i + ", "+ i + ")"); conn.commit(); } Properties props = new Properties(); props.setProperty(QueryServices.MAX_MUTATION_SIZE_ATTRIB, String.valueOf(NUMBER_OF_ROWS / 2)); PhoenixConnection connection = (PhoenixConnection) DriverManager.getConnection(getUrl(), props); connection.setAutoCommit(false); try { for(int i = 0; i < NUMBER_OF_ROWS; i++) { connection.createStatement().execute( "DELETE FROM " + tableName + " WHERE K = " + i ); } } catch (SQLException e) { assertTrue(e.getMessage().contains( SQLExceptionCode.MAX_MUTATION_SIZE_EXCEEDED.getMessage())); } props = new Properties(); props.setProperty(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB, "10"); connection = (PhoenixConnection) DriverManager.getConnection(getUrl(), props); connection.setAutoCommit(false); try { for(int i = 0; i < NUMBER_OF_ROWS; i++) { connection.createStatement().execute( "DELETE FROM " + tableName + " WHERE K = " + i ); } } catch (SQLException e) { assertTrue(e.getMessage().contains( SQLExceptionCode.MAX_MUTATION_SIZE_BYTES_EXCEEDED.getMessage())); } }

Target:
public void testDeleteMaxMutationSize() throws SQLException { String tableName = generateUniqueName(); int NUMBER_OF_ROWS = 20; String ddl = "CREATE TABLE " + tableName + " (V BIGINT PRIMARY KEY, K BIGINT)"; PhoenixConnection conn = (PhoenixConnection) DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); for(int i = 0; i < NUMBER_OF_ROWS; i++) { conn.createStatement().execute( "UPSERT INTO " + tableName + " VALUES (" + i + ", "+ i + ")"); conn.commit(); } Properties props = new Properties(); props.setProperty(QueryServices.MAX_MUTATION_SIZE_ATTRIB, String.valueOf(NUMBER_OF_ROWS / 2)); PhoenixConnection connection = (PhoenixConnection) DriverManager.getConnection(getUrl(), props); connection.setAutoCommit(false); try { for(int i = 0; i < NUMBER_OF_ROWS; i++) { connection.createStatement().execute( "DELETE FROM " + tableName + " WHERE K = " + i ); } } catch (SQLException e) { assertTrue(e.getMessage().contains( SQLExceptionCode.MAX_MUTATION_SIZE_EXCEEDED.getMessage())); } props.setProperty(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB, "10"); props.setProperty(QueryServices.MAX_MUTATION_SIZE_ATTRIB, "10000"); connection = (PhoenixConnection) DriverManager.getConnection(getUrl(), props); connection.setAutoCommit(false); try { connection.createStatement().execute("DELETE FROM " + tableName ); } catch (SQLException e) { assertTrue(e.getMessage().contains( SQLExceptionCode.MAX_MUTATION_SIZE_BYTES_EXCEEDED.getMessage())); } }
Source:
void moreHitPointsThanHits() { final List<Unit> targetUnits = List.of(givenAnyUnit(), givenAnyUnit()); targetUnits.forEach( unit -> { final UnitAttachment unitAttachment = (UnitAttachment) unit.getType().getAttachment(UNIT_ATTACHMENT_NAME); when(unitAttachment.getHitPoints()).thenReturn(2); }); final FiringGroup firingGroup = new FiringGroup("", "", List.of(), targetUnits); final FireRoundState fireRoundState = new FireRoundState(); fireRoundState.setDice(givenDiceRollWithHits(3)); final SelectCasualties selectCasualties = new SelectCasualties( battleState, BattleState.Side.OFFENSE, firingGroup, fireRoundState, (arg1, arg2) -> new CasualtyDetails()); final SelectMainBattleCasualties.Select selectFunction = mock(SelectMainBattleCasualties.Select.class); final CasualtyDetails expected = new CasualtyDetails(); when(selectFunction.apply(any(), any(), anyCollection(), anyInt())).thenReturn(expected); final CasualtyDetails details = new SelectMainBattleCasualties(selectFunction).apply(delegateBridge, selectCasualties); assertThat(details, is(expected)); verify(selectFunction) .apply( eq(delegateBridge), eq(selectCasualties), (Collection<Unit>) argThat(containsInAnyOrder(targetUnits.toArray())), eq(3)); }

Target:
void moreHitPointsThanHits() { final List<Unit> targetUnits = List.of(givenAnyUnit(), givenAnyUnit()); targetUnits.forEach( unit -> { final UnitAttachment unitAttachment = (UnitAttachment) unit.getType().getAttachment(UNIT_ATTACHMENT_NAME); when(unitAttachment.getHitPoints()).thenReturn(2); }); final FiringGroup firingGroup = FiringGroup.groupBySuicideOnHit(UNITS, List.of(firingUnit), targetUnits).get(0); final FireRoundState fireRoundState = new FireRoundState(); fireRoundState.setDice(givenDiceRollWithHits(3)); final SelectCasualties selectCasualties = new SelectCasualties( battleState, BattleState.Side.OFFENSE, firingGroup, fireRoundState, (arg1, arg2) -> new CasualtyDetails()); final SelectMainBattleCasualties.Select selectFunction = mock(SelectMainBattleCasualties.Select.class); final CasualtyDetails expected = new CasualtyDetails(); when(selectFunction.apply(any(), any(), anyCollection(), anyInt())).thenReturn(expected); final CasualtyDetails details = new SelectMainBattleCasualties(selectFunction).apply(delegateBridge, selectCasualties); assertThat(details, is(expected)); verify(selectFunction) .apply( eq(delegateBridge), eq(selectCasualties), (Collection<Unit>) argThat(containsInAnyOrder(targetUnits.toArray())), eq(3)); }
Source:
public synchronized static void storeOnImageRegistry(String key, ImageDescriptor descriptor) { getImageRegistry().put(key, descriptor); }

Target:
private synchronized static void storeOnImageRegistry(String key, ImageDescriptor descriptor) { getImageRegistry().put(key, descriptor); }
Source:
public UserConfigLoader(HiveConf conf) { this.hiveConf = conf; }

Target:
protected UserConfigLoader(HiveConf conf) { this.hiveConf = conf; }
Source:
public void updateDataSourceName(CorrelationDataSource eamDataSource, String newName) throws EamDbException { Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "UPDATE data_sources SET name = ? WHERE id = ?"; try { preparedStatement = conn.prepareStatement(sql); preparedStatement.setString(1, newName); preparedStatement.setInt(2, eamDataSource.getID()); preparedStatement.executeUpdate(); CorrelationDataSource updatedDataSource = new CorrelationDataSource( eamDataSource.getCaseID(), eamDataSource.getID(), eamDataSource.getDeviceID(), newName, eamDataSource.getDataSourceObjectID()); dataSourceCacheByDsObjectId.put(getDataSourceByDSObjectIdCacheKey(updatedDataSource.getCaseID(), updatedDataSource.getDataSourceObjectID()), updatedDataSource); dataSourceCacheById.put(getDataSourceByIdCacheKey(updatedDataSource.getCaseID(), updatedDataSource.getID()), updatedDataSource); } catch (SQLException ex) { throw new EamDbException("Error updating name of data source with ID " + eamDataSource.getDataSourceObjectID() + " to " + newName, ex); } finally { EamDbUtil.closeStatement(preparedStatement); EamDbUtil.closeConnection(conn); } }

Target:
public void updateDataSourceName(CorrelationDataSource eamDataSource, String newName) throws EamDbException { Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "UPDATE data_sources SET name = ? WHERE id = ?"; try { preparedStatement = conn.prepareStatement(sql); preparedStatement.setString(1, newName); preparedStatement.setInt(2, eamDataSource.getID()); preparedStatement.executeUpdate(); CorrelationDataSource updatedDataSource = new CorrelationDataSource( eamDataSource.getCaseID(), eamDataSource.getID(), eamDataSource.getDeviceID(), newName, eamDataSource.getDataSourceObjectID(), eamDataSource.getMd5(), eamDataSource.getSha1(), eamDataSource.getSha256()); dataSourceCacheByDsObjectId.put(getDataSourceByDSObjectIdCacheKey(updatedDataSource.getCaseID(), updatedDataSource.getDataSourceObjectID()), updatedDataSource); dataSourceCacheById.put(getDataSourceByIdCacheKey(updatedDataSource.getCaseID(), updatedDataSource.getID()), updatedDataSource); } catch (SQLException ex) { throw new EamDbException("Error updating name of data source with ID " + eamDataSource.getDataSourceObjectID() + " to " + newName, ex); } finally { EamDbUtil.closeStatement(preparedStatement); EamDbUtil.closeConnection(conn); } }
Source:
public void listProjectUsersWithSpecificPermissions_ShouldReturnUsers() { List<User> foundUsers = sut.listProjectUsersWithPermissions(testProject, ANNOTATOR); assertThat(foundUsers).hasSize(2); assertThat(foundUsers).contains(beate, kevin); }

Target:
public void listProjectUsersWithSpecificPermissions_ShouldReturnUsers() { List<User> foundUsers = sut.listProjectUsersWithPermissions(testProject, ANNOTATOR); assertThat(foundUsers).containsExactly(beate, kevin); }
Source:
public void huge64bitFile() { File hugeFile = new File(tmpDir, "huge64bitFileTest.txt"); try { RandomAccessFile largeFile = new RandomAccessFile(hugeFile, "rw"); largeFile.setLength(4* 1024 * 1024 * 1024 + 2); } catch (IOException e) { fail("unable to prepare source directory for zipping", e); } File zipFile = null; ZipArchiver archiver = null; try { zipFile = File.createTempFile("test", ".zip"); archiver = new ZipArchiver(Files.newOutputStream(zipFile.toPath())); archiver.visit(hugeFile, "huge64bitFileTest.txt"); } catch (Exception e) { fail("exception driving ZipArchiver", e); } finally { if (archiver != null) { try { archiver.close(); } catch (IOException e) { } } } String zipEntryName = null; ZipFile zipFileVerify = null; try { zipFileVerify = new ZipFile(zipFile); zipEntryName = ((ZipEntry) zipFileVerify.entries().nextElement()).getName(); } catch (Exception e) { fail("failure enumerating zip entries", e); } finally { if (zipFileVerify != null) { try { zipFileVerify.close(); } catch (IOException e) { } } } assertEquals("huge64bitFileTest.txt", zipEntryName); }

Target:
public void huge64bitFile() { File hugeFile = new File(tmpDir, "huge64bitFileTest.txt"); try { RandomAccessFile largeFile = new RandomAccessFile(hugeFile, "rw"); largeFile.setLength(4 * 1024 * 1024 * 1024 + 2); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Couldn't set up huge file for huge64bitFile test", e); return; } File zipFile = null; ZipArchiver archiver = null; try { zipFile = File.createTempFile("test", ".zip"); archiver = new ZipArchiver(Files.newOutputStream(zipFile.toPath())); archiver.visit(hugeFile, "huge64bitFileTest.txt"); } catch (Exception e) { fail("exception driving ZipArchiver", e); } finally { if (archiver != null) { try { archiver.close(); } catch (IOException e) { } } } String zipEntryName = null; ZipFile zipFileVerify = null; try { zipFileVerify = new ZipFile(zipFile); zipEntryName = ((ZipEntry) zipFileVerify.entries().nextElement()).getName(); } catch (Exception e) { fail("failure enumerating zip entries", e); } finally { if (zipFileVerify != null) { try { zipFileVerify.close(); } catch (IOException e) { } } } assertEquals("huge64bitFileTest.txt", zipEntryName); }
Source:
private void connect() throws XAException { if (delegate != null) { return; } try { xaConnection = xaConnectionFactory.createXAConnection(); xaSession = xaConnection.createXASession(); delegate = xaSession.getXAResource(); } catch (JMSException e) { LOGGER.warn("Failed to create connection", e); throw new XAException(XAException.XAER_PROTO); } }

Target:
private boolean connect() { if (delegate != null) { return true; } try { xaConnection = createXAConnection(); xaSession = xaConnection.createXASession(); delegate = xaSession.getXAResource(); } catch (JMSException e) { LOGGER.warn("Failed to create connection", e); return false; } return true; }
Source:
private Object writeCollectionValue(Object value, ElasticsearchPersistentProperty property, TypeInformation<?> typeHint) { Streamable collectionSource = value instanceof Iterable ? Streamable.of((Iterable) value) : Streamable.of(ObjectUtils.toObjectArray(value)); List<Object> target = new LinkedList<>(); if (!typeHint.getActualType().getType().equals(Object.class) && conversions.isSimpleType(typeHint.getActualType().getType())) { collectionSource.map(this::getWriteSimpleValue).forEach(target::add); } else { Streamable.of((Iterable) value).map(it -> { if (it == null) { return null; } if (conversions.isSimpleType(it.getClass())) { return getWriteSimpleValue(it); } return getWriteComplexValue(property, ClassTypeInformation.from(it.getClass()), it); }).forEach(target::add); } return target; }

Target:
private Object writeCollectionValue(Object value, ElasticsearchPersistentProperty property, TypeInformation<?> typeHint) { Streamable<?> collectionSource = value instanceof Iterable ? Streamable.of((Iterable<?>) value) : Streamable.of(ObjectUtils.toObjectArray(value)); List<Object> target = new ArrayList<>(); if (!typeHint.getActualType().getType().equals(Object.class) && isSimpleType(typeHint.getActualType().getType())) { collectionSource.map(this::getWriteSimpleValue).forEach(target::add); } else { collectionSource.map(it -> { if (it == null) { return null; } if (isSimpleType(it)) { return getWriteSimpleValue(it); } return getWriteComplexValue(property, ClassTypeInformation.from(it.getClass()), it); }).forEach(target::add); } return target; }
Source:
private void attemptResourceInitialization(CommCarePlatform platform, boolean isUpgrade, Resource r, Vector<Resource> missingResources) throws ResourceInitializationException { try { r.getInstaller().initialize(platform, isUpgrade); } catch (FileNotFoundException e) { missingResources.add(r); } catch (IOException | InvalidStructureException | InvalidReferenceException | XmlPullParserException | UnfullfilledRequirementsException e) { throw new ResourceInitializationException(r, e); } if (r.getStatus() == Resource.RESOURCE_STATUS_UNINITIALIZED) { missingResources.add(r); } }

Target:
private void attemptResourceInitialization(CommCarePlatform platform, boolean isUpgrade, Resource r, Vector<Resource> missingResources) throws ResourceInitializationException { try { r.getInstaller().initialize(platform, isUpgrade); } catch (FileNotFoundException e) { missingResources.add(r); } catch (IOException | InvalidStructureException | InvalidReferenceException | XmlPullParserException | UnfullfilledRequirementsException e) { throw new ResourceInitializationException(r, e); } if (r.getStatus() == Resource.RESOURCE_STATUS_UNINITIALIZED) { Logger.log(LogTypes.SOFT_ASSERT, "Failed to initialize resource with descriptor " + r.getDescriptor() + " and id " + r.getResourceId()); } }
Source:
public synchronized void unregister(URI key) { if (locks.containsKey(key)) { LockProvider provider = locks.get(key); if (provider != null) { provider.decreateCount(); if (provider.getRegisterCount() < 1) { locks.remove(key); } } } }

Target:
public synchronized void unregister(URI key) { LockProvider provider = locks.get(key); if (provider != null) { provider.decreateCount(); if (provider.getRegisterCount() < 1) { locks.remove(key); } } }
Source:
private void processLoads(final IDMContext context, final DataRequestMonitor<ILoadInfo> rm, final ProcStatCoreLoads loads) { if (context instanceof ICoreDMContext) { String coreId = ((ICoreDMContext) context).getId(); int load = (int)loads.get("cpu"+coreId).floatValue(); rm.done(new GDBLoadInfo(Integer.toString(load))); } else if (context instanceof ICPUDMContext) { getCores(context, new ImmediateDataRequestMonitor<ICoreDMContext[]>() { @Override protected void handleCompleted() { ICoreDMContext[] coreContexts = getData(); if (!isSuccess() || coreContexts == null || coreContexts.length < 1) { rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Can't get load info for CPU", null)); return; } int i = 0; float load = 0.0f; for (ICoreDMContext coreCtx : coreContexts) { String coreId = coreCtx.getId(); load += loads.get("cpu"+coreId); i++; } load /= i; String wm = null; rm.done(new GDBLoadInfo(Integer.toString((int)load), wm)); } } ); } else { rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Wrong context type", null)); } }

Target:
private void processLoads(final IDMContext context, final DataRequestMonitor<ILoadInfo> rm, final ProcStatCoreLoads loads) { if (loads == null) { rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,"Can't get load info", null)); return; } if (context instanceof ICoreDMContext) { String coreId = ((ICoreDMContext) context).getId(); float load = loads.getLoad(coreId); String wm = null; rm.done(new GDBLoadInfo(Integer.toString((int)load),wm)); } else if (context instanceof ICPUDMContext) { getCores(context, new ImmediateDataRequestMonitor<ICoreDMContext[]>() { @Override protected void handleCompleted() { ICoreDMContext[] coreContexts = getData(); if (!isSuccess() || coreContexts == null || coreContexts.length < 1) { rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,"Can't get load info for CPU", null)); return; } int i = 0; float load = 0.0f; for (ICoreDMContext coreCtx : coreContexts) { String coreId = coreCtx.getId(); load += loads.getLoad(coreId); i++; } load /= i; String wm = null; rm.done(new GDBLoadInfo(Integer.toString((int)load), wm)); } } ); } }
Source:
public File export(final String cropName, final String programUUID) { try { final File temporaryFolder = Files.createTempDir(); final String fileNameFullPath = temporaryFolder.getAbsolutePath() + File.separator + GermplasmExcelTemplateExportServiceImpl.FILE_NAME; return this.generateTemplateFile(fileNameFullPath, cropName, programUUID); } catch (final IOException e) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); errors.reject("cannot.exportAsXLS.germplasm.template", ""); throw new ResourceNotFoundException(errors.getAllErrors().get(0)); } }

Target:
public File export(final String cropName, final String programUUID) { try { final File temporaryFolder = Files.createTempDir(); final String fileNameFullPath = temporaryFolder.getAbsolutePath() + File.separator + GermplasmExcelTemplateExportServiceImpl.FILE_NAME; return this.generateTemplateFile(fileNameFullPath, cropName, programUUID); } catch (final IOException e) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); errors.reject("cannot.export.as.xls.germplasm.template", ""); throw new ResourceNotFoundException(errors.getAllErrors().get(0)); } }
Source:
private RevisionInfo resolveRevisionToDisplay(ChangeInfo info) { if (revision == null) { revision = info.current_revision(); } else if (!info.revisions().containsKey(revision)) { JsArray<RevisionInfo> list = info.revisions().values(); for (int i = 0; i < list.length(); i++) { RevisionInfo r = list.get(i); if (revision.equals(String.valueOf(r._number()))) { revision = r.name(); break; } } } RevisionInfo rev = revision != null ? info.revision(revision) : null; if (rev != null) { return rev; } JsArray<RevisionInfo> revisions = info.revisions().values(); if (revisions.length() > 0) { RevisionInfo.sortRevisionInfoByNumber(revisions); rev = revisions.get(revisions.length() - 1); revision = rev.name(); return rev; } else { new ErrorDialog( Resources.M.changeWithNoRevisions(info.legacy_id().get())).center(); throw new IllegalStateException("no revision, cannot proceed"); } }

Target:
private RevisionInfo resolveRevisionToDisplay(ChangeInfo info) { RevisionInfo rev = resolveRevisionOrPatchSetId(info, revision, info.current_revision()); if (rev != null) { revision = rev.name(); return rev; } JsArray<RevisionInfo> revisions = info.revisions().values(); if (revisions.length() > 0) { RevisionInfo.sortRevisionInfoByNumber(revisions); rev = revisions.get(revisions.length() - 1); revision = rev.name(); return rev; } else { new ErrorDialog( Resources.M.changeWithNoRevisions(info.legacy_id().get())).center(); throw new IllegalStateException("no revision, cannot proceed"); } }
Source:
public void expandParent(int parentIndex) { int parentWrapperIndex = getParentWrapperIndex(parentIndex); Object helperItem = getHelperItem(parentWrapperIndex); ParentWrapper parentWrapper = null; if (helperItem instanceof ParentWrapper) { parentWrapper = (ParentWrapper) helperItem; } if (parentWrapper == null) { return; } expandViews(parentWrapperIndex); }

Target:
public void expandParent(int parentIndex) { int parentWrapperIndex = getParentWrapperIndex(parentIndex); Object helperItem = getHelperItem(parentWrapperIndex); ParentWrapper parentWrapper; if (helperItem instanceof ParentWrapper) { parentWrapper = (ParentWrapper) helperItem; } else { return; } expandViews(parentWrapper, parentWrapperIndex); }
Source:
public boolean setRenderer(Renderer newRenderer){ boolean rendererChanged = false; if (newRenderer!=null){ if (renderer==null || !newRenderer.equals(renderer.getSchema())){ renderer = Engine.factory.getEngineObject(newRenderer); this.setWidth(renderer.getWidth()); this.setHeight(renderer.getHeight()); rendererChanged=true; } } else { if (renderer!=null){ rendererChanged=true; } renderer=null; this.setWidth(0); this.setHeight(0); } return rendererChanged; }

Target:
public boolean setRenderer(Renderer newRenderer) { boolean rendererChanged = false; if (newRenderer != null) { renderer = Engine.factory.getEngineObject(newRenderer); this.setWidth(renderer.getWidth()); this.setHeight(renderer.getHeight()); rendererChanged = true; } else { if (renderer != null) { rendererChanged = true; } renderer = null; this.setWidth(0); this.setHeight(0); } return rendererChanged; }
Source:
public void fullTextWithSpecialChars() throws Exception { TestRepository<InMemoryRepository> repo = createProject("repo"); RevCommit commit1 = repo.parseBody(repo.commit().message("foo_bar_foo").create()); Change change1 = newChange(repo, commit1, null, null, null).insert(); RevCommit commit2 = repo.parseBody(repo.commit().message("one.two.three").create()); Change change2 = newChange(repo, commit2, null, null, null).insert(); assertTrue(query("message:foo_ba").isEmpty()); assertResultEquals(change1, queryOne("message:bar")); assertResultEquals(change1, queryOne("message:foo_bar")); assertResultEquals(change2, queryOne("message:two")); assertResultEquals(change2, queryOne("message:one.two")); }

Target:
public void fullTextWithSpecialChars() throws Exception { TestRepository<InMemoryRepository> repo = createProject("repo"); RevCommit commit1 = repo.parseBody(repo.commit().message("foo_bar_foo").create()); Change change1 = newChange(repo, commit1, null, null, null).insert(); RevCommit commit2 = repo.parseBody(repo.commit().message("one.two.three").create()); Change change2 = newChange(repo, commit2, null, null, null).insert(); assertTrue(query("message:foo_ba").isEmpty()); assertResultEquals(change1, queryOne("message:bar")); assertResultEquals(change1, queryOne("message:foo_bar")); assertResultEquals(change1, queryOne("message:foo bar")); assertResultEquals(change2, queryOne("message:two")); assertResultEquals(change2, queryOne("message:one.two")); assertResultEquals(change2, queryOne("message:one two")); }
Source:
private Endpoint toEndpoint(String name, ServerConfigImpl config) { String stringPort = config.getPort().split("/")[0]; Map<String, String> attributes = new HashMap<>(config.getAttributes()); putIfNotNull(attributes, "protocol", config.getProtocol()); putIfNotNull(attributes, "path", config.getPath()); String isInternal = config.getAttributes().remove(ServerConfig.INTERNAL_SERVER_ATTRIBUTE); if ("true".equals(isInternal)) { attributes.put("public", "false"); } return new Endpoint() .withName(name) .withPort(Integer.parseInt(stringPort)) .withAttributes(attributes); }

Target:
private Endpoint toEndpoint(String name, ServerConfigImpl config) { String stringPort = config.getPort().split("/")[0]; Map<String, String> attributes = new HashMap<>(config.getAttributes()); putIfNotNull(attributes, "protocol", config.getProtocol()); putIfNotNull(attributes, "path", config.getPath()); String isInternal = config.getAttributes().remove(ServerConfig.INTERNAL_SERVER_ATTRIBUTE); if ("true".equals(isInternal)) { attributes.put(PUBLIC_ENDPOINT_ATTRIBUTE, "false"); } return new Endpoint() .withName(name) .withPort(Integer.parseInt(stringPort)) .withAttributes(attributes); }
Source:
public ValidationResult validate(RuntimeContainer container) { ValidationResultMutable vr = new ValidationResultMutable(); try { connection = connect(); vr.setStatus(ValidationResult.Result.OK); } catch (Exception ex) { fillValidationResult(vr, ex); } return vr; }

Target:
public ValidationResult validate(RuntimeContainer container) { try { connection = connect(); return ValidationResult.OK; } catch (Exception ex) { return createValidationResult(ex); } }
Source:
public void tripletsWhoseSumIs1001() { List<PythagoreanTriplet> actual = PythagoreanTriplet .makeTripletsList() .withFactorsLessThanOrEqualTo(1001) .thatSumTo(1001) .build(); List<PythagoreanTriplet> expected = Arrays.asList(); assertEquals(expected.size(), actual.size()); for (int i = 0; i < expected.size(); ++i) { assertEquals(expected.get(i), actual.get(i)); } }

Target:
public void tripletsWhoseSumIs1001() { List<PythagoreanTriplet> actual = PythagoreanTriplet .makeTripletsList() .withFactorsLessThanOrEqualTo(1001) .thatSumTo(1001) .build(); List<PythagoreanTriplet> expected = Collections.emptyList(); assertEquals(expected, actual); }
Source:
public CommandContext withoutCompensationContext() { return withCompensationContext(new DefaultCompensationContext()); }

Target:
public CommandContext withoutCompensationContext() { return withCompensationContext(null); }
Source:
private static String getSignature(PsiElement element) { if (element instanceof GoFunctionDeclaration) { return "func " + ((GoFunctionDeclaration)element).getIdentifier().getText() + ((GoFunctionDeclaration)element).getSignature().getText() + "<br/><br/>"; } if (element instanceof GoMethodDeclaration) { return "func " + ((GoMethodDeclaration)element).getReceiver().getText() + " " + ((GoMethodDeclaration)element).getIdentifier().getText() + ((GoMethodDeclaration)element).getSignature().getText() + "<br/><br/>"; } return ""; }

Target:
private static String getSignature(PsiElement element) { if (!(element instanceof GoSignatureOwner)) { return ""; } PsiElement identifier = null; if (element instanceof GoNamedSignatureOwner) { identifier = ((GoNamedSignatureOwner)element).getIdentifier(); } GoSignature signature = ((GoSignatureOwner)element).getSignature(); if (identifier == null && signature == null) { return ""; } String result = " <b>func " + (identifier != null ? identifier.getText() : "") + "("; if (signature != null) { result += getParametersAsString(signature.getParameters()); } result += ")"; if (signature != null && signature.getResult() != null) { GoResult signatureResult = signature.getResult(); if (signatureResult.getParameters() != null){ String signatureParameters = getParametersAsString(signatureResult.getParameters()); if (signatureParameters.length() > 0) { result += " (" + signatureParameters + ")"; } } else if (signatureResult.getType() != null) { GoType signatureResultType = signatureResult.getType(); if (signatureResultType instanceof GoTypeList) { result += " (" + signatureResult.getType().getText() + ")"; } else { result += " " + signatureResult.getType().getText(); } } } return result + "</b><br/>"; }
Source:
public void testDeserialization() throws Exception { for (Short version : versions) { composedBlobIdAndDeserialize(version); } }

Target:
public void testDeserialization() throws Exception { composedBlobIdAndDeserialize(version); }
Source:
public void emitModifiers(ImmutableSet<Modifier> modifiers) { for (Modifier modifier : modifiers) { emitAndIndent(Ascii.toLowerCase(modifier.name())); emitAndIndent(" "); } }

Target:
public void emitModifiers(ImmutableSet<Modifier> modifiers) { if (!modifiers.isEmpty()) { for (Modifier modifier : EnumSet.copyOf(modifiers)) { emitAndIndent(Ascii.toLowerCase(modifier.name())); emitAndIndent(" "); } } }