auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
@NonNull public static Flow get(@NonNull Context context) { Flow flow = InternalContextWrapper.getFlow(context); if (null == flow) { throw new IllegalStateException("The passed context must be wrapped with Flow!"); } return flow; }

Target:
@NonNull public static Flow get(@NonNull Context context) { Flow flow = InternalContextWrapper.getFlow(context); if (null == flow) { throw new IllegalStateException("Context was not wrapped with flow. " + "Make sure attachBaseContext was overridden in your main activity"); } return flow; }
Source:
public abstract @Nullable PcapPacket parseNextPacket() throws IOException, BadPcapFileException, BadPacketException; public abstract void skipNextPacket() throws IOException, BadPcapFileException; public abstract void seekPacket(long rank) throws IOException, BadPcapFileException; public abstract PcapTimestampScale getTimestampPrecision(); public synchronized long getTotalNbPackets() throws IOException, BadPcapFileException { if (fTotalNumberPackets == -1) { long rank = fCurrentRank; fCurrentRank = fFileIndex.floorKey(rank); while (hasNextPacket()) { skipNextPacket(); } fTotalNumberPackets = fCurrentRank; fCurrentRank = rank; seekPacket(rank); } return fTotalNumberPackets; }

Target:
public abstract @Nullable PcapPacket parseNextPacket() throws IOException, BadPcapFileException, BadPacketException; public abstract void skipNextPacket() throws IOException, BadPcapFileException; public abstract void seekPacket(long rank) throws IOException, BadPcapFileException; public abstract PcapTimestampScale getTimestampPrecision(); public abstract long getTimeAccuracy(); public abstract long getTimeZoneCorrection(); public abstract long getSnapShotLength(); public abstract long getDataLinkType(); public synchronized long getTotalNbPackets() throws IOException, BadPcapFileException { if (fTotalNumberPackets == -1) { long rank = fCurrentRank; fCurrentRank = fFileIndex.floorKey(rank); while (hasNextPacket()) { skipNextPacket(); } fTotalNumberPackets = fCurrentRank; fCurrentRank = rank; seekPacket(rank); } return fTotalNumberPackets; }
Source:
private StackTraceElement[] getStackTrace(Thread thread) { StackTraceElement[] threadStack; try { threadStack = thread.getStackTrace(); } catch (SecurityException e) { threadStack = new StackTraceElement[0]; } return threadStack; }

Target:
private StackTraceElement[] getStackTrace(Thread thread) { try { return thread.getStackTrace(); } catch (SecurityException e) { return new StackTraceElement[0]; } }
Source:
public void setup() throws IOException { System.out.println("SETUP CALLED AT " + +System.currentTimeMillis()); if (ComplexMetrics.getSerdeForType("hyperUnique") == null) { ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde(Hashing.murmur3_128())); } schemaInfo = BenchmarkSchemas.SCHEMA_MAP.get(schema); BenchmarkDataGenerator gen = new BenchmarkDataGenerator( schemaInfo.getColumnSchemas(), RNG_SEED, schemaInfo.getDataInterval(), rowsPerSegment ); incIndex = makeIncIndex(); for (int j = 0; j < rowsPerSegment; j++) { InputRow row = gen.nextRow(); if (j % 10000 == 0) { System.out.println(j + " rows generated."); } incIndex.add(row); } File tmpFile = File.createTempFile("FilterPartitionBenchmark-" + System.currentTimeMillis(), ".TEMPDIR"); tmpFile.delete(); tmpFile.mkdirs(); System.out.println(tmpFile.getAbsolutePath() + " isFile: " + tmpFile.isFile() + " isDir:" + tmpFile.isDirectory()); tmpFile.deleteOnExit(); indexFile = INDEX_MERGER_V9.persist( incIndex, tmpFile, new IndexSpec() ); qIndex = INDEX_IO.loadIndex(indexFile); }

Target:
public void setup() throws IOException { log.info("SETUP CALLED AT " + System.currentTimeMillis()); if (ComplexMetrics.getSerdeForType("hyperUnique") == null) { ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde(Hashing.murmur3_128())); } schemaInfo = BenchmarkSchemas.SCHEMA_MAP.get(schema); BenchmarkDataGenerator gen = new BenchmarkDataGenerator( schemaInfo.getColumnSchemas(), RNG_SEED, schemaInfo.getDataInterval(), rowsPerSegment ); incIndex = makeIncIndex(); for (int j = 0; j < rowsPerSegment; j++) { InputRow row = gen.nextRow(); if (j % 10000 == 0) { log.info(j + " rows generated."); } incIndex.add(row); } File tmpFile = Files.createTempDir(); log.info("Using temp dir: " + tmpFile.getAbsolutePath()); tmpFile.deleteOnExit(); indexFile = INDEX_MERGER_V9.persist( incIndex, tmpFile, new IndexSpec() ); qIndex = INDEX_IO.loadIndex(indexFile); }
Source:
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { if (junitImported) { return super.visit(node, data); } ASTImplementsList impl = node.getFirstChildOfType(ASTImplementsList.class); if (impl != null && impl.jjtGetParent().equals(node)) { for (int ix = 0; ix < impl.jjtGetNumChildren(); ix++) { Node child = impl.jjtGetChild(ix); if (child.getClass() != ASTClassOrInterfaceType.class) { continue; } ASTClassOrInterfaceType type = (ASTClassOrInterfaceType) child; if (isJUnitTest(type)) { junitImported = true; return super.visit(node, data); } } } if (node.jjtGetNumChildren() != 0 && node.jjtGetChild(0) instanceof ASTExtendsList) { ASTClassOrInterfaceType type = node.jjtGetChild(0).getFirstChildOfType(ASTClassOrInterfaceType.class); if (isJUnitTest(type)) { junitImported = true; return super.visit(node, data); } } return super.visit(node, data); }

Target:
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { if (junitImported) { return super.visit(node, data); } for (final ASTClassOrInterfaceType type : node.getSuperInterfacesTypeNodes()) { if (isJUnitTest(type)) { junitImported = true; return super.visit(node, data); } } ASTClassOrInterfaceType type = node.getSuperClassTypeNode(); if (type != null && isJUnitTest(type)) { junitImported = true; return super.visit(node, data); } return super.visit(node, data); }
Source:
public void should_exclude() { quickFix.invoke(project, mock(Editor.class), mock(PsiFile.class)); assertFalse(settings.isRuleActive("rule")); verify(submitter).submitOpenFilesAuto(TriggerType.BINDING_UPDATE); }

