auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected static List<Integer> getEmptySpread() { return Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); }

Target:
protected static List<Integer> getEmptySpread() { return new ArrayList<Integer>(Collections.nCopies(96, 0)); }
Source:
public int hashCode() { int prime = 14747; int result = prime + ((fName == null) ? 0 : fName.hashCode()); result = prime * result + fTestClass.hashCode(); return prime * result + fParameters.hashCode(); }

Target:
public int hashCode() { int prime = 14747; int result = prime + fName.hashCode(); result = prime * result + fTestClass.hashCode(); return prime * result + fParameters.hashCode(); }
Source:
public void patchCanLoginMissingValue() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/canLogin", "true"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true)));; List<Operation> ops2 = new ArrayList<Operation>(); ReplaceOperation replaceOperation2 = new ReplaceOperation("/canLogin", null); ops2.add(replaceOperation2); patchBody = getPatchContent(ops2); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isBadRequest()); getClient(token).perform(get("/api/eperson/epersons/" + ePerson.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))) .andExpect(jsonPath("$.email", Matchers.is("johndoe@fake-email.com"))) .andExpect(jsonPath("$.requireCertificate", Matchers.is(false))); }

Target:
public void patchCanLoginMissingValue() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/canLogin", true); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true)));; List<Operation> ops2 = new ArrayList<Operation>(); ReplaceOperation replaceOperation2 = new ReplaceOperation("/canLogin", null); ops2.add(replaceOperation2); patchBody = getPatchContent(ops2); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isBadRequest()); getClient(token).perform(get("/api/eperson/epersons/" + ePerson.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))) .andExpect(jsonPath("$.email", Matchers.is("johndoe@fake-email.com"))) .andExpect(jsonPath("$.requireCertificate", Matchers.is(false))); }
Source:
private void readData( Node stepnode ) throws KettleXMLException { try { inputFileField = XMLHandler.getTagValue( stepnode, "input_file_field" ); outputFileField = XMLHandler.getTagValue( stepnode, "output_file_field" ); inputFile = XMLHandler.getTagValue( stepnode, "input_file" ); outputFile = XMLHandler.getTagValue( stepnode, "output_file" ); useValuesFromFields = "Y".equals( XMLHandler.getTagValue( stepnode, "use_values_from_fields" ) ) || XMLHandler.getTagValue( stepnode, "use_values_from_fields" ) == null; createParentfolder = "Y".equals( XMLHandler.getTagValue( stepnode, "create_parent_folder" ) ); parameterFieldMap = new HashMap<String, String>(); Node parsNode = XMLHandler.getSubNode( stepnode, XML_TAG_PARAMETERS ); List<Node> nodes = XMLHandler.getNodes( parsNode, XML_TAG_PARAMETER ); for ( Node node : nodes ) { String parameter = XMLHandler.getTagValue( node, "name" ); String fieldname = XMLHandler.getTagValue( node, "field" ); if ( !Utils.isEmpty( parameter ) && !Utils.isEmpty( fieldname ) ) { parameterFieldMap.put( parameter, fieldname ); } } outputProcessorType = ProcessorType.getProcessorTypeByCode( XMLHandler.getTagValue( stepnode, "processor_type" ) ); } catch ( Exception e ) { throw new KettleXMLException( BaseMessages.getString( PKG, "PentahoReportingOutputMeta.Exception.UnableToLoadStepInfo" ), e ); } }

Target:
private void readData( Node stepnode ) throws KettleXMLException { try { inputFileField = XMLHandler.getTagValue( stepnode, XML_TAG_INPUT_FILE_FIELD ); outputFileField = XMLHandler.getTagValue( stepnode, XML_TAG_OUTPUT_FILE_FIELD ); inputFile = XMLHandler.getTagValue( stepnode, XML_TAG_INPUT_FILE ); outputFile = XMLHandler.getTagValue( stepnode, XML_TAG_OUTPUT_FILE ); useValuesFromFields = "Y".equals( XMLHandler.getTagValue( stepnode, XML_TAG_USE_VALUES_FROM_FIELDS ) ) || XMLHandler.getTagValue( stepnode, XML_TAG_USE_VALUES_FROM_FIELDS ) == null; createParentFolder = "Y".equals( XMLHandler.getTagValue( stepnode, XML_TAG_CREATE_PARENT_FOLDER ) ); parameterFieldMap = new HashMap<String, String>(); Node parsNode = XMLHandler.getSubNode( stepnode, XML_TAG_PARAMETERS ); List<Node> nodes = XMLHandler.getNodes( parsNode, XML_TAG_PARAMETER ); for ( Node node : nodes ) { String parameter = XMLHandler.getTagValue( node, XML_TAG_NAME ); String fieldname = XMLHandler.getTagValue( node, XML_TAG_FIELD ); if ( !Utils.isEmpty( parameter ) && !Utils.isEmpty( fieldname ) ) { parameterFieldMap.put( parameter, fieldname ); } } outputProcessorType = ProcessorType.getProcessorTypeByCode( XMLHandler.getTagValue( stepnode, XML_TAG_PROCESSOR_TYPE ) ); } catch ( Exception e ) { throw new KettleXMLException( BaseMessages.getString( PKG, "PentahoReportingOutputMeta.Exception.UnableToLoadStepInfo" ), e ); } }
Source:
private static boolean isSchemaCompatibleWithRelObj(Object relObj, Schema unionSchema) { if (unionSchema.getType() == Schema.Type.NULL) { return relObj == null; } switch (unionSchema.getType()) { case RECORD: return relObj instanceof SamzaSqlRelRecord; case ARRAY: return relObj instanceof List; case MAP: return relObj instanceof Map; case FIXED: return relObj instanceof ByteString; case BYTES: return relObj instanceof ByteString; case FLOAT: return relObj instanceof Float || relObj instanceof Double; default: return true; } }

