auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void expandJar_shouldExpandDirectoryWithParentTreeIfNameIsDirectoryAndKeepFullPathIsTrue() throws IOException { final int numberOfFilesInSpecifiedJarDirectory = 2; String directoryPath = "META-INF/maven/org.openmrs.module/test1-api"; File destinationFolder = this.getEmptyJarDestinationFolder(); ModuleUtil.expandJar(getJarFile(), destinationFolder, directoryPath, true); Object[] filesList = FileUtils.listFiles(destinationFolder, null, true).toArray(); Assert.assertEquals(numberOfFilesInSpecifiedJarDirectory, filesList.length); String expectedPath = destinationFolder.getPath() + File.separator + directoryPath.replace("/", File.separator) + File.separator; String ActualPath = ((File)filesList[0]).getPath().replace(((File)filesList[0]).getName(), ""); Assert.assertEquals(expectedPath, ActualPath); FileUtils.deleteDirectory(destinationFolder); }

Target:
public void expandJar_shouldExpandDirectoryWithParentTreeIfNameIsDirectoryAndKeepFullPathIsTrue() throws Exception { final int numberOfFilesInSpecifiedJarDirectory = 2; String directoryPath = "META-INF/maven/org.openmrs.module/test1-api"; File destinationFolder = this.getEmptyJarDestinationFolder(); ModuleUtil.expandJar(getJarFile(), destinationFolder, directoryPath, true); List<File> actualExpandedFiles = (List<File>)FileUtils.listFiles(destinationFolder, null, true); Assert.assertEquals(numberOfFilesInSpecifiedJarDirectory, actualExpandedFiles.size()); File expectedPath = new File(destinationFolder, directoryPath); Assert.assertEquals(expectedPath.toString(), actualExpandedFiles.get(0).getParent()); FileUtils.deleteDirectory(destinationFolder); }
Source:
private Ordering<Row> metricOrdering(final String column, final Comparator comparator) { return Ordering.from(Comparator.comparing((Row row) -> row.getRaw(column), Comparator.nullsFirst(comparator))); }

Target:
private Ordering<Row> metricOrdering(final String column, final Comparator comparator) { if (NullHandling.sqlCompatible()) { return Ordering.from(Comparator.comparing((Row row) -> row.getRaw(column), Comparator.nullsFirst(comparator))); } else { return Ordering.from(Comparator.comparing((Row row) -> row.getRaw(column), Comparator.nullsLast(comparator))); } }
Source:
public void testV2LsRefs() throws Exception { RevCommit tip = remote.commit().message("message").create(); remote.update("master", tip); server.updateRef("HEAD").link("refs/heads/master"); RevTag tag = remote.tag("tag", tip); remote.update("refs/tags/tag", tag); ByteArrayInputStream recvStream = uploadPackV2("command=ls-refs\n", PacketLineIn.DELIM, PacketLineIn.END); PacketLineIn pckIn = new PacketLineIn(recvStream); assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " HEAD")); assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/master")); assertThat(pckIn.readString(), is(tag.toObjectId().getName() + " refs/tags/tag")); assertTrue(pckIn.readString() == PacketLineIn.END); }

Target:
public void testV2LsRefs() throws Exception { RevCommit tip = remote.commit().message("message").create(); remote.update("master", tip); server.updateRef("HEAD").link("refs/heads/master"); RevTag tag = remote.tag("tag", tip); remote.update("refs/tags/tag", tag); ByteArrayInputStream recvStream = uploadPackV2("command=ls-refs\n", PacketLineIn.END); PacketLineIn pckIn = new PacketLineIn(recvStream); assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " HEAD")); assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/master")); assertThat(pckIn.readString(), is(tag.toObjectId().getName() + " refs/tags/tag")); assertTrue(pckIn.readString() == PacketLineIn.END); }
Source:
private List<EventHandler<ActiveContext>> getActiveContextHandler(final String namespace) { final List<EventHandler<ActiveContext>> activeContextHandlers = new ArrayList<>(3); switch (namespace) { case NAMESPACE_SERVER: activeContextHandlers.add(asyncDolphinDriver.get().getFirstContextActiveHandlerForServer(true)); activeContextHandlers.add(new ServerContextActiveHandler()); break; case NAMESPACE_WORKER: activeContextHandlers.add(asyncDolphinDriver.get().getFirstContextActiveHandlerForWorker(true)); activeContextHandlers.add(new WorkerContextActiveHandler()); break; default: throw new RuntimeException("Unsupported namespace"); } return activeContextHandlers; }

Target:
private List<EventHandler<ActiveContext>> getActiveContextHandler(final String namespace) { final List<EventHandler<ActiveContext>> activeContextHandlers = new ArrayList<>(2); switch (namespace) { case NAMESPACE_SERVER: activeContextHandlers.add(asyncDolphinDriver.get().getFirstContextActiveHandlerForServer(true)); activeContextHandlers.add(new ServerContextActiveHandler()); break; case NAMESPACE_WORKER: activeContextHandlers.add(asyncDolphinDriver.get().getFirstContextActiveHandlerForWorker(true)); activeContextHandlers.add(new WorkerContextActiveHandler()); break; default: throw new RuntimeException("Unsupported namespace"); } return activeContextHandlers; }
Source:
protected void configureDispatch() { bindAnnotated(RpcDispatchHooks.class).to(builder.getDispatchHooks()).in(Singleton.class); bind(RpcDispatchCallFactory.class).to(DefaultRpcDispatchCallFactory.class).in(Singleton.class); bind(DispatchAsync.class).to(RpcDispatchAsync.class).in(Singleton.class); }