Target:
public void should_exclude() { quickFix.invoke(project, mock(Editor.class), mock(PsiFile.class)); assertThat(settings.isRuleExplicitlyDisabled("rule")).isTrue(); verify(submitter).submitOpenFilesAuto(TriggerType.BINDING_UPDATE); }
Source:
public static void openUrlInBrowser(final Context context, final String url) { final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); final String defaultBrowserPackageName = getDefaultBrowserPackageName(context); if (defaultBrowserPackageName.equals("android")) { openUrlBrowserChooser(context, url); } else { intent.setPackage(defaultBrowserPackageName); context.startActivity(intent); } }

Target:
public static void openUrlInBrowser(final Context context, final String url) { final String defaultBrowserPackageName = getDefaultBrowserPackageName(context); if (defaultBrowserPackageName.equals("android")) { openInDefaultApp(context, url); } else { final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.setPackage(defaultBrowserPackageName); context.startActivity(intent); } }
Source:
private JSONObject readJSONObjFromWire(SocketChannel sc, String remoteAddressForErrorMsg) throws IOException, JSONException { try { ByteBuffer lengthBuffer = ByteBuffer.allocate(4); while (lengthBuffer.remaining() > 0) { int read = sc.read(lengthBuffer); if (read == -1) { throw new EOFException(remoteAddressForErrorMsg); } } lengthBuffer.flip(); int length = lengthBuffer.getInt(); if (length > 16 * 1024) { throw new IOException( "Length prefix on wire for expected JSON string is greater than 16K max."); } if (length < 2) { throw new IOException( "Length prefix on wire for expected JSON string is less than minimum document size of 2."); } ByteBuffer messageBytes = ByteBuffer.allocate(length); while (messageBytes.hasRemaining()) { int read = sc.read(messageBytes); if (read == -1) { throw new EOFException(remoteAddressForErrorMsg); } } messageBytes.flip(); JSONObject jsObj = new JSONObject(new String(messageBytes.array(), StandardCharsets.UTF_8)); return jsObj; } catch (IOException | JSONException ex) { sc.close(); throw ex; } }

