auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void runInContext() { Connect conn = null; try { conn = LibvirtConnection.getConnection(); diskStatusMap.clear(); File[] iscsiVolumes = new File(ISCSI_PATH_PREFIX).listFiles(); if (iscsiVolumes == null || iscsiVolumes.length == 0) { s_logger.debug("No iscsi sessions found for cleanup"); return; } for( File v : iscsiVolumes) { if (isIscsiDisk(v.getAbsolutePath())) { s_logger.debug("found iscsi disk by cleanup thread, marking inactive:" + v.getAbsolutePath()); diskStatusMap.put(v.getAbsolutePath(), false); } } int[] domains = conn.listDomains(); s_logger.debug(String.format("found %d domains", domains.length)); for (int domId : domains) { Domain dm = conn.domainLookupByID(domId); final String domXml = dm.getXMLDesc(0); final LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser(); parser.parseDomainXML(domXml); List<LibvirtVMDef.DiskDef> disks = parser.getDisks(); for (final LibvirtVMDef.DiskDef disk : disks) { if (diskStatusMap.containsKey(disk.getDiskPath())) { diskStatusMap.put(disk.getDiskPath(), true); s_logger.debug("active disk found by cleanup thread" + disk.getDiskPath()); } } } for (String diskPath : diskStatusMap.keySet()) { if (!diskStatusMap.get(diskPath)) { if (Files.exists(Paths.get(diskPath))) { try { s_logger.info("Cleaning up disk " + diskPath); iscsiStorageAdaptor.disconnectPhysicalDiskByPath(diskPath); } catch (Exception e) { s_logger.warn("[ignored] Error cleaning up " + diskPath, e); } } } } } catch (LibvirtException e) { s_logger.warn("[ignored] Error trying to cleanup ", e); } }

Target:
protected void runInContext() { Connect conn = null; try { conn = LibvirtConnection.getConnection(); File[] iscsiVolumes = new File(ISCSI_PATH_PREFIX).listFiles(); if (iscsiVolumes == null || iscsiVolumes.length == 0) { s_logger.debug("No iscsi sessions found for cleanup"); return; } initializeDiskStatusMap(iscsiVolumes); updateDiskStatusMapWithInactiveIscsiSessions(conn); disconnectInactiveSessions(); } catch (LibvirtException e) { s_logger.warn("[ignored] Error trying to cleanup ", e); } }
Source:
protected SimpleKeyManagerFactory(String name) { super(CURRENT_SPI.get(), PROVIDER, name); CURRENT_SPI.get().init(this); CURRENT_SPI.remove(); if (name == null) { throw new NullPointerException("name"); } }

Target:
protected SimpleKeyManagerFactory(String name) { super(CURRENT_SPI.get(), PROVIDER, ObjectUtil.checkNotNull(name, "name")); CURRENT_SPI.get().init(this); CURRENT_SPI.remove(); }
Source:
@Override public boolean contains(Object o) { if (o == null) throw new UnsupportedOperationException("Null values are not supported!"); return contains((int)o); }

Target:
@Override public boolean contains(Object o) { if (o == null) throw new NullPointerException("Null values are not supported!"); return contains((int)o); }
Source:
public static String callProcOverJSONRaw(String varString, final int expectedCode) throws Exception { URI jsonAPIURI = URI.create("http://localhost:8095/api/1.0/"); try (CloseableHttpClient httpclient = HttpClients.createDefault()) { HttpPost post = new HttpPost(jsonAPIURI); RequestConfig rc = RequestConfig.copy(RequestConfig.DEFAULT).setExpectContinueEnabled(true).build(); post.setProtocolVersion(HttpVersion.HTTP_1_1); post.setConfig(rc); post.setEntity(new StringEntity(varString, ContentType.APPLICATION_FORM_URLENCODED)); ResponseHandler<String> rh = new ResponseHandler<String>() { @Override public String handleResponse(final HttpResponse response) throws ClientProtocolException, IOException { int status = response.getStatusLine().getStatusCode(); assertEquals(expectedCode, status); if ((status >= 200 && status < 300) || status == 400) { HttpEntity entity = response.getEntity(); return entity != null ? EntityUtils.toString(entity) : null; } return null; } }; return httpclient.execute(post,rh); } }

Target:
public static String callProcOverJSONRaw(String varString, final int expectedCode) throws Exception { URI jsonAPIURI = URI.create("http://localhost:8095/api/1.0/"); try (CloseableHttpClient httpclient = HttpClients.createDefault()) { HttpPost post = new HttpPost(jsonAPIURI); RequestConfig rc = RequestConfig.copy(RequestConfig.DEFAULT).setExpectContinueEnabled(true).build(); post.setProtocolVersion(HttpVersion.HTTP_1_1); post.setConfig(rc); post.setEntity(new StringEntity(varString, utf8ApplicationFormUrlEncoded)); ResponseHandler<String> rh = new ResponseHandler<String>() { @Override public String handleResponse(final HttpResponse response) throws ClientProtocolException, IOException { int status = response.getStatusLine().getStatusCode(); assertEquals(expectedCode, status); if ((status >= 200 && status < 300) || status == 400) { HttpEntity entity = response.getEntity(); return entity != null ? EntityUtils.toString(entity) : null; } return null; } }; return httpclient.execute(post,rh); } }
Source:
private int findUnusedPort() { synchronized (processLock) { int port = config.getStartPort(); int maxPortSoFar = -1; for (ProcessHolder processHolder : processes) { if (processHolder.port > maxPortSoFar) { maxPortSoFar = processHolder.port; } if (processHolder.port == port) { port = maxPortSoFar + 1; } } return port; } }

Target:
private int findUnusedPort() { synchronized (tasks) { int port = config.getStartPort(); int maxPortSoFar = -1; for (TaskInfo taskInfo : tasks.values()) { if (taskInfo.processHolder != null) { if (taskInfo.processHolder.port > maxPortSoFar) { maxPortSoFar = taskInfo.processHolder.port; } if (taskInfo.processHolder.port == port) { port = maxPortSoFar + 1; } } } return port; } }
Source:
public static <T> T newInstance(Class<T> theClass, Configuration conf, Class<?>[] argTypes, Object ... values) { T result; try { Constructor<T> meth = (Constructor<T>) CONSTRUCTOR_CACHE.get(theClass); if (meth == null) { meth = theClass.getDeclaredConstructor(argTypes); meth.setAccessible(true); CONSTRUCTOR_CACHE.put(theClass, meth); } result = meth.newInstance(values); } catch (Exception e) { throw new RuntimeException(e); } setConf(result, conf); return result; }