Target:
private static boolean isSchemaCompatibleWithRelObj(Object relObj, Schema unionSchema) { Validate.notNull(unionSchema, "Schema cannot be null"); if (unionSchema.getType() == Schema.Type.NULL) { return relObj == null; } switch (unionSchema.getType()) { case RECORD: return relObj instanceof SamzaSqlRelRecord; case ARRAY: return relObj instanceof List; case MAP: return relObj instanceof Map; case FIXED: return relObj instanceof ByteString; case BYTES: return relObj instanceof ByteString; case FLOAT: return relObj instanceof Float || relObj instanceof Double; default: return true; } }
Source:
public static char[] getPolicyFriendlyRandomPassword(String username) throws UserStoreException { return getPolicyFriendlyRandomPassword(username, 8); }

Target:
public static String getPolicyFriendlyRandomPassword(String username) throws UserStoreException { return getPolicyFriendlyRandomPassword(username, 8); }
Source:
protected DataSet(long id, long instrumentId, String name, LocalDateTime start, LocalDateTime end, int status, Properties properties, LocalDateTime lastTouched, int needsFlagCount, List<Message> messages) { this.id = id; this.instrumentId = instrumentId; this.name = name; this.start = start; this.end = end; this.status = status; this.properties = properties; this.lastTouched = lastTouched; this.needsFlagCount = needsFlagCount; this.messages = new ArrayList<>(messages); }

Target:
protected DataSet(long id, long instrumentId, String name, LocalDateTime start, LocalDateTime end, int status, Properties properties, LocalDateTime lastTouched, int needsFlagCount, List<Message> messages) { this.id = id; this.instrumentId = instrumentId; this.name = name; this.start = start; this.end = end; this.status = status; this.properties = properties; this.lastTouched = lastTouched; this.needsFlagCount = needsFlagCount; this.messages = new ArrayList<Message>(messages); }
Source:
protected ExtractionResult visitInPredicate(InPredicate node, Boolean complement) { if (!(node.getValueList() instanceof InListExpression)) { return super.visitInPredicate(node, complement); } InListExpression valueList = (InListExpression) node.getValueList(); checkState(!valueList.getValues().isEmpty(), "InListExpression should never be empty"); Iterator<Expression> expressionIterator = valueList.getValues().iterator(); TupleDomain<Symbol> tupleDomain = process(new ComparisonExpression(EQUAL, node.getValue(), expressionIterator.next()), complement) .getTupleDomain(); while (expressionIterator.hasNext() && !tupleDomain.isAll()) { ExtractionResult result = process(new ComparisonExpression(EQUAL, node.getValue(), expressionIterator.next()), complement); if (complement) { tupleDomain = tupleDomain.intersect(result.getTupleDomain()); } else { tupleDomain = TupleDomain.columnWiseUnion(tupleDomain, result .getTupleDomain()); } } if (tupleDomain.isAll()) { Expression originalPredicate = node; if (complement) { originalPredicate = new NotExpression(originalPredicate); } return new ExtractionResult(tupleDomain, originalPredicate); } return new ExtractionResult(tupleDomain, TRUE_LITERAL); }

Target:
protected ExtractionResult visitInPredicate(InPredicate node, Boolean complement) { if (!(node.getValueList() instanceof InListExpression)) { return super.visitInPredicate(node, complement); } InListExpression valueList = (InListExpression) node.getValueList(); checkState(!valueList.getValues().isEmpty(), "InListExpression should never be empty"); ExtractionResult extractionResult; if (complement) { ImmutableList.Builder<Expression> disjuncts = ImmutableList.builder(); for (Expression expression : valueList.getValues()) { disjuncts.add(new ComparisonExpression(EQUAL, node.getValue(), expression)); } extractionResult = process(or(disjuncts.build()), true); } else { TupleDomain<Symbol> tupleDomain = TupleDomain.none(); for (Expression expression : valueList.getValues()) { ExtractionResult result = process(new ComparisonExpression(EQUAL, node.getValue(), expression), complement); tupleDomain = TupleDomain.columnWiseUnion(tupleDomain, result.getTupleDomain()); if (tupleDomain.isAll() || !result.isFullyRewritten()) { return new ExtractionResult(tupleDomain, node); } } extractionResult = new ExtractionResult(tupleDomain, TRUE_LITERAL); } if (extractionResult.tupleDomain.isAll()) { Expression originalPredicate = node; if (complement) { originalPredicate = new NotExpression(originalPredicate); } return new ExtractionResult(extractionResult.tupleDomain, originalPredicate); } return extractionResult; }
Source:
private void updateData(byte[] input, int offset, int len, boolean isFinal) throws IllegalBlockSizeException, BadPaddingException { inBuffer.clear(); inBuffer.put(input, offset, len); inBuffer.flip(); outBuffer.clear(); try { if (isFinal) { doFinal(inBuffer, outBuffer); } else { update(inBuffer, outBuffer); } } catch (ShortBufferException e) { } outBuffer.flip(); }

Target:
private void updateData(byte[] input, int offset, int len, boolean isFinal) throws IllegalBlockSizeException, BadPaddingException, ShortBufferException { inBuffer.clear(); inBuffer.put(input, offset, len); inBuffer.flip(); outBuffer.clear(); if (isFinal) { doFinal(inBuffer, outBuffer); } else { update(inBuffer, outBuffer); } outBuffer.flip(); }
Source:
public SWTBotTreeItem doubleClick() { waitForEnabled(); log.debug(MessageFormat.format("Double-clicking on {0}", this)); notifyTree(SWT.MouseEnter, createMouseEvent(0, SWT.NONE, 0)); notifyTree(SWT.Activate, super.createEvent()); setFocus(); notifyTree(SWT.FocusIn, super.createEvent()); notifyTree(SWT.MouseDown, createMouseEvent(1, SWT.NONE, 1)); notifyTree(SWT.Selection, createSelectionEvent(SWT.NONE), selectRunnable(widget, false)); notifyTree(SWT.MouseUp, createMouseEvent(1, SWT.BUTTON1, 1)); notifyTree(SWT.MouseDown, createMouseEvent(1, SWT.NONE, 2)); notifyTree(SWT.MouseDoubleClick, createMouseEvent(1, SWT.NONE, 2)); notifyTree(SWT.DefaultSelection, createSelectionEvent(SWT.NONE)); notifyTree(SWT.MouseUp, createMouseEvent(1, SWT.BUTTON1, 2)); notifyTree(SWT.MouseExit, createMouseEvent(0, SWT.NONE, 0)); notifyTree(SWT.Deactivate, super.createEvent()); notifyTree(SWT.FocusOut, super.createEvent()); log.debug(MessageFormat.format("Double-clicked on {0}", this)); return this; }