Target:
private JSONObject readJSONObjFromWire(SocketChannel sc, String remoteAddressForErrorMsg) throws IOException, JSONException { ByteBuffer lengthBuffer = ByteBuffer.allocate(4); while (lengthBuffer.remaining() > 0) { int read = sc.read(lengthBuffer); if (read == -1) { throw new EOFException(remoteAddressForErrorMsg); } } lengthBuffer.flip(); int length = lengthBuffer.getInt(); if (length > 16 * 1024) { throw new IOException( "Length prefix on wire for expected JSON string is greater than 16K max."); } if (length < 2) { throw new IOException( "Length prefix on wire for expected JSON string is less than minimum document size of 2."); } ByteBuffer messageBytes = ByteBuffer.allocate(length); while (messageBytes.hasRemaining()) { int read = sc.read(messageBytes); if (read == -1) { throw new EOFException(remoteAddressForErrorMsg); } } messageBytes.flip(); JSONObject jsObj = new JSONObject(new String(messageBytes.array(), StandardCharsets.UTF_8)); return jsObj; }
Source:
@Test public void testJsonLength() { String query = "select json_length(\"product_name\", 'lax $') from \"product\""; final String expected = "SELECT JSON_LENGTH(\"product_name\" FORMAT JSON, 'lax $')\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); }

Target:
@Test public void testJsonLength() { String query = "select json_length(\"product_name\", 'lax $'), " + "json_length(\"product_name\") from \"product\""; final String expected = "SELECT JSON_LENGTH(\"product_name\" FORMAT JSON, 'lax $'), " + "JSON_LENGTH(\"product_name\" FORMAT JSON)\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); }
Source:
public long freeMemory(long windowId) throws IOException { long memoryFreed = 0; Long clearWindowId; while ((clearWindowId = committedData.floorKey(windowId)) != null) { Map<Slice, BucketedValue> windowData = committedData.remove(clearWindowId); for (Map.Entry<Slice, BucketedValue> entry: windowData.entrySet()) { memoryFreed += entry.getKey().length + entry.getValue().getSize(); } } fileCache.clear(); if (cachedBucketMetas != null) { for (BucketsFileSystem.TimeBucketMeta tbm : cachedBucketMetas.values()) { FileAccess.FileReader reader = readers.remove(tbm.getTimeBucketId()); if (reader != null) { memoryFreed += tbm.getSizeInBytes(); reader.close(); } } } sizeInBytes.getAndAdd(-memoryFreed); windowsForFreeMemory.add(windowId); return memoryFreed; }

Target:
public long freeMemory(long windowId) throws IOException { long memoryFreed = 0; Iterator<Map.Entry<Long, Map<Slice, BucketedValue>>> entryIter = committedData.entrySet().iterator(); while (entryIter.hasNext()) { Map.Entry<Long, Map<Slice, BucketedValue>> bucketEntry = entryIter.next(); if (bucketEntry.getKey() > windowId) { break; } Map<Slice, BucketedValue> windowData = bucketEntry.getValue(); entryIter.remove(); for (Map.Entry<Slice, BucketedValue> entry : windowData.entrySet()) { memoryFreed += entry.getKey().length + entry.getValue().getSize(); } } fileCache.clear(); if (cachedBucketMetas != null) { for (BucketsFileSystem.TimeBucketMeta tbm : cachedBucketMetas.values()) { FileAccess.FileReader reader = readers.remove(tbm.getTimeBucketId()); if (reader != null) { memoryFreed += tbm.getSizeInBytes(); reader.close(); } } } sizeInBytes.getAndAdd(-memoryFreed); windowsForFreeMemory.add(windowId); return memoryFreed; }
Source:
public void execute() { dataObject.addNestedClass( nestedClass ); DataObjectChangeEvent event = new DataObjectChangeEvent( ChangeType.NESTED_CLASS_ADD_CHANGE, getContext().getContextId(), getSource(), getDataObject(), null, null, nestedClass ); notifyChange( event ); }

Target:
public void execute() { dataObject.addNestedClass( nestedClass ); DataModelerEvent event = new DataObjectChangeEvent() .withChangeType( ChangeType.NESTED_CLASS_ADD_CHANGE ) .withOldValue( null ) .withNewValue( nestedClass ) .withContextId( getContext().getContextId() ) .withSource( getSource() ) .withCurrentDataObject( getDataObject() ); notifyChange( event ); }
Source:
private RootBeanDefinition getRootBeanDefinition(String mode) { if (StringUtils.hasLength(mode)) { if (isEmbeddedServerEnabled(mode)) { return new RootBeanDefinition(this.embeddedServers.get(mode).getContainerClass(), null, null); } } else { for (Map.Entry<String, EmbeddedLdapServer> entry : this.embeddedServers.entrySet()) { EmbeddedLdapServer ldapServer = entry.getValue(); if (ClassUtils.isPresent(ldapServer.getClassName(), getClass().getClassLoader())) { return new RootBeanDefinition(ldapServer.getContainerClass(), null, null); } } } throw new IllegalStateException("Embedded LDAP server is not provided"); }

Target:
private RootBeanDefinition getRootBeanDefinition(String mode) { if (isApacheDsEnabled(mode)) { return new RootBeanDefinition(APACHEDS_CONTAINER_CLASSNAME, null, null); } else if (isUnboundidEnabled(mode)) { return new RootBeanDefinition(UNBOUNDID_CONTAINER_CLASSNAME, null, null); } throw new IllegalStateException("Embedded LDAP server is not provided"); }
Source:
public ChartsetFigure(ActionListener addChartHandler) { add(new Label(StackedchartsImages.getImage( StackedchartsImages.DESC_CHARTSET))); chartsetHeader = new DirectionalLabel(Activator.FONT_12); chartsetHeader.setText("Chart Set"); chartsetHeader.setTextAlignment(PositionConstants.TOP); if (boldFont == null) { FontData fontData = Display.getDefault().getActiveShell().getFont() .getFontData()[0]; boldFont = new Font(Display.getDefault(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD)); } chartsetHeader.setFont(boldFont); add(chartsetHeader); Button button = new Button(StackedchartsImages.getImage( StackedchartsImages.DESC_ADD)); button.setToolTip(new Label("Add new chart")); button.addActionListener(addChartHandler); add(button); }

Target:
public ChartsetFigure(ActionListener addChartHandler) { add(new Label(StackedchartsImages.getImage( StackedchartsImages.DESC_CHARTSET))); chartsetHeader = new DirectionalLabel(Activator.FONT_12); chartsetHeader.setText("Chart Set"); chartsetHeader.setTextAlignment(PositionConstants.TOP); add(chartsetHeader); Button button = new Button(StackedchartsImages.getImage( StackedchartsImages.DESC_ADD)); button.setToolTip(new Label("Add new chart")); button.addActionListener(addChartHandler); add(button); }
Source:
public void unannounceTask(String taskId) { try { curatorFramework.delete().guaranteed().forPath(getTaskPathForId(taskId)); } catch (Exception e) { log.warn("Could not delete task path for task[%s], looks like it already went away", taskId); } }

Target:
public void unannounceTask(String taskId) { try { curatorFramework.delete().guaranteed().forPath(getTaskPathForId(taskId)); } catch (Exception e) { log.warn(e, "Could not delete task path for task[%s]", taskId); } }
Source:
public DefaultProblem read(JsonReader in) throws IOException { URI type = null; String title = null; StatusType status = null; Map<String, Object> parameters = new HashMap<>(); String detail = null; URI instance = null; ThrowableProblem cause = null; in.beginObject(); while (in.hasNext()) { String name = in.nextName(); switch (name) { case "type": type = TYPE_ADAPTER.read(in); break; case "title": title = STRING.read(in); break; case "status": status = statusAdapter.read(in); break; case "detail": detail = STRING.read(in); break; case "instance": instance = TypeAdapters.URI.read(in); break; case "cause": cause = throwableProblemAdapter.read(in); break; default: parameters.put(name, gson.fromJson(in, Object.class)); break; } } in.endObject(); return new DefaultProblem(type, title, status, detail, instance, cause, parameters); }

Target:
public DefaultProblem read(JsonReader in) throws IOException { ProblemBuilder builder = new ProblemBuilder(); in.beginObject(); while (in.hasNext()) { String name = in.nextName(); switch (name) { case "type": builder.withType(TYPE.read(in)); break; case "title": builder.withTitle(STRING.read(in)); break; case "status": builder.withStatus(statusAdapter.read(in)); break; case "detail": builder.withDetail(STRING.read(in)); break; case "instance": builder.withInstance(URI.read(in)); break; case "cause": builder.withCause(throwableProblemAdapter.read(in)); break; default: builder.with(name, gson.fromJson(in, Object.class)); break; } } in.endObject(); return (DefaultProblem) builder.build(); }
Source:
private String readInputLine(ReadLineHandler readLineHandler) { try { createTerminalConnection(readLineHandler); } catch (IOException e) { e.printStackTrace(); } return readLineHandler.getLine(); }

Target:
private String readInputLine(ReadLineHandler readLineHandler) { try { createTerminalConnection(readLineHandler); } catch (IOException e) { throw ROOT_LOGGER.noConsoleAvailable(); } return readLineHandler.getLine(); }
Source:
private Checkpoint convertToCheckpoint(BlobItem blobItem) { Checkpoint checkpoint = new Checkpoint(); logger.info("Found blob for partition {}", blobItem.getName()); String[] names = blobItem.getName().split(BLOB_PATH_SEPARATOR); checkpoint.setFullyQualifiedNamespace(names[0]); checkpoint.setEventHubName(names[1]); checkpoint.setConsumerGroup(names[2]); checkpoint.setPartitionId(names[4]); if (CoreUtils.isNullOrEmpty(blobItem.getMetadata())) { logger.warning("No metadata available for blob {}", blobItem.getName()); return checkpoint; } blobItem.getMetadata().forEach((key, value) -> { switch (key) { case SEQUENCE_NUMBER: checkpoint.setSequenceNumber(Long.parseLong(value)); break; case OFFSET: checkpoint.setOffset(Long.parseLong(value)); break; default: break; } }); return checkpoint; }

Target:
private Mono<Checkpoint> convertToCheckpoint(BlobItem blobItem) { String[] names = blobItem.getName().split(BLOB_PATH_SEPARATOR); logger.info("Found blob for partition {}", blobItem.getName()); if (names.length == 5) { if (CoreUtils.isNullOrEmpty(blobItem.getMetadata())) { logger.warning("No metadata available for blob {}", blobItem.getName()); return Mono.empty(); } Map<String, String> metadata = blobItem.getMetadata(); Checkpoint checkpoint = new Checkpoint() .setFullyQualifiedNamespace(names[0]) .setEventHubName(names[1]) .setConsumerGroup(names[2]) .setPartitionId(names[4]) .setSequenceNumber(Long.parseLong(metadata.get(SEQUENCE_NUMBER))) .setOffset(Long.parseLong(metadata.get(OFFSET))); return Mono.just(checkpoint); } return Mono.empty(); }
Source:
public void testNotificationMessageWithInvalidConfig() throws Exception { startMockServer(1); byte requestBytes[] = new byte[48 + CONFIG_BYTES_LENGTH]; ByteBuffer requestBuffer = ByteBuffer.wrap(requestBytes); requestBuffer.clear(); requestBuffer.putInt(ServerState.LOOKING.ordinal()); requestBuffer.putLong(1); requestBuffer.putLong(0); requestBuffer.putLong(0); requestBuffer.putLong(0); requestBuffer.putInt(FastLeaderElection.Notification.CURRENTVERSION); requestBuffer.putInt(CONFIG_BYTES_LENGTH); requestBuffer.put(CONFIG_BYTES); mockCnxManager.toSend(0L, requestBuffer); sendValidNotifications(1, 0); leaderElectionThread.join(5000); if (leaderElectionThread.isAlive()) { Assert.fail("Leader election thread didn't join, something went wrong."); } }

Target:
public void testNotificationMessageWithInvalidConfig() throws Exception { startMockServer(1); ByteBuffer requestBuffer = FastLeaderElection.buildMsg(ServerState.LOOKING.ordinal(), 1, 0, 0, 0, CONFIG_BYTES); mockCnxManager.toSend(0L, requestBuffer); sendValidNotifications(1, 0); leaderElectionThread.join(5000); if (leaderElectionThread.isAlive()) { Assert.fail("Leader election thread didn't join, something went wrong."); } }
Source:
public static void verifySecureStorageOfPassword(String username, String server, boolean shouldExist, ServerType serverType) { WorkbenchPreferenceDialog workbenchPreferenceDialog = new WorkbenchPreferenceDialog(); StoragePreferencePage secureStoragePreferencePage = new StoragePreferencePage(); new WorkbenchShell().setFocus(); workbenchPreferenceDialog.open(); new WorkbenchPreferenceDialog().select(secureStoragePreferencePage); secureStoragePreferencePage.selectContentTab(); boolean exists = secureStoragePreferencePage.passwordExists("[Default Secure Storage]", getPluginId(serverType), server, username); workbenchPreferenceDialog.ok(); assertTrue(shouldExist ? "Password wasn't present in secure storage while it." : "Password was present in secure storage but shouldn't.", shouldExist == exists); }

Target:
public static void verifySecureStorageOfPassword(String username, String server, boolean shouldExist, ServerType serverType) { WorkbenchPreferenceDialog workbenchPreferenceDialog = new WorkbenchPreferenceDialog(); StoragePreferencePage secureStoragePreferencePage = new StoragePreferencePage(); new WorkbenchShell().setFocus(); workbenchPreferenceDialog.open(); new WorkbenchPreferenceDialog().select(secureStoragePreferencePage); secureStoragePreferencePage.selectContentTab(); boolean exists = secureStoragePreferencePage.passwordExists("[Default Secure Storage]", getPluginId(serverType), server, username); workbenchPreferenceDialog.ok(); assertTrue(shouldExist ? "Password wasn't present in secure storage while it should." : "Password was present in secure storage but it shouldn't.", shouldExist == exists); }
Source:
public void init() throws IOException { kafkaConfig.put("group.id", minionIdentity.getLocation()); kafkaConfig.put("enable.auto.commit", "true"); kafkaConfig.put("key.deserializer", StringDeserializer.class.getCanonicalName()); kafkaConfig.put("value.deserializer", ByteArrayDeserializer.class.getCanonicalName()); kafkaConfig.put("auto.commit.interval.ms", "1000"); kafkaConfig.put("key.serializer", StringSerializer.class.getCanonicalName()); kafkaConfig.put("value.serializer", ByteArraySerializer.class.getCanonicalName()); final Dictionary<String, Object> properties = configAdmin.getConfiguration(KAFKA_CLIENT_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); kafkaConfig.put(key, properties.get(key)); } } LOG.info("initializing the Kafka producer with: {}", kafkaConfig); final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(null); producer = new KafkaProducer<>(kafkaConfig); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } String cacheConfig = kafkaConfig.getProperty("rpcid.cache.config", "maximumSize=1000,expireAfterWrite=10m"); rpcIdCache = CacheBuilder.from(cacheConfig).build(); }