Target:
protected void configureDispatch() { bind(RpcDispatchHooks.class).to(builder.getDispatchHooks()).in(Singleton.class); bind(RpcDispatchCallFactory.class).to(DefaultRpcDispatchCallFactory.class).in(Singleton.class); bind(DispatchAsync.class).to(RpcDispatchAsync.class).in(Singleton.class); }
Source:
private void verifyAccountAndContainerFromBlobId(String blobId, Account expectedAccount, Container expectedContainer, RestServiceErrorCode expectedRestErrorCode) throws Exception { RestRequest restRequest; for (RestMethod restMethod : Lists.newArrayList(RestMethod.GET, RestMethod.HEAD, RestMethod.DELETE)) { restRequest = createRestRequest(restMethod, blobId, null, null); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); try { doOperation(restRequest, restResponseChannel); if (expectedRestErrorCode != null) { if (expectedRestErrorCode != null) { fail("Should have thrown"); } } } catch (RestServiceException e) { assertEquals("Wrong RestServiceErrorCode", expectedRestErrorCode, e.getErrorCode()); } assertEquals("Wrong account object in RestRequest's args", expectedAccount, restRequest.getArgs().get(RestUtils.InternalKeys.TARGET_ACCOUNT_KEY)); assertEquals("Wrong container object in RestRequest's args", expectedContainer, restRequest.getArgs().get(RestUtils.InternalKeys.TARGET_CONTAINER_KEY)); assertEquals("Wrong account object in RestRequest's args", expectedAccount, restRequest.getArgs().get(RestUtils.InternalKeys.TARGET_ACCOUNT_KEY)); assertEquals("Wrong container object in RestRequest's args", expectedContainer, restRequest.getArgs().get(RestUtils.InternalKeys.TARGET_CONTAINER_KEY)); } }

Target:
private void verifyAccountAndContainerFromBlobId(String blobId, Account expectedAccount, Container expectedContainer, RestServiceErrorCode expectedRestErrorCode) throws Exception { RestRequest restRequest; for (RestMethod restMethod : Lists.newArrayList(RestMethod.GET, RestMethod.HEAD, RestMethod.DELETE)) { restRequest = createRestRequest(restMethod, blobId, null, null); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); try { doOperation(restRequest, restResponseChannel); if (expectedRestErrorCode != null) { fail("Should have thrown"); } } catch (RestServiceException e) { assertEquals("Wrong RestServiceErrorCode", expectedRestErrorCode, e.getErrorCode()); } assertEquals("Wrong account object in RestRequest's args", expectedAccount, restRequest.getArgs().get(RestUtils.InternalKeys.TARGET_ACCOUNT_KEY)); assertEquals("Wrong container object in RestRequest's args", expectedContainer, restRequest.getArgs().get(RestUtils.InternalKeys.TARGET_CONTAINER_KEY)); } }
Source:
private static String getQuotaRegexString(SearchObjectAutoCompleter search) { String query = ".*" + search.getDefaultSort(SearchObjects.QUOTA_OBJ_NAME) + ".*" + search.getRelatedTableNameWithOutTags(SearchObjects.QUOTA_OBJ_NAME) + ".* "; return query; }

Target:
private static String getQuotaRegexString(SearchObjectAutoCompleter search) { StringBuilder query = new StringBuilder(); query.append(".*") .append(search.getDefaultSort(SearchObjects.QUOTA_OBJ_NAME)) .append(".*") .append(search.getRelatedTableNameWithOutTags(SearchObjects.QUOTA_OBJ_NAME)) .append(".* "); return query.toString(); }
Source:
MethodSpec generateConstructor(List<Property> properties) { List<ParameterSpec> params = Lists.newArrayListWithCapacity(properties.size()); for (Property property : properties) { params.add(ParameterSpec.builder(property.type, property.name).build()); } MethodSpec.Builder builder = MethodSpec.constructorBuilder() .addParameters(params); StringBuilder superFormat = new StringBuilder("super("); List<ParameterSpec> args = new LinkedList<ParameterSpec>(); for (int i = 0, n = params.size(); i < n; i++) { args.add(params.get(i)); superFormat.append("$N"); if (i < n - 1) superFormat.append(", "); } superFormat.append(")"); builder.addStatement(superFormat.toString(), args.toArray()); return builder.build(); }

Target:
MethodSpec generateConstructor(List<Property> properties) { List<ParameterSpec> params = Lists.newArrayListWithCapacity(properties.size()); for (Property property : properties) { params.add(ParameterSpec.builder(property.type, property.name).build()); } MethodSpec.Builder builder = MethodSpec.constructorBuilder() .addParameters(params); StringBuilder superFormat = new StringBuilder("super("); List<ParameterSpec> args = new ArrayList<ParameterSpec>(); for (int i = 0, n = params.size(); i < n; i++) { args.add(params.get(i)); superFormat.append("$N"); if (i < n - 1) superFormat.append(", "); } superFormat.append(")"); builder.addStatement(superFormat.toString(), args.toArray()); return builder.build(); }
Source:
protected boolean connect(String serverName) { boolean connectStatus = false; client = getSSHClient(); Integer timeout = Config.<Integer> GetValue(ConfigValues.ConnectToServerTimeoutInSeconds) * 1000; client.setHardTimeout(timeout); client.setSoftTimeout(timeout); client.setHost(serverName, port); try { client.connect(); client.authenticate(); connectStatus = true; } catch (Exception e) { log.debug( String.format("Could not connect to server %1$s: %2$s", this.host, e.getMessage())); } return connectStatus; }

Target:
protected boolean connect(String serverName) { boolean connectStatus = false; client = getSSHClient(); Integer timeout = Config.<Integer> GetValue(ConfigValues.ConnectToServerTimeoutInSeconds) * 1000; client.setHardTimeout(timeout); client.setSoftTimeout(timeout); client.setHost(serverName, port); try { client.connect(); client.authenticate(); connectStatus = true; } catch (Exception e) { log.debug( String.format("Could not connect to server %1$s: %2$s", serverName, e.getMessage())); throw new RuntimeException(e); } return connectStatus; }
Source:
public void marshalJAXBElementWithEmptySpaces() throws Exception { Reader input = new InputStreamReader(Thread.currentThread() .getContextClassLoader() .getResourceAsStream("MOBS2-with-trailling-whitespace.xml")); GeodesyMLType geodesyML = marshaller.unmarshal(input, GeodesyMLType.class).getValue(); List<JAXBElement<?>> els = geodesyML.getElements(); Traverser.traverse(geodesyML, new Traverser.Visitor() { public void process(Object x) { if (x instanceof String) { Assert.assertEquals(x.toString(), x.toString().trim()); } } }); }

Target:
public void marshalJAXBElementWithEmptySpaces() throws Exception { Reader input = new InputStreamReader(Thread.currentThread() .getContextClassLoader() .getResourceAsStream("MOBS2-with-trailing-whitespace.xml")); GeodesyMLType geodesyML = marshaller.unmarshal(input, GeodesyMLType.class).getValue(); List<JAXBElement<?>> els = geodesyML.getElements(); Traverser.traverse(geodesyML, new Traverser.Visitor() { public void process(Object x) { if (x instanceof String) { Assert.assertEquals(x.toString(), x.toString().trim()); } } }); }
Source:
public ReadOnlyTableException(String message) { super(SQLExceptionInfo.getNewInfoObject(code).setMessage(message).toString(), code.getSQLState()); }