Target:
public SWTBotTreeItem doubleClick() { waitForEnabled(); log.debug(MessageFormat.format("Double-clicking on {0}", this)); notifyTree(SWT.MouseEnter, createMouseEvent(0, SWT.NONE, 0)); notifyTree(SWT.Activate, super.createEvent()); setFocus(); notifyTree(SWT.FocusIn, super.createEvent()); notifyTree(SWT.MouseDown, createMouseEvent(1, SWT.NONE, 1)); notifyTree(SWT.Selection, createSelectionEvent(SWT.NONE), selectRunnable(widget, false)); notifyTree(SWT.MouseUp, createMouseEvent(1, SWT.BUTTON1, 1)); notifyTree(SWT.MouseDown, createMouseEvent(1, SWT.NONE, 2)); notifyTree(SWT.MouseDoubleClick, createMouseEvent(1, SWT.NONE, 2)); notifyTree(SWT.DefaultSelection, createDefaultSelectionEvent(SWT.NONE)); notifyTree(SWT.MouseUp, createMouseEvent(1, SWT.BUTTON1, 2)); notifyTree(SWT.MouseExit, createMouseEvent(0, SWT.NONE, 0)); notifyTree(SWT.Deactivate, super.createEvent()); notifyTree(SWT.FocusOut, super.createEvent()); log.debug(MessageFormat.format("Double-clicked on {0}", this)); return this; }
Source:
public MessagePacker packExtendedTypeHeader(int extType, int payloadLen) throws IOException { if(payloadLen < (1 << 8)) { if(payloadLen == 1) { writeByteAndByte(FIXEXT1, (byte) extType); } else if(payloadLen == 2){ writeByteAndByte(FIXEXT2, (byte) extType); } else if(payloadLen == 4) { writeByteAndByte(FIXEXT4, (byte) extType); } else if(payloadLen == 8) { writeByteAndByte(FIXEXT8, (byte) extType); } else if(payloadLen == 16) { writeByteAndByte(FIXEXT16, (byte) extType); } else { writeByteAndByte(EXT8, (byte) payloadLen); writeByte((byte) extType); } } else if(payloadLen < (1 << 16)) { writeByteAndShort(EXT16, (short) payloadLen); writeByte((byte) extType); } else { writeByteAndInt(EXT32, payloadLen); writeByte((byte) extType); } return this; }

Target:
public MessagePacker packExtendedTypeHeader(int extType, int payloadLen) throws IOException { if(payloadLen < (1 << 8)) { if(payloadLen > 0 && (payloadLen & (payloadLen - 1)) == 0) { if(payloadLen == 1) { writeByteAndByte(FIXEXT1, (byte) extType); } else if(payloadLen == 2){ writeByteAndByte(FIXEXT2, (byte) extType); } else if(payloadLen == 4) { writeByteAndByte(FIXEXT4, (byte) extType); } else if(payloadLen == 8) { writeByteAndByte(FIXEXT8, (byte) extType); } else if(payloadLen == 16) { writeByteAndByte(FIXEXT16, (byte) extType); } else { writeByteAndByte(EXT8, (byte) payloadLen); writeByte((byte) extType); } } else { writeByteAndByte(EXT8, (byte) payloadLen); writeByte((byte) extType); } } else if(payloadLen < (1 << 16)) { writeByteAndShort(EXT16, (short) payloadLen); writeByte((byte) extType); } else { writeByteAndInt(EXT32, payloadLen); writeByte((byte) extType); } return this; }
Source:
private static LeaderPingResult getLeaderPingResult( UUID uuid, @Nullable Future<Map.Entry<LeaderPingerContext<PingableLeader>, PingResult>> pingFuture, Optional<OrderableSlsVersion> timeLockVersion) throws ExecutionException { if (pingFuture == null) { return LeaderPingResults.pingTimedOut(); } PingResult pingResult = Futures.getDone(pingFuture).getValue(); if (!pingResult.isLeader()) { return LeaderPingResults.pingReturnedFalse(); } return isAtLeastOurVersion(pingResult, timeLockVersion) ? LeaderPingResults.pingReturnedTrue( uuid, Futures.getDone(pingFuture).getKey().hostAndPort()) : LeaderPingResults.pingReturnedTrueWithOlderVersion(pingResult.timeLockVersion().get()); }

Target:
private static LeaderPingResult getLeaderPingResult( UUID uuid, @Nullable Future<Map.Entry<LeaderPingerContext<PingableLeader>, PingResult>> pingFuture, Optional<OrderableSlsVersion> timeLockVersion) { if (pingFuture == null) { return LeaderPingResults.pingTimedOut(); } try { PingResult pingResult = Futures.getDone(pingFuture).getValue(); if (!pingResult.isLeader()) { return LeaderPingResults.pingReturnedFalse(); } return isAtLeastOurVersion(pingResult, timeLockVersion) ? LeaderPingResults.pingReturnedTrue( uuid, Futures.getDone(pingFuture).getKey().hostAndPort()) : LeaderPingResults.pingReturnedTrueWithOlderVersion(pingResult.timeLockVersion().get()); } catch (ExecutionException e) { return LeaderPingResults.pingCallFailedWithExecutionException(e.getCause()); } }
Source:
public void setup() throws Exception { initMocks(this); md5 = "md5"; currentUser = new Username(new CaseInsensitiveString("user")); cruiseConfig = GoConfigMother.defaultCruiseConfig(); newPackageRepo = new PackageRepository(); oldPackageRepo = new PackageRepository(); newRepoId = oldRepoId = "npmOrg"; pluginId = "npm"; newPackageRepo.setId(newRepoId); newPackageRepo.setName(newRepoId); oldPackageRepo.setId(oldRepoId); oldPackageRepo.setName(oldRepoId); newPackageRepo.setPluginConfiguration(new PluginConfiguration(pluginId, "1")); oldPackageRepo.setPluginConfiguration(new PluginConfiguration(pluginId, "1")); result = new HttpLocalizedOperationResult(); cruiseConfig.setPackageRepositories(new PackageRepositories(oldPackageRepo)); }