Target:
public void init() throws IOException { kafkaConfig.put(ConsumerConfig.GROUP_ID_CONFIG, minionIdentity.getLocation()); kafkaConfig.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true"); kafkaConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getCanonicalName()); kafkaConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getCanonicalName()); kafkaConfig.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000"); kafkaConfig.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); kafkaConfig.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getCanonicalName()); kafkaConfig.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class.getCanonicalName()); final Dictionary<String, Object> properties = configAdmin.getConfiguration(KafkaRpcConstants.KAFKA_CONFIG_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); kafkaConfig.put(key, properties.get(key)); } } LOG.info("initializing the Kafka producer with: {}", kafkaConfig); final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(null); producer = new KafkaProducer<>(kafkaConfig); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } String cacheConfig = kafkaConfig.getProperty("rpcid.cache.config", "maximumSize=1000,expireAfterWrite=10m"); rpcIdCache = CacheBuilder.from(cacheConfig).build(); }
Source:
protected void synchingToTime(final long time) { if(fJob!= null ) { fJob.cancel(); } fJob = new Job("Synching to " + time) { @Override protected IStatus run(IProgressMonitor monitor) { List<TimeGraphEntry> traceEntries = getEntryList(getTrace()); if (traceEntries == null) { return Status.OK_STATUS; } Consumer<TimeGraphEntry> consumer = new Consumer<TimeGraphEntry>() { @Override public void accept(TimeGraphEntry entry) { if (monitor.isCanceled()) { return; } if (entry instanceof FlameChartEntry) { FlameChartEntry callStackEntry = (FlameChartEntry) entry; ICalledFunction currentFunction = callStackEntry.updateAt(time); if (fSyncSelection && currentFunction != null) { if (time == currentFunction.getStart()) { fSyncSelection = false; Display.getDefault().asyncExec(() -> { getTimeGraphViewer().setSelection(callStackEntry, true); getTimeGraphViewer().getTimeGraphControl().fireSelectionChanged(); }); } } return; } entry.getChildren().forEach(this); } }; traceEntries.forEach(consumer); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } Display.getDefault().asyncExec(() -> { getTimeGraphViewer().refresh(); }); return Status.OK_STATUS; } }; fJob.schedule(); }