Target:
public static <T> T newInstance(Class<T> theClass, Configuration conf, Class<?>[] argTypes, Object ... values) { T result; if (argTypes.length != values.length) { throw new IllegalArgumentException(argTypes.length + " parameters are required but " + values.length + " arguments are provided"); } try { Constructor<T> meth = (Constructor<T>) CONSTRUCTOR_CACHE.get(theClass); if (meth == null) { meth = theClass.getDeclaredConstructor(argTypes); meth.setAccessible(true); CONSTRUCTOR_CACHE.put(theClass, meth); } result = meth.newInstance(values); } catch (Exception e) { throw new RuntimeException(e); } setConf(result, conf); return result; }
Source:
public String getColumnText(Object element, int columnIndex) { if (element instanceof TimeGraphEntry) { TimeGraphEntry entry = (TimeGraphEntry) element; ITimeGraphState function = fFunctions.get(entry.getModel().getId()); if (columnIndex == 0 && function != null) { return function.getLabel(); } else if (columnIndex == 0 && ((CallStackEntryModel) entry.getModel()).getStackLevel() <= 0) { return entry.getName(); } else if (columnIndex == 1 && function != null) { return Integer.toString(((CallStackEntryModel) entry.getModel()).getStackLevel()); } else if (columnIndex == 2 && function != null) { return TmfTimestampFormat.getDefaulTimeFormat().format(function.getStartTime()); } else if (columnIndex == 3 && function != null) { return TmfTimestampFormat.getDefaulTimeFormat().format(function.getStartTime() + function.getDuration()); } else if (columnIndex == 4 && function != null) { return TmfTimestampFormat.getDefaulIntervalFormat().format(function.getDuration()); } } return ""; }

Target:
public String getColumnText(Object element, int columnIndex) { if (element instanceof TimeGraphEntry) { TimeGraphEntry entry = (TimeGraphEntry) element; ITimeGraphEntryModel model = entry.getModel(); ITimeGraphState function = fFunctions.get(model.getId()); if (columnIndex == 0 && function != null) { return function.getLabel(); } else if (columnIndex == 0 && (!(model instanceof CallStackEntryModel) || (model instanceof CallStackEntryModel && ((CallStackEntryModel) model).getStackLevel() <= 0))) { return entry.getName(); } else if (columnIndex == 1 && function != null && model instanceof CallStackEntryModel) { return Integer.toString(((CallStackEntryModel) model).getStackLevel()); } else if (columnIndex == 2 && function != null) { return TmfTimestampFormat.getDefaulTimeFormat().format(function.getStartTime()); } else if (columnIndex == 3 && function != null) { return TmfTimestampFormat.getDefaulTimeFormat().format(function.getStartTime() + function.getDuration()); } else if (columnIndex == 4 && function != null) { return TmfTimestampFormat.getDefaulIntervalFormat().format(function.getDuration()); } } return ""; }
Source:
private void logMissingTranslation(String filePath, String fileName) { log(0, MSG_KEY_MISSING_TRANSLATION_FILE, fileName); fireErrors(filePath); }

Target:
private void logMissingTranslation(String filePath, String fileName) { log(0, MSG_KEY_MISSING_TRANSLATION_FILE, fileName); fireErrors(filePath); getMessageDispatcher().fireFileFinished(filePath); }
Source:
private Set<ObjectId> listRefLogObjects(Ref ref, long minTime) throws IOException { ReflogReader reflogReader = repo.getReflogReader(ref.getName()); if (reflogReader == null) { throw new IOException(); } List<ReflogEntry> rlEntries = reflogReader .getReverseEntries(); if (rlEntries == null || rlEntries.isEmpty()) return Collections.<ObjectId> emptySet(); Set<ObjectId> ret = new HashSet<ObjectId>(); for (ReflogEntry e : rlEntries) { if (e.getWho().getWhen().getTime() < minTime) break; ObjectId newId = e.getNewId(); if (newId != null && !ObjectId.zeroId().equals(newId)) ret.add(newId); ObjectId oldId = e.getOldId(); if (oldId != null && !ObjectId.zeroId().equals(oldId)) ret.add(oldId); } return ret; }

Target:
private Set<ObjectId> listRefLogObjects(Ref ref, long minTime) throws IOException { ReflogReader reflogReader = repo.getReflogReader(ref.getName()); if (reflogReader == null) { return Collections.emptySet(); } List<ReflogEntry> rlEntries = reflogReader .getReverseEntries(); if (rlEntries == null || rlEntries.isEmpty()) return Collections.<ObjectId> emptySet(); Set<ObjectId> ret = new HashSet<ObjectId>(); for (ReflogEntry e : rlEntries) { if (e.getWho().getWhen().getTime() < minTime) break; ObjectId newId = e.getNewId(); if (newId != null && !ObjectId.zeroId().equals(newId)) ret.add(newId); ObjectId oldId = e.getOldId(); if (oldId != null && !ObjectId.zeroId().equals(oldId)) ret.add(oldId); } return ret; }
Source:
protected final void configure() { if (alreadyBound) { if (!boundType.equals(getClass())) { throw new RuntimeException("You are trying to use more than one DispatchAsync implementation. " + boundType.getName() + " was already installed."); } } else { alreadyBound = true; boundType = getClass(); bind(ClientActionHandlerRegistry.class).to(builder.clientActionHandlerRegistryType).asEagerSingleton(); bind(ExceptionHandler.class).to(builder.exceptionHandlerType); bind(SecurityCookieAccessor.class).to(builder.sessionAccessorType); bind(DispatchHooks.class).to(builder.getDispatchHooks()).in(Singleton.class); configureDispatch(); } }