Target:
public void setup() throws Exception { initMocks(this); currentUser = new Username(new CaseInsensitiveString("user")); cruiseConfig = GoConfigMother.defaultCruiseConfig(); repoId = "npmOrg"; newPackageRepo = new PackageRepository(repoId, repoId, new PluginConfiguration("npm", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("REPO_URL"), new ConfigurationValue("http://bar")))); oldPackageRepo = new PackageRepository(repoId, repoId, new PluginConfiguration("npm", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("REPO_URL"), new ConfigurationValue("http://foo")))); result = new HttpLocalizedOperationResult(); cruiseConfig.setPackageRepositories(new PackageRepositories(oldPackageRepo)); }
Source:
public ByteBuf allocate(int capacity) { accountBytes.accept(capacity); return Unpooled.wrappedBuffer(new byte[capacity]); }

Target:
public ByteBuf allocate(int capacity) { accountBytes.accept(capacity); return Unpooled.buffer(capacity); }
Source:
public void applyNewObjectPosition(@NonNull Object o, @NonNull LatLon position, @Nullable ApplyMovedObjectCallback callback) { boolean result = false; if (o instanceof FavouritePoint) { favorites.editFavourite((FavouritePoint) o, position.getLatitude(), position.getLongitude()); favorites.lookupAddressAllPersonalPoints(); result = true; } if (callback != null) { callback.onApplyMovedObject(result, o); } }

Target:
public void applyNewObjectPosition(@NonNull Object o, @NonNull LatLon position, @Nullable ApplyMovedObjectCallback callback) { boolean result = false; if (o instanceof FavouritePoint) { favorites.editFavourite((FavouritePoint) o, position.getLatitude(), position.getLongitude()); favorites.lookupAddress((FavouritePoint) o); result = true; } if (callback != null) { callback.onApplyMovedObject(result, o); } }
Source:
public GetObjectResponse( Headers headers, String bucket, String region, String object, InputStream body) { this.response = new BaseResponse(headers, bucket, region, object); this.body = body; }

Target:
public GetObjectResponse( Headers headers, String bucket, String region, String object, InputStream body) { super(body); this.response = new GenericResponse(headers, bucket, region, object); }
Source:
public String getName() { String[] nameElements = ctClass.getSimpleName().replace('$', '.').split("\\."); return nameElements[nameElements.length - 1]; }

Target:
public String getName() { return getClassName(); }
Source:
private int addWriter( SinkTransformation<InputT, CommT, WriterStateT, GlobalCommT> sinkTransformation, int parallelism, Context context) { final boolean hasState = sinkTransformation .getSink() .getWriterStateSerializer() .isPresent(); checkState(sinkTransformation.getInputs().size() == 1); @SuppressWarnings("unchecked") final Transformation<InputT> input = (Transformation<InputT>) sinkTransformation .getInputs() .get(0); final TypeInformation<InputT> inputTypeInfo = input.getOutputType(); final StreamOperatorFactory<CommT> writer = hasState ? new StatefulWriterOperatorFactory<>(sinkTransformation.getSink()) : new StatelessWriterOperatorFactory<>( sinkTransformation.getSink()); final int writerId = addOperatorToStreamGraph( writer, input.getId(), inputTypeInfo, extractCommittableTypeInformation(sinkTransformation.getSink()), "Sink Writer:", parallelism, sinkTransformation.getMaxParallelism(), sinkTransformation, context); StreamGraphUtils.configureResourceProperties( context.getStreamGraph(), writerId, sinkTransformation); return writerId; }

Target:
private int addWriter( SinkTransformation<InputT, CommT, WriterStateT, GlobalCommT> sinkTransformation, int parallelism, Context context) { final boolean hasState = sinkTransformation .getSink() .getWriterStateSerializer() .isPresent(); checkState(sinkTransformation.getInputs().size() == 1); @SuppressWarnings("unchecked") final Transformation<InputT> input = (Transformation<InputT>) sinkTransformation .getInputs() .get(0); final TypeInformation<InputT> inputTypeInfo = input.getOutputType(); final StreamOperatorFactory<CommT> writer = hasState ? new StatefulWriterOperatorFactory<>(sinkTransformation.getSink()) : new StatelessWriterOperatorFactory<>( sinkTransformation.getSink()); final ChainingStrategy chainingStrategy = sinkTransformation.getChainingStrategy(); if (chainingStrategy != null) { writer.setChainingStrategy(chainingStrategy); } return addOperatorToStreamGraph( writer, input.getId(), inputTypeInfo, extractCommittableTypeInformation(sinkTransformation.getSink()), "Sink Writer:", parallelism, sinkTransformation.getMaxParallelism(), sinkTransformation, context); }
Source:
protected void assertNotSupported(String projection, String message) { try { functionAssertions.executeProjectionWithFullEngine(projection); fail("Expected to thrown a NOT_SUPPORTED exception"); } catch (PrestoException e) { assertEquals(e.getErrorCode(), NOT_SUPPORTED.toErrorCode()); assertEquals(e.getMessage(), message); } }

Target:
protected void assertNotSupported(String projection, String message) { try { functionAssertions.executeProjectionWithFullEngine(projection); fail("expected exception"); } catch (PrestoException e) { assertEquals(e.getErrorCode(), NOT_SUPPORTED.toErrorCode()); assertEquals(e.getMessage(), message); } }
Source:
public boolean addChildAtLoading(INode node) { int pos; if (!node.isReference()) { pos = (children == null) ? (-1) : (-children.size() - 1); } else { pos = searchChildren(node.getLocalNameBytes()); if (pos >= 0) { return false; } } addChild(node, pos); return true; }