Target:
public ReadOnlyTableException(String message) { super(new SQLExceptionInfo.Builder(code).setMessage(message).toString(), code.getSQLState()); }
Source:
private static Personname formatPatientName(String nameString, EnExplicitFamily lastname, EnExplicitGiven firstname, EnExplicitGiven middlename, EnExplicitPrefix prefix, EnExplicitSuffix suffix) { boolean namefound; Personname personNameDBModel = new Personname(); namefound = checkNameContents(lastname, firstname, middlename, prefix, suffix, personNameDBModel); if (!namefound && StringUtils.isNotEmpty(nameString)) { LOG.info("setting name by nameString ", nameString); personNameDBModel.setLastName(nameString); } return personNameDBModel; }

Target:
private static Personname formatPatientName(String nameString, EnExplicitFamily lastname, EnExplicitGiven firstname, EnExplicitGiven middlename, EnExplicitPrefix prefix, EnExplicitSuffix suffix) { boolean namefound; Personname personNameDBModel = new Personname(); namefound = checkNameContents(lastname, firstname, middlename, prefix, suffix, personNameDBModel); if (!namefound && StringUtils.isNotEmpty(nameString)) { LOG.info("setting name by nameString : ", nameString); personNameDBModel.setLastName(nameString); } return personNameDBModel; }
Source:
public void clearCache() { Enumeration<IReferenceCollection> elementss = fApiComponentCache.elements(); while (elementss.hasMoreElements()) { IReferenceCollection reference = elementss.nextElement(); reference.clear(); } fApiComponentCache.flush(); }

Target:
public void clearCache() { Enumeration<IReferenceCollection> elements = fApiComponentCache.elements(); while (elements.hasMoreElements()) { IReferenceCollection reference = elements.nextElement(); reference.clear(); } fApiComponentCache.flush(); }
Source:
public Object handle(Message<?> message) throws Exception { Callable<Object> messageHandling; if (message instanceof CommandMessage) { messageHandling = () -> handle((CommandMessage) message); } else { messageHandling = () -> handle((EventMessage) message); } return executeWithResult(messageHandling); }

Target:
public Object handle(Message<?> message) throws Exception { Callable<Object> messageHandling; if (message instanceof CommandMessage) { messageHandling = () -> handle((CommandMessage) message); } else if (message instanceof EventMessage) { messageHandling = () -> handle((EventMessage) message); } else { throw new IllegalArgumentException("Unsupported message type: " + message.getClass()); } return executeWithResult(messageHandling); }
Source:
private Double getOverlappingPercentages(double cMin, double cMax, double bMin, double bMax) { if (cMin > bMax || cMax < bMin) { return 0.0; } double regionMin = Math.max(cMin, bMin); double regionMax = Math.min(cMax, bMax); double dividend = regionMax - regionMin; double divider = bMax - bMin; if (dividend == divider) return 1.0; else return dividend / divider; }

Target:
private Double getOverlappingPercentages(double cMin, double cMax, double bMin, double bMax) { if (cMin > bMax || cMax < bMin) { return 0.0; } double regionMin = Math.max(cMin, bMin); double regionMax = Math.min(cMax, bMax); double dividend = regionMax - regionMin; double divider = bMax - bMin; if (divider == 0.0) { if (dividend == 0.0) { return 1.0; } else return 0.0; } else return dividend / divider; }
Source:
public void testCreateLinearIndexFromBCF(final File inputBCF) throws IOException { final File tmpBCF = new File(IOUtil.createTempDir("testCreateIndexFromBCF", null), inputBCF.getName()); Files.copy(inputBCF, tmpBCF); final Index index = IndexFactory.createIndex(tmpBCF, new BCF2Codec(), IndexFactory.IndexType.LINEAR); index.writeBasedOnFeatureFile(tmpBCF); try(final VCFFileReader originalReader = new VCFFileReader(inputBCF,false); final VCFFileReader tmpReader = new VCFFileReader(tmpBCF, new File(tmpBCF.getAbsolutePath()+ ".idx"),true)) { Iterator<VariantContext> originalIt = originalReader.iterator(); while(originalIt.hasNext()) { VariantContext vcOrig = originalIt.next(); final Interval queryInterval = new Interval(vcOrig.getContig(), vcOrig.getStart(), vcOrig.getEnd()); Iterator<VariantContext> tmpIt = tmpReader.query(queryInterval.getContig(), queryInterval.getStart(), queryInterval.getEnd()); Assert.assertTrue(tmpIt.hasNext(), "Variant not returned from indexed file"); VariantContext vcTmp = tmpIt.next(); Assert.assertEquals(vcOrig.getContig(), vcTmp.getContig()); Assert.assertEquals(vcOrig.getStart(), vcTmp.getStart()); Assert.assertEquals(vcOrig.getEnd(), vcTmp.getEnd()); Assert.assertFalse(tmpIt.hasNext()); } } }

Target:
public void testCreateLinearIndexFromBCF(final File inputBCF) throws IOException { final File tempDir = IOUtil.createTempDir("testCreateIndexFromBCF", null); tempDir.deleteOnExit(); final File tmpBCF = new File(tempDir, inputBCF.getName()); Files.copy(inputBCF, tmpBCF); tmpBCF.deleteOnExit(); final Index index = IndexFactory.createIndex(tmpBCF, new BCF2Codec(), IndexFactory.IndexType.LINEAR); index.writeBasedOnFeatureFile(tmpBCF); final File tempIndex = Tribble.indexFile(tmpBCF); tempIndex.deleteOnExit(); try (final VCFFileReader originalReader = new VCFFileReader(inputBCF,false); final VCFFileReader tmpReader = new VCFFileReader(tmpBCF, tempIndex,true)) { final Iterator<VariantContext> originalIt = originalReader.iterator(); while (originalIt.hasNext()) { final VariantContext vcOrig = originalIt.next(); final Interval queryInterval = new Interval(vcOrig.getContig(), vcOrig.getStart(), vcOrig.getEnd()); final Iterator<VariantContext> tmpIt = tmpReader.query(queryInterval.getContig(), queryInterval.getStart(), queryInterval.getEnd()); Assert.assertTrue(tmpIt.hasNext(), "Variant not returned from indexed file"); final VariantContext vcTmp = tmpIt.next(); Assert.assertEquals(vcOrig.getContig(), vcTmp.getContig()); Assert.assertEquals(vcOrig.getStart(), vcTmp.getStart()); Assert.assertEquals(vcOrig.getEnd(), vcTmp.getEnd()); Assert.assertFalse(tmpIt.hasNext()); } } }
Source:
public MetaDataService metaDataService() { return mock(MetaDataService.class, RETURNS_DEEP_STUBS); }

