auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public <V> V columnValue(ColumnName columnName, ColumnMapping<V> columnMapping) { checkNotNull(columnName); checkNotNull(columnMapping); if (!storageFields.containsKey(columnName)) { throw newIllegalStateException("Column with the name `%s` was not found.", columnName); } Object columnValue = storageFields.get(columnName); if (columnValue == null) { V result = columnMapping.ofNull() .apply(null); return result; } V result = columnMapping.of(columnValue.getClass()) .applyTo(columnValue); return result; }

Target:
public final <V> V columnValue(ColumnName columnName, ColumnMapping<V> columnMapping) { checkNotNull(columnName); checkNotNull(columnMapping); if (!storageFields.containsKey(columnName)) { throw newIllegalStateException("Column with the name `%s` was not found.", columnName); } Object columnValue = storageFields.get(columnName); if (columnValue == null) { V result = columnMapping.ofNull() .apply(null); return result; } V result = columnMapping.of(columnValue.getClass()) .applyTo(columnValue); return result; }
Source:
public static long extractLong(final Metric m) { if (m instanceof Counting) { return ((Counting) m).getCount(); } if (m instanceof Gauge) { final Object value = ((Gauge) m).getValue(); if (value instanceof Long) { return (long) value; } if (value instanceof Integer) { return ((Integer) value).longValue(); } } throw new IllegalArgumentException("could not extract long value"); }

Target:
public static long extractLong(final Metric m) { if (m instanceof Counting) { return ((Counting) m).getCount(); } if (m instanceof Gauge) { final Object value = ((Gauge) m).getValue(); if (value instanceof Number) { return ((Number) value).longValue(); } } throw new IllegalArgumentException(String.format("could not extract long value from %s", m.getClass())); }
Source:
private int[] getSelectedArray(ProjectionBlock projectionBlock) { int[] selected = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL]; for (int i = 0; i < _numberWhenStatements; i++) { TransformFunction transformFunction = _whenStatements.get(i); int[] conditions = transformFunction.transformToIntValuesSV(projectionBlock); for (int j = 0; j < conditions.length; j++) { if (selected[j] == 0 && conditions[j] == 1) { selected[j] = i + 1; } } } return selected; }

Target:
private int[] getSelectedArray(ProjectionBlock projectionBlock) { if (_selectedResults == null) { _selectedResults = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL]; } else { Arrays.fill(_selectedResults, 0); } for (int i = 0; i < _numberWhenStatements; i++) { TransformFunction transformFunction = _whenStatements.get(i); int[] conditions = transformFunction.transformToIntValuesSV(projectionBlock); for (int j = 0; j < conditions.length; j++) { if (_selectedResults[j] == 0 && conditions[j] == 1) { _selectedResults[j] = i + 1; } } } return _selectedResults; }
Source:
public ThemeFingerprintRegistry themeFingerprintRegistry() throws IOException, MolgenisStyleException { ThemeFingerprintRegistry themeFingerprintRegistry = mock(ThemeFingerprintRegistry.class); when(themeFingerprintRegistry.getFingerprint("")).thenReturn(""); return themeFingerprintRegistry; }

Target:
public ThemeFingerprintRegistry themeFingerprintRegistry() throws IOException, MolgenisStyleException { ThemeFingerprintRegistry themeFingerprintRegistry = mock(ThemeFingerprintRegistry.class); when(themeFingerprintRegistry.getFingerprint(anyString())).thenReturn(""); return themeFingerprintRegistry; }
Source:
public Response getDatasourceRuleHistory( @QueryParam("interval") final String interval ) { Interval theInterval = interval == null ? null : new Interval(interval); return Response.ok(auditManager.fetchAuditHistory("rules", theInterval)) .build(); }

Target:
public Response getDatasourceRuleHistory( @QueryParam("interval") final String interval ) { try { Interval theInterval = interval == null ? null : new Interval(interval); return Response.ok(auditManager.fetchAuditHistory("rules", theInterval)) .build(); } catch (IllegalArgumentException e) { return Response.serverError().entity(ImmutableMap.<String, Object>of("error", e.getMessage())).build(); } }
Source:
private void checkFileContainsDRepresentation(URI uri, boolean expectedDRepresentation, final WhereToFindDRep whereToFindDRep, String errorMessage) { boolean containsDRepresentation = false; ExtensibleURIConverterImpl uriConverterImpl = new ExtensibleURIConverterImpl(); InputStream inputStream = null; try { inputStream = uriConverterImpl.createInputStream(uri); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); saxParser.parse(inputStream, new DefaultHandler() { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (WhereToFindDRep.IN_DVIEW.equals(whereToFindDRep)) { if (qName.equals("ownedRepresentations") && attributes.getValue("xmi:type").equals(TablePackage.eINSTANCE.getNsPrefix() + ":" + "DTable")) { throw new SAXException(DREPRESENTATION_FOUND); } } else if (WhereToFindDRep.AS_ROOT_OBJECTS.equals(whereToFindDRep)) { if (qName.equals(TablePackage.eINSTANCE.getNsPrefix() + ":" + "DTable")) { throw new SAXException(DREPRESENTATION_FOUND); } } } }); } catch (SAXException e) { if (e.getMessage().contains(DREPRESENTATION_FOUND)) { containsDRepresentation = true; } } catch (Exception e) { failCheckData(); } finally { if (inputStream != null) { try { inputStream.close(); } catch (final IOException e) { failCheckData(); } } } assertEquals(errorMessage, expectedDRepresentation, containsDRepresentation); }