Target:
public boolean addChildAtLoading(INode node) { int pos; if (!node.isReference()) { pos = (children == null) ? (-1) : (-children.size() - 1); addChild(node, pos); return true; } else { return addChild(node); } }
Source:
public PageEntity(String unlocalizedName, String entity, int size) { super(unlocalizedName); Class EntityClass=(Class) EntityList.stringToClassMapping.get(entity); this.size=size; try { dummyEntity = (Entity)EntityClass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {null}); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } }

Target:
public PageEntity(String unlocalizedName, String entity, int size) { super(unlocalizedName); Class EntityClass=(Class) EntityList.stringToClassMapping.get(entity); this.size=size; try { dummyEntity = (Entity)EntityClass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {null}); } catch (Exception e) { e.printStackTrace(); } }
Source:
private ByteBuffer parsePacketIDB(ByteBuffer pcapPacketHeader, int blockLength) throws IOException { ByteBuffer pcapPacketData; pcapPacketData = ByteBuffer.allocate(blockLength - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapPacketHeader.getShort(); pcapPacketData.clear(); SeekableByteChannel fFileChannel; try { fFileChannel = getFileChannel(); fFileChannel.read(pcapPacketData); } catch (BadPcapFileException e1) { } pcapPacketData.flip(); return pcapPacketData; }

Target:
private ByteBuffer parsePacketIDB(ByteBuffer pcapPacketHeader, int blockLength) throws IOException { ByteBuffer pcapPacketData; pcapPacketData = ByteBuffer.allocate(blockLength - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapPacketHeader.getShort(); pcapPacketData.clear(); SeekableByteChannel fileChannel; try { fileChannel = getFileChannel(); fileChannel.read(pcapPacketData); } catch (BadPcapFileException e1) { } pcapPacketData.flip(); return pcapPacketData; }
Source:
public void createOutboundLocalSocketBinding() throws IOException, CommandFailedException { ConfigFragment fragment = page.switchToOutboundLocal(); WizardWindow wizard = fragment.getResourceManager().addResource(); Editor editor = wizard.getEditor(); editor.text("name", OUTBOUND_LOCAL_NAME); editor.text("socketBinding", "https"); boolean result = wizard.finish(); assertTrue("Window should be closed", result); assertTrue("Socket Binding should be present in table", fragment.resourceIsPresent(OUTBOUND_LOCAL_NAME)); verifier.verifyResource(DMR_OUTBOUND_LOCAL, true); fragment.getResourceManager().removeResourceAndConfirm(OUTBOUND_LOCAL_NAME); verifier.verifyResource(DMR_OUTBOUND_LOCAL, false); }

Target:
public void createOutboundLocalSocketBinding() { ConfigFragment fragment = page.switchToOutboundLocal(); WizardWindow wizard = fragment.getResourceManager().addResource(); Editor editor = wizard.getEditor(); editor.text("name", OUTBOUND_LOCAL_NAME); editor.text("socketBinding", "https"); boolean result = wizard.finish(); assertTrue("Window should be closed", result); assertTrue("Socket Binding should be present in table", fragment.resourceIsPresent(OUTBOUND_LOCAL_NAME)); verifier.verifyResource(DMR_OUTBOUND_LOCAL, true); fragment.getResourceManager().removeResourceAndConfirm(OUTBOUND_LOCAL_NAME); verifier.verifyResource(DMR_OUTBOUND_LOCAL, false); }
Source:
private File getDhclientFile(String interfaceName) throws KuraException { File ret; File globalDhClientFile = new File(formGlobalDhclientLeasesFilename()); File interfaceDhClientFile = new File(formInterfaceDhclientLeasesFilename(interfaceName)); if (interfaceDhClientFile.exists()) { ret = interfaceDhClientFile; } else if (globalDhClientFile.exists()) { ret = globalDhClientFile; } else { try { if (interfaceDhClientFile.createNewFile()) { logger.debug("The doesn't exist, created new empty file ...", interfaceDhClientFile.getName()); } } catch (Exception e) { throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR, e); } ret = interfaceDhClientFile; } return ret; }

Target:
private File getDhclientFile(String interfaceName) throws KuraException { File ret; File globalDhClientFile = new File(formGlobalDhclientLeasesFilename()); File interfaceDhClientFile = new File(formInterfaceDhclientLeasesFilename(interfaceName)); if (interfaceDhClientFile.exists()) { ret = interfaceDhClientFile; } else if (globalDhClientFile.exists()) { ret = globalDhClientFile; } else { try { if (interfaceDhClientFile.createNewFile()) { logger.info("The doesn't exist, created new empty file ...", interfaceDhClientFile.getName()); } } catch (Exception e) { throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR, e); } ret = interfaceDhClientFile; } return ret; }
Source:
public void sendMessage_shouldSaveTheSentMessage() throws MessageException { Message message = ms.createMessage("recipient@example.com", "sender@example.com", "subject", "content"); message.setId(123); try { ms.sendMessage(message); SentMessage sentMessage = Context.getSentMessageService().getSentMessage(123); Assert.assertNotNull(sentMessage); Assert.assertEquals(123, (int)sentMessage.getMessageId()); } catch (MessageException e) { if (!e.getMessage().contains(NO_SMTP_SERVER_ERROR)) { e.printStackTrace(); fail(); } } }

Target:
public void sendMessage_shouldSaveTheSentMessage() throws MessageException { Message message = ms.createMessage("recipient@example.com", "sender@example.com", "subject", "content"); message.setId(123); try { ms.sendMessage(message); SentMessage sentMessage = Context.getSentMessageService().getSentMessage(123); assertNotNull(sentMessage); assertEquals(123, (int)sentMessage.getMessageId()); } catch (MessageException e) { if (!e.getMessage().contains(NO_SMTP_SERVER_ERROR)) { e.printStackTrace(); fail(); } } }
Source:
public SpectralSearchlight(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); ManaEffect effect = new AddManaOfAnyColorToManaPoolTargetControllerEffect("chosen player"); effect.setText("Choose a player. That player adds one mana of any color he or she chooses to his or her mana pool"); Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, effect, new TapSourceCost()); ability.addTarget(new TargetPlayer(1, 1, true)); this.addAbility(ability); }