Target:
protected void synchingToTime(final long time) { if(fJob!= null ) { fJob.cancel(); } long syncTime = fSyncTime; fJob = new Job("Flame Chart: Synching to " + time) { @Override protected IStatus run(IProgressMonitor monitor) { List<TimeGraphEntry> traceEntries = getEntryList(getTrace()); if (traceEntries == null) { return Status.OK_STATUS; } Consumer<TimeGraphEntry> consumer = new Consumer<TimeGraphEntry>() { private long fLocalSyncTime = syncTime; @Override public void accept(TimeGraphEntry entry) { if (monitor.isCanceled()) { return; } if (!(entry instanceof FlameChartEntry)) { entry.getChildren().forEach(this); return; } FlameChartEntry callStackEntry = (FlameChartEntry) entry; ICalledFunction currentFunction = callStackEntry.updateAt(time); if (fLocalSyncTime == time && currentFunction != null) { if (time == currentFunction.getStart()) { fLocalSyncTime = -1; Display.getDefault().asyncExec(() -> { getTimeGraphViewer().setSelection(callStackEntry, true); getTimeGraphViewer().getTimeGraphControl().fireSelectionChanged(); }); } } } }; traceEntries.forEach(consumer); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } Display.getDefault().asyncExec(() -> { getTimeGraphViewer().refresh(); }); return Status.OK_STATUS; } }; fJob.schedule(); }
Source:
public void testExecuteLargeUpdateStatementSELECT() throws Exception { try (Statement stmt = con.createStatement()) { long count = stmt.executeLargeUpdate("select true from generate_series(1, 5)"); Assert.fail("A result was returned when none was expected. Returned: " + count); } catch (SQLException e) { Assert.assertEquals("0100E", e.getSQLState()); } }

Target:
public void testExecuteLargeUpdateStatementSELECT() throws Exception { try (Statement stmt = con.createStatement()) { long count = stmt.executeLargeUpdate("select true from generate_series(1, 5)"); Assert.fail("A result was returned when none was expected. Returned: " + count); } catch (SQLException e) { Assert.assertEquals(PSQLState.TOO_MANY_RESULTS.getState(), e.getSQLState()); } }
Source:
public DB2WeekDiffFunction() { super("(select sign(i1) * floor(abs(i1)) from lateral(values (trunc(-(cast(?1 as date) - cast(?2 as date))) / 7)) as temp(i1))"); }

Target:
public DB2WeekDiffFunction() { super("-int((days(cast(?1 as timestamp)) - days(cast(?2 as timestamp))) / 7)"); }
Source:
public Map<?, ListenableFuture<Void>> execute(final String group, int count, Template template, Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) { Integer locationId = Integer.valueOf(template.getHardware().getLocation().getId()); VirtualDatacenter vdc = cloudService.getVirtualDatacenter(locationId); Iterable<VirtualAppliance> existingGroups = vdc.listVirtualAppliances(); Optional<VirtualAppliance> vapp = tryFind(existingGroups, new Predicate<VirtualAppliance>() { @Override public boolean apply(VirtualAppliance input) { return input.getName().equals(group); } }); if (!vapp.isPresent()) { logger.debug(">> Creating group %s", group); VirtualAppliance newVapp = VirtualAppliance.builder(context, vdc).name(group).build(); newVapp.save(); logger.debug("<< group(%s) created", newVapp.getId()); } else { logger.debug(">> Using existing group(%s)", vapp.get().getId()); } return super.execute(group, count, template, goodNodes, badNodes, customizationResponses); }

Target:
public Map<?, ListenableFuture<Void>> execute(final String group, int count, Template template, Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) { Integer locationId = Integer.valueOf(template.getHardware().getLocation().getId()); VirtualDatacenter vdc = cloudService.getVirtualDatacenter(locationId); Iterable<VirtualAppliance> existingGroups = vdc.listVirtualAppliances(); Optional<VirtualAppliance> vapp = tryFind(existingGroups, new Predicate<VirtualAppliance>() { @Override public boolean apply(VirtualAppliance input) { return input.getName().equals(group); } }); VirtualAppliance newVapp = null; if (!vapp.isPresent()) { logger.debug(">> Creating group %s", group); newVapp = VirtualAppliance.builder(context, vdc).name(group).build(); newVapp.save(); logger.debug("<< group(%s) created", newVapp.getId()); } else { logger.debug(">> Using existing group(%s)", vapp.get().getId()); } VirtualApplianceCachingTemplate abiquoTemplate = VirtualApplianceCachingTemplate .from(template) .withVirtualDatacenter(vdc) .withVirtualAppliance(vapp.or(newVapp)) .build(); return super.execute(group, count, abiquoTemplate, goodNodes, badNodes, customizationResponses); }
Source:
public void confirmShellAddProjectUsingExistProject(String projectName) throws RemoteException { SWTBot bot = new SWTBot(); bot.waitUntil( Conditions.shellIsActive(SHELL_ADD_RESOURCES), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT); SWTBotShell shell = bot.shell(SHELL_ADD_RESOURCES); shell.activate(); shell.bot().radio(RADIO_USING_EXISTING_DIRECTORY).click(); bot.sleep(1000); shell.bot().textWithLabel(LABEL_EXISTING_DIRECTORY_PATH, 0).setText(projectName); shell.bot().button(FINISH).click(); int timeout = 5; confirmDialogs: while (timeout-- > 0) { bot.sleep(2000); for (SWTBotShell currentShell : bot.shells()) { if (currentShell.getText().equals(SHELL_WARNING_LOCAL_CHANGES_DELETED) || currentShell.getText().equals(SHELL_SAVE_RESOURCE)) { currentShell.activate(); currentShell.bot().button(YES).click(); currentShell.bot().waitUntil(Conditions.shellCloses(currentShell)); break confirmDialogs; } else if (currentShell.getText().equals(SHELL_CONFIRM_SAVE_UNCHANGED_CHANGES)) { currentShell.activate(); currentShell.bot().button(YES).click(); currentShell.bot().waitUntil(Conditions.shellCloses(currentShell)); shell.bot().button(FINISH).click(); continue confirmDialogs; } } } shell.bot().waitUntil(Conditions.shellCloses(shell)); }