Target:
public MetaDataService metaDataService() { return mock(MetaDataService.class); }
Source:
public Request( final String name, final HttpVerb verb, final String path, final ImmutableList<Arguments> requiredArguments, final ImmutableList<Arguments> optionalArguments) { this.name = name; this.verb = verb; this.path = path; this.requiredArguments = requiredArguments; this.optionalArguments = optionalArguments; this.cHelper = CHelper.getInstance(); }

Target:
public Request( final String name, final HttpVerb verb, final String path, final ImmutableList<Arguments> requiredArguments, final ImmutableList<Arguments> optionalArguments) { this.name = name; this.verb = verb; this.path = path; this.requiredArguments = requiredArguments; this.optionalArguments = optionalArguments; this.requestHelper = RequestHelper.getInstance(); }
Source:
public void error(String s) { logger.error(s); }

Target:
public void error(String s) { logger.log(Level.ERROR, s); }
Source:
protected abstract TupleBatch fetchNextReady() throws Exception; protected final void setEOS() { if (isProfilingMode() && !eos()) { PROFILING_LOGGER.info("[{}#{}][{}@{}][{}][{}]:end", MyriaConstants.EXEC_ENV_VAR_QUERY_ID, getQueryId(), getOpName(), getFragmentId(), System.nanoTime()); } eos = true; }

Target:
protected abstract TupleBatch fetchNextReady() throws Exception; protected final void setEOS() { if (eos()) { return; } if (isProfilingMode()) { PROFILING_LOGGER.info("[{}#{}][{}@{}][{}][{}]:end", MyriaConstants.EXEC_ENV_VAR_QUERY_ID, getQueryId(), getOpName(), getFragmentId(), System.nanoTime()); } eos = true; }
Source:
private boolean overwrite(String name) { for (Object propertie : getProperties()) { Property property = (Property) propertie; String propertyName = property.getName(); if (propertyName.equals(name)) { if (property.isDefault()) { MessageDialog.openError(propertyTableViewer.getControl().getShell(), AntPreferencesMessages.AntPropertiesBlock_17, MessageFormat.format(AntPreferencesMessages.AntPropertiesBlock_18, new Object[] { propertyName, property.getPluginLabel() })); return false; } boolean overWrite = MessageDialog.openQuestion(propertyTableViewer.getControl().getShell(), AntPreferencesMessages.AntPropertiesBlock_15, MessageFormat.format(AntPreferencesMessages.AntPropertiesBlock_16, new Object[] { name })); if (!overWrite) { return false; } ((AntContentProvider) propertyTableViewer.getContentProvider()).remove(property); break; } } return true; }

Target:
private boolean overwrite(String name) { for (Object prop : getProperties()) { Property property = (Property) prop; String propertyName = property.getName(); if (propertyName.equals(name)) { if (property.isDefault()) { MessageDialog.openError(propertyTableViewer.getControl().getShell(), AntPreferencesMessages.AntPropertiesBlock_17, MessageFormat.format(AntPreferencesMessages.AntPropertiesBlock_18, new Object[] { propertyName, property.getPluginLabel() })); return false; } boolean overWrite = MessageDialog.openQuestion(propertyTableViewer.getControl().getShell(), AntPreferencesMessages.AntPropertiesBlock_15, MessageFormat.format(AntPreferencesMessages.AntPropertiesBlock_16, new Object[] { name })); if (!overWrite) { return false; } ((AntContentProvider) propertyTableViewer.getContentProvider()).remove(property); break; } } return true; }
Source:
public static INDArray expandDims(INDArray input, int dimension) { if (dimension < 0) dimension += input.rank(); int[] shape = input.shape(); int[] indexes = new int[input.rank() + 1]; for (int i = 0; i < indexes.length; i++) indexes[i] = i < dimension ? shape[i] : i == dimension ? 1 : shape[i - 1]; return input.reshape(indexes); }

Target:
public static INDArray expandDims(INDArray input, int dimension) { if (dimension < 0) dimension += input.rank(); int[] shape = input.shape(); int[] indexes = new int[input.rank() + 1]; for (int i = 0; i < indexes.length; i++) indexes[i] = i < dimension ? shape[i] : i == dimension ? 1 : shape[i - 1]; return input.reshape(input.ordering(), indexes); }
Source:
public void initiate() { for (int i = 0; i < lh.getLedgerMetadata().currentEnsemble.size(); i++) { lh.bk.getBookieClient().readEntry(lh.getLedgerMetadata().currentEnsemble.get(i), lh.ledgerId, BookieProtocol.LAST_ADD_CONFIRMED, this, i, BookieProtocol.FLAG_NONE); } }

Target:
public void initiate() { LedgerMetadata metadata = lh.getLedgerMetadata(); for (int i = 0; i < metadata.currentEnsemble.size(); i++) { lh.bk.getBookieClient().readEntry(metadata.currentEnsemble.get(i), lh.ledgerId, BookieProtocol.LAST_ADD_CONFIRMED, this, i, BookieProtocol.FLAG_NONE); } }
Source:
private FetchResult fetch(Git git, String label) throws GitAPIException{ FetchCommand fetch = git.fetch(); fetch.setRemote("origin"); fetch.setTagOpt(TagOpt.FETCH_TAGS); setTimeout(fetch); try { setCredentialsProvider(fetch); FetchResult result = fetch.call(); if(result.getTrackingRefUpdates() != null && result.getTrackingRefUpdates().size() > 0) { this.logger.info("Fetched for remote " + label + " and found " + result.getTrackingRefUpdates().size() + " updates"); } return result; } catch (TransportException ex){ if(errorLogOnFailingFetch){ this.logger.error("Could not fetch remote for " + label + " remote: " + git .getRepository().getConfig().getString("remote", "origin", "url")); } else{ this.logger.warn("Could not fetch remote for " + label + " remote: " + git .getRepository().getConfig().getString("remote", "origin", "url")); } throw ex; } catch (Exception ex) { this.logger.warn("Could not fetch remote for " + label + " remote: " + git .getRepository().getConfig().getString("remote", "origin", "url")); return null; } }