Target:
public SpectralSearchlight(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); ManaEffect effect = new AddManaOfAnyColorToManaPoolTargetPlayerEffect("chosen player"); effect.setText("Choose a player. That player adds one mana of any color he or she chooses to his or her mana pool"); Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, effect, new TapSourceCost()); ability.getEffects().add(0, new ChoosePlayerEffect(Outcome.PutManaInPool)); this.addAbility(ability); }
Source:
public void testArrayLengthWithAllSupportedTypes() throws Exception { for (DataType<?> type : DataTypeTesting.ALL_TYPES_EXCEPT_ARRAYS) { if(type.equals(DataTypes.INTERVAL)) { continue; } Supplier dataGenerator = DataTypeTesting.getDataGenerator(type); Object val1 = dataGenerator.get(); Object val2 = dataGenerator.get(); Object[] arr = {val1, val2}; Object[] values = new Object[] { arr }; resetClusterService(); try (QueryTester tester = new QueryTester.Builder( createTempDir(), THREAD_POOL, clusterService, Version.CURRENT, "create table \"t_"+ type.getName() + "\" (xs array(\"" + type.getName() + "\"))" ).indexValues("xs", values).build()) { System.out.println(type); List<Object> result = tester.runQuery("xs", "array_length(xs, 1) >= 2"); assertThat(result.size(), is(1)); ArrayType arrayType = new ArrayType<>(type); if (type.id() != ObjectType.ID) { assertThat(arrayType.compareValueTo((List) result.get(0), Arrays.asList(arr)), is(0)); } } } }

Target:
public void testArrayLengthWithAllSupportedTypes() throws Exception { for (DataType<?> type : DataTypeTesting.ALL_TYPES_EXCEPT_ARRAYS) { if(DataTypes.STORAGE_UNSUPPORTED.contains(type)) { continue; } Supplier dataGenerator = DataTypeTesting.getDataGenerator(type); Object val1 = dataGenerator.get(); Object val2 = dataGenerator.get(); Object[] arr = {val1, val2}; Object[] values = new Object[] { arr }; resetClusterService(); try (QueryTester tester = new QueryTester.Builder( createTempDir(), THREAD_POOL, clusterService, Version.CURRENT, "create table \"t_"+ type.getName() + "\" (xs array(\"" + type.getName() + "\"))" ).indexValues("xs", values).build()) { System.out.println(type); List<Object> result = tester.runQuery("xs", "array_length(xs, 1) >= 2"); assertThat(result.size(), is(1)); ArrayType arrayType = new ArrayType<>(type); if (type.id() != ObjectType.ID) { assertThat(arrayType.compareValueTo((List) result.get(0), Arrays.asList(arr)), is(0)); } } } }
Source:
public Range<Double> getMzRange() { Range<Double> mzRange = MsSpectrumUtil.getMzRange(mzValues, getMzBinaryDataInfo().getArrayLength()); return mzRange; }

Target:
public Range<Double> getMzRange() { Range<Double> mzRange = null; try { mzRange = Range.closed(Double.valueOf(getCVValue(MzMLCV.cvLowestMz)), Double.valueOf(getCVValue(MzMLCV.cvHighestMz))); } catch (Exception e) { e.printStackTrace(); } if (mzRange == null) mzRange = MsSpectrumUtil.getMzRange(getMzValues(), getMzBinaryDataInfo().getArrayLength()); return mzRange; }
Source:
private Map<String, List<String>> createTestData(){ Map<String, List<String>> testMap = new HashMap<>(); List<String> nameList = newArrayList("Dave", "Jeff"); List<String> jobList = newArrayList("Plumber", "Builder"); List<String> cityList = newArrayList("Dover", "Boston"); testMap.put("name", nameList); testMap.put("job", jobList); testMap.put("city", cityList); return testMap; }

Target:
private Map<String, List<String>> createTestData(){ Map<String, List<String>> testMap = new HashMap<>(); testMap.put("name", Arrays.asList("Dave", "Jeff")); testMap.put("job", Arrays.asList("Plumber", "Builder")); testMap.put("city", Arrays.asList("Dover", "Boston")); return testMap; }
Source:
private static void loadProperties( Properties props, String propertyFileName) { InputStream propertyFileInputStream = null; try { try { propertyFileInputStream = new DefaultResourceLoader(ClassLoaderUtils.getDefaultClassLoader()).getResource(propertyFileName).getInputStream(); props.load(propertyFileInputStream); } finally { if (propertyFileInputStream != null) { propertyFileInputStream.close(); } } } catch (IOException e) { e.printStackTrace(); throw new RuntimeException("PropertyLoadingFactoryBean unable to load property file: " + propertyFileName); } }

Target:
private static void loadProperties( Properties props, String propertyFileName) { InputStream propertyFileInputStream = null; try { try { propertyFileInputStream = new DefaultResourceLoader(ClassLoaderUtils.getDefaultClassLoader()).getResource(propertyFileName).getInputStream(); props.load(propertyFileInputStream); } finally { if (propertyFileInputStream != null) { propertyFileInputStream.close(); } } } catch (IOException e) { LOG.error(e); throw new RuntimeException("PropertyLoadingFactoryBean unable to load property file: " + propertyFileName); } }
Source:
public CloseableIterator<SAMRecord> queryAlignmentStart(String sequence, int start) { long[] filePointers = null; final SAMFileHeader fileHeader = getFileHeader(); final int referenceIndex = fileHeader.getSequenceIndex(sequence); if (referenceIndex != -1) { final BAMIndex fileIndex = getIndex(); final BAMFileSpan fileSpan = fileIndex.getSpanOverlapping( referenceIndex, start, -1); filePointers = fileSpan != null ? fileSpan.toCoordinateArray() : null; } if (filePointers == null || filePointers.length == 0) return emptyIterator; SeekableStream s = null; if (file != null) { try { s = new SeekableFileStream(file); } catch (FileNotFoundException e) { throw new RuntimeException(e); } } else if (is instanceof SeekableStream) s = (SeekableStream) is; SAMIteratorForCRAM si = null; try { s.seek(0); si = new SAMIteratorForCRAM(s, referenceSource); si.setValidationStringency(validationStringency); it = si; } catch (IOException e) { throw new RuntimeEOFException(e); } Container c = null; for (int i = 0; i < filePointers.length; i += 2) { long containerOffset = filePointers[i] >>> 16; int sliceIndex = (int) ((filePointers[i] << 48) >>> 48); try { s.seek(containerOffset); c = CramIO.readContainerHeader(s); if (c.alignmentStart + c.alignmentSpan > start) { s.seek(containerOffset); return si; } } catch (IOException e) { throw new RuntimeException(e); } } it = emptyIterator; return it; }