Target:
private void checkFileContainsDRepresentation(URI uri, boolean expectedDRepresentation, final WhereToFindDRep whereToFindDRep, String errorMessage) { boolean containsDRepresentation = false; ExtensibleURIConverterImpl uriConverterImpl = new ExtensibleURIConverterImpl(); InputStream inputStream = null; try { inputStream = uriConverterImpl.createInputStream(uri); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); saxParser.parse(inputStream, new DefaultHandler() { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (WhereToFindDRep.IN_DVIEW.equals(whereToFindDRep)) { if (qName.equals("ownedRepresentations") && attributes.getValue("xmi:type").equals(TablePackage.eINSTANCE.getNsPrefix() + ":" + "DTable")) { throw new SAXException(DREPRESENTATION_FOUND); } } else if (WhereToFindDRep.AS_ROOT_OBJECTS.equals(whereToFindDRep)) { if (qName.equals(TablePackage.eINSTANCE.getNsPrefix() + ":" + "DTable")) { throw new SAXException(DREPRESENTATION_FOUND); } } } }); } catch (SAXException e) { if (e.getMessage().equals(DREPRESENTATION_FOUND)) { containsDRepresentation = true; } } catch (Exception e) { failCheckData(); } finally { if (inputStream != null) { try { inputStream.close(); } catch (final IOException e) { failCheckData(); } } } assertEquals(errorMessage, expectedDRepresentation, containsDRepresentation); }
Source:
private void removeReadArrayKeys(StatementTree statementTree) { Map<String, Map<String, AssignmentExpressionTree>> cleanedWrittenAndUnread = new HashMap<>(); for (Map.Entry<String, Map<String, AssignmentExpressionTree>> entry : writtenAndUnread.entrySet()) { if (!symbolWasUsedInTree(namesToSymbols.get(entry.getKey()), statementTree)) { cleanedWrittenAndUnread.put(entry.getKey(), entry.getValue()); } } writtenAndUnread = cleanedWrittenAndUnread; }

Target:
private void removeReadArrayKeys(StatementTree statementTree) { writtenAndUnread = writtenAndUnread.entrySet().stream() .filter(entry -> !symbolWasUsedInTree(namesToSymbols.get(entry.getKey()), statementTree)) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); }
Source:
public void handleEvent(@NonNull ITmfStateSystemBuilder ss, @NonNull ITmfEvent event) throws AttributeNotFoundException { int quark = ss.getQuarkAbsoluteAndAdd(NetworkStrings.RX_KEY); ITmfStateValue value = ss.queryOngoingState(quark); Long size = (Long) event.getContent().getField(getLayout().fieldLen()).getValue(); ss.modifyAttribute(event.getTimestamp().toNanos(), TmfStateValue.newValueLong(value.unboxLong() + size), quark); }

Target:
public void handleEvent(@NonNull ITmfStateSystemBuilder ss, @NonNull ITmfEvent event) throws AttributeNotFoundException { int quark = ss.getQuarkAbsoluteAndAdd(NetworkStrings.RX_KEY); Long size = event.getContent().getFieldValue(Long.class, getLayout().fieldLen()); if( size != null) { StateSystemBuilderUtils.incrementAttributeLong(ss, event.getTimestamp().toNanos(), quark, size); } }
Source:
public List<GooglePubSubSender> senders() { if (pubsubPrefixes != null) { try { final PubSub pubsub = PubSubOptions.getDefaultInstance().getService(); return pubsubPrefixes.stream() .map(prefix -> new GooglePubSubSender(pubsub, prefix)) .collect(toList()); } catch (Exception e) { log.warn("Failed to set up google pubsub service", e); return emptyList(); } } else { return emptyList(); } }

Target:
public List<GooglePubSubSender> senders() { return senders(() -> PubSubOptions.getDefaultInstance().getService()); }
Source:
private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); endSuccessfully(); if (getCommandCompensationPhase() == CommandCompensationPhase.END_COMMAND) { getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand(); } }

Target:
private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); boolean clearCompensation = true; try { endSuccessfully(); } catch (Exception e) { clearCompensation = false; } finally { if (clearCompensation) { if (getCommandCompensationPhase() == CommandCompensationPhase.END_COMMAND) { getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand(); } } else { if (getCommandCompensationPhase() == CommandCompensationPhase.END_COMMAND) { compensate(); } } } }
Source:
public JdbcAclService(DataSource dataSource, LookupStrategy lookupStrategy) { Assert.notNull(dataSource, "DataSource required"); Assert.notNull(lookupStrategy, "LookupStrategy required"); this.jdbcOperations = new JdbcTemplate(dataSource); this.lookupStrategy = lookupStrategy; this.aclClassIdUtils = new AclClassIdUtils(); }

Target:
public JdbcAclService(DataSource dataSource, LookupStrategy lookupStrategy) { this(new JdbcTemplate(dataSource), lookupStrategy); }
Source:
private int getLayoutPosition(final int position) { return this.isRTL ? getCount() - 1 - position : position; }

Target:
private int getLayoutPosition(final int position) { return LocalizeLayoutUtils.getLayoutPosition(this.isRTL, getCount(), position); }
Source:
private void verify(Channel channel, Publisher publisher) { if (!channel.getSource().equals(publisher)) { throw new IllegalArgumentException(); } }

Target:
private void verify(Channel channel, Publisher publisher) { if (!channel.getSource().equals(publisher)) { throw new IllegalArgumentException("Channel source does not match updater source"); } }
Source:
public void reportServices(Appendable out) throws InvalidSyntaxException { checkNonNullArgument(out, "Output destination instance cannot be null"); try (Formatter f = new Formatter(out)) { Stream.of(framework.getBundleContext() .getServiceReferences((String) null, null)) .forEach(sref -> f.format("%s%n", sref)); f.flush(); } }

Target:
public void reportServices(Appendable out) throws InvalidSyntaxException { requireNonNull(out, "Output destination instance cannot be null"); try (Formatter f = new Formatter(out)) { Stream.of(framework.getBundleContext() .getAllServiceReferences((String) null, null)) .forEach(sref -> f.format("%s%n", sref)); f.flush(); } }
Source:
public void testToCompletionStageDelayedCompletion() { waitFor(2); Thread mainThread = Thread.currentThread(); Promise<String> willSucceed = Promise.promise(); Promise<String> willFail = Promise.promise(); willSucceed.future().toCompletionStage().whenComplete((str, err) -> { assertEquals("Yo", str); assertNull(err); assertNotSame(mainThread, Thread.currentThread()); complete(); }); willFail.future().toCompletionStage().whenComplete((str, err) -> { assertNull(str); assertTrue(err instanceof RuntimeException); assertEquals("Woops", err.getMessage()); assertNotSame(mainThread, Thread.currentThread()); complete(); }); disableThreadChecks(); new Thread(() -> willSucceed.complete("Yo")).start(); new Thread(() -> willFail.fail(new RuntimeException("Woops"))).start(); await(5, SECONDS); }