Target:
protected final void configure() { if (alreadyBound) { if (!boundType.equals(getClass())) { throw new RuntimeException("You are trying to use more than one DispatchAsync implementation. " + boundType.getName() + " was already installed."); } } else { alreadyBound = true; boundType = getClass(); bind(ClientActionHandlerRegistry.class).to(builder.clientActionHandlerRegistryType).asEagerSingleton(); bind(ExceptionHandler.class).to(builder.exceptionHandlerType); bind(SecurityCookieAccessor.class).to(builder.sessionAccessorType); bind(DispatchHooks.class).to(builder.dispatchHooks).in(Singleton.class); configureDispatch(); } }
Source:
public void copyPreviousWalFiles(List<PreviousWALDetails> parentWals, Set<PreviousWALDetails> alreadyCopiedWals) { try { PreviousWALDetails parentWal = parentWals.iterator().next(); for (long i = parentWal.getStartPosition().fileId; i <= parentWal.getEndPosition().fileId; i++) { DataInputStream in = bfs.getInputStream(parentWal.getWalKey(), WAL_FILE_PREFIX + i); DataOutputStream out = bfs.getOutputStream(walKey, WAL_FILE_PREFIX + i); IOUtils.copyLarge(in, out); in.close(); out.close(); } alreadyCopiedWals.add(parentWal); parentWals.clear(); } catch (IOException e) { DTThrowable.wrapIfChecked(e); } }

Target:
public void copyPreviousWalFiles(List<PreviousWALDetails> parentWals, Set<PreviousWALDetails> alreadyCopiedWals) { try { PreviousWALDetails parentWal = parentWals.iterator().next(); for (long i = parentWal.getStartPosition().fileId; i <= parentWal.getEndPosition().fileId; i++) { DataInputStream in = bfs.getInputStream(parentWal.getWalKey(), WAL_FILE_PREFIX + i); DataOutputStream out = bfs.getOutputStream(walKey, WAL_FILE_PREFIX + i); IOUtils.copyLarge(in, out); in.close(); out.close(); } } catch (IOException e) { throw Throwables.propagate(e); } }
Source:
public void bridgeDeleteVxLanPort(UUID bridgeId, IPv4Addr mgmtIp) throws SerializationException, StateAccessException { Bridge b = bridgesGet(bridgeId); if (b == null || b.getVxLanPortIds() == null) { return; } for (UUID portId : b.getVxLanPortIds()) { VxLanPort p = (VxLanPort)portsGet(portId); if (p.getMgmtIpAddr().equals(mgmtIp)) { bridgeDeleteVxLanPort(p); return; } } }

Target:
public void bridgeDeleteVxLanPort(UUID bridgeId, IPv4Addr mgmtIp) throws SerializationException, StateAccessException { Bridge b = bridgesGet(bridgeId); if (b == null) { return; } for (UUID portId : b.getVxLanPortIds()) { VxLanPort p = (VxLanPort)portsGet(portId); if (p.getMgmtIpAddr().equals(mgmtIp)) { bridgeDeleteVxLanPort(p); return; } } }
Source:
protected File getFolder(final String folderPath) { return getFolder(new File(folderPath)); }

Target:
private File getFolder(final String folderPath) { return getFolder(new File(folderPath)); }
Source:
public void execute(IProgressMonitor monitor) throws CoreException { IWorkspaceRunnable action = new IWorkspaceRunnable() { @Override public void run(IProgressMonitor actMonitor) throws CoreException { if (commitAll) commitAll(); else if (amending || commitFileList != null && commitFileList.size() > 0 || commitIndex) { SubMonitor progress = SubMonitor.convert(actMonitor, CoreText.CommitOperation_PerformingCommit, 1); addUntracked(); commit(); progress.worked(1); } else if (commitWorkingDirChanges) { } else { } } }; ResourcesPlugin.getWorkspace().run(action, getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor); }

Target:
public void execute(IProgressMonitor monitor) throws CoreException { IWorkspaceRunnable action = new IWorkspaceRunnable() { @Override public void run(IProgressMonitor actMonitor) throws CoreException { if (commitAll) commitAll(); else if (amending || commitFileList != null && commitFileList.size() > 0 || commitIndex) { SubMonitor progress = SubMonitor.convert(actMonitor); progress.setTaskName( CoreText.CommitOperation_PerformingCommit); addUntracked(); commit(); } else if (commitWorkingDirChanges) { } else { } } }; ResourcesPlugin.getWorkspace().run(action, getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor); }
Source:
public void marshal(ITypeMarshalBuffer buffer) throws CoreException { short firstBytes = ITypeMarshalBuffer.FUNCTION_TYPE; int len= parameters.length & 0xffff; int codedLen= len * ITypeMarshalBuffer.FLAG1; if (codedLen < ITypeMarshalBuffer.FLAG4) { firstBytes |= codedLen; buffer.putShort(firstBytes); } else { firstBytes |= ITypeMarshalBuffer.FLAG4; buffer.putShort(firstBytes); buffer.putInt(len); } buffer.marshalType(returnType); for (int i = 0; i < len; i++) { buffer.marshalType(parameters[i]); } }

Target:
public void marshal(ITypeMarshalBuffer buffer) throws CoreException { short firstBytes = ITypeMarshalBuffer.FUNCTION_TYPE; int len= parameters.length & 0xffff; int codedLen= len * ITypeMarshalBuffer.FIRST_FLAG; if (codedLen < ITypeMarshalBuffer.LAST_FLAG) { firstBytes |= codedLen; buffer.putShort(firstBytes); } else { firstBytes |= ITypeMarshalBuffer.LAST_FLAG; buffer.putShort(firstBytes); buffer.putInt(len); } buffer.marshalType(returnType); for (int i = 0; i < len; i++) { buffer.marshalType(parameters[i]); } }
Source:
public void runServer() throws Exception { TraceUtil.enableServerTraces(getHostname(), applicationName, context.getConfiguration()); final AtomicReference<Throwable> err = new AtomicReference<>(); Thread service = new Thread(this, applicationName); service.setUncaughtExceptionHandler((thread, exception) -> { err.set(exception); }); service.start(); service.join(); Throwable thrown = err.get(); if (thrown != null) { if (thrown instanceof Error) { throw (Error) thrown; } if (thrown instanceof Exception) { throw (Exception) thrown; } throw new RuntimeException("Weird throwable type thrown", thrown); } }