Target:
public void confirmShellAddProjectUsingExistProject(String projectName) throws RemoteException { SWTBot bot = new SWTBot(); bot.waitUntil( Conditions.shellIsActive(SHELL_ADD_RESOURCES), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT); SWTBotShell shell = bot.shell(SHELL_ADD_RESOURCES); shell.activate(); shell.bot().radio(RADIO_USING_EXISTING_DIRECTORY).click(); shell.bot().textWithLabel(LABEL_EXISTING_DIRECTORY_PATH, 0).setText(projectName); shell.bot().button(FINISH).click(); int timeout = 5; confirmDialogs: while (timeout-- > 0) { bot.sleep(2000); for (SWTBotShell currentShell : bot.shells()) { if (currentShell.getText().equals(SHELL_WARNING_LOCAL_CHANGES_DELETED) || currentShell.getText().equals(SHELL_SAVE_RESOURCE)) { currentShell.activate(); currentShell.bot().button(YES).click(); currentShell.bot().waitUntil(Conditions.shellCloses(currentShell)); break confirmDialogs; } else if (currentShell.getText().equals(SHELL_CONFIRM_SAVE_UNCHANGED_CHANGES)) { currentShell.activate(); currentShell.bot().button(YES).click(); currentShell.bot().waitUntil(Conditions.shellCloses(currentShell)); shell.bot().button(FINISH).click(); continue confirmDialogs; } } } shell.bot().waitUntil(Conditions.shellCloses(shell)); }
Source:
public void send(HttpClient client) throws IOException { org.eclipse.jetty.client.api.Request.Listener listener = new Request.Listener.Adapter() { @Override public void onSuccess(Request request) { onRequestComplete(); } @Override public void onFailure(Request request, Throwable failure) { onConnectionFailed(failure); } }; InputStreamResponseListener responseListener = new InputStreamResponseListener() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); @Override public void onContent(Response response, ByteBuffer content, Callback callback) { if (response.getStatus() != SC_OK) { LOG.warn("Response received {}: {}", response.getStatus(), response.getReason()); } byte[] buffer = new byte[content.limit()]; content.get(buffer); baos.write(buffer, 0, buffer.length); callback.succeeded(); } @Override public void onComplete(Result result) { if (result.isFailed()) { doTaskCompleted(result.getFailure()); } else { onResponseComplete(result, baos.toByteArray(), null); } } }; request.followRedirects(supportRedirect).listener(listener).send(responseListener); }

Target:
public void send(HttpClient client) throws IOException { org.eclipse.jetty.client.api.Request.Listener listener = new Request.Listener.Adapter() { @Override public void onSuccess(Request request) { onRequestComplete(); } @Override public void onFailure(Request request, Throwable failure) { onConnectionFailed(failure); } }; InputStreamResponseListener responseListener = new InputStreamResponseListener() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); @Override public void onContent(Response response, ByteBuffer content, Callback callback) { byte[] buffer = new byte[content.limit()]; content.get(buffer); baos.write(buffer, 0, buffer.length); callback.succeeded(); } @Override public void onComplete(Result result) { if (result.isFailed()) { doTaskCompleted(result.getFailure()); } else { onResponseComplete(result, baos.toByteArray()); } } }; request.followRedirects(supportRedirect).listener(listener).send(responseListener); }
Source:
public Collection<PackFile> repack() throws IOException { Collection<PackFile> toBeDeleted = repo.getObjectDatabase().getPacks(); Map<String, Ref> refsBefore = repo.getAllRefs(); for (Ref ref : repo.getRefDatabase().getAdditionalRefs()) refsBefore.put(ref.getName(), ref); Set<ObjectId> allHeads = new HashSet<ObjectId>(); Set<ObjectId> nonHeads = new HashSet<ObjectId>(); Set<ObjectId> tagTargets = new HashSet<ObjectId>(); Set<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (ref.getName().startsWith(Constants.R_HEADS)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); List<ReflogEntry> rlEntries = repo.getReflogReader(ref.getName()) .getReverseEntries(); if (rlEntries != null) for (ReflogEntry e : rlEntries) nonHeads.add(e.getNewId()); } tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); if (!allHeads.isEmpty()) { PackFile heads = writePack(allHeads, Collections.<ObjectId> emptySet(), tagTargets); if (heads != null) ret.add(heads); } if (!nonHeads.isEmpty()) { PackFile rest = writePack(nonHeads, allHeads, tagTargets); if (rest != null) ret.add(rest); } deleteOldPacks(toBeDeleted, ret, true); prunePacked(); return ret; }

Target:
public Collection<PackFile> repack() throws IOException { Collection<PackFile> toBeDeleted = repo.getObjectDatabase().getPacks(); Map<String, Ref> refsBefore = repo.getAllRefs(); for (Ref ref : repo.getRefDatabase().getAdditionalRefs()) refsBefore.put(ref.getName(), ref); Set<ObjectId> allHeads = new HashSet<ObjectId>(); Set<ObjectId> nonHeads = new HashSet<ObjectId>(); Set<ObjectId> tagTargets = new HashSet<ObjectId>(); Set<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (ref.getName().startsWith(Constants.R_HEADS)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); List<ReflogEntry> rlEntries = repo.getReflogReader(ref.getName()) .getReverseEntries(); if (rlEntries != null) for (ReflogEntry e : rlEntries) { nonHeads.add(e.getNewId()); ObjectId oldId = e.getOldId(); if (oldId != null && !ObjectId.zeroId().equals(oldId)) nonHeads.add(oldId); } } tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); PackFile heads = null; if (!allHeads.isEmpty()) { heads = writePack(allHeads, Collections.<ObjectId> emptySet(), tagTargets, null); if (heads != null) ret.add(heads); } if (!nonHeads.isEmpty()) { PackFile rest = writePack(nonHeads, allHeads, tagTargets, (heads == null) ? null : Collections.singleton(heads .getIndex())); if (rest != null) ret.add(rest); } deleteOldPacks(toBeDeleted, ret, true); prunePacked(); return ret; }
Source:
Analyzer(@Nonnull List<JField> fields, @Nonnull JMethod constructor) { this.constructor = constructor; this.field2id = Maps.newHashMap(); for (JField field : fields) { if (!field.isFinal() && !field.isVolatile() && NotEffectivelyFinalField.checkIfCanBeFinal(field)) { this.field2id.put(field, new Integer(this.field2id.size())); } } }