Target:
public void testToCompletionStageDelayedCompletion() { waitFor(2); Thread mainThread = Thread.currentThread(); Promise<String> willSucceed = Promise.promise(); Promise<String> willFail = Promise.promise(); willSucceed.future().toCompletionStage().whenComplete((str, err) -> { assertEquals("Yo", str); assertNull(err); assertNotSame(mainThread, Thread.currentThread()); complete(); }); willFail.future().toCompletionStage().whenComplete((str, err) -> { assertNull(str); assertTrue(err instanceof RuntimeException); assertEquals("Woops", err.getMessage()); assertNotSame(mainThread, Thread.currentThread()); complete(); }); disableThreadChecks(); new Thread(() -> willSucceed.complete("Yo")).start(); new Thread(() -> willFail.fail(new RuntimeException("Woops"))).start(); await(); }
Source:
public final String toDot() { build(); StringBuilder sb = new StringBuilder("graph " + name() + "{"); for (DotGraph.Node node : nodes) { sb.append(node.toDot()); } for (DotGraph.Edge edge : edges) { sb.append(edge.toDot()); } return sb.append("}").toString(); }

Target:
public final String toDot() { build(); StringBuilder sb = new StringBuilder() .append("graph ") .append(name()) .append(" {") .append(NEW_LINE); elements.build().map(DotElement::toDot).forEach(sb::append); return sb.append(NEW_LINE) .append("}") .toString(); }
Source:
public void testProjectImportWithOptional() throws Exception { String filePath = rootTestResourcesPath + "project_with_optional.xml"; saxParser.parse(inputStream = DatabaseProjectXmlHandlerTest.class.getResourceAsStream(filePath), handler); assertEquals(1, projectsReceiver.getProjects().size()); Project project = projectsReceiver.getProjects().iterator().next(); assertEquals(projectId, project.getId()); assertEquals(projectGrantId, project.getProjectGrantId()); assertEquals(projectAcronym, project.getProjectAcronym()); assertEquals(fundingClass, project.getFundingClass()); assertEquals(optional1, project.getOptional1()); assertEquals(optional2, project.getOptional2()); }

Target:
public void testProjectImportWithOptional() throws Exception { String filePath = rootTestResourcesPath + "project_with_optional.xml"; saxParser.parse(inputStream = DatabaseProjectXmlHandlerTest.class.getResourceAsStream(filePath), handler); assertEquals(1, projectsReceiver.getProjects().size()); Project project = projectsReceiver.getProjects().get(0); assertEquals(projectId, project.getId()); assertEquals(projectGrantId, project.getProjectGrantId()); assertEquals(projectAcronym, project.getProjectAcronym()); assertEquals(fundingClass, project.getFundingClass()); assertEquals(optional1, project.getOptional1()); assertEquals(optional2, project.getOptional2()); }
Source:
public String getWorkspaceLocation() { IEclipseContext context = getWorkbenchConfigurer().getWorkbench().getService(IEclipseContext.class); return IDEWorkspacePreferencePage.getWorkspaceLocationForWindowTitle(context); }

Target:
public String getWorkspaceLocation() { IEclipseContext context = getWorkbenchConfigurer().getWorkbench().getService(IEclipseContext.class); String location = (String) context.get(E4Workbench.SHOW_LOCATION); if (location != null) { return location; } if (IDEWorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(IDEInternalPreferences.SHOW_LOCATION)) { return Platform.getLocation().toOSString(); } return null; }
Source:
private Response createResponse(Status status, Object entity) { ResponseBuilder rp = responseBuilder(status); PipedOutputStream out = new PipedOutputStream(); try { PipedInputStream in = new PipedInputStream(out); rp.entity(in); } catch (IOException e) { throw new RuntimeException(e); } new Thread(new Runnable() { @Override public void run() { try (JsonWriter jsonWriter = GSON.newJsonWriter(new BufferedWriter(new OutputStreamWriter(out)))) { if (entity != null) { GSON.toJson(entity, entity.getClass(), jsonWriter); jsonWriter.flush(); } } catch (IOException | JsonIOException e) { logger.error("Error streaming JSON through PipedInpuStream/PipedOutputStream: ", e); } } }).start(); return rp.build(); }

Target:
private Response createResponse(Status status, Object entity) { ResponseBuilder rp = responseBuilder(status); PipedOutputStream out = new PipedOutputStream(); try { PipedInputStream in = new PipedInputStream(out); rp.entity(in); } catch (IOException e) { throw new RuntimeException(e); } Thread writerThread = new Thread(() -> { try (JsonWriter jsonWriter = gson.newJsonWriter(new BufferedWriter(new OutputStreamWriter(out)))) { if (entity != null) { gson.toJson(entity, entity.getClass(), jsonWriter); jsonWriter.flush(); } } catch (IOException | JsonIOException e) { logger.error("Error streaming JSON through PipedInpuStream/PipedOutputStream: ", e); } }); writerThread.setDaemon(true); writerThread.start(); return rp.build(); }
Source:
public static DateTime getTargetDate(final boolean isDaySleeper, final DateTime queryDate, final DateTime currentTimeLocal, final Optional<Integer> queryHourOptional, final TimeZoneOffsetMap timeZoneOffsetMap){ final long queryDateLocal = queryDate.getMillis() - timeZoneOffsetMap.getOffsetWithDefaultAsZero(queryDate.getMillis()); final boolean isStillQueryDate; if (queryHourOptional.isPresent()) { isStillQueryDate = (currentTimeLocal.withTimeAtStartOfDay().getMillis() - queryDateLocal) < DateTimeConstants.MILLIS_PER_DAY; } else { isStillQueryDate = false; } final DateTime targetDate; if(isStillQueryDate && !isDaySleeper){ targetDate = queryDate.minusDays(1); } else { targetDate = queryDate; } return targetDate; }

Target:
public static DateTime getTargetDate(final boolean isDaySleeper, final DateTime queryDate, final DateTime currentTimeLocal, final Optional<Integer> queryHourOptional, final TimeZoneOffsetMap timeZoneOffsetMap){ final long endQueryDate = queryDate.getMillis() - timeZoneOffsetMap.getOffsetWithDefaultAsZero(queryDate.getMillis()) + DateTimeConstants.MILLIS_PER_DAY; final boolean isStillQueryDate; if (queryHourOptional.isPresent()) { isStillQueryDate = currentTimeLocal.withTimeAtStartOfDay().isBefore(endQueryDate); } else { isStillQueryDate = false; } final DateTime targetDate; if(isStillQueryDate && !isDaySleeper){ targetDate = queryDate.minusDays(1); } else { targetDate = queryDate; } return targetDate; }
Source:
public static void customizeTable(JTable table) { table.setGridColor(Color.lightGray); table.setRowHeight(28); }