Target:
public void runServer() throws Exception { final AtomicReference<Throwable> err = new AtomicReference<>(); Thread service = new Thread(this, applicationName); service.setUncaughtExceptionHandler((thread, exception) -> { err.set(exception); }); service.start(); service.join(); Throwable thrown = err.get(); if (thrown != null) { if (thrown instanceof Error) { throw (Error) thrown; } if (thrown instanceof Exception) { throw (Exception) thrown; } throw new RuntimeException("Weird throwable type thrown", thrown); } }
Source:
MigrationZipFile newZipFileFor(Path exportDirectory) { Validate.notNull(exportDirectory, "invalid null export file"); try { List<Path> exportFilePaths = Files.find( exportDirectory, 1, (path, basicFileAttributes) -> path.toFile() .getName() .matches( productBranding + "-.*" + ConfigurationMigrationManager.EXPORT_EXTENSION)) .collect(Collectors.toList()); switch (exportFilePaths.size()) { case 1: return new MigrationZipFile(exportFilePaths.get(0)); case 0: throw new MigrationException(Messages.IMPORT_FILE_MISSING_ERROR, exportDirectory, ""); default: throw new MigrationException(Messages.IMPORT_FILE_MULTIPLE_ERROR, exportDirectory); } } catch (FileNotFoundException e) { throw new MigrationException(Messages.IMPORT_FILE_MISSING_ERROR, exportDirectory, e); } catch (SecurityException | IOException e) { throw new MigrationException(Messages.IMPORT_FILE_OPEN_ERROR, exportDirectory, e); } }

Target:
MigrationZipFile newZipFileFor(Path exportDirectory) { Validate.notNull(exportDirectory, "invalid null export file"); try { List<Path> exportFilePaths = Files.find(exportDirectory, 1, this::exportFileWithBrandingName) .collect(Collectors.toList()); switch (exportFilePaths.size()) { case 1: return new MigrationZipFile(exportFilePaths.get(0)); case 0: throw new MigrationException(Messages.IMPORT_FILE_MISSING_ERROR, exportDirectory, ""); default: throw new MigrationException(Messages.IMPORT_FILE_MULTIPLE_ERROR, exportDirectory); } } catch (FileNotFoundException e) { throw new MigrationException(Messages.IMPORT_FILE_MISSING_ERROR, exportDirectory, e); } catch (SecurityException | IOException e) { throw new MigrationException(Messages.IMPORT_FILE_OPEN_ERROR, exportDirectory, e); } }
Source:
public static CharSequence getDescription(AccessibilityNodeInfoCompat node, View view) { CharSequence contentDescription = node.getContentDescription(); CharSequence nodeText = node.getText(); boolean hasNodeText = !TextUtils.isEmpty(nodeText); boolean isEditText = view instanceof EditText; if (!TextUtils.isEmpty(contentDescription) && (!isEditText || !hasNodeText)) { return contentDescription; } if (hasNodeText) { return nodeText; } if (view instanceof ViewGroup) { String concatChildDescription = ""; String separator = ", "; ViewGroup viewGroup = (ViewGroup) view; for (int i = 0, count = viewGroup.getChildCount(); i < count; i++) { final View child = viewGroup.getChildAt(i); AccessibilityNodeInfoCompat childNodeInfo = AccessibilityNodeInfoCompat.obtain(); ViewCompat.onInitializeAccessibilityNodeInfo(child, childNodeInfo); CharSequence childNodeDescription = null; if (AccessibilityUtil.isSpeakingNode(childNodeInfo, child)) { childNodeDescription = getDescription(childNodeInfo, child); } if (!TextUtils.isEmpty(childNodeDescription)) { if (!TextUtils.isEmpty(concatChildDescription)) { concatChildDescription += separator; } concatChildDescription += childNodeDescription; } childNodeInfo.recycle(); } return !TextUtils.isEmpty(concatChildDescription) ? concatChildDescription : null; } return null; }

Target:
public static CharSequence getDescription(AccessibilityNodeInfoCompat node, View view) { CharSequence contentDescription = node.getContentDescription(); CharSequence nodeText = node.getText(); boolean hasNodeText = !TextUtils.isEmpty(nodeText); boolean isEditText = view instanceof EditText; if (!TextUtils.isEmpty(contentDescription) && (!isEditText || !hasNodeText)) { return contentDescription; } if (hasNodeText) { return nodeText; } if (view instanceof ViewGroup) { final StringBuilder concatChildDescription = new StringBuilder(); final String separator = ", "; ViewGroup viewGroup = (ViewGroup) view; for (int i = 0, count = viewGroup.getChildCount(); i < count; i++) { final View child = viewGroup.getChildAt(i); AccessibilityNodeInfoCompat childNodeInfo = AccessibilityNodeInfoCompat.obtain(); ViewCompat.onInitializeAccessibilityNodeInfo(child, childNodeInfo); CharSequence childNodeDescription = null; if (AccessibilityUtil.isSpeakingNode(childNodeInfo, child)) { childNodeDescription = getDescription(childNodeInfo, child); } if (!TextUtils.isEmpty(childNodeDescription)) { if (concatChildDescription.length() > 0) { concatChildDescription.append(separator); } concatChildDescription.append(childNodeDescription); } childNodeInfo.recycle(); } return concatChildDescription.length() > 0 ? concatChildDescription.toString() : null; } return null; }
Source:
public void testMsgNotifHeartbeat_requestModel_nonRoot() throws Exception { TestApplication app = new TestApplication(); app.setDirectory( this.folder.newFolder()); ManagedApplication ma = new ManagedApplication( app ); this.managerWrapper.getNameToManagedApplication().put( app.getName(), ma ); String targetId = this.manager.targetsMngr().createTarget( "id: tid2\nhandler: h" ); this.manager.targetsMngr().associateTargetWith( targetId, app, null ); File dir = new File( this.manager.configurationMngr().getWorkingDirectory(), ConfigurationUtils.TARGETS + "/" + targetId ); Utils.createDirectory( dir ); Utils.writeStringInto( "#!/bin/bash\necho Bonjour le monde cruel > toto.txt", new File( dir, Constants.TARGET_SCRIPT_FILE_NAME )); Assert.assertNotNull( this.manager.targetsMngr().findScriptResources(targetId) ); this.msgClient.allSentMessages.clear(); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); MsgNotifHeartbeat msg = new MsgNotifHeartbeat( app.getName(), app.getWar(), "192.168.1.45" ); msg.setModelRequired( true ); this.managerWrapper.getMessagingClient().getMessageProcessor().storeMessage( msg ); Thread.sleep( 100 ); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); app.getWar().getComponent().installerName( Constants.TARGET_INSTALLER ); this.managerWrapper.getMessagingClient().getMessageProcessor().storeMessage( msg ); Thread.sleep( 100 ); Assert.assertEquals( 1, this.msgClient.allSentMessages.size()); Message sentMessage = this.msgClient.allSentMessages.get( 0 ); Assert.assertEquals( MsgCmdSetScopedInstance.class, sentMessage.getClass()); Assert.assertNotNull(((MsgCmdSetScopedInstance) sentMessage).getScopedInstance()); }