Target:
private FetchResult fetch(Git git, String label) throws GitAPIException{ FetchCommand fetch = git.fetch(); fetch.setRemote("origin"); fetch.setTagOpt(TagOpt.FETCH_TAGS); setTimeout(fetch); try { setCredentialsProvider(fetch); FetchResult result = fetch.call(); if(result.getTrackingRefUpdates() != null && result.getTrackingRefUpdates().size() > 0) { logger.info("Fetched for remote " + label + " and found " + result.getTrackingRefUpdates().size() + " updates"); } return result; } catch (TransportException ex){ this.logger.error("Could not fetch remote for " + label + " remote: " + git .getRepository().getConfig().getString("remote", "origin", "url")); throw ex; } catch (Exception ex) { String message = "Could not fetch remote for " + label + " remote: " + git .getRepository().getConfig().getString("remote", "origin", "url"); warn(message, ex); return null; } }
Source:
public void migrate() throws Exception { ExecutorService executorService = Executors.newFixedThreadPool(configuration.getConcurrency()); DataStore targetStore = H2MigrateConfiguration.getDataStore(configuration.getTargetStoreConfiguration()); File logDirectory = configuration.getLogDirectory(); try (LogWriter netcdfWriter = new LogWriter(new File(logDirectory, "migrated.txt")); LogWriter h2Writer = new LogWriter(new File(logDirectory, "h2.txt"))) { LinkedHashSet<String> filePaths = new LinkedHashSet<>(); final String[] coverages; if (configuration.getSourceStoreConfiguration() != null) { coverages = getFilesFromStore(filePaths); } else { coverages = getFilesFromReader(filePaths); } List<Future> futures = new ArrayList<>(); for (String path : filePaths) { futures.add( executorService.submit( () -> migrateNetcdf( path, coverages, targetStore, netcdfWriter, h2Writer))); } for (Future future : futures) { try { future.get(); } catch (Exception e) { if (configuration.isFailureIgnored()) { LOGGER.log(Level.WARNING, "Failed to migrate file ", e); } else { throw new MigrationException("Failed to migrate file", e); } } } updateMosaicConfiguration(coverages); } finally { executorService.shutdown(); if (targetStore != null) targetStore.dispose(); } }

Target:
public void migrate() throws Exception { ExecutorService executorService = Executors.newFixedThreadPool(configuration.getConcurrency()); DataStore targetStore = H2MigrateConfiguration.getDataStore(configuration.getTargetStoreConfiguration()); File logDirectory = configuration.getLogDirectory(); try (LogWriter netcdfWriter = new LogWriter(new File(logDirectory, "migrated.txt")); LogWriter h2Writer = new LogWriter(new File(logDirectory, "h2.txt"))) { targetStore.getTypeNames(); LinkedHashSet<String> filePaths = new LinkedHashSet<>(); final String[] coverages; if (configuration.getSourceStoreConfiguration() != null) { coverages = getFilesFromStore(filePaths); } else { coverages = getFilesFromReader(filePaths); } Map<String, Future> futures = new HashMap<>(); for (String path : filePaths) { futures.put( path, executorService.submit( () -> migrateNetcdf( path, coverages, targetStore, netcdfWriter, h2Writer))); } for (Map.Entry<String, Future> entry : futures.entrySet()) { try { entry.getValue().get(); } catch (Exception e) { if (configuration.isFailureIgnored()) { LOGGER.log(Level.WARNING, "Failed to migrate file: " + entry.getKey(), e); } else { throw new MigrationException( "Failed to migrate file: " + entry.getKey(), e); } } } updateMosaicConfiguration(coverages); LOGGER.info("Migration complete with success!"); } finally { executorService.shutdown(); if (targetStore != null) targetStore.dispose(); } }
Source:
public void flush(boolean force) { if (useOptmizedPartitionedOutputOperator) { if (force) { for (int i = 0; i < partitionData.length; i++) { PartitionData target = partitionData[i]; target.flush(outputBuffer); } return; } } for (int partition = 0; partition < pageBuilders.length; partition++) { PageBuilder partitionPageBuilder = pageBuilders[partition]; if (!partitionPageBuilder.isEmpty() && (force || partitionPageBuilder.isFull())) { Page pagePartition = partitionPageBuilder.build(); partitionPageBuilder.reset(); List<SerializedPage> serializedPages = splitPage(pagePartition, DEFAULT_MAX_PAGE_SIZE_IN_BYTES).stream() .map(serde::serialize) .collect(toImmutableList()); outputBuffer.enqueue(lifespan, partition, serializedPages); pagesAdded.incrementAndGet(); rowsAdded.addAndGet(pagePartition.getPositionCount()); } } }

Target:
public void flush(boolean force) { for (int partition = 0; partition < pageBuilders.length; partition++) { PageBuilder partitionPageBuilder = pageBuilders[partition]; if (!partitionPageBuilder.isEmpty() && (force || partitionPageBuilder.isFull())) { Page pagePartition = partitionPageBuilder.build(); partitionPageBuilder.reset(); List<SerializedPage> serializedPages = splitPage(pagePartition, DEFAULT_MAX_PAGE_SIZE_IN_BYTES).stream() .map(serde::serialize) .collect(toImmutableList()); outputBuffer.enqueue(lifespan, partition, serializedPages); pagesAdded.incrementAndGet(); rowsAdded.addAndGet(pagePartition.getPositionCount()); } } }
Source:
protected <T extends Entity> void populateSpec(EntitySpec<T> spec) { String name, templateId=null, planId=null; if (template.isPresent()) { name = template.get().getName(); templateId = template.get().getId(); } else { name = (String)attrs.getStringKey("name"); } planId = (String)attrs.getStringKey("id"); if (planId==null) planId = (String) attrs.getStringKey(BrooklynCampConstants.PLAN_ID_FLAG); String impl = (String)attrs.getStringKey("impl"); if (!Strings.isBlank(impl)) { try { @SuppressWarnings("unchecked") Class<? extends T> clazz = (Class<? extends T>) mgmt.getCatalog().getRootClassLoader().loadClass(impl); spec.impl(clazz); } catch (ClassNotFoundException e) { throw Exceptions.propagate(e); } } if (!Strings.isBlank(name)) spec.displayName(name); if (templateId != null) spec.configure(BrooklynCampConstants.TEMPLATE_ID, templateId); if (planId != null) spec.configure(BrooklynCampConstants.PLAN_ID, planId); List<Location> childLocations = new BrooklynYamlLocationResolver(mgmt).resolveLocations(attrs.getAllConfig(), true); if (childLocations != null) spec.locations(childLocations); decorateSpec(spec); }