Target:
public static void customizeTable(JTable table) { table.setGridColor(lightGray); table.setRowHeight(28); }
Source:
public boolean isValid(T value, ConstraintValidatorContext context) { if ( value == null ) { return true; } Clock reference; try { ClockProvider clockProvider = context.getClockProvider(); reference = clockProvider.getClock(); } catch (Exception e) { throw LOG.getUnableToGetCurrentTimeFromClockProvider( e ); } int result = value.compareTo( getReferenceValue( reference ) ); if ( isPast ) { return isPresentValid ? ( result <= 0 ) : ( result < 0 ); } else { return isPresentValid ? ( result >= 0 ) : ( result > 0 ); } }

Target:
public boolean isValid(T value, ConstraintValidatorContext context) { if ( value == null ) { return true; } Clock reference; try { ClockProvider clockProvider = context.getClockProvider(); reference = clockProvider.getClock(); } catch (Exception e) { throw LOG.getUnableToGetCurrentTimeFromClockProvider( e ); } int result = value.compareTo( getReferenceValue( reference ) ); return isValid( result ); }
Source:
public int getClientDestinationPort() { if (clientRemoteAddress instanceof InetSocketAddress) { return ((InetSocketAddress) clientRemoteAddress).getPort(); } else { return getOriginalPort(); } }

Target:
public Optional<Integer> getClientDestinationPort() { if (clientRemoteAddress instanceof InetSocketAddress) { InetSocketAddress inetSocketAddress = (InetSocketAddress) this.clientRemoteAddress; return Optional.of(inetSocketAddress.getPort()); } else { return Optional.empty(); } }
Source:
public static int hashCodeAscii(CharSequence bytes) { int hash = HASH_CODE_ASCII_SEED; final int length = bytes.length(), remainingBytes = length & 7; if (length >= 32) { for (int i = length - 8; i >= remainingBytes; i -= 8) { hash = hashCodeAsciiCompute(bytes, i, hash); } } else if (length >= 8) { hash = hashCodeAsciiCompute(bytes, length - 8, hash); if (length >= 16) { hash = hashCodeAsciiCompute(bytes, length - 16, hash); if (length >= 24) { hash = hashCodeAsciiCompute(bytes, length - 24, hash); } } } if (remainingBytes == 0) { return hash; } int offset = 0; if (remainingBytes != 2 & remainingBytes != 4 & remainingBytes != 6) { hash = hash * HASH_CODE_C1 + hashCodeAsciiSanitizeByte(bytes.charAt(0)); offset = 1; } if (remainingBytes != 1 & remainingBytes != 4 & remainingBytes != 5) { hash = hash * (offset == 0 ? HASH_CODE_C1 : HASH_CODE_C2) + hashCodeAsciiSanitize(hashCodeAsciiSanitizeShort(bytes, offset)); offset += 2; } if (remainingBytes >= 4) { return hash * ((offset == 0 | offset == 3) ? HASH_CODE_C1 : HASH_CODE_C2) + hashCodeAsciiSanitizeInt(bytes, offset); } return hash; }

Target:
public static int hashCodeAscii(CharSequence bytes) { final int length = bytes.length(); final int remainingBytes = length & 7; int hash = HASH_CODE_ASCII_SEED; if (length >= 32) { for (int i = length - 8; i >= remainingBytes; i -= 8) { hash = hashCodeAsciiCompute(bytes, i, hash); } } else if (length >= 8) { hash = hashCodeAsciiCompute(bytes, length - 8, hash); if (length >= 16) { hash = hashCodeAsciiCompute(bytes, length - 16, hash); if (length >= 24) { hash = hashCodeAsciiCompute(bytes, length - 24, hash); } } } if (remainingBytes == 0) { return hash; } int offset = 0; if (remainingBytes != 2 & remainingBytes != 4 & remainingBytes != 6) { hash = hash * HASH_CODE_C1 + hashCodeAsciiSanitizeByte(bytes.charAt(0)); offset = 1; } if (remainingBytes != 1 & remainingBytes != 4 & remainingBytes != 5) { hash = hash * (offset == 0 ? HASH_CODE_C1 : HASH_CODE_C2) + hashCodeAsciiSanitize(hashCodeAsciiSanitizeShort(bytes, offset)); offset += 2; } if (remainingBytes >= 4) { return hash * ((offset == 0 | offset == 3) ? HASH_CODE_C1 : HASH_CODE_C2) + hashCodeAsciiSanitizeInt(bytes, offset); } return hash; }
Source:
private void modifyNearbyAI() { float x = getPos().getX(); float y = getPos().getY(); float z = getPos().getZ(); List<EntityVillager> villagers = MiscTools.getNearbyEntities(worldObj, EntityVillager.class, x, y - 1, y + 3, z, 20); for (EntityVillager villager : villagers) { AIPlugin.addAITask(villager, 9, new EntityAIWatchBlock(villager, getMachineType().getBlock(), getMachineType().ordinal(), 4, 0.08F)); AIPlugin.addAITask(villager, 9, new EntityAIMoveToBlock(villager, getMachineType().getBlock(), getMachineType().ordinal(), 16, 0.002F)); } }