Target:
public void testMsgNotifHeartbeat_requestModel_nonRoot() throws Exception { TestApplication app = new TestApplication(); app.setDirectory( this.folder.newFolder()); ManagedApplication ma = new ManagedApplication( app ); this.managerWrapper.getNameToManagedApplication().put( app.getName(), ma ); this.msgClient.allSentMessages.clear(); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); MsgNotifHeartbeat msg = new MsgNotifHeartbeat( app.getName(), app.getWar(), "192.168.1.45" ); msg.setModelRequired( true ); this.managerWrapper.getMessagingClient().getMessageProcessor().storeMessage( msg ); Thread.sleep( 100 ); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); app.getWar().getComponent().installerName( Constants.TARGET_INSTALLER ); this.managerWrapper.getMessagingClient().getMessageProcessor().storeMessage( msg ); Thread.sleep( 100 ); Assert.assertEquals( 1, this.msgClient.allSentMessages.size()); Message sentMessage = this.msgClient.allSentMessages.get( 0 ); Assert.assertEquals( MsgCmdSetScopedInstance.class, sentMessage.getClass()); Assert.assertNotNull(((MsgCmdSetScopedInstance) sentMessage).getScopedInstance()); }
Source:
protected void prepareOnAffectedNodes(TxInvocationContext<?> ctx, PrepareCommand command, Collection<Address> recipients, boolean ignored) { try { Map<Address, Response> resps = rpcManager.invokeRemotely(recipients, command, rpcManager.getDefaultRpcOptions(true, DeliverOrder.NONE)); CacheTransaction ct = ctx.getCacheTransaction(); for (Response r : resps.values()) readVersionsFromResponse(r, ct); } finally { transactionRemotelyPrepared(ctx); } }

Target:
protected void prepareOnAffectedNodes(TxInvocationContext<?> ctx, PrepareCommand command, Collection<Address> recipients, boolean ignored) { try { Map<Address, Response> resps = rpcManager.invokeRemotely(recipients, command, rpcManager.getDefaultRpcOptions(true, DeliverOrder.NONE)); checkTxCommandResponses(resps); CacheTransaction ct = ctx.getCacheTransaction(); for (Response r : resps.values()) readVersionsFromResponse(r, ct); } finally { transactionRemotelyPrepared(ctx); } }
Source:
public Entry[] list(File directory, FileModeStrategy fileModeStrategy) { List<Entry> result = new ArrayList<>(); FS fs = this; try { Files.walkFileTree(directory.toPath(), EnumSet.noneOf(FileVisitOption.class), 1, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { File f = file.toFile(); FS.Attributes attributes = new FS.Attributes(fs, f, true, attrs.isDirectory(), fs.supportsExecute() ? f.canExecute() : false, attrs.isSymbolicLink(), attrs.isRegularFile(), attrs.creationTime().toMillis(), attrs.lastModifiedTime().toMillis(), attrs.size()); result.add(new FileEntry(f, fs, attributes, fileModeStrategy)); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); } catch (IOException e) { } if (result.isEmpty()) { return NO_ENTRIES; } return result.toArray(new Entry[result.size()]); }

Target:
public Entry[] list(File directory, FileModeStrategy fileModeStrategy) { List<Entry> result = new ArrayList<>(); FS fs = this; boolean checkExecutable = fs.supportsExecute(); try { Files.walkFileTree(directory.toPath(), EnumSet.noneOf(FileVisitOption.class), 1, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { File f = file.toFile(); FS.Attributes attributes = new FS.Attributes(fs, f, true, attrs.isDirectory(), checkExecutable && f.canExecute(), attrs.isSymbolicLink(), attrs.isRegularFile(), attrs.creationTime().toMillis(), attrs.lastModifiedTime().toMillis(), attrs.size()); result.add(new FileEntry(f, fs, attributes, fileModeStrategy)); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); } catch (IOException e) { } if (result.isEmpty()) { return NO_ENTRIES; } return result.toArray(new Entry[result.size()]); }
Source:
private void doGetHeadDeleteTest(int contentSize, boolean multipartPost) throws Exception { ByteBuffer content = ByteBuffer.wrap(TestUtils.getRandomBytes(contentSize)); String serviceId = "getHeadDeleteServiceID"; String contentType = "application/octet-stream"; String ownerId = "getHeadDeleteOwnerID"; HttpHeaders headers = new DefaultHttpHeaders(); setAmbryHeadersForPut(headers, 7200, false, serviceId, contentType, ownerId); headers.set(HttpHeaderNames.CONTENT_LENGTH, content.capacity()); String blobId; byte[] usermetadata = null; if (multipartPost) { usermetadata = UtilsTest.getRandomString(32).getBytes(); } else { headers.add(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key1", "value1"); headers.add(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key2", "value2"); } blobId = putBlob(headers, content, usermetadata); headers.add(RestUtils.Headers.BLOB_SIZE, (long) content.capacity()); getBlobAndVerify(blobId, null, headers, content); getNotModifiedBlobAndVerify(blobId, null, false); getUserMetadataAndVerify(blobId, null, headers, usermetadata); getBlobInfoAndVerify(blobId, null, headers, usermetadata); getHeadAndVerify(blobId, null, headers); deleteBlobAndVerify(blobId); verifyOperationsAfterDelete(blobId, headers, content, usermetadata); }

Target:
private void doGetHeadDeleteTest(int contentSize, boolean multipartPost) throws Exception { ByteBuffer content = ByteBuffer.wrap(TestUtils.getRandomBytes(contentSize)); String serviceId = "getHeadDeleteServiceID"; String contentType = "application/octet-stream"; String ownerId = "getHeadDeleteOwnerID"; HttpHeaders headers = new DefaultHttpHeaders(); setAmbryHeadersForPut(headers, 7200, false, serviceId, contentType, ownerId); String blobId; byte[] usermetadata = null; if (multipartPost) { usermetadata = UtilsTest.getRandomString(32).getBytes(); } else { headers.add(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key1", "value1"); headers.add(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key2", "value2"); } blobId = putBlob(headers, content, usermetadata); headers.add(RestUtils.Headers.BLOB_SIZE, (long) content.capacity()); getBlobAndVerify(blobId, null, headers, content); getNotModifiedBlobAndVerify(blobId, null, false); getUserMetadataAndVerify(blobId, null, headers, usermetadata); getBlobInfoAndVerify(blobId, null, headers, usermetadata); getHeadAndVerify(blobId, null, headers); deleteBlobAndVerify(blobId); verifyOperationsAfterDelete(blobId, headers, content, usermetadata); }
Source:
public void showDialogueBox(Allergy allergy) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getContext()); alertDialogBuilder.setTitle(R.string.delete_allergy_title); alertDialogBuilder .setMessage(R.string.delete_allergy_description) .setCancelable(false) .setPositiveButton(R.string.mark_patient_deceased_proceed, (dialog, id) -> { dialog.cancel(); ((PatientDashboardAllergyPresenter) mPresenter).deleteAllergy(allergy.getUuid()); }) .setNegativeButton(R.string.dialog_button_cancel, (dialog, id) -> { alertDialog.cancel(); }); alertDialog = alertDialogBuilder.create(); alertDialog.show(); }