Target:
public CloseableIterator<SAMRecord> queryAlignmentStart(String sequence, int start) { long[] filePointers = null; final SAMFileHeader fileHeader = getFileHeader(); final int referenceIndex = fileHeader.getSequenceIndex(sequence); if (referenceIndex != -1) { final BAMIndex fileIndex = getIndex(); final BAMFileSpan fileSpan = fileIndex.getSpanOverlapping( referenceIndex, start, -1); filePointers = fileSpan != null ? fileSpan.toCoordinateArray() : null; } if (filePointers == null || filePointers.length == 0) return emptyIterator; SeekableStream s = getSeekableStreamOrFailWithRTE(); CRAMIterator si = null; try { s.seek(0); si = new CRAMIterator(s, referenceSource); si.setValidationStringency(validationStringency); it = si; } catch (IOException e) { throw new RuntimeEOFException(e); } Container c = null; for (int i = 0; i < filePointers.length; i += 2) { long containerOffset = filePointers[i] >>> 16; int sliceIndex = (int) ((filePointers[i] << 48) >>> 48); try { s.seek(containerOffset); c = CramIO.readContainerHeader(s); if (c.alignmentStart + c.alignmentSpan > start) { s.seek(containerOffset); return si; } } catch (IOException e) { throw new RuntimeException(e); } } it = null; return it; }
Source:
public IType getType() { if (type == null) { IASTNode parent= getPrimaryDeclaration().getParent(); while (parent != null) { if (parent instanceof ICPPASTParameterDeclaration) { type= CPPVisitor.createType((ICPPASTParameterDeclaration) parent, true); break; } parent= parent.getParent(); } } if (type instanceof CPPPlaceholderType) { CPPDependentEvaluation eval = new EvalBinding(this, null, getPrimaryDeclaration()); TypeOfDependentExpression replacementType = new TypeOfDependentExpression(eval); replacementType.setForTemplateAuto(true); type = replacementType; } return type; }

Target:
public IType getType() { if (type == null) { IASTNode parent= getPrimaryDeclaration().getParent(); while (parent != null) { if (parent instanceof ICPPASTParameterDeclaration) { type= CPPVisitor.createType((ICPPASTParameterDeclaration) parent, true); break; } parent= parent.getParent(); } if (type instanceof CPPPlaceholderType) { CPPDependentEvaluation eval = new EvalBinding(this, null, getPrimaryDeclaration()); TypeOfDependentExpression replacementType = new TypeOfDependentExpression(eval); replacementType.setForTemplateAuto(true); type = replacementType; } } return type; }
Source:
private void maybeCollapseAssignShorthand(Node n, Node parent) { if (n.isAssign() && n.getFirstChild().isName() && n.getLastChild().hasChildren() && n.getLastChild().getFirstChild().isName()) { Node op = n.getLastChild(); int assignOp = getAssignOpFromOp(op); if (n.getFirstChild().getString().equals(op.getFirstChild().getString())) { op.setType(assignOp); Node opDetached = op.detachFromParent(); opDetached.setJSDocInfo(n.getJSDocInfo()); parent.replaceChild(n, opDetached); compiler.reportCodeChange(); } } }

Target:
private void maybeCollapseAssignShorthand(Node n, Node parent) { if (n.isAssign() && n.getFirstChild().isName() && NodeUtil.hasCorrespondingAssignmentOp(n.getLastChild()) && n.getLastChild().getFirstChild().isName()) { Node op = n.getLastChild(); int assignOp = NodeUtil.getAssignOpFromOp(op); if (n.getFirstChild().getString().equals(op.getFirstChild().getString())) { op.setType(assignOp); Node opDetached = op.detachFromParent(); opDetached.setJSDocInfo(n.getJSDocInfo()); parent.replaceChild(n, opDetached); compiler.reportCodeChange(); } } }
Source:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); if(request.getMethod().contains("VM")){ setReactorsMap(request.getParams().get("vmID").asText(), client); } ContextHolder.init(); if (client.getRetryPolicy().getIdentifier() != null){ ContextHolder.setServerName(client.getRetryPolicy().getIdentifier()); log.debug("client policy identifier {}", client.getRetryPolicy().getIdentifier()); }else{ ContextHolder.setServerName(Integer.toString(client.hashCode())); log.error("client identifier were not found, using hash"); } reactorClient = client; ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }

Target:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); if(eventSupportedMethods.contains(request.getMethod())){ setReactorsMap(request.getParams().get("vmID").asText(), client); } ContextHolder.init(); if (client.getRetryPolicy().getIdentifier() != null){ ContextHolder.setServerName(client.getRetryPolicy().getIdentifier()); log.debug("client policy identifier {}", client.getRetryPolicy().getIdentifier()); }else{ ContextHolder.setServerName(Integer.toString(client.hashCode())); log.error("client identifier were not found, using hash"); } ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }
Source:
public EnrichmentTransformRuntime(EnrichmentTransform enrichmentTransform) { this.enrichmentTransform = enrichmentTransform; cachedDataProvider = new CachedDataProvider<Object, Object>(enrichmentTransform.getDataProvider(), enrichmentTransform.getMaxCacheSize(), enrichmentTransform.getEntryExpirationInterval(), enrichmentTransform.getEntryRefreshInterval()); cachedDataProvider.prepare(); }