Target:
private void modifyNearbyAI() { for (EntityVillager villager : findNearbyVillagers(20)) { AIPlugin.addAITask(villager, 9, new EntityAIWatchBlock(villager, getMachineType().getState(), 4, 0.08F)); AIPlugin.addAITask(villager, 9, new EntityAIMoveToBlock(villager, getMachineType().getState(), 16, 0.002F)); } }
Source:
public void run() { if (!ensureMeasurementNecessary()) return; final String sixRandomDigits = String.valueOf(mRandom.nextInt(900000) + 100000); final byte[] dnsPacket = getDnsQueryPacket(sixRandomDigits); try (SSLSocket sslSocket = setupSSLSocket()) { mMeasurement.startTime = now(); sslSocket.connect( new InetSocketAddress(mTarget, DNS_TLS_PORT), TCP_CONNECT_TIMEOUT); sslSocket.startHandshake(); maybeDoHostnameVerification(sslSocket); mMeasurement.description += " src{" + getLocalAddressString(sslSocket) + "}" + " qtype{" + mQueryType + "}" + " qname{" + sixRandomDigits + "-android-ds.metric.gstatic.com}"; final OutputStream output = sslSocket.getOutputStream(); final ByteBuffer querySize = ByteBuffer.allocate(2); querySize.putShort((short) dnsPacket.length); output.write(querySize.array()); output.write(dnsPacket); final InputStream input = sslSocket.getInputStream(); final byte[] buf = new byte[2]; input.read(buf, 0, 2); final short expectReplyLen = ByteBuffer.wrap(buf).getShort(); final byte[] reply = new byte[expectReplyLen]; int read = 0; while (read < expectReplyLen) { int n = input.read(reply, read, expectReplyLen - read); if (n < 0) break; read += n; } if (read == expectReplyLen && read > DNS_HEADER_SIZE) { mMeasurement.recordSuccess("1/1 " + responseCodeStr((int) (reply[3]) & 0x0f)); } else { mMeasurement.recordFailure("Unexpected answer length " + read); } } catch (IOException | NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { mMeasurement.recordFailure(e.toString()); } }

Target:
public void run() { if (isFailedDuringConstruction()) return; final String sixRandomDigits = String.valueOf(mRandom.nextInt(900000) + 100000); final byte[] dnsPacket = getDnsQueryPacket(sixRandomDigits); try (SSLSocket sslSocket = setupSSLSocket()) { mMeasurement.startTime = now(); sslSocket.connect( new InetSocketAddress(mTarget, DNS_TLS_PORT), TCP_CONNECT_TIMEOUT_MS); sslSocket.startHandshake(); appendDnsToMeasurementDescription( sixRandomDigits, sslSocket.getLocalSocketAddress()); final OutputStream output = sslSocket.getOutputStream(); final ByteBuffer querySize = ByteBuffer.allocate(2); querySize.putShort((short) dnsPacket.length); output.write(querySize.array()); output.write(dnsPacket); final InputStream input = sslSocket.getInputStream(); final byte[] lengthField = new byte[2]; input.read(lengthField, 0, 2); final short expectReplyLen = ByteBuffer.wrap(lengthField).getShort(); if (expectReplyLen <= 0) { throw new IOException("Unexpected length Field " + expectReplyLen); } final byte[] reply = new byte[expectReplyLen]; int read = 0; while (read < expectReplyLen) { int n = input.read(reply, read, expectReplyLen - read); if (n < 0) { throw new IOException("Unexpected EOF"); } read += n; } if (read == expectReplyLen && read > DNS_HEADER_SIZE) { mMeasurement.recordSuccess("1/1 " + responseCodeStr((int) (reply[3]) & 0x0f)); } else { mMeasurement.recordFailure( "Read " + read + " bytes while length field is " + expectReplyLen); } } catch (IOException e) { mMeasurement.recordFailure(e.toString()); } }
Source:
public static List<String> getEnclosingBlockNames(@Nonnull List<FlowNode> nodes) { List<String> names = new ArrayList<>(); for (FlowNode n : nodes) { ThreadNameAction threadNameAction = n.getAction(ThreadNameAction.class); if (n.getAction(LabelAction.class) != null && threadNameAction != null) { names.add(threadNameAction.getThreadName()); } else { names.add(n.getDisplayName()); } } return names; }

Target:
public static List<String> getEnclosingBlockNames(@Nonnull List<FlowNode> nodes) { List<String> names = new ArrayList<>(); for (FlowNode n : nodes) { ThreadNameAction threadNameAction = n.getAction(ThreadNameAction.class); LabelAction labelAction = n.getAction(LabelAction.class); if (threadNameAction != null) { names.add(threadNameAction.getThreadName()); } else if (labelAction != null) { names.add(labelAction.getDisplayName()); } } return names; }
Source:
public int updateDevicePingMins(String deviceId, int newPingMins) throws DeviceOrganizationDAOException { Connection conn; PreparedStatement stmt = null; int rows; int updatedPingMins = -1; try { conn = this.getConnection(); String sql = "UPDATE DEVICE_ORGANIZATION_MAP SET MINUTES_SINCE_LAST_PING = ? WHERE DEVICE_ID = ?"; stmt = conn.prepareStatement(sql, new String[]{"id"}); stmt.setInt(1, newPingMins); stmt.setString(2, deviceId); rows = stmt.executeUpdate(); if (rows > 0) { updatedPingMins = newPingMins; } } catch (SQLException e) { throw new DeviceOrganizationDAOException("Error occurred while updating No. of mins since last ping of device '" + deviceId + "'", e); } finally { DeviceManagementDAOUtil.cleanupResources(stmt, null); return updatedPingMins; } }

Target:
public int updateDevicePingMins(String deviceId, int newPingMins) throws DeviceOrganizationDAOException { Connection conn; PreparedStatement stmt = null; int rows; int updatedPingMins = -1; try { conn = this.getConnection(); String sql = "UPDATE DEVICE_ORGANIZATION_MAP SET MINUTES_SINCE_LAST_PING = ? WHERE DEVICE_ID = ?"; stmt = conn.prepareStatement(sql, new String[]{"id"}); stmt.setInt(1, newPingMins); stmt.setString(2, deviceId); rows = stmt.executeUpdate(); if (rows > 0) { updatedPingMins = newPingMins; } } catch (SQLException e) { throw new DeviceOrganizationDAOException("Error occurred while " + "updating No. of mins since last ping of device '" + deviceId + "'", e); } finally { DeviceManagementDAOUtil.cleanupResources(stmt, null); return updatedPingMins; } }
Source:
public void testParseHost( String test_description, String uri_host, String partToExtract, String result ) { if (result.equals("")) { result = null; } assertEquals( test_description, result, HostParser.parse( uri_host, partToExtract ) ); }

Target:
public void testParseHost( String test_description, String uri_host, String partToExtract, String result ) { if (result.equals("__null__")) { result = null; } assertEquals( test_description, result, HostParser.parse( uri_host, partToExtract ) ); }
Source:
public ConnectionAnchor(Block block) { this.loadFXML("ConnectionAnchor"); this.block = block; this.errorState = new SimpleBooleanProperty(false); this.activeState = new SimpleBooleanProperty(true); connections = new ArrayList<Connection>(); activeState.addListener(a -> invalidateActive()); errorState.addListener(this::checkError); }

Target:
public ConnectionAnchor(Block block) { this.loadFXML("ConnectionAnchor"); this.block = block; this.errorState = new SimpleBooleanProperty(false); this.activeState = new SimpleBooleanProperty(true); this.connections = new ArrayList<Connection>(); this.activeState.addListener(a -> invalidateActive()); this.errorState.addListener(this::checkError); }
Source:
private static Token decode(String value) { try { byte[] byteValue = Base64.getUrlDecoder().decode(value); byte[] mac = Arrays.copyOf(byteValue, 32); byte[] restBytes = Arrays.copyOfRange(byteValue, 32, byteValue.length); String rest = new String(restBytes, StandardCharsets.UTF_8); if (!KEY.checkMac(restBytes, mac)) { throw new IllegalArgumentException("Failed mac check for " + rest); } String[] splits = rest.split("[:]", 3); String epoch = splits[0]; int authenticationNameLength = Integer.parseInt(splits[1]); String authenticationNameAndBrowserUrl = Util.fixEmpty(splits[2]); String authenticationName = authenticationNameAndBrowserUrl.substring(0, authenticationNameLength); String browserUrl = authenticationNameAndBrowserUrl.substring(authenticationNameLength + 1); return new Token(browserUrl, authenticationName, ofEpochMilli(Long.parseLong(epoch))); } catch (Exception ex) { LOGGER.log(Level.FINE, "Failure decoding", ex); return null; } }

Target:
private static Token decode(String value) { try { byte[] byteValue = Base64.getUrlDecoder().decode(value); byte[] mac = Arrays.copyOf(byteValue, 32); byte[] restBytes = Arrays.copyOfRange(byteValue, 32, byteValue.length); String rest = new String(restBytes, StandardCharsets.UTF_8); if (!KEY.checkMac(restBytes, mac)) { throw new IllegalArgumentException("Failed mac check for " + rest); } String[] splits = rest.split("[:]", 3); String epoch = splits[0]; int authenticationNameLength = Integer.parseInt(splits[1]); String authenticationNameAndBrowserUrl = splits[2]; String authenticationName = authenticationNameAndBrowserUrl.substring(0, authenticationNameLength); String browserUrl = authenticationNameAndBrowserUrl.substring(authenticationNameLength + 1); return new Token(browserUrl, authenticationName, ofEpochMilli(Long.parseLong(epoch))); } catch (Exception ex) { LOGGER.log(Level.FINE, "Failure decoding", ex); return null; } }
Source:
public void cleaUp() throws ServerConnectorException, InterruptedException { primaryClient.shutDown(); secondaryClient.shutDown(); serverConnectors.forEach( serverConnector -> { serverConnector.stop(); } ); }

Target:
public void cleaUp() throws ServerConnectorException, InterruptedException { serverConnectors.forEach( serverConnector -> { serverConnector.stop(); } ); }
Source:
public String toString() { return "InternalSinkRecord{" + "consumerRecord=" + originalRecord.toString() + "} " + super.toString(); }

Target:
public String toString() { return super.toString(); }
Source:
protected void customLoadScript(String processpath, String[] icons, String path){ String tempFolderPath = coreWorkspace.getApplicationFolder(); File tempFolder = new File(tempFolderPath, "wpsscripts"); if(!tempFolder.exists()) { if(!tempFolder.mkdirs()){ LOGGER.error("Unable to create the OrbisGIS temporary folder."); return; } } URL scriptUrl = this.getClass().getResource(processpath); final File tempFile = new File(tempFolder.getAbsolutePath(), new File(scriptUrl.getFile()).getName()); if(!tempFile.exists()) { try{ if(tempFile.createNewFile()){ LOGGER.error("Unable to create the script file."); return; } } catch (IOException e) { LoggerFactory.getLogger(WpsScriptsPackage.class).error(e.getMessage()); } } try (FileOutputStream out = new FileOutputStream(tempFile)) { IOUtils.copy(scriptUrl.openStream(), out); } catch (Exception e){ LOGGER.error("Unable to copy the content of the script to the temporary file."); return; } List<ProcessIdentifier> piList = localWpsService.addLocalSource(tempFile, icons, false, path); for(ProcessIdentifier pi : piList){ listIdProcess.add(pi.getProcessDescriptionType().getIdentifier()); } }

Target:
protected void customLoadScript(String processpath, String[] icons, String path){ String tempFolderPath = coreWorkspace.getApplicationFolder(); File tempFolder = new File(tempFolderPath, "wpsscripts"); if(!tempFolder.exists()) { if(!tempFolder.mkdirs()){ LOGGER.error("Unable to create the OrbisGIS temporary folder."); return; } } URL scriptUrl = this.getClass().getResource(processpath); final File tempFile = new File(tempFolder.getAbsolutePath(), new File(scriptUrl.getFile()).getName()); if(!tempFile.exists()) { try{ if(!tempFile.createNewFile()){ LOGGER.error("Unable to create the script file."); return; } } catch (IOException e) { LoggerFactory.getLogger(WpsScriptsPackage.class).error(e.getMessage()); } } try (FileOutputStream out = new FileOutputStream(tempFile)) { IOUtils.copy(scriptUrl.openStream(), out); } catch (Exception e){ LOGGER.error("Unable to copy the content of the script to the temporary file."); return; } List<ProcessIdentifier> piList = localWpsService.addLocalSource(tempFile, icons, false, path); for(ProcessIdentifier pi : piList){ listIdProcess.add(pi.getProcessDescriptionType().getIdentifier()); } }
Source:
private Watch pvcIsWaitingForConsumerWatcher( CompletableFuture<PersistentVolumeClaim> future, PersistentVolumeClaim actualPvc) throws InfrastructureException { return clientFactory .create(workspaceId) .events() .inNamespace(namespace) .withField("reason", "WaitForFirstConsumer") .withField("involvedObject.uid", actualPvc.getMetadata().getUid()) .watch( new Watcher<Event>() { private final Logger log = LoggerFactory.getLogger(getClass()); @Override public void eventReceived(Action action, Event resource) { log.debug( "PVC is waiting for first consumer. Don't wait to bound to avoid deadlock."); future.complete(actualPvc); } @Override public void onClose(KubernetesClientException cause) { log.debug(cause.toString()); } }); }

Target:
private Watch pvcIsWaitingForConsumerWatcher( CompletableFuture<PersistentVolumeClaim> future, PersistentVolumeClaim actualPvc) throws InfrastructureException { return clientFactory .create(workspaceId) .events() .inNamespace(namespace) .withField(PVC_EVENT_REASON_FIELD_KEY, PVC_EVENT_WAIT_CONSUMER_REASON) .withField(PVC_EVENT_UID_FIELD_KEY, actualPvc.getMetadata().getUid()) .watch( new Watcher<Event>() { @Override public void eventReceived(Action action, Event resource) { LOG.debug( "PVC '" + actualPvc.getMetadata().getName() + "' is waiting for first consumer. Don't wait to bound to avoid deadlock."); future.complete(actualPvc); } @Override public void onClose(KubernetesClientException cause) { safelyFinishFutureOnClose(cause, future, actualPvc.getMetadata().getName()); } }); }
Source:
public final void draw(GC gc, ITimeGraphPresentationProvider provider) { Rectangle bounds = getBounds(); if (bounds.width <= 0) { return; } RGBAColor backgroundRgba = getBackgroundColor(); if (backgroundRgba != null) { int prevAlpha = gc.getAlpha(); Color prevBgColor = gc.getBackground(); Color prevFgColor = gc.getForeground(); int prevLineWidth = gc.getLineWidth(); setContext(gc); innerDraw(gc); RGBAColor foregroundRgb = getForegroundColor(); if (foregroundRgb != null) { setContext(gc); drawBorder(gc); } gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); postDraw(provider, gc); gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); } }