Target:
protected <T extends Entity> void populateSpec(EntitySpec<T> spec) { String name, templateId=null, planId=null; if (template.isPresent()) { name = template.get().getName(); templateId = template.get().getId(); } else { name = (String)attrs.getStringKey("name"); } planId = (String)attrs.getStringKey("id"); if (planId==null) planId = (String) attrs.getStringKey(BrooklynCampConstants.PLAN_ID_FLAG); if (!Strings.isBlank(name)) spec.displayName(name); if (templateId != null) spec.configure(BrooklynCampConstants.TEMPLATE_ID, templateId); if (planId != null) spec.configure(BrooklynCampConstants.PLAN_ID, planId); List<Location> childLocations = new BrooklynYamlLocationResolver(mgmt).resolveLocations(attrs.getAllConfig(), true); if (childLocations != null) spec.locations(childLocations); decorateSpec(spec); }
Source:
private JFreeChart createDebugEventGanttChart() { eventStatistics = new EventStatistics( InitializationManager.getInstance().getDebugEventManager(), selectedDebugInterval); final GanttCategoryDataset dataset = eventStatistics .createDebugEventGanttChartDataset(); final JFreeChart chart = ChartFactory.createGanttChart( "Debug Events During Selected Debug Interval", "Event", "Time", dataset, false, true, false); CategoryPlot plot = chart.getCategoryPlot(); ValueAxis axis = plot.getRangeAxis(); axis.setRangeWithMargins(selectedDebugInterval.getStart().getTime(), selectedDebugInterval.getEnd().getTime()); plot.setRenderer(new WatchDogGanttRenderer()); return chart; }

Target:
private JFreeChart createDebugEventGanttChart() { eventStatistics = new EventStatistics( InitializationManager.getInstance().getDebugEventManager(), selectedDebugInterval); GanttCategoryDataset dataset = eventStatistics .createDebugEventGanttChartDataset(); JFreeChart chart = ChartFactory.createGanttChart( "Debug Events During Selected Debug Interval", "Event", "Time", dataset, false, true, false); CategoryPlot plot = chart.getCategoryPlot(); ValueAxis axis = plot.getRangeAxis(); axis.setRangeWithMargins(selectedDebugInterval.getStart().getTime(), selectedDebugInterval.getEnd().getTime()); plot.setRenderer(new WatchDogGanttRenderer()); return chart; }
Source:
private ArrayList<String> getTestCasesFileNamesWithPaths(String testFileFolder) { ArrayList<String> fileNamesWithPaths = new ArrayList<>(); File folder = new File(testFileFolder); File[] listOfFiles = folder.listFiles(); if (listOfFiles != null) { for (File file : listOfFiles) { String filename = file.getName(); if (filename.endsWith(".xml") || filename.endsWith(".XML")) { fileNamesWithPaths.add(testFileFolder + "/" + filename); } } } return fileNamesWithPaths; }

Target:
private ArrayList<String> getTestCasesFileNamesWithPaths(String testFileFolder) { ArrayList<String> fileNamesWithPaths = new ArrayList<>(); File folder = new File(testFileFolder); File[] listOfFiles = folder.listFiles(); if (listOfFiles != null) { for (File file : listOfFiles) { String filename = file.getName(); if (filename.endsWith(".xml") || filename.endsWith(".XML")) { fileNamesWithPaths.add(testFileFolder + File.separator + filename); } } } return fileNamesWithPaths; }
Source:
public void setup() { db = dbRule.getGraphDatabaseAPI(); if ( withIndex ) { Neo4jMatchers.createIndex( db, LABEL, keys ); Neo4jMatchers.createIndex( db, LABEL, keys[0] ); } }

Target:
public void setup() { db = dbRule.getGraphDatabaseAPI(); if ( withIndex ) { try ( org.neo4j.graphdb.Transaction tx = db.beginTx() ) { db.schema().indexFor( LABEL ).on( keys[0] ).create(); IndexCreator indexCreator = db.schema().indexFor( LABEL ); for ( String key : keys ) { indexCreator = indexCreator.on( key ); } indexCreator.create(); tx.success(); } try ( org.neo4j.graphdb.Transaction tx = db.beginTx() ) { db.schema().awaitIndexesOnline( 5, TimeUnit.MINUTES ); tx.success(); } } }
Source:
public static int nextPowerOf2(int v) { A.ensure(v >= 0, "v must not be negative"); if (v == 0) return 1; v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }

Target:
public static int nextPowerOf2(int v) { A.ensure(v >= 0, "v must not be negative"); if (v == 0) return 1; return 1 << (32 - Integer.numberOfLeadingZeros(v - 1)); }
Source:
public ResponseEntity<?> deleteStorage(@PathVariable("id") final String id, final NativeWebRequest request) { if (!adminService.isAdmin(AuthorizationService.Operation.WRITE)) { return status(FORBIDDEN).build(); } storageService.deleteStorage(id); return status(NO_CONTENT).build(); }

Target:
public ResponseEntity<?> deleteStorage(@PathVariable("id") final String id, final NativeWebRequest request) throws PluginException, DbWriteOperationsBlockedException, NoSuchStorageException, StorageIsUsedException, InternalNakadiException{ if (!adminService.isAdmin(AuthorizationService.Operation.WRITE)) { return status(FORBIDDEN).build(); } storageService.deleteStorage(id); return status(NO_CONTENT).build(); }
Source:
public void writeTo(AsyncWritableChannel channel, Callback<Long> callback) { throw new NotImplementedException(); }

Target:
public void writeTo(AsyncWritableChannel channel, Callback<Long> callback) { throw new UnsupportedOperationException(); }
Source:
@Override public boolean tryFinishEviction(GridDhtLocalPartition part) { ctx.database().checkpointReadLock(); try { lock.writeLock().lock(); try { if (stopping) return false; part.finishEviction(); if (part.state() != EVICTED) return false; long seq = this.updateSeq.incrementAndGet(); assert lastTopChangeVer.initialized() : lastTopChangeVer; updateLocal(part.id(), part.state(), seq, lastTopChangeVer); consistencyCheck(); grp.onPartitionEvicted(part.id()); try { grp.offheap().destroyCacheDataStore(part.dataStore()); } catch (IgniteCheckedException e) { log.error("Unable to destroy cache data store on partition eviction [id=" + part.id() + "]", e); } part.clearDeferredDeletes(); List<GridDhtLocalPartition> parts = localPartitions(); int renting = 0; for (GridDhtLocalPartition part0 : parts) { if (part0.state() == RENTING) renting++; } if (renting == 0) ctx.exchange().scheduleResendPartitions(); return true; } finally { lock.writeLock().unlock(); } } finally { ctx.database().checkpointReadUnlock(); } }