Target:
public EnrichmentTransformRuntime(EnrichmentTransform enrichmentTransform) { this.enrichmentTransform = enrichmentTransform; final TransformDataProvider transformDataProvider = enrichmentTransform.getTransformDataProvider(); cachedDataProvider = new CachedTransformDataProviderRuntime(TransformDataProviderRuntimeService.get().get(transformDataProvider), enrichmentTransform.getMaxCacheSize(), enrichmentTransform.getEntryExpirationInterval(), enrichmentTransform.getEntryRefreshInterval()); cachedDataProvider.prepare(); }
Source:
public ThreadMeta update(ThreadMeta newMeta) { if (newMeta.threadName != null && !newMeta.threadName.isEmpty()) { threadName = newMeta.threadName; } return this; }

Target:
public ThreadMeta update(ThreadMeta newMeta) { if (newMeta.threadName != null && !newMeta.threadName.isEmpty()) { return new ThreadMeta(newMeta.threadId, newMeta.threadName); } return this; }
Source:
private static byte[] generateAdditionalAttributes(SignerConfig signerConfig) { if (signerConfig.apkSignerLineage == null) { return new byte[0]; } throw new NotImplementedException(); }

Target:
private static byte[] generateAdditionalAttributes(SignerConfig signerConfig) { if (signerConfig.mSigningCertificateLineage == null) { return new byte[0]; } throw new UnsupportedOperationException(); }
Source:
public void testInsertWithColumnNames() throws Exception { execute("create table test (\"firstName\" string, \"lastName\" string)"); execute("insert into test (\"firstName\", \"lastName\") values('Youri', 'Zoon')"); assertEquals(1, response.rowCount()); refresh(); execute("select * from test where \"firstName\" = 'Youri'"); assertEquals(1, response.rowCount()); assertEquals("Youri", response.rows()[0][0]); assertEquals("Zoon", response.rows()[0][1]); }

Target:
public void testInsertWithColumnNames() throws Exception { execute("create table test (\"firstName\" text, \"lastName\" text)"); execute("insert into test (\"firstName\", \"lastName\") values ('Youri', 'Zoon')"); assertEquals(1, response.rowCount()); refresh(); execute("select * from test where \"firstName\" = 'Youri'"); assertEquals(1, response.rowCount()); assertEquals("Youri", response.rows()[0][0]); assertEquals("Zoon", response.rows()[0][1]); }
Source:
private void registerWithSubDirectories(AbstractWatchService watchService, Path toWatch) throws IOException { Files.walkFileTree(toWatch, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path subDir, BasicFileAttributes attrs) throws IOException { Kind<?>[] kinds = watchService.getWatchEventKinds(subDir); if (kinds != null) { registerDirectoryInternal(watchService, kinds, subDir); } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { if (exc instanceof AccessDeniedException) { logger.warn("Do not have permission to access directory '{}', skipping it", file.toAbsolutePath().toString()); } return FileVisitResult.SKIP_SUBTREE; } }); }

Target:
private void registerWithSubDirectories(AbstractWatchService watchService, Path toWatch) throws IOException { Files.walkFileTree(toWatch, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path subDir, BasicFileAttributes attrs) throws IOException { Kind<?>[] kinds = watchService.getWatchEventKinds(subDir); if (kinds != null) { registerDirectoryInternal(watchService, kinds, subDir); } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { if (exc instanceof AccessDeniedException) { logger.warn("Access to folder '{}' was denied, therefore skipping it.", file.toAbsolutePath().toString()); } return FileVisitResult.SKIP_SUBTREE; } }); }
Source:
private void endCurrentPlayerTurn() { if (this.currentPlayerIndex < this.playerList.size()) this.currentPlayerIndex++; else this.currentPlayerIndex = 0; }

Target:
private void endCurrentPlayerTurn() { this.currentPlayerIndex = (this.currentPlayerIndex + 1) % NUMBER_OF_PLAYERS; }
Source:
private static void validatePKConstraints(TableSchema schema) { if (!schema.getPrimaryKey().isPresent()) { throw new ValidationException("PK constraints must be defined in the 'upsert-kafka' connector."); } for (String key: schema.getPrimaryKey().get().getColumns()) { if (!schema.getTableColumn(key).get().isPhysical()) { throw new ValidationException( "Define the PK on the physical columns rather than metadata in the 'upsert-kafka' connector."); } } }

Target:
private static void validatePKConstraints(TableSchema schema) { if (!schema.getPrimaryKey().isPresent()) { throw new ValidationException( "'upsert-kafka' tables require to define a PRIMARY KEY constraint. " + "The PRIMARY KEY specifies which columns should be read from or write to the Kafka message key. " + "The PRIMARY KEY also defines records in the 'upsert-kafka' table should update or delete on which keys."); } }
Source:
public void getLocale_noContext() { final ActivityController<MainActivity> controller = Robolectric.buildActivity(MainActivity.class); controller.setup(); final Locale locale = Tools.getLocale(null); Assert.assertThat("If no context supplied, should always be the same", locale, is(equalTo(Locale.getDefault()))); RuntimeEnvironment.setQualifiers("de-rDE"); controller.configurationChange(); final Locale localeAfterChange = Tools.getLocale(null); Assert.assertThat("If no context supplied, should always be the same", locale, is(equalTo(Locale.getDefault()))); }

Target:
public void getLocale_noContext() { final ActivityController<MainActivity> controller = Robolectric.buildActivity(MainActivity.class); controller.setup(); final Locale locale = Tools.getLocale(null); Assert.assertThat("If no context supplied, should always be the same", locale, is(equalTo(Locale.getDefault()))); RuntimeEnvironment.setQualifiers("de-rDE"); controller.configurationChange(); final Locale localeAfterChange = Tools.getLocale(null); Assert.assertThat("If no context supplied, should always be the same", localeAfterChange, is(equalTo(Locale.getDefault()))); }