Target:
public final void draw(GC gc, ITimeGraphPresentationProvider provider) { Rectangle bounds = getBounds(); if (bounds.width <= 0) { return; } RGBAColor backgroundRgba = getBackgroundColor(); if (backgroundRgba != null) { int prevAlpha = gc.getAlpha(); Color prevBgColor = gc.getBackground(); Color prevFgColor = gc.getForeground(); int prevLineWidth = gc.getLineWidth(); setContext(gc); innerDraw(gc); if (fLineWidth != NO_BORDER) { setContext(gc); drawBorder(gc); } gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); postDraw(provider, gc); gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); } }
Source:
public Map<String, JobValidatorService> getRegisteredFactories() throws IllegalAccessException, InstantiationException { return new HashMap<>(jobValidators); }

Target:
public ImmutableMap<String, JobValidatorService> getRegisteredFactories() throws IllegalAccessException, InstantiationException { return jobValidators; }
Source:
private void notifySelect(boolean ctrl) { int stateMask1 = (ctrl) ? (SWT.NONE | SWT.CTRL) : SWT.NONE; int stateMask2 = (ctrl) ? (SWT.BUTTON1 | SWT.CTRL) : SWT.BUTTON1; SWTBotTreeItem item = new SWTBotTreeItem(lastSelectionItem); notifyTree(SWT.MouseEnter); notifyTree(SWT.MouseMove); notifyTree(SWT.Activate); notifyTree(SWT.FocusIn); notifyTree(SWT.MouseDown, item.createMouseEvent(1, stateMask1, 1)); notifyTree(SWT.Selection, item.createSelectionEvent(stateMask2)); notifyTree(SWT.MouseUp, item.createMouseEvent(1, stateMask2, 1)); notifyTree(SWT.MouseHover); notifyTree(SWT.MouseMove); notifyTree(SWT.MouseExit); notifyTree(SWT.Deactivate); }