Target:
public void showDialogueBox(Allergy allergy) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getContext()); alertDialogBuilder.setTitle(getString(R.string.delete_allergy_title, allergy.getAllergen().getCodedAllergen().getDisplay())); alertDialogBuilder .setMessage(R.string.delete_allergy_description) .setCancelable(false) .setPositiveButton(R.string.mark_patient_deceased_proceed, (dialog, id) -> { dialog.cancel(); ((PatientDashboardAllergyPresenter) mPresenter).deleteAllergy(allergy.getUuid()); }) .setNegativeButton(R.string.dialog_button_cancel, (dialog, id) -> { alertDialog.cancel(); }); alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
Source:
protected void executeQueryCommand() { Map<KeyValuePairCompat<ConfigurationValues, String>, Object> configValuesMap = new HashMap<KeyValuePairCompat<ConfigurationValues, String>, Object>(); createConfigValuesSet(); for (ConfigurationValues configValue : ConfigurationValues.values()) { if (!shouldReturnValue(configValue) || !configValuesSet.contains(configValue.toString())) { continue; } List<String> versions = new ArrayList<String>(); versions.add(Config.DefaultConfigurationVersion); for (Version version : Version.ALL) { versions.add(version.toString()); } for (String version : versions) { KeyValuePairCompat<ConfigurationValues, String> key = new KeyValuePairCompat<ConfigurationValues, String>(configValue, version); Object value = Config.<Object> GetValue(ConfigValues.valueOf(configValue.toString()), version); configValuesMap.put(key, value); } } getQueryReturnValue().setReturnValue(configValuesMap); }

Target:
protected void executeQueryCommand() { Map<KeyValuePairCompat<ConfigurationValues, String>, Object> configValuesMap = new HashMap<KeyValuePairCompat<ConfigurationValues, String>, Object>(); for (ConfigurationValues configValue : ConfigurationValues.values()) { if (!shouldReturnValue(configValue)) { continue; } List<String> versions = new ArrayList<String>(); versions.add(Config.DefaultConfigurationVersion); for (Version version : Version.ALL) { versions.add(version.toString()); } for (String version : versions) { KeyValuePairCompat<ConfigurationValues, String> key = new KeyValuePairCompat<ConfigurationValues, String>(configValue, version); Object value = Config.<Object> GetValue(ConfigValues.valueOf(configValue.toString()), version); configValuesMap.put(key, value); } } getQueryReturnValue().setReturnValue(configValuesMap); }
Source:
public void testCompleteXmlToString() { URL resource = XmlConfigurationTest.class.getResource("/configs/ehcache-complete.xml"); Configuration config = new XmlConfiguration(resource); XmlConfiguration xmlConfig = new XmlConfiguration(config); String actualXMLConfigString = xmlConfig.toString(); if(System.getProperty("os.name").toLowerCase().contains("win")) { actualXMLConfigString = actualXMLConfigString.replace('\\', '/'); } assertThat(actualXMLConfigString, isSimilarTo(Input.from(resource)).ignoreComments().ignoreWhitespace().withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))); }

Target:
public void testCompleteXmlToString() { URL resource = XmlConfigurationTest.class.getResource("/configs/ehcache-complete.xml"); Configuration config = new XmlConfiguration(resource); XmlConfiguration xmlConfig = new XmlConfiguration(config); assertThat(xmlConfig.toString(), isSimilarTo(Input.from(resource)).ignoreComments().ignoreWhitespace().withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))); }
Source:
public void testRefuse() throws Exception { final List<Integer> items = Lists.newArrayList(); Callback<Integer> callback = new Callback<Integer>() { @Override public void call(Integer item) throws Exception { if (item >= 5) { throw new CallbackRefusedException(); } items.add(item); } }; streamer.read(response(200, inputStream(TEST_JSON)), callback, INT_TYPE_REF); assertEquals(ImmutableList.of(1, 2, 3, 4), items); }

Target:
public void testRefuse() throws Exception { final List<Integer> items = Lists.newArrayList(); Callback<Integer> callback = new Callback<Integer>() { @Override public void call(Integer item) throws Exception { if (item >= 5) { throw new CallbackRefusedException(); } items.add(item); } }; streamer.read(response(Status.OK, inputStream(TEST_JSON)), callback, INT_TYPE_REF); assertEquals(ImmutableList.of(1, 2, 3, 4), items); }
Source:
public Boolean getDuplicateIndices() { return duplicateIndices; }

Target:
public boolean getDuplicateIndices() { return duplicateIndices; }
Source:
void runAction() { synchronized (lock) { throwIfClosed(); action.run(); } }