Target:
Analyzer(@Nonnull List<JField> fields, @Nonnull JMethod constructor) { this.constructor = constructor; this.field2id = Maps.newHashMap(); for (JField field : fields) { if (!field.isFinal() && !field.isVolatile() && NotEffectivelyFinalField.checkIfCanBeFinal(field)) { this.field2id.put(field, Integer.valueOf(this.field2id.size())); } } }
Source:
private static <T> List<T> runAllInParallel(int parallelism, List<Callable<T>> toRun) throws ExecutionException { if (toRun.isEmpty()) { return Collections.emptyList(); } else if (toRun.size() == 1) { try { return Collections.singletonList(toRun.get(0).call()); } catch (Exception e) { throw new ExecutionException(e); } } int limitedParallelism = Math.min(parallelism, toRun.size()); LOG.info("Initiating action with parallelism: {}", limitedParallelism); ExecutorService threadPool = Executors.newFixedThreadPool(limitedParallelism); try { List<Future<T>> futures = new ArrayList<Future<T>>(); for (Callable<T> callable : toRun) { futures.add(threadPool.submit(callable)); } List<T> result = new ArrayList<T>(toRun.size()); for (Future<T> future : futures) { try { result.add(future.get()); } catch (InterruptedException e) { throw new RuntimeException("The thread was interrupted", e); } } return result; } finally { threadPool.shutdownNow(); } }

Target:
private static <T> List<T> runAllInParallel(int parallelism, List<Callable<T>> toRun) throws ExecutionException { if (toRun.isEmpty()) { return Collections.emptyList(); } int limitedParallelism = Math.min(parallelism, toRun.size()); LOG.info("Initiating action with parallelism: {}", limitedParallelism); ExecutorService threadPool = Executors.newFixedThreadPool(limitedParallelism); try { List<Future<T>> futures = new ArrayList<Future<T>>(); for (Callable<T> callable : toRun) { futures.add(threadPool.submit(callable)); } List<T> result = new ArrayList<T>(toRun.size()); for (Future<T> future : futures) { try { result.add(future.get()); } catch (InterruptedException e) { throw new RuntimeException("The thread was interrupted", e); } } return result; } finally { threadPool.shutdownNow(); } }
Source:
public KafkaCollector.Builder toBuilder() { return KafkaCollector.builder() .bootstrapServers(bootstrapServers) .groupId(groupId) .topic(topic) .streams(streams) .overrides(overrides); }

Target:
public KafkaCollector.Builder toBuilder() { final KafkaCollector.Builder result = KafkaCollector.builder(); if (bootstrapServers != null) result.bootstrapServers(bootstrapServers); if (groupId != null) result.groupId(groupId); if (topic != null) result.topic(topic); if (streams != null) result.streams(streams); if (overrides != null) result.overrides(overrides); return result; }
Source:
protected void registerBundle(BundleInfo bundle) { String groupId = bundle.getGroupId(); if (groupId != null) { groupId = BundleGroup.PREFIX + groupId; } String artifactId = bundle.getArtifactId(); if (groupId == null || artifactId == null) { groupId = VIRTUAL_BUNDLE_GROUP; ((BundleInfoImpl) bundle).setGroupId(groupId); } if (!mavenGroups.containsKey(groupId)) { mavenGroups.put(groupId, new ArrayList<String>()); } mavenGroups.get(groupId).add(bundle.getId()); }

Target:
protected void registerBundle(BundleInfo bundle) { String groupId = bundle.getGroupId(); if (groupId != null) { groupId = BundleGroup.PREFIX + groupId; } String artifactId = bundle.getArtifactId(); if (groupId == null || artifactId == null) { groupId = VIRTUAL_BUNDLE_GROUP; ((BundleInfoImpl) bundle).setGroupId(groupId); } mavenGroups.computeIfAbsent(groupId, k -> new ArrayList<>()).add(bundle.getId()); }
Source:
public void testGitHubReleaseNoWorkflowOnDockstoreNoUser() throws Exception { CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient(BasicIT.USER_2_USERNAME, testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); try { client.handleGitHubRelease(workflowRepo, "thisisafakeuser", "0.1", installationId); } catch (ApiException ex) { assertEquals("Should not be able to add a workflow when user does not exist on Dockstore.", LAMBDA_ERROR, ex.getCode()); } }

Target:
public void testGitHubReleaseNoWorkflowOnDockstoreNoUser() throws Exception { CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient(BasicIT.USER_2_USERNAME, testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); try { client.handleGitHubRelease(workflowRepo, "thisisafakeuser", "0.1", installationId); Assert.fail("Should not reach this statement."); } catch (ApiException ex) { assertEquals("Should not be able to add a workflow when user does not exist on Dockstore.", LAMBDA_ERROR, ex.getCode()); } }
Source:
public void define_search() { WebService.Action search = controller.action("search"); assertThat(search).isNotNull(); assertThat(search.isPost()).isFalse(); assertThat(search.params()).hasSize(5); assertThat(search.param("language").possibleValues()).containsOnly(xoo1Key, xoo2Key); assertThat(search.param("language").deprecatedSince()).isEqualTo("6.4"); assertThat(search.param("profileName").deprecatedSince()).isEqualTo("6.4"); }