Target:
private void notifySelect(boolean ctrl) { int stateMask1 = (ctrl) ? (SWT.NONE | SWT.CTRL) : SWT.NONE; int stateMask2 = (ctrl) ? (SWT.BUTTON1 | SWT.CTRL) : SWT.BUTTON1; SWTBotTreeItem item = new SWTBotTreeItem(lastSelectionItem); notifyTree(SWT.MouseEnter); notifyTree(SWT.MouseMove); notifyTree(SWT.Activate); notifyTree(SWT.FocusIn); notifyTree(SWT.MouseDown, item.createMouseEvent(1, stateMask1, 1)); notifyTree(SWT.Selection, item.createSelectionEvent(stateMask2)); notifyTree(SWT.MouseUp, item.createMouseEvent(1, stateMask2, 1)); }
Source:
private MessageEvent doActionRefreshCurrentPage(TestCaseExecution tCExecution) { MessageEvent message; try { LOG.debug("REFRESH CURRENT PAGE"); if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) { return this.webdriverService.doSeleniumActionRefreshCurrentPage(tCExecution.getSession()); } message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION); message.setDescription(message.getDescription().replace("%ACTION%", "OpenURL[WithBase]")); message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType())); return message; } catch (Exception e) { message = new MessageEvent(MessageEventEnum.ACTION_FAILED_REFRESHCURRENTPAGE); String messageString = e.getMessage().split("\n")[0]; message.setDescription(message.getDescription().replace("%DETAIL%", messageString)); LOG.debug("Exception Running scroll to :" + messageString, e); return message; } }

Target:
private MessageEvent doActionRefreshCurrentPage(TestCaseExecution tCExecution) { MessageEvent message; try { LOG.debug("REFRESH CURRENT PAGE"); if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) { return this.webdriverService.doSeleniumActionRefreshCurrentPage(tCExecution.getSession()); } message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION); message.setDescription(message.getDescription().replace("%ACTION%", "refreshCurrentPage")); message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType())); return message; } catch (Exception e) { message = new MessageEvent(MessageEventEnum.ACTION_FAILED_REFRESHCURRENTPAGE); String messageString = e.getMessage().split("\n")[0]; message.setDescription(message.getDescription().replace("%DETAIL%", messageString)); LOG.debug("Exception doing action refreshCurrentPage :" + messageString, e); return message; } }
Source:
private DiskImage createMemoryDisk(Snapshot snapshot) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); StorageDomainStatic sd = validateStorageDomainExistsInDb(snapshot, guids.get(0), guids.get(2), guids.get(3)); DiskImage disk = isMemoryDiskAlreadyExistsInDb(snapshot, guids.get(2), guids.get(3)); if (sd == null || disk != null) { return null; } VM vm = snapshotVmConfigurationHelper.getVmFromConfiguration( snapshot.getVmConfiguration(), snapshot.getVmId(), snapshot.getId()); DiskImage memoryDisk = MemoryUtils.createSnapshotMemoryDisk( vm, sd.getStorageType(), vmOverheadCalculator, MemoryUtils.generateMemoryDiskDescription(vm, snapshot.getDescription())); memoryDisk.setId(guids.get(2)); memoryDisk.setImageId(guids.get(3)); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(guids.get(0)))); memoryDisk.setStoragePoolId(guids.get(1)); memoryDisk.setCreationDate(snapshot.getCreationDate()); memoryDisk.setActive(true); memoryDisk.setWipeAfterDelete(vm.getDiskList().stream().anyMatch(d -> d.isWipeAfterDelete())); return memoryDisk; }