Target:
void runAction() { synchronized (lock) { throwIfClosed(); action.run(); close(); } }
Source:
public void testSingleTaskOccupyingSlotIndefinitely() { final PhysicalSlot physicalSlot = createPhysicalSlot(); allocateSingleLogicalSlotFromPhysicalSlot(physicalSlot, true); assertTrue(physicalSlot.willBeOccupiedIndefinitely()); }

Target:
public void testSingleTaskOccupyingSlotIndefinitely() { final PhysicalSlot physicalSlot = createPhysicalSlot(); allocateSingleLogicalSlotFromPhysicalSlot(physicalSlot, true); assertThat(physicalSlot.willBeOccupiedIndefinitely(), is(true)); }
Source:
public void testGetCarbonConfigDirPath() throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException { Map<String, String> newEnv = new HashMap<>(); newEnv.put(CarbonBaseConstants.CARBON_CONFIG_DIR_PATH_ENV, "../wso2am-2.1.0/repository/conf"); try { Class<?> processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment"); Field theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment"); theEnvironmentField.setAccessible(true); Map<String, String> env = (Map<String, String>) theEnvironmentField.get(null); env.putAll(newEnv); Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField ("theCaseInsensitiveEnvironment"); theCaseInsensitiveEnvironmentField.setAccessible(true); Map<String, String> cienv = (Map<String, String>) theCaseInsensitiveEnvironmentField.get(null); cienv.putAll(newEnv); } catch (NoSuchFieldException e) { Class[] classes = Collections.class.getDeclaredClasses(); Map<String, String> env = System.getenv(); for (Class cl : classes) { if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { Field field = null; field = cl.getDeclaredField("m"); field.setAccessible(true); Object obj = field.get(env); Map<String, String> map = (Map<String, String>) obj; map.clear(); map.putAll(newEnv); } } } assertEquals(CarbonBaseUtils.getCarbonConfigDirPath(), "../wso2am-2.1.0/repository/conf", "Must provide the location where carbon.xml resides"); }

Target:
public void testGetCarbonConfigDirPath() throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException { setEnvironmentVariables(CarbonBaseConstants.CARBON_CONFIG_DIR_PATH_ENV, "/wso2am-2.1.0/repository/conf"); assertEquals(CarbonBaseUtils.getCarbonConfigDirPath(), "/wso2am-2.1.0/repository/conf", "Must provide the location where carbon.xml resides"); }
Source:
public Result run(String[] args) { Context context = new Context(); JavacFileManager.preRegister(context); return compile(args, context); }

Target:
public Result run(String[] args) { Context context = new Context(); JavacFileManager.preRegister(context); return run(args, context); }
Source:
public void testBasic() throws HttpException, IOException { ResteasyClient client = new ResteasyClientBuilderImpl().build(); ResteasyWebTarget target = client.target(TestPortProvider.generateURL("/")); BasicResource br = target.proxy(BasicResource.class); Assert.assertEquals("org/jboss/resteasy/springmvc/test", br.getBasicString()); Assert.assertEquals("something", br.getBasicObject().getSomething()); Assert.assertEquals("Hi, I'm custom!", br.getSpringMvcValue()); Assert.assertEquals(1, br.getSingletonCount().intValue()); Assert.assertEquals(2, br.getSingletonCount().intValue()); Assert.assertEquals(1, br.getPrototypeCount().intValue()); Assert.assertEquals(1, br.getPrototypeCount().intValue()); Assert.assertEquals("text/plain", br.getContentTypeHeader()); Integer interceptorCount = br .getSpringInterceptorCount("afterCompletion"); Assert.assertEquals(new Integer(8), interceptorCount); Assert.assertEquals("text/plain", br.getContentTypeHeader()); Assert.assertEquals("springSomething", br.testSpringXml().getSomething()); }

Target:
public void testBasic() throws HttpException, IOException { ResteasyWebTarget target = client.target(TestPortProvider.generateURL("/")); BasicResource br = target.proxy(BasicResource.class); Assert.assertEquals("org/jboss/resteasy/springmvc/test", br.getBasicString()); Assert.assertEquals("something", br.getBasicObject().getSomething()); Assert.assertEquals("Hi, I'm custom!", br.getSpringMvcValue()); Assert.assertEquals(1, br.getSingletonCount().intValue()); Assert.assertEquals(2, br.getSingletonCount().intValue()); Assert.assertEquals(1, br.getPrototypeCount().intValue()); Assert.assertEquals(1, br.getPrototypeCount().intValue()); Assert.assertEquals("text/plain", br.getContentTypeHeader()); Integer interceptorCount = br .getSpringInterceptorCount("afterCompletion"); Assert.assertEquals(new Integer(8), interceptorCount); Assert.assertEquals("text/plain", br.getContentTypeHeader()); Assert.assertEquals("springSomething", br.testSpringXml().getSomething()); }
Source:
public void test(TestHarness th) { this.th = th; try { testBasicHttpsConnection(); } catch (Exception e) { th.todo(false, "Unexpected exception: " + e); e.printStackTrace(); } }

Target:
public void test(TestHarness th) { this.th = th; try { testBasicHttpsConnection(); } catch (IOException e) { th.todo(false, "Unexpected exception: " + e); e.printStackTrace(); } }
Source:
public void throwIfBoxPositionIsFilled(Boxable boxable) throws IOException { if (boxable.getBox() == null || boxable.getBoxPosition() == null) return; Box box = get(boxable.getBox().getId()); BoxableView boxableView = box.getBoxable(boxable.getBoxPosition()); if (boxableView == null) return; if (boxableView.getId().getTargetId() != boxable.getId()) { throw new IllegalArgumentException("Box position '" + boxable.getBoxPosition() + "' in box '" + box.getAlias() + "' is not empty"); } }

Target:
public void throwIfBoxPositionIsFilled(Boxable boxable) throws IOException { if (boxable.getBox() == null || boxable.getBoxPosition() == null) return; Box box = get(boxable.getBox().getId()); BoxableView boxableView = box.getBoxable(boxable.getBoxPosition()); if (boxableView == null) return; if (!(boxableView.getId().getTargetId() == boxable.getId() && boxableView.getId().getTargetType() == boxable.getEntityType())) { throw new IllegalArgumentException("Box position '" + boxable.getBoxPosition() + "' in box '" + box.getAlias() + "' is not empty"); } }
Source:
private void checkUsage(Tree tree) { if (tree.getParent().is(Tree.Kind.FUNCTION_CALL, Tree.Kind.ASSIGNMENT, Tree.Kind.ASSIGNMENT_BY_REFERENCE) && !isArgumentOfSafeFunctionCall(tree)) { context().newIssue(this, tree, MESSAGE); } }

Target:
private void checkUsage(Tree tree) { Tree parent = tree.getParent(); if (!(parent instanceof BinaryExpressionTree) && !(parent instanceof UnaryExpressionTree) && !isArgumentOfSafeFunctionCall(tree)) { context().newIssue(this, tree, MESSAGE); } }
Source:
public void run() { if (job == null) { return; } for (SCMPollingDecisionHandler handler : SCMPollingDecisionHandler.all()) { if (!handler.shouldPoll(job)) { LOGGER.log(Level.FINE, "Skipping polling for {0} due to veto from {1}", new Object[]{job.getFullDisplayName(), handler} ); return; } } String threadName = Thread.currentThread().getName(); Thread.currentThread().setName("SCM polling for "+job); try { startTime = System.currentTimeMillis(); if(runPolling()) { SCMTriggerItem p = job(); String name = " #"+p.getNextBuildNumber(); SCMTriggerCause cause; try { cause = new SCMTriggerCause(getLogFile()); } catch (IOException e) { LOGGER.log(WARNING, "Failed to parse the polling log",e); cause = new SCMTriggerCause(); } Action[] queueActions = new Action[additionalActions.length + 1]; queueActions[0] = new CauseAction(cause); System.arraycopy(additionalActions, 0, queueActions, 1, additionalActions.length); if (p.scheduleBuild2(p.getQuietPeriod(), queueActions) != null) { LOGGER.info("SCM changes detected in "+ job.getFullDisplayName()+". Triggering "+name); } else { LOGGER.info("SCM changes detected in "+ job.getFullDisplayName()+". Job is already in the queue"); } } } finally { Thread.currentThread().setName(threadName); } }

Target:
public void run() { if (job == null) { return; } SCMDecisionHandler veto = SCMDecisionHandler.firstShouldPollVeto(job); if (veto != null) { try (StreamTaskListener listener = new StreamTaskListener(getLogFile())) { listener.getLogger().println( "Skipping polling on " + DateFormat.getDateTimeInstance().format(new Date()) + " due to veto from " + veto); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to record SCM polling for " + job, e); } LOGGER.log(Level.FINE, "Skipping polling for {0} due to veto from {1}", new Object[]{job.getFullDisplayName(), veto} ); return; } String threadName = Thread.currentThread().getName(); Thread.currentThread().setName("SCM polling for "+job); try { startTime = System.currentTimeMillis(); if(runPolling()) { SCMTriggerItem p = job(); String name = " #"+p.getNextBuildNumber(); SCMTriggerCause cause; try { cause = new SCMTriggerCause(getLogFile()); } catch (IOException e) { LOGGER.log(WARNING, "Failed to parse the polling log",e); cause = new SCMTriggerCause(); } Action[] queueActions = new Action[additionalActions.length + 1]; queueActions[0] = new CauseAction(cause); System.arraycopy(additionalActions, 0, queueActions, 1, additionalActions.length); if (p.scheduleBuild2(p.getQuietPeriod(), queueActions) != null) { LOGGER.info("SCM changes detected in "+ job.getFullDisplayName()+". Triggering "+name); } else { LOGGER.info("SCM changes detected in "+ job.getFullDisplayName()+". Job is already in the queue"); } } } finally { Thread.currentThread().setName(threadName); } }
Source:
public void calculatorReturnsManyTablesWithHighestPriority_thenProviderReturnsOneOfThose() { givenPriority(table("table1"), 0.0); givenPriority(table("table2"), 30.0); givenPriority(table("table3"), 30.0); givenPriority(table("table4"), 30.0); givenPriority(table("table5"), 10.0); whenGettingNextTableToSweep(); Assert.assertTrue(tableToSweep.isPresent()); Assert.assertThat(tableToSweep.get(), CoreMatchers.anyOf( CoreMatchers.is(table("table2")), CoreMatchers.is(table("table3")), CoreMatchers.is(table("table4")))); }

Target:
public void calculatorReturnsManyTablesWithHighestPriority_thenProviderReturnsOneOfThose() { givenPriority(table("table1"), 0.0); givenPriority(table("table2"), 30.0); givenPriority(table("table3"), 30.0); givenPriority(table("table4"), 30.0); givenPriority(table("table5"), 10.0); whenGettingNextTableToSweep(); Assert.assertTrue(tableToSweep.isPresent()); Assert.assertThat(tableToSweep.get(), anyOf(is(table("table2")), is(table("table3")), is(table("table4")))); }
Source:
private static Integer intLiteralValue(LiteralTree literal) { String literalValue = literal.value().replaceAll("_", ""); if (literalValue.startsWith("0b") || literalValue.startsWith("0B")) { String binaryWithoutPrefix = literalValue.substring(2); if (binaryWithoutPrefix.length() >= 32 && binaryWithoutPrefix.charAt(0) == '1') { return Integer.parseUnsignedInt(binaryWithoutPrefix, 2); } return Integer.valueOf(binaryWithoutPrefix, 2); } return Long.decode(literalValue).intValue(); }

Target:
private static Integer intLiteralValue(LiteralTree literal) { String literalValue = literal.value().replaceAll("_", ""); if (literalValue.startsWith("0b") || literalValue.startsWith("0B")) { return Integer.parseUnsignedInt(literalValue.substring(2), 2); } return Long.decode(literalValue).intValue(); }
Source:
public double getLocationRatio(ITmfLocation location) { long size = fFile.length() - fDataOffset; long pos; try { pos = fFileInput.getChannel().position() - fDataOffset; } catch (IOException e) { pos = 0; } return 1.0 / size * pos; }

Target:
public double getLocationRatio(ITmfLocation location) { long size = fFile.length() - fDataOffset; long pos; try { pos = fFileInput.getFilePointer() - fDataOffset; } catch (IOException e) { pos = 0; } return 1.0 / size * pos; }