Target:
@Override public boolean tryFinishEviction(GridDhtLocalPartition part) { ctx.database().checkpointReadLock(); try { lock.writeLock().lock(); try { if (stopping) return false; part.finishEviction(); if (part.state() != EVICTED) return false; long seq = this.updateSeq.incrementAndGet(); assert lastTopChangeVer.initialized() : lastTopChangeVer; updateLocal(part.id(), part.state(), seq, lastTopChangeVer); consistencyCheck(); grp.onPartitionEvicted(part.id()); try { grp.offheap().destroyCacheDataStore(part.dataStore()); } catch (IgniteCheckedException e) { log.error("Unable to destroy cache data store on partition eviction [id=" + part.id() + "]", e); } part.clearDeferredDeletes(); List<GridDhtLocalPartition> parts = localPartitions(); boolean renting = false; for (GridDhtLocalPartition part0 : parts) { if (part0.state() == RENTING) { renting = true; break; } } if (!renting) ctx.exchange().scheduleResendPartitions(); return true; } finally { lock.writeLock().unlock(); } } finally { ctx.database().checkpointReadUnlock(); } }
Source:
public Pair<Long,Float> next() { if ( hasNext() ) { return Pair.of( currentIterator().next(), currentIterator().currentScore() ); } else { throw new NoSuchElementException( "The iterator is exhausted" ); } }

Target:
public ScoreEntry next() { if ( hasNext() ) { return new ScoreEntry( iterator.next(), iterator.currentScore() ); } else { throw new NoSuchElementException( "The iterator is exhausted" ); } }
Source:
private boolean isHostHealthy(InetSocketAddress host) { try { CassandraClientPoolingContainer testingContainer = currentPools.get(host); testingContainer.runWithPooledResource(describeRing); testingContainer.runWithPooledResource(validatePartitioner); return true; } catch (Exception e) { log.warn("We tried to add back into the pool, but got an exception" + " that caused us to distrust this host further. Exception message was: : {}", SafeArg.of("host", host), SafeArg.of("exceptionClass", e.getClass().getTypeName()), UnsafeArg.of("exceptionMessage", e.getMessage())); return false; } }

Target:
private boolean isHostHealthy(InetSocketAddress host) { try { CassandraClientPoolingContainer testingContainer = currentPools.get(host); testingContainer.runWithPooledResource(describeRing); testingContainer.runWithPooledResource(validatePartitioner); return true; } catch (Exception e) { log.warn("We tried to add back into the pool, but got an exception" + " that caused us to distrust this host further. Exception message was: : {}", SafeArg.of("host", host), SafeArg.of("exceptionClass", e.getClass().getCanonicalName()), UnsafeArg.of("exceptionMessage", e.getMessage())); return false; } }
Source:
private void setAttributeOptionsForProduct(TaskAttribute taskAttribute, Product actualProduct) { taskAttribute.clearOptions(); if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey())) { boolean found = false; String actualValue = taskAttribute.getValue(); for (SortableActiveEntry SortableActiveEntry : actualProduct.getMilestones()) { if (SortableActiveEntry.isActive()) { taskAttribute.putOption(SortableActiveEntry.getName(), SortableActiveEntry.getName()); if (!found) { found = actualValue.equals(SortableActiveEntry.getName()); } } } if (!found) { taskAttribute.setValue(""); } } else if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().VERSION.getKey())) { boolean found = false; String actualValue = taskAttribute.getValue(); for (SortableActiveEntry SortableActiveEntry : actualProduct.getVersions()) { if (SortableActiveEntry.isActive()) { taskAttribute.putOption(SortableActiveEntry.getName(), SortableActiveEntry.getName()); if (!found) { found = actualValue.equals(SortableActiveEntry.getName()); } } } if (!found) { taskAttribute.setValue(""); } } else if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().COMPONENT.getKey())) { boolean found = false; String actualValue = taskAttribute.getValue(); for (Component component : actualProduct.getComponents()) { if (component.isActive()) { taskAttribute.putOption(component.getName(), component.getName()); if (!found) { found = actualValue.equals(component.getName()); } } } if (!found) { taskAttribute.setValue(""); } } }

Target:
private void setAttributeOptionsForProduct(TaskAttribute taskAttribute, Product actualProduct) { taskAttribute.clearOptions(); if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey())) { internalSetAttributeOptions(taskAttribute, actualProduct.getMilestones()); } else if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().VERSION.getKey())) { internalSetAttributeOptions(taskAttribute, actualProduct.getVersions()); } else if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().COMPONENT.getKey())) { internalSetAttributeOptions(taskAttribute, actualProduct.getComponents()); } }
Source:
private int index(Iterator<Item> iterator) throws DSpaceSolrIndexerException { try { int i = 0; SolrServer server = solrServerResolver.getServer(); while (iterator.hasNext()) { try { Item item = iterator.next(); System.out.println("indexing item " + item.getID()); server.add(this.index(item)); context.uncacheEntity(item); } catch (SQLException | MetadataBindException | ParseException | XMLStreamException | WritingXmlException ex) { log.error(ex.getMessage(), ex); } i++; if (i % 100 == 0) System.out.println(i + " items imported so far..."); } System.out.println("Total: " + i + " items"); server.commit(); return i; } catch (SolrServerException | IOException ex) { throw new DSpaceSolrIndexerException(ex.getMessage(), ex); } }

Target:
private int index(Iterator<Item> iterator) throws DSpaceSolrIndexerException { try { int i = 0; SolrServer server = solrServerResolver.getServer(); while (iterator.hasNext()) { try { Item item = iterator.next(); server.add(this.index(item)); context.uncacheEntity(item); } catch (SQLException | MetadataBindException | ParseException | XMLStreamException | WritingXmlException ex) { log.error(ex.getMessage(), ex); } i++; if (i % 100 == 0) System.out.println(i + " items imported so far..."); } System.out.println("Total: " + i + " items"); server.commit(); return i; } catch (SolrServerException | IOException ex) { throw new DSpaceSolrIndexerException(ex.getMessage(), ex); } }
Source:
private PrimitiveLongIterator queryIndexOrEmpty( IndexReader reader, IndexQuery[] query ) { PrimitiveLongIterator indexedNodeIds; try { indexedNodeIds = reader.query( query ); } catch ( IndexNotApplicableKernelException e ) { indexedNodeIds = PrimitiveLongCollections.emptyIterator(); } indexedNodeIds = LookupFilter.exactIndexMatches( propertyReader, indexedNodeIds, query ); return indexedNodeIds; }