Target:
private DiskImage createMemoryDisk(Snapshot snapshot) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); StorageDomainStatic sd = validateStorageDomainExistsInDb(snapshot, guids.get(0), guids.get(2), guids.get(3)); DiskImage disk = isMemoryDiskAlreadyExistsInDb(snapshot, guids.get(2), guids.get(3)); if (sd == null || disk != null) { return null; } VM vm = snapshotVmConfigurationHelper.getVmFromConfiguration( snapshot.getVmConfiguration(), snapshot.getVmId(), snapshot.getId()); DiskImage memoryDisk = MemoryUtils.createSnapshotMemoryDisk( vm, sd.getStorageType(), vmOverheadCalculator, MemoryUtils.generateMemoryDiskDescription(vm, snapshot.getDescription())); memoryDisk.setId(guids.get(2)); memoryDisk.setImageId(guids.get(3)); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(guids.get(0)))); memoryDisk.setStoragePoolId(guids.get(1)); memoryDisk.setCreationDate(snapshot.getCreationDate()); memoryDisk.setActive(true); memoryDisk.setWipeAfterDelete(vm.getDiskList().stream().anyMatch(DiskImage::isWipeAfterDelete)); return memoryDisk; }
Source:
public Object open(Connection connection, long oid, int mode) throws SQLException { if (shouldUseReflection) { Object largeObjectManager = getLargeObjectManager(connection); try { Method method = largeObjectManager.getClass().getMethod("open", Connection.class, long.class, int.class); return method.invoke(largeObjectManager, connection, oid, mode); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { throw new SQLException("Couldn't access org.postgresql.largeobject.LargeObjectManager", ex); } } else { return ((PGConnection) unwrap(connection)).getLargeObjectAPI().open(oid, mode); } }

Target:
public Object open(Connection connection, long oid, int mode) throws SQLException { if (shouldUseReflection) { Object largeObjectManager = getLargeObjectManager(connection); try { Method method = largeObjectManager.getClass().getMethod("open", long.class, int.class); return method.invoke(largeObjectManager, oid, mode); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { throw new SQLException("Couldn't access org.postgresql.largeobject.LargeObjectManager", ex); } } else { return ((PGConnection) unwrap(connection)).getLargeObjectAPI().open(oid, mode); } }
Source:
public synchronized AdHocPlannedStatement planSqlCalcite(SqlTask task) throws ValidationException, RelConversionException, PlannerFallbackException { VoltPlanner planner = new VoltPlanner(m_schemaPlus); planner.validate(task.getParsedQuery()); RelNode rel = planner.convert(task.getParsedQuery()); RelTraitSet requiredLogicalOutputTraits = rel.getTraitSet().replace(VoltLogicalRel.VOLTDB_LOGICAL); RelNode transformed = planner.transform( VoltPlannerPrograms.directory.LOGICAL.ordinal(), requiredLogicalOutputTraits, rel); transformed = VoltDBRelUtil.addTraitRecurcively(transformed, RelDistributions.SINGLETON); RelTraitSet requiredPhysicalOutputTraits = transformed.getTraitSet().replace(VoltDBPRel.VOLTDB_PHYSICAL); RelNode nodeAfterPhysicalConversion = planner.transform( VoltPlannerPrograms.directory.VOLT_PHYSICAL_CONVERSION.ordinal(), requiredPhysicalOutputTraits, transformed); Util.discard(nodeAfterPhysicalConversion); planner.close(); throw new PlannerFallbackException(); }

Target:
public synchronized AdHocPlannedStatement planSqlCalcite(SqlTask task) throws ValidationException, RelConversionException, PlannerFallbackException { VoltPlanner planner = new VoltPlanner(m_schemaPlus); planner.validate(task.getParsedQuery()); RelNode rel = planner.convert(task.getParsedQuery()); compileLog.info("ORIGINAL\n" + RelOptUtil.toString(rel)); RelTraitSet requiredLogicalOutputTraits = planner.getEmptyTraitSet().replace(VoltLogicalRel.CONVENTION); RelNode transformed = planner.transform( PlannerRules.Phase.LOGICAL.ordinal(), requiredLogicalOutputTraits, rel); compileLog.info("LOGICAL\n" + RelOptUtil.toString(transformed)); transformed.getCluster().getPlanner().addRelTraitDef(RelDistributionTraitDef.INSTANCE); transformed = VoltRelUtil.addTraitRecurcively(transformed, RelDistributions.SINGLETON); planner.close(); throw new PlannerFallbackException(); }
Source:
private static LocalDate convertDate(Attribute attr, String valueAsString) { try { return parseLocalDate(valueAsString); } catch (java.time.format.DateTimeParseException e) { throw new DateParseException(attr, valueAsString); } }

Target:
private static LocalDate convertDate(Attribute attr, String valueAsString) { try { return parseLocalDate(valueAsString); } catch (DateTimeParseException e) { throw new DateParseException(attr, valueAsString); } }
Source:
public static byte[] rowFollowingSameLength(byte[] rowKey) { byte[] result = Arrays.copyOf(rowKey, rowKey.length); result[rowKey.length - 1] = 0; for (int index = rowKey.length - 1; index >= 0; index--) { result[index] = (byte) (rowKey[index] + 1); if (result[index] != 0) { break; } } return result; }

Target:
public static byte[] rowFollowingSameLength(byte[] rowKey) { byte[] result = Arrays.copyOf(rowKey, rowKey.length); for (int index = rowKey.length - 1; index >= 0; index--) { result[index] = (byte) (rowKey[index] + 1); if (result[index] != 0) { break; } } return result; }
Source:
public void resolveMessageOrDefaultShouldReturnMessageKeyWhenMessageResolutionFails() { String message = messageKeyResolver.resolveMessageOrDefault(NON_EXISTENT_MESSAGE_KEY, DEFAULT_MESSAGE); assertThat(message, equalTo("[ ! " + NON_EXISTENT_MESSAGE_KEY + " ! ]")); }

Target:
public void resolveMessageOrDefaultShouldReturnMessageKeyWhenMessageResolutionFails() { given(messageSource .getMessage(eq(NON_EXISTENT_MESSAGE_KEY), any(Object[].class), any(Locale.class))) .willThrow(new NoSuchMessageException(NON_EXISTENT_MESSAGE_KEY)); String message = messageKeyResolver.resolveMessageOrDefault(NON_EXISTENT_MESSAGE_KEY); assertThat(message, equalTo( MessageKeyResolverImpl.DEFAULT_MESSAGE_PREFIX + NON_EXISTENT_MESSAGE_KEY + MessageKeyResolverImpl.DEFAULT_MESSAGE_POSTFIX)); }