Target:
public void define_search() { WebService.Action search = controller.action("search"); assertThat(search).isNotNull(); assertThat(search.isPost()).isFalse(); assertThat(search.params()).hasSize(5); assertThat(search.param("language").possibleValues()).containsOnly(xoo1Key, xoo2Key); assertThat(search.param("language").deprecatedSince()).isEqualTo("6.4"); assertThat(search.param("profileName").deprecatedSince()).isEqualTo("6.4"); assertThat(search.param("organization").since()).isEqualTo("6.4"); }
Source:
RestAdapter provideRestAdapter() { return new Builder() .setLogLevel(LogLevel.BASIC) .setEndpoint( new Endpoint() { @Override public String getUrl() { return "<LINK_0>"; } @Override public String getName() { return "KazakAPI"; } }) .build(); }

Target:
RestAdapter provideRestAdapter() { return new Builder() .setLogLevel(LogLevel.BASIC) .setEndpoint( new Endpoint() { @Override public String getUrl() { return BuildConfig.ENDPOINT_URL; } @Override public String getName() { return "KazakAPI"; } }) .build(); }
Source:
public JSONObject createDecorationJson(ArrayList<UUID> comp_uuids, MotionDisplayer motionDisplayer) { JSONObject expMarker_json = new JSONObject(); UUID mesh_uuid = UUID.randomUUID(); expMarker_json.put("uuid", mesh_uuid.toString()); expMarker_json.put("type", "Mesh"); expMarker_json.put("opensimtype", "ExperimentalMarker"); expMarker_json.put("name", getName()); expMarker_json.put("geometry", motionDisplayer.getExperimentalMarkerGeometryJson().get("uuid")); expMarker_json.put("material", motionDisplayer.getExperimentalMarkerMaterialJson().get("uuid")); StateVector dataAtStartTime = motionDisplayer.getSimmMotionData().getStateVector(0); ArrayDouble interpolatedStates = dataAtStartTime.getData(); int idx = getStartIndexInFileNotIncludingTime(); AnnotatedMotion mot = (AnnotatedMotion)motionDisplayer.getSimmMotionData(); conversion = mot.getUnitConversion(); JSONArray pos = new JSONArray(); for (int i = 0; i < 3; i++) { pos.add(interpolatedStates.get(idx+i)/conversion); } expMarker_json.put("position", pos); expMarker_json.put("castShadow", false); expMarker_json.put("userData", "NonEditable"); comp_uuids.add(mesh_uuid); return expMarker_json; }

Target:
public JSONObject createDecorationJson(ArrayList<UUID> comp_uuids, MotionDisplayer motionDisplayer) { JSONObject expMarker_json = new JSONObject(); UUID mesh_uuid = UUID.randomUUID(); expMarker_json.put("uuid", mesh_uuid.toString()); expMarker_json.put("type", "Mesh"); expMarker_json.put("opensimtype", "ExperimentalMarker"); expMarker_json.put("name", getName()); expMarker_json.put("geometry", motionDisplayer.getExperimentalMarkerGeometryJson().get("uuid")); expMarker_json.put("material", motionDisplayer.getExperimentalMarkerMaterialJson().get("uuid")); StateVector dataAtStartTime = motionDisplayer.getSimmMotionData().getStateVector(0); ArrayDouble interpolatedStates = dataAtStartTime.getData(); int idx = getStartIndexInFileNotIncludingTime(); AnnotatedMotion mot = (AnnotatedMotion)motionDisplayer.getSimmMotionData(); conversion = mot.getUnitConversion(); JSONArray pos = new JSONArray(); for (int i = 0; i < 3; i++) { pos.add(interpolatedStates.get(idx+i)*conversion); } expMarker_json.put("position", pos); expMarker_json.put("castShadow", false); expMarker_json.put("userData", "NonEditable"); comp_uuids.add(mesh_uuid); return expMarker_json; }
Source:
public void analyzer(String analyzerName) { this.analyzerName = analyzerName; }

Target:
public void analyzer(String analyzerName) { this.analyzer = analysisDefinitionRegistry.getAnalyzerDefinition( analyzerName ); if ( analyzer == null ) { throw log.unknownAnalyzer( analyzerName, EventContexts.fromIndexFieldAbsolutePath( absoluteFieldPath ) ); } }
Source:
public void testDifferenceDays() { Date day1_10am = new Date(2018, 4, 6, 10, 0); Date day1_11pm55 = new Date(2018, 4, 6, 23, 55); Date day2_01am = new Date(2018, 4, 7, 1, 0); Date day2_11pm = new Date(2018, 4, 7, 1, 0); Date day3_08am = new Date(2018, 4, 8, 8, 0); assertEquals(0, Util.differenceInCalendarDay(day1_10am, day1_11pm55)); assertEquals(1, Util.differenceInCalendarDay(day1_10am, day2_01am)); assertEquals(1, Util.differenceInCalendarDay(day1_11pm55, day2_01am)); assertEquals(2, Util.differenceInCalendarDay(day1_10am, day3_08am)); assertEquals(1, Util.differenceInCalendarDay(day2_11pm, day3_08am)); assertEquals(-1, Util.differenceInCalendarDay(day3_08am, day2_11pm)); }

Target:
public void testDifferenceDays() throws Exception { Date may_6_10am = parseDate("2018-05-06 10:00:00"); Date may_6_11pm55 = parseDate("2018-05-06 23:55:00"); Date may_7_01am = parseDate("2018-05-07 01:00:00"); Date may_7_11pm = parseDate("2018-05-07 11:00:00"); Date may_8_08am = parseDate("2018-05-08 08:00:00"); Date june_3_08am = parseDate("2018-06-03 08:00:00"); Date june_9_08am = parseDate("2018-06-09 08:00:00"); Date june_9_08am_nextYear = parseDate("2019-06-09 08:00:00"); assertEquals(0, Util.daysBetween(may_6_10am, may_6_11pm55)); assertEquals(1, Util.daysBetween(may_6_10am, may_7_01am)); assertEquals(1, Util.daysBetween(may_6_11pm55, may_7_01am)); assertEquals(2, Util.daysBetween(may_6_10am, may_8_08am)); assertEquals(1, Util.daysBetween(may_7_11pm, may_8_08am)); assertEquals(28, Util.daysBetween(may_6_10am, june_3_08am)); assertEquals(34, Util.daysBetween(may_6_10am, june_9_08am)); assertEquals(365 + 34, Util.daysBetween(may_6_10am, june_9_08am_nextYear)); assertEquals(-1, Util.daysBetween(may_8_08am, may_7_11pm)); }