Target:
private PrimitiveLongIterator queryIndexOrEmpty( IndexReader reader, IndexQuery[] query ) { PrimitiveLongIterator indexedNodeIds; try { indexedNodeIds = reader.query( query ); } catch ( IndexNotApplicableKernelException e ) { throw new RuntimeException( format( "Consistency checking error: index provider does not support exact query %s", Arrays.toString( query ) ), e ); } indexedNodeIds = LookupFilter.exactIndexMatches( propertyReader, indexedNodeIds, query ); return indexedNodeIds; }
Source:
private String getMonthCharacters(DateGrain dateGrain, String label) { if (label == null) { return null; } int labelCPCount = label.codePointCount(0, label.length()); switch (dateGrain) { case DAY: case WEEK: return label.substring(labelCPCount - 4, labelCPCount - 2); case MONTH: return label.substring(labelCPCount - 2, labelCPCount); default: break; } return null; }

Target:
private String getMonthCharacters(DateGrain dateGrain, String label) { switch (dateGrain) { case DAY: case WEEK: return label.substring(label.length() - 4, label.length() - 2); case MONTH: return label.substring(label.length() - 2); default: break; } return null; }
Source:
private static ArrayList<RiakTsPB.TsColumnDescription> parseColumnDescriptions(OtpInputStream is) throws OtpErlangDecodeException { final int colNameCount = is.read_list_head(); final String[] columnNames = new String[colNameCount]; for (int colNameIdx = 0; colNameIdx < colNameCount; colNameIdx++) { final String colName = new String(is.read_binary(), StandardCharsets.UTF_8); columnNames[colNameIdx] = colName; final boolean isLastRow = colNameIdx + 1 == colNameCount; if (isLastRow) { is.read_nil(); } } final int colTypeCount = is.read_list_head(); assert (colNameCount == colTypeCount); final String[] columnTypes = new String[colTypeCount]; for (int colTypeIdx = 0; colTypeIdx < colTypeCount; colTypeIdx++) { final String colType = is.read_atom(); columnTypes[colTypeIdx] = colType; final boolean isLastRow = colTypeIdx + 1 == colNameCount; if (isLastRow) { is.read_nil(); } } final ArrayList<RiakTsPB.TsColumnDescription> columnDescriptions = new ArrayList<>(colNameCount); for (int colDescIdx = 0; colDescIdx < colNameCount; colDescIdx++) { final RiakTsPB.TsColumnDescription desc = RiakTsPB.TsColumnDescription.newBuilder().setName( ByteString.copyFromUtf8(columnNames[colDescIdx])).setType(RiakTsPB.TsColumnType.valueOf( columnTypes[colDescIdx].toUpperCase(Locale.US))).build(); columnDescriptions.add(desc); } return columnDescriptions; }

Target:
private static ArrayList<RiakTsPB.TsColumnDescription> parseColumnDescriptions(OtpInputStream is) throws OtpErlangDecodeException { final int colNameCount = is.read_list_head(); final String[] columnNames = new String[colNameCount]; for (int colNameIdx = 0; colNameIdx < colNameCount; colNameIdx++) { final String colName = new String(is.read_binary(), StandardCharsets.UTF_8); columnNames[colNameIdx] = colName; } if (colNameCount > 0) { is.read_nil(); } final int colTypeCount = is.read_list_head(); assert (colNameCount == colTypeCount); final String[] columnTypes = new String[colTypeCount]; for (int colTypeIdx = 0; colTypeIdx < colTypeCount; colTypeIdx++) { final String colType = is.read_atom(); columnTypes[colTypeIdx] = colType; } if (colTypeCount > 0) { is.read_nil(); } final ArrayList<RiakTsPB.TsColumnDescription> columnDescriptions = new ArrayList<>(colNameCount); for (int colDescIdx = 0; colDescIdx < colNameCount; colDescIdx++) { final RiakTsPB.TsColumnDescription.Builder descBuilder = RiakTsPB.TsColumnDescription.newBuilder(); descBuilder.setName(ByteString.copyFromUtf8(columnNames[colDescIdx])); descBuilder.setType(RiakTsPB.TsColumnType.valueOf(columnTypes[colDescIdx].toUpperCase(Locale.US))); columnDescriptions.add(descBuilder.build()); } return columnDescriptions; }
Source:
public Iterable<String> getColNames() { return Iterables.transform(fields, new Function<Field, String>() { @Override @Nullable public String apply(Field arg0) { return arg0.getSqlName(); } }); }

Target:
public Iterable<String> getColNames() { return Iterables.transform(fields, new Function<Field, String>() { @Override @Nullable public String apply(@Nullable Field arg0) { return arg0 != null ? arg0.getSqlName() : null; } }); }
Source:
public long getLength() throws IOException { if (size == null) { try { size = getConnection().getContentLengthLong(); } catch (IOException ex) { size = -1L; throw ex; } } return size; }

Target:
public long getLength() throws IOException { if (size == null) { try { size = getConnection().getContentLengthLong(); } catch (IOException ex) { size = -1L; LOG.error("Exception while getting length for url connection {}",getConnection().getURL().toExternalForm(),ex); throw ex; } } return size; }
Source:
protected final void runLeaf(Statement statement, Description description, RunNotifier notifier) { EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); eachNotifier.fireTestStarted(); try { runLeafIsolated(statement); } catch (AssumptionViolatedException e) { eachNotifier.addFailedAssumption(e); } catch (Throwable e) { eachNotifier.addFailure(e); } finally { eachNotifier.fireTestFinished(); } }

Target:
protected final void runLeaf(Statement statement, Description description, RunNotifier notifier) { EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); eachNotifier.fireTestStarted(); try { statement.evaluate(); } catch (AssumptionViolatedException e) { eachNotifier.addFailedAssumption(e); } catch (Throwable e) { eachNotifier.addFailure(e); } finally { eachNotifier.fireTestFinished